From 76044ddccdf4271438441e5d8b3e669c7aed92e8 Mon Sep 17 00:00:00 2001 From: Sanne Raymaekers Date: Wed, 5 Feb 2025 11:40:15 +0100 Subject: [PATCH] store/cockpitApi: add notification when composing images --- src/store/cockpit/enhancedCockpitApi.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/store/cockpit/enhancedCockpitApi.ts b/src/store/cockpit/enhancedCockpitApi.ts index d8a6059b..997da87d 100644 --- a/src/store/cockpit/enhancedCockpitApi.ts +++ b/src/store/cockpit/enhancedCockpitApi.ts @@ -45,6 +45,26 @@ const enhancedApi = cockpitApi.enhanceEndpoints({ }, composeBlueprint: { invalidatesTags: [{ type: 'Composes' }], + onQueryStarted: async (_, { dispatch, queryFulfilled }) => { + queryFulfilled + .then(() => { + dispatch( + addNotification({ + variant: 'success', + title: 'Build was queued', + }) + ); + }) + .catch((err) => { + dispatch( + addNotification({ + variant: 'danger', + title: 'Unable to build blueprint', + description: `Error message ${err.error.message}: ${err.error.body.details}`, + }) + ); + }); + }, }, getComposes: { providesTags: [{ type: 'Composes' }],