From a2ff0f559a05a354e0e14d00ee6263b1c22a90c5 Mon Sep 17 00:00:00 2001 From: Valentin Kirilov Date: Tue, 23 Sep 2025 16:02:53 +0300 Subject: [PATCH 1/2] feat(fe): extend the success notifications api - allow overriding the default actions buttons - allow show/hide the default dismiss button re #RI-7484 --- .../notifications/Notifications.tsx | 59 +++++++++++-------- redisinsight/ui/src/slices/interfaces/app.ts | 2 + 2 files changed, 37 insertions(+), 24 deletions(-) diff --git a/redisinsight/ui/src/components/notifications/Notifications.tsx b/redisinsight/ui/src/components/notifications/Notifications.tsx index f536783feb..a7c8d0be6f 100644 --- a/redisinsight/ui/src/components/notifications/Notifications.tsx +++ b/redisinsight/ui/src/components/notifications/Notifications.tsx @@ -54,32 +54,43 @@ const Notifications = () => { ) const showSuccessToasts = (data: IMessage[]) => - data.forEach(({ id = '', title = '', message = '', className, group }) => { - const handleClose = () => { - onSubmitNotification(id, group) - removeToast(id) - } - if (toastIdsRef.current.has(id)) { - removeToast(id) - return - } - const toastId = riToast( - { - className, - message: title, - description: getSuccessText(message), - actions: { - primary: { - closes: true, - label: 'OK', - onClick: handleClose, + data.forEach( + ({ + id = '', + title = '', + message = '', + showCloseButton = true, + actions, + className, + group, + }) => { + const handleClose = () => { + onSubmitNotification(id, group) + removeToast(id) + } + if (toastIdsRef.current.has(id)) { + removeToast(id) + return + } + const toastId = riToast( + { + className, + message: title, + description: getSuccessText(message), + actions: actions ?? { + primary: { + closes: true, + label: 'OK', + onClick: handleClose, + }, }, + showCloseButton, }, - }, - { variant: riToast.Variant.Success, toastId: id }, - ) - toastIdsRef.current.set(id, toastId) - }) + { variant: riToast.Variant.Success, toastId: id }, + ) + toastIdsRef.current.set(id, toastId) + }, + ) const showErrorsToasts = (errors: IError[]) => errors.forEach( diff --git a/redisinsight/ui/src/slices/interfaces/app.ts b/redisinsight/ui/src/slices/interfaces/app.ts index beba850e56..525567331e 100644 --- a/redisinsight/ui/src/slices/interfaces/app.ts +++ b/redisinsight/ui/src/slices/interfaces/app.ts @@ -48,6 +48,8 @@ export interface IMessage { message: string | JSX.Element group?: string className?: string + showCloseButton?: boolean + actions?: RiToastType['actions'] } export enum AppWorkspace { From 186f46a0f3c671a31e446153ddf946d84e459671 Mon Sep 17 00:00:00 2001 From: Valentin Kirilov Date: Tue, 23 Sep 2025 16:03:41 +0300 Subject: [PATCH 2/2] fix(ui): rework the visuals of the "upload data bulk" notification re #RI-7484 --- .../notifications/styles.module.scss | 18 -------- .../notifications/success-messages.tsx | 45 +++++++------------ 2 files changed, 17 insertions(+), 46 deletions(-) diff --git a/redisinsight/ui/src/components/notifications/styles.module.scss b/redisinsight/ui/src/components/notifications/styles.module.scss index 0f6b6d8d48..817b08578e 100644 --- a/redisinsight/ui/src/components/notifications/styles.module.scss +++ b/redisinsight/ui/src/components/notifications/styles.module.scss @@ -17,24 +17,6 @@ box-shadow: none !important; } -.summary { - border-top: 1px solid var(--euiToastSuccessBtnColor); - padding-top: 8px; - - :global(.euiFlexItem:not(:last-child)) { - margin-right: 14px !important; - } - - .summaryValue { - font-size: 14px; - font-weight: 500; - } - - .summaryLabel { - color: var(--euiToastLightColor) !important; - } -} - .infiniteMessage { :global { .euiToastHeader { diff --git a/redisinsight/ui/src/components/notifications/success-messages.tsx b/redisinsight/ui/src/components/notifications/success-messages.tsx index 622180bef6..6275acced6 100644 --- a/redisinsight/ui/src/components/notifications/success-messages.tsx +++ b/redisinsight/ui/src/components/notifications/success-messages.tsx @@ -13,8 +13,9 @@ import { } from 'uiSrc/utils' import { numberWithSpaces } from 'uiSrc/utils/numbers' import { FlexItem, Row } from 'uiSrc/components/base/layout/flex' -import { Text } from 'uiSrc/components/base/text' +import { Text, Title } from 'uiSrc/components/base/text' import styles from './styles.module.scss' +import { Spacer } from '../base/layout' // TODO: use i18n file for texts export default { @@ -242,53 +243,41 @@ export default { return { title: ( <> - Action completed + Action completed {fileName ? ( <> -
- Commands executed from file: - {formatLongName(fileName, 34, 5)} + + Commands executed from file: + {formatLongName(fileName, 34, 5)} ) : null} + ), message: ( - + - - {numberWithSpaces(processed)} - - - Commands Processed - + {numberWithSpaces(processed)} + Commands Processed - - {numberWithSpaces(succeed)} - - - Success - + {numberWithSpaces(succeed)} + Success - - {numberWithSpaces(failed)} - - - Errors - + {numberWithSpaces(failed)} + Errors - + {millisecondsFormat(data?.duration || 0, 'H:mm:ss.SSS')} - - Time Taken - + Time Taken ), className: 'dynamic', + actions: {}, // Make sure we don't show the default OK button } }, DELETE_LIBRARY: (libraryName: string) => ({