mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-10-12 23:37:00 +08:00
improve(core-connection): CB-413 add connection deletion confirm dialog
CB-413
This commit is contained in:
@@ -17,6 +17,7 @@ export default [
|
||||
'app_shared_navigationTabsBar_placeholder',
|
||||
'There are no objects to show. Double click on an object in the navigation tree to open it.',
|
||||
],
|
||||
['app_shared_navigationTree_delete_connection_confirm', 'Confirm connection deletion'],
|
||||
['app_log_view_clear_log', 'Clear logs'],
|
||||
['app_log_view_entry_type', 'Type'],
|
||||
['app_log_view_entry_timestamp', 'Timestamp'],
|
||||
|
||||
@@ -11,6 +11,7 @@ export default [
|
||||
'app_shared_navigationTabsBar_placeholder',
|
||||
'Нет открытых объектов для отображения. Дважды нажмите на элемент в дереве навигации, чтобы открыть его.',
|
||||
],
|
||||
['app_shared_navigationTree_delete_connection_confirm', 'Потвердите удаление подключения'],
|
||||
['app_navigationTree_openNodeTab', 'Открыть'],
|
||||
['app_navigationTree_refreshNode', 'Обновить'],
|
||||
['app_shared_inlineEditor_dialog_title', 'Редактирование'],
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
import { injectable } from '@cloudbeaver/core-di';
|
||||
import { CommonDialogService, ConfirmationDialog } from '@cloudbeaver/core-dialogs';
|
||||
import { NotificationService } from '@cloudbeaver/core-events';
|
||||
import { SessionResource } from '@cloudbeaver/core-root';
|
||||
|
||||
@@ -27,7 +28,8 @@ export class ConnectionsManagerService {
|
||||
readonly connectionObjectContainers: ContainerResource,
|
||||
private sessionResource: SessionResource,
|
||||
private notificationService: NotificationService,
|
||||
private connectionAuthService: ConnectionAuthService
|
||||
private connectionAuthService: ConnectionAuthService,
|
||||
private commonDialogService: CommonDialogService
|
||||
) {
|
||||
this.sessionResource.onDataUpdate.subscribe(this.restoreConnections.bind(this));
|
||||
}
|
||||
@@ -79,6 +81,15 @@ export class ConnectionsManagerService {
|
||||
return;
|
||||
}
|
||||
|
||||
const confirmed = await this.commonDialogService.open(ConfirmationDialog, {
|
||||
title: 'app_shared_navigationTree_delete_connection_confirm',
|
||||
message: `Would you like to delete ${connection.name} connection?`,
|
||||
confirmActionText: 'ui_delete',
|
||||
});
|
||||
if (!confirmed) {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.connectionInfo.deleteConnection(id);
|
||||
await this.afterConnectionClose(id);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ const style = css`
|
||||
export interface ConfirmationDialogPayload {
|
||||
title: string;
|
||||
message: string;
|
||||
confirmActionText?: string;
|
||||
}
|
||||
|
||||
export function ConfirmationDialog({
|
||||
@@ -66,7 +67,7 @@ export function ConfirmationDialog({
|
||||
mod={['unelevated']}
|
||||
onClick={handleResolve}
|
||||
>
|
||||
<Translate token='ui_processing_ok' />
|
||||
<Translate token={payload.confirmActionText || 'ui_processing_ok'} />
|
||||
</Button>
|
||||
</footer>
|
||||
</dialog>
|
||||
|
||||
Reference in New Issue
Block a user