CB-2463 feat(plugin-connections): Do not close form on logout

This commit is contained in:
Konstantin Vasilev
2022-08-31 10:39:38 +03:00
parent 82fd4c7b93
commit 4ad42175aa
@@ -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, {