mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-10-16 06:40:05 +08:00
fix: CB-2372 folders creation access
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
import { action, computed, makeObservable, observable } from 'mobx';
|
||||
|
||||
import type { IFormStateInfo } from '@cloudbeaver/core-blocks';
|
||||
import { createConnectionParam, DatabaseConnection, EConnectionFeature, IConnectionInfoParams, IConnectionsResource } from '@cloudbeaver/core-connections';
|
||||
import { createConnectionParam, DatabaseConnection, IConnectionInfoParams, IConnectionsResource } from '@cloudbeaver/core-connections';
|
||||
import { Executor, IExecutionContextProvider, IExecutor } from '@cloudbeaver/core-executor';
|
||||
import type { ConnectionConfig, ResourceKey } from '@cloudbeaver/core-sdk';
|
||||
import { MetadataMap, uuid } from '@cloudbeaver/core-utils';
|
||||
|
||||
@@ -100,29 +100,34 @@ export class ConnectionFoldersBootstrap extends Bootstrap {
|
||||
this.actionService.addHandler({
|
||||
id: 'tree-tools-menu-folders-handler',
|
||||
isActionApplicable: (context, action) => {
|
||||
const tree = context.tryGet(DATA_CONTEXT_ELEMENTS_TREE);
|
||||
|
||||
if (tree?.baseRoot !== ROOT_NODE_PATH || !this.userInfoResource.data) {
|
||||
if (action !== ACTION_NEW_FOLDER) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return [ACTION_NEW_FOLDER].includes(action);
|
||||
},
|
||||
isDisabled: (context, action) => {
|
||||
const tree = context.tryGet(DATA_CONTEXT_ELEMENTS_TREE);
|
||||
|
||||
if (!tree) {
|
||||
return true;
|
||||
if (!tree || !this.userInfoResource.data) {
|
||||
return false;
|
||||
}
|
||||
const targetNode = this.getTargetNode(tree);
|
||||
|
||||
if (action === ACTION_NEW_FOLDER) {
|
||||
const targetNode = this.getTargetNode(tree);
|
||||
|
||||
return targetNode === undefined;
|
||||
}
|
||||
|
||||
return false;
|
||||
return targetNode !== undefined;
|
||||
},
|
||||
// isDisabled: (context, action) => {
|
||||
// const tree = context.tryGet(DATA_CONTEXT_ELEMENTS_TREE);
|
||||
|
||||
// if (!tree) {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// if (action === ACTION_NEW_FOLDER) {
|
||||
// const targetNode = this.getTargetNode(tree);
|
||||
|
||||
// return targetNode === undefined;
|
||||
// }
|
||||
|
||||
// return false;
|
||||
// },
|
||||
handler: this.elementsTreeActionHandler.bind(this),
|
||||
});
|
||||
|
||||
|
||||
+4
-1
@@ -67,7 +67,10 @@ export class PublicConnectionFormService {
|
||||
}
|
||||
|
||||
this.formState
|
||||
.setOptions(config.connectionId ? 'edit' : 'create', 'public')
|
||||
.setOptions(
|
||||
config.connectionId ? 'edit' : 'create',
|
||||
'public'
|
||||
)
|
||||
.setConfig(projectId, config)
|
||||
.setAvailableDrivers(availableDrivers || []);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user