fix(referencelines): and bring back the notification for worker updates but disallow duplication (#5005)
This commit is contained in:
1 parent
4643d6dc40
commit
98f8187dfe
21 files changed
+285
-65
No files matched your search
@@ -60,17 +60,24 @@ class UINotificationService {
|
||||
* @param {string} [notification.promiseMessages.loading] - Message to show while promise is pending
|
||||
* @param {string | function} [notification.promiseMessages.success] - Message to show when promise resolves
|
||||
* @param {string | function} [notification.promiseMessages.error] - Message to show when promise rejects
|
||||
* @param {object} [notification.action] - Action button configuration
|
||||
* @param {string} notification.action.label - The label for the action button
|
||||
* @param {function} notification.action.onClick - The function to call when the action button is clicked
|
||||
* @returns {string} id - The ID of the created notification
|
||||
*/
|
||||
show({
|
||||
title,
|
||||
message,
|
||||
duration = 5000,
|
||||
duration = 2000,
|
||||
position = 'bottom-right',
|
||||
type = 'info',
|
||||
autoClose = true,
|
||||
promise,
|
||||
promiseMessages,
|
||||
id,
|
||||
allowDuplicates = false,
|
||||
deduplicationInterval = 30000,
|
||||
action,
|
||||
}: {
|
||||
title: string;
|
||||
message: string | ((data?: any) => string);
|
||||
@@ -90,6 +97,13 @@ class UINotificationService {
|
||||
success?: string | ((data: any) => string);
|
||||
error?: string | ((error: any) => string);
|
||||
};
|
||||
id?: string;
|
||||
allowDuplicates?: boolean;
|
||||
deduplicationInterval?: number;
|
||||
action?: {
|
||||
label: string;
|
||||
onClick: () => void;
|
||||
};
|
||||
}): string {
|
||||
if (promise && promiseMessages) {
|
||||
const loadingId = serviceImplementation._show({
|
||||
@@ -98,6 +112,9 @@ class UINotificationService {
|
||||
type: 'loading',
|
||||
autoClose: false,
|
||||
position,
|
||||
id: id ? `${id}-loading` : undefined,
|
||||
allowDuplicates,
|
||||
deduplicationInterval,
|
||||
});
|
||||
|
||||
promise.then(
|
||||
@@ -114,6 +131,10 @@ class UINotificationService {
|
||||
duration,
|
||||
position,
|
||||
autoClose,
|
||||
id: id ? `${id}-success` : undefined,
|
||||
allowDuplicates,
|
||||
deduplicationInterval,
|
||||
action,
|
||||
});
|
||||
this.hide(loadingId);
|
||||
},
|
||||
@@ -130,6 +151,10 @@ class UINotificationService {
|
||||
duration,
|
||||
position,
|
||||
autoClose,
|
||||
id: id ? `${id}-error` : undefined,
|
||||
allowDuplicates,
|
||||
deduplicationInterval,
|
||||
action,
|
||||
});
|
||||
this.hide(loadingId);
|
||||
}
|
||||
@@ -145,6 +170,10 @@ class UINotificationService {
|
||||
position,
|
||||
type,
|
||||
autoClose,
|
||||
id,
|
||||
allowDuplicates,
|
||||
deduplicationInterval,
|
||||
action,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user