Skip to content

Commit 05beaa7

Browse files
AdrienZorin95670
authored andcommitted
feat(catalog-ui): add notifications for favorite filter actions
1 parent 1c34b38 commit 05beaa7

3 files changed

Lines changed: 31 additions & 4 deletions

File tree

apps/catalog-ui/docs/i18n.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,9 @@ The `FormDialog` component uses the following keys for internationalization:
436436
"confirmLoading": "Creating..."
437437
}
438438
},
439+
"RemoveFavoriteNotifyMessage": "The favorite '{name}' has been removed.",
440+
"CreateFavoriteNotifyMessage": "The favorite '{name}' has been created.",
441+
"OverrideFavoriteNotifyMessage": "The favorite '{name}' has been overwritten.",
439442
"LinidSmartFilter": {
440443
//(...) see next section
441444
}
@@ -831,6 +834,9 @@ export default {
831834
confirmLoading: 'Creating...',
832835
},
833836
},
837+
RemoveFavoriteNotifyMessage: "The favorite '{name}' has been removed.",
838+
CreateFavoriteNotifyMessage: "The favorite '{name}' has been created.",
839+
OverrideFavoriteNotifyMessage: "The favorite '{name}' has been overwritten.",
834840
LinidSmartFilter: {
835841
label: 'Search',
836842
hint: 'Enter your search criteria',

apps/catalog-ui/docs/pages/GenericTablePage.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ Each active filter is serialized to a query param using `filter.toString()`, key
199199
- `OverrideFavoriteDialog.content` — body of the override-favorite form dialog
200200
- `CreateFavoriteDialog.title` — title of the create-favorite form dialog
201201
- `CreateFavoriteDialog.content` — body of the create-favorite form dialog
202+
- `RemoveFavoriteNotifyMessage` — notification message displayed when a favorite filter set is successfully deleted
203+
- `CreateFavoriteNotifyMessage` — notification message displayed when a new favorite filter set is successfully created
204+
- `OverrideFavoriteNotifyMessage` — notification message displayed when an existing favorite filter set is successfully updated with new filters
202205

203206
---
204207

apps/catalog-ui/src/pages/GenericTablePage.vue

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,15 @@ function openDeleteFavoriteDialog(favorite: LinidFilterSet): void {
298298
}),
299299
uiNamespace: `${uiNamespace.value}.delete-favorite-dialog`,
300300
i18nScope: `${i18nScope.value}.DeleteFavoriteDialog`,
301-
onConfirm: () =>
301+
onConfirm: () => {
302302
deleteUserPreference(
303303
`${favoritesBaseConfigurationKey.value}${favorite.id}`
304-
),
304+
);
305+
Notify({
306+
type: 'positive',
307+
message: t('RemoveFavoriteNotifyMessage', { name: favorite.label }),
308+
});
309+
},
305310
},
306311
});
307312
}
@@ -335,7 +340,7 @@ function openOverrideFavoriteDialog(): void {
335340
},
336341
],
337342
// eslint-disable-next-line jsdoc/require-jsdoc
338-
onSubmit: (formData: { favorite: LinidFilterSet }) =>
343+
onSubmit: (formData: { favorite: LinidFilterSet }) => {
339344
saveUserPreference(
340345
`${favoritesBaseConfigurationKey.value}${formData.favorite.id}`,
341346
JSON.stringify({
@@ -347,7 +352,14 @@ function openOverrideFavoriteDialog(): void {
347352
filters.value
348353
).toString(),
349354
})
350-
),
355+
);
356+
Notify({
357+
type: 'positive',
358+
message: t('OverrideFavoriteNotifyMessage', {
359+
name: formData.favorite.label,
360+
}),
361+
});
362+
},
351363
afterClose: () => {
352364
isSmartFilterMenuPersistent.value = false;
353365
},
@@ -414,6 +426,12 @@ function openCreateFavoriteDialog(): void {
414426
).toString(),
415427
})
416428
);
429+
Notify({
430+
type: 'positive',
431+
message: t('CreateFavoriteNotifyMessage', {
432+
name: trimmedFavoriteName,
433+
}),
434+
});
417435
},
418436
},
419437
});

0 commit comments

Comments
 (0)