Skip to content

Commit 225e2dc

Browse files
committed
fix(core-events): CB-2565 autoClose prop for notifications
1 parent d9d62bf commit 225e2dc

5 files changed

Lines changed: 11 additions & 3 deletions

File tree

webapp/packages/core-events/src/INotification.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export interface INotification<TProps extends INotificationExtraProps<any> = INo
5454
message?: string;
5555
timestamp: number;
5656
details?: string | Error | null;
57+
autoClose?: boolean;
5758
persistent?: boolean;
5859
state: { deleteDelay: number };
5960
isSilent: boolean;
@@ -69,6 +70,7 @@ export interface INotificationOptions<TProps extends INotificationExtraProps<any
6970
message?: string;
7071
details?: string | Error | null;
7172
isSilent?: boolean;
73+
autoClose?: boolean;
7274
persistent?: boolean;
7375
extraProps?: TProps;
7476
timestamp?: number;

webapp/packages/core-events/src/NotificationService.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export class NotificationService {
8080
isSilent: !!options.isSilent,
8181
customComponent: options.customComponent,
8282
extraProps: options.extraProps || {} as TProps,
83+
autoClose: options.autoClose,
8384
persistent: options.persistent,
8485
state: observable({ deleteDelay: 0 }),
8586
timestamp: options.timestamp || Date.now(),

webapp/packages/core-notifications/src/NotificationsItem/NotificationItemController.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class NotificationItemController implements IInitializableController {
2222
isDetailsDialogOpen = false;
2323
private notification!: INotification<any>;
2424

25-
constructor(private commonDialogService: CommonDialogService) {
25+
constructor(private readonly commonDialogService: CommonDialogService) {
2626
makeObservable(this, {
2727
isDetailsDialogOpen: observable,
2828
});
@@ -35,7 +35,11 @@ export class NotificationItemController implements IInitializableController {
3535
this.handleShowDetails = this.showDetails.bind(this);
3636
}
3737

38-
if (notification.type !== ENotificationType.Error && !notification.persistent) {
38+
if (
39+
notification.type !== ENotificationType.Error
40+
&& !notification.persistent
41+
&& notification.autoClose !== false
42+
) {
3943
this.closeAfter = FadeTimeout;
4044
}
4145
}

webapp/packages/plugin-sql-editor-navigation-tab-resource/src/PluginBootstrap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ export class PluginBootstrap extends Bootstrap {
204204
this.notificationService.logInfo({
205205
title: 'sql_editor_upload_script_max_size_title',
206206
message: `Max size: ${maxSize}KB\nFile size: ${size}KB`,
207-
persistent: true,
207+
autoClose: false,
208208
});
209209

210210
return;

webapp/packages/plugin-sql-editor/src/SqlEditor/useTools.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export function useTools(state: ISqlEditorTabState): Readonly<State> {
8282
this.notificationService.logInfo({
8383
title: 'sql_editor_upload_script_max_size_title',
8484
message: `Max size: ${maxSize}KB\nFile size: ${size}KB`,
85+
autoClose: false,
8586
});
8687

8788
return false;

0 commit comments

Comments
 (0)