mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
CB-2463 feat(plugin-connections): Do not close form on logout
This commit is contained in:
+13
-7
@@ -45,7 +45,7 @@ export class PublicConnectionFormService {
|
||||
|
||||
this.authenticationService.onLogin.addHandler(async (event, context) => {
|
||||
if (event === 'before') {
|
||||
const confirmed = await this.close(false);
|
||||
const confirmed = await this.showUnsavedChangesDialog();
|
||||
if (!confirmed) {
|
||||
ExecutorInterrupter.interrupt(context);
|
||||
}
|
||||
@@ -164,6 +164,14 @@ export class PublicConnectionFormService {
|
||||
};
|
||||
|
||||
private readonly closeHandler: IExecutorHandler<any> = async (data, contexts) => {
|
||||
const confirmed = await this.showUnsavedChangesDialog();
|
||||
|
||||
if (!confirmed) {
|
||||
ExecutorInterrupter.interrupt(contexts);
|
||||
}
|
||||
};
|
||||
|
||||
private async showUnsavedChangesDialog(): Promise<boolean> {
|
||||
if (
|
||||
!this.formState
|
||||
|| !this.optionsPanelService.isOpen(formGetter)
|
||||
@@ -176,13 +184,13 @@ export class PublicConnectionFormService {
|
||||
))
|
||||
)
|
||||
) {
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
const state = await this.formState.checkFormState();
|
||||
|
||||
if (!state?.edited) {
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
const result = await this.commonDialogService.open(ConfirmationDialog, {
|
||||
@@ -191,10 +199,8 @@ export class PublicConnectionFormService {
|
||||
confirmActionText: 'ui_processing_ok',
|
||||
});
|
||||
|
||||
if (result === DialogueStateResult.Rejected) {
|
||||
ExecutorInterrupter.interrupt(contexts);
|
||||
}
|
||||
};
|
||||
return result !== DialogueStateResult.Rejected;
|
||||
}
|
||||
|
||||
private async tryReconnect(connectionKey: IConnectionInfoParams) {
|
||||
const result = await this.commonDialogService.open(ConfirmationDialog, {
|
||||
|
||||
Reference in New Issue
Block a user