/
vshmidt
/
cloudbeaver
Обзор
Документация
Войти
/
vshmidt
/
cloudbeaver
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
devel
webapp/packages/plugin-authentication/src/Dialog/AuthDialogService.ts
55 строк
1 KB
Dmitrii Barnukov
dbeaver/pro#6509 Query confirmations (#3793)
28 окт 2025, 16:35
Не верифицирован
28 окт 2025, 16:35
2a107f3
Код
Авторство
О чём код?
/* * CloudBeaver - Cloud Database Manager * Copyright (C) 2020-2025 DBeaver Corp and others * * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ import { injectable } from '@cloudbeaver/core-di'; import { CommonDialogService, type DialogResult } from '@cloudbeaver/core-dialogs'; import type { IAuthOptions } from '../IAuthOptions.js'; import { importLazyComponent } from '@cloudbeaver/core-blocks'; const AuthDialog = importLazyComponent(() => import('./AuthDialog.js').then(m => m.AuthDialog)); @injectable(() => [CommonDialogService]) export class AuthDialogService { get isPersistent(): boolean { return this.persistent; } private persistent: boolean; private dialog: Promise<DialogResult> | null; constructor(private readonly commonDialogService: CommonDialogService) { this.persistent = false; this.dialog = null; } showLoginForm( persistent = false, options: IAuthOptions = { providerId: null, }, ): Promise<DialogResult> { if (this.dialog) { return this.dialog; } this.persistent = persistent; this.dialog = this.commonDialogService.open(AuthDialog, options, { persistent }); this.dialog.finally(() => { this.dialog = null; this.persistent = false; }); return this.dialog; } closeLoginForm(): void { if (this.dialog) { this.commonDialogService.rejectDialog(this.dialog); } } }