Skip to content

Commit f4b5d0f

Browse files
author
Adrien
committed
feat(catalog-ui): add notifications for favorite filter actions
1 parent ca6b0ad commit f4b5d0f

3 files changed

Lines changed: 31 additions & 6 deletions

File tree

apps/catalog-ui/docs/i18n.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,12 @@ 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
441-
}
444+
},
442445
}
443446
}
444447
```
@@ -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: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,15 @@ function openDeleteFavoriteDialog(favorite: LinidFilterSet): void {
295295
}),
296296
uiNamespace: `${uiNamespace.value}.delete-favorite-dialog`,
297297
i18nScope: `${i18nScope.value}.DeleteFavoriteDialog`,
298-
onConfirm: () =>
298+
onConfirm: () => {
299299
deleteUserPreference(
300300
`${favoritesBaseConfigurationKey.value}${favorite.id}`
301-
),
301+
);
302+
Notify({
303+
type: 'positive',
304+
message: t('RemoveFavoriteNotifyMessage', {name: favorite.label}),
305+
});
306+
},
302307
},
303308
});
304309
}
@@ -332,7 +337,7 @@ function openOverrideFavoriteDialog(): void {
332337
},
333338
],
334339
// eslint-disable-next-line jsdoc/require-jsdoc
335-
onSubmit: (formData: { favorite: LinidFilterSet }) =>
340+
onSubmit: (formData: { favorite: LinidFilterSet }) => {
336341
saveUserPreference(
337342
`${favoritesBaseConfigurationKey.value}${formData.favorite.id}`,
338343
JSON.stringify({
@@ -344,7 +349,14 @@ function openOverrideFavoriteDialog(): void {
344349
filters.value
345350
).toString(),
346351
})
347-
),
352+
);
353+
Notify({
354+
type: 'positive',
355+
message: t('OverrideFavoriteNotifyMessage', {
356+
name: formData.favorite.label,
357+
}),
358+
});
359+
},
348360
afterClose: () => {
349361
isSmartFilterMenuPersistent.value = false;
350362
},
@@ -391,7 +403,7 @@ function openCreateFavoriteDialog(): void {
391403
if (favorites.value.some((fav) => fav.label === trimmedFavoriteName)) {
392404
Notify({
393405
type: 'negative',
394-
message: t('CreateFavoriteDialog.duplicateName', {
406+
message: t('CreateFavoriteMessage.duplicateName', {
395407
name: trimmedFavoriteName,
396408
}),
397409
});
@@ -411,6 +423,10 @@ function openCreateFavoriteDialog(): void {
411423
).toString(),
412424
})
413425
);
426+
Notify({
427+
type: 'positive',
428+
message: t('CreateFavoriteNotifyMessage', { name: trimmedFavoriteName }),
429+
});
414430
},
415431
},
416432
});

0 commit comments

Comments
 (0)