Merge pull request #852 from dbeaver/fix/rm-anon

fix(plugin-resource-manager): CB-2072 hide save button
This commit is contained in:
Alexey
2022-05-26 08:56:00 +03:00
committed by GitHub
2 changed files with 6 additions and 8 deletions
@@ -7,7 +7,6 @@
*/
import { DATA_CONTEXT_NAV_NODE, EMainMenu, MainMenuService } from '@cloudbeaver/core-app';
import { AuthInfoService } from '@cloudbeaver/core-authentication';
import { Bootstrap, injectable } from '@cloudbeaver/core-di';
import { CommonDialogService, ConfirmationDialogDelete, DialogueStateResult } from '@cloudbeaver/core-dialogs';
import { SideBarPanelService } from '@cloudbeaver/core-ui';
@@ -25,7 +24,6 @@ export class PluginBootstrap extends Bootstrap {
private readonly resourceManagerService: ResourceManagerService,
private readonly sideBarPanelService: SideBarPanelService,
private readonly navResourceNodeService: NavResourceNodeService,
private readonly authInfoService: AuthInfoService,
private readonly commonDialogService: CommonDialogService,
private readonly actionService: ActionService,
private readonly menuService: MenuService,
@@ -41,7 +39,7 @@ export class PluginBootstrap extends Bootstrap {
order: 3,
type: 'checkbox',
title: 'plugin_resource_manager_title',
isHidden: () => !this.resourceManagerService.enabled || !this.authInfoService.userInfo,
isHidden: () => !this.resourceManagerService.enabled,
isChecked: () => this.resourceManagerService.panelEnabled,
onClick: this.resourceManagerService.togglePanel,
}
@@ -51,9 +49,7 @@ export class PluginBootstrap extends Bootstrap {
key: 'resource-manager-tab',
order: 0,
name: 'plugin_resource_manager_title',
isHidden: () => !this.resourceManagerService.enabled
|| !this.resourceManagerService.panelEnabled
|| !this.authInfoService.userInfo,
isHidden: () => !this.resourceManagerService.enabled || !this.resourceManagerService.panelEnabled,
onClose: this.resourceManagerService.togglePanel,
panel: () => ResourceManager,
});
@@ -8,6 +8,7 @@
import { computed, makeObservable, observable } from 'mobx';
import { AuthInfoService } from '@cloudbeaver/core-authentication';
import { injectable } from '@cloudbeaver/core-di';
import { ResourceManagerSettingsService } from './ResourceManagerSettingsService';
@@ -15,13 +16,14 @@ import { ResourceManagerSettingsService } from './ResourceManagerSettingsService
@injectable()
export class ResourceManagerService {
get enabled() {
return !this.resourceManagerSettingsService.settings.getValue('disabled');
return !this.resourceManagerSettingsService.settings.getValue('disabled') && !!this.authInfoService.userInfo;
}
panelEnabled: boolean;
constructor(
private readonly resourceManagerSettingsService: ResourceManagerSettingsService
private readonly resourceManagerSettingsService: ResourceManagerSettingsService,
private readonly authInfoService: AuthInfoService,
) {
this.togglePanel = this.togglePanel.bind(this);