mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
Merge pull request #1133 from dbeaver/fix/CB-2565/auto-close-notifications
fix(core-events): CB-2565 autoClose prop for notifications
This commit is contained in:
@@ -54,6 +54,7 @@ export interface INotification<TProps extends INotificationExtraProps<any> = INo
|
||||
message?: string;
|
||||
timestamp: number;
|
||||
details?: string | Error | null;
|
||||
autoClose?: boolean;
|
||||
persistent?: boolean;
|
||||
state: { deleteDelay: number };
|
||||
isSilent: boolean;
|
||||
@@ -69,6 +70,7 @@ export interface INotificationOptions<TProps extends INotificationExtraProps<any
|
||||
message?: string;
|
||||
details?: string | Error | null;
|
||||
isSilent?: boolean;
|
||||
autoClose?: boolean;
|
||||
persistent?: boolean;
|
||||
extraProps?: TProps;
|
||||
timestamp?: number;
|
||||
|
||||
@@ -80,6 +80,7 @@ export class NotificationService {
|
||||
isSilent: !!options.isSilent,
|
||||
customComponent: options.customComponent,
|
||||
extraProps: options.extraProps || {} as TProps,
|
||||
autoClose: options.autoClose,
|
||||
persistent: options.persistent,
|
||||
state: observable({ deleteDelay: 0 }),
|
||||
timestamp: options.timestamp || Date.now(),
|
||||
|
||||
+6
-2
@@ -22,7 +22,7 @@ export class NotificationItemController implements IInitializableController {
|
||||
isDetailsDialogOpen = false;
|
||||
private notification!: INotification<any>;
|
||||
|
||||
constructor(private commonDialogService: CommonDialogService) {
|
||||
constructor(private readonly commonDialogService: CommonDialogService) {
|
||||
makeObservable(this, {
|
||||
isDetailsDialogOpen: observable,
|
||||
});
|
||||
@@ -35,7 +35,11 @@ export class NotificationItemController implements IInitializableController {
|
||||
this.handleShowDetails = this.showDetails.bind(this);
|
||||
}
|
||||
|
||||
if (notification.type !== ENotificationType.Error && !notification.persistent) {
|
||||
if (
|
||||
notification.type !== ENotificationType.Error
|
||||
&& !notification.persistent
|
||||
&& notification.autoClose !== false
|
||||
) {
|
||||
this.closeAfter = FadeTimeout;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ export class PluginBootstrap extends Bootstrap {
|
||||
this.notificationService.logInfo({
|
||||
title: 'sql_editor_upload_script_max_size_title',
|
||||
message: `Max size: ${maxSize}KB\nFile size: ${size}KB`,
|
||||
persistent: true,
|
||||
autoClose: false,
|
||||
});
|
||||
|
||||
return;
|
||||
|
||||
@@ -82,6 +82,7 @@ export function useTools(state: ISqlEditorTabState): Readonly<State> {
|
||||
this.notificationService.logInfo({
|
||||
title: 'sql_editor_upload_script_max_size_title',
|
||||
message: `Max size: ${maxSize}KB\nFile size: ${size}KB`,
|
||||
autoClose: false,
|
||||
});
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user