mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
CB-4982 disable transaction manager for viewer (#2576)
* CB-4982 disable transaction manager for viewer * CB-4982 change naming --------- Co-authored-by: kseniaguzeeva <112612526+kseniaguzeeva@users.noreply.github.com>
This commit is contained in:
+3
@@ -31,6 +31,7 @@ import { MENU_APP_ACTIONS } from '@cloudbeaver/plugin-top-app-bar';
|
||||
import { ACTION_DATASOURCE_TRANSACTION_COMMIT } from './actions/ACTION_DATASOURCE_TRANSACTION_COMMIT';
|
||||
import { ACTION_DATASOURCE_TRANSACTION_COMMIT_MODE_TOGGLE } from './actions/ACTION_DATASOURCE_TRANSACTION_COMMIT_MODE_TOGGLE';
|
||||
import { ACTION_DATASOURCE_TRANSACTION_ROLLBACK } from './actions/ACTION_DATASOURCE_TRANSACTION_ROLLBACK';
|
||||
import { TransactionManagerSettingsService } from './TransactionManagerSettingsService';
|
||||
|
||||
@injectable()
|
||||
export class TransactionManagerBootstrap extends Bootstrap {
|
||||
@@ -46,6 +47,7 @@ export class TransactionManagerBootstrap extends Bootstrap {
|
||||
private readonly notificationService: NotificationService,
|
||||
private readonly commonDialogService: CommonDialogService,
|
||||
private readonly localizationService: LocalizationService,
|
||||
private readonly transactionManagerSettingsService: TransactionManagerSettingsService,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
@@ -59,6 +61,7 @@ export class TransactionManagerBootstrap extends Bootstrap {
|
||||
const transaction = this.getContextTransaction();
|
||||
|
||||
return (
|
||||
!this.transactionManagerSettingsService.disabled &&
|
||||
!this.optionsPanelService.active &&
|
||||
this.connectionSchemaManagerService.currentConnection?.connected === true &&
|
||||
!!transaction?.context &&
|
||||
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* CloudBeaver - Cloud Database Manager
|
||||
* Copyright (C) 2020-2024 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 { Dependency, injectable } from '@cloudbeaver/core-di';
|
||||
import { SettingsProvider, SettingsProviderService } from '@cloudbeaver/core-settings';
|
||||
import { schema, schemaExtra } from '@cloudbeaver/core-utils';
|
||||
|
||||
const defaultSettings = schema.object({
|
||||
'plugin.datasource-transaction-manager.disabled': schemaExtra.stringedBoolean().default(false),
|
||||
});
|
||||
|
||||
@injectable()
|
||||
export class TransactionManagerSettingsService extends Dependency {
|
||||
get disabled(): boolean {
|
||||
return this.settings.getValue('plugin.datasource-transaction-manager.disabled');
|
||||
}
|
||||
readonly settings: SettingsProvider<typeof defaultSettings>;
|
||||
|
||||
constructor(private readonly settingsProviderService: SettingsProviderService) {
|
||||
super();
|
||||
this.settings = this.settingsProviderService.createSettings(defaultSettings);
|
||||
}
|
||||
}
|
||||
@@ -1 +1,10 @@
|
||||
/*
|
||||
* CloudBeaver - Cloud Database Manager
|
||||
* Copyright (C) 2020-2024 DBeaver Corp and others
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0.
|
||||
* you may not use this file except in compliance with the License.
|
||||
*/
|
||||
export { datasourceTransactionManagerPlugin } from './manifest';
|
||||
|
||||
export { TransactionManagerSettingsService } from './TransactionManagerSettingsService';
|
||||
|
||||
@@ -9,11 +9,12 @@ import type { PluginManifest } from '@cloudbeaver/core-di';
|
||||
|
||||
import { LocaleService } from './LocaleService';
|
||||
import { TransactionManagerBootstrap } from './TransactionManagerBootstrap';
|
||||
import { TransactionManagerSettingsService } from './TransactionManagerSettingsService';
|
||||
|
||||
export const datasourceTransactionManagerPlugin: PluginManifest = {
|
||||
info: {
|
||||
name: 'Datasource transaction manager plugin',
|
||||
},
|
||||
|
||||
providers: [TransactionManagerBootstrap, LocaleService],
|
||||
providers: [TransactionManagerBootstrap, TransactionManagerSettingsService, LocaleService],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user