mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-10-16 14:50:15 +08:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21efd694ff | ||
|
|
a87d041a60 |
@@ -14,6 +14,7 @@ import type { IMenuItem } from './MenuItem/IMenuItem';
|
||||
export type MenuCreatorItem = IMenuItem | IAction | IMenu;
|
||||
|
||||
export interface IMenuItemsCreator {
|
||||
root?: boolean;
|
||||
menus: Set<IMenu>;
|
||||
contexts: Set<DataContextGetter<any>>;
|
||||
isApplicable?: (context: IDataContextProvider) => boolean;
|
||||
|
||||
@@ -14,6 +14,7 @@ import { isAction } from '../Action/createAction';
|
||||
import type { IAction } from '../Action/IAction';
|
||||
import { isMenu } from './createMenu';
|
||||
import { DATA_CONTEXT_MENU } from './DATA_CONTEXT_MENU';
|
||||
import { DATA_CONTEXT_MENU_NESTED } from './DATA_CONTEXT_MENU_NESTED';
|
||||
import type { IMenuHandler, IMenuHandlerOptions } from './IMenuHandler';
|
||||
import type { IMenuItemsCreator, IMenuItemsCreatorOptions, MenuCreatorItem } from './IMenuItemsCreator';
|
||||
import type { IMenuActionItem } from './MenuItem/IMenuActionItem';
|
||||
@@ -144,6 +145,9 @@ function filterApplicable(contexts: IDataContextProvider): (creator: IMenuItemsC
|
||||
const menu = contexts.getOwn(DATA_CONTEXT_MENU);
|
||||
|
||||
return (creator: IMenuItemsCreator) => {
|
||||
if (creator.root && contexts.has(DATA_CONTEXT_MENU_NESTED)) {
|
||||
return false;
|
||||
}
|
||||
if (creator.menus.size > 0) {
|
||||
if (!isNotNullDefined(menu) || !creator.menus.has(menu)) {
|
||||
return false;
|
||||
|
||||
@@ -25,7 +25,7 @@ import {
|
||||
PermissionsService,
|
||||
ServerConfigResource,
|
||||
} from '@cloudbeaver/core-root';
|
||||
import { ACTION_DELETE, ActionService, DATA_CONTEXT_MENU_NESTED, MenuSeparatorItem, MenuService } from '@cloudbeaver/core-view';
|
||||
import { ACTION_DELETE, ActionService, MenuSeparatorItem, MenuService } from '@cloudbeaver/core-view';
|
||||
import { MENU_APP_ACTIONS } from '@cloudbeaver/plugin-top-app-bar';
|
||||
|
||||
import { PluginConnectionsSettingsService } from '../PluginConnectionsSettingsService';
|
||||
@@ -62,6 +62,7 @@ export class ConnectionMenuBootstrap extends Bootstrap {
|
||||
this.addConnectionsMenuToTopAppBar();
|
||||
|
||||
this.menuService.addCreator({
|
||||
root: true,
|
||||
isApplicable: context => {
|
||||
if (this.pluginConnectionsSettingsService.hideConnectionViewForUsers && !this.permissionsService.has(EAdminPermission.admin)) {
|
||||
return false;
|
||||
@@ -79,7 +80,7 @@ export class ConnectionMenuBootstrap extends Bootstrap {
|
||||
return false;
|
||||
}
|
||||
|
||||
return context.has(DATA_CONTEXT_CONNECTION) && !context.has(DATA_CONTEXT_MENU_NESTED);
|
||||
return context.has(DATA_CONTEXT_CONNECTION);
|
||||
},
|
||||
getItems: (context, items) => [...items, MENU_CONNECTION_VIEW],
|
||||
});
|
||||
@@ -141,8 +142,8 @@ export class ConnectionMenuBootstrap extends Bootstrap {
|
||||
});
|
||||
|
||||
this.menuService.addCreator({
|
||||
root: true,
|
||||
contexts: [DATA_CONTEXT_CONNECTION],
|
||||
isApplicable: context => !context.has(DATA_CONTEXT_MENU_NESTED),
|
||||
getItems: (context, items) => [
|
||||
...items,
|
||||
ACTION_CONNECTION_CHANGE_CREDENTIALS,
|
||||
|
||||
@@ -13,7 +13,7 @@ import { LocalizationService } from '@cloudbeaver/core-localization';
|
||||
import { DATA_CONTEXT_NAV_NODE, EObjectFeature } from '@cloudbeaver/core-navigation-tree';
|
||||
import { EAdminPermission, SessionPermissionsResource } from '@cloudbeaver/core-root';
|
||||
import { withTimestamp } from '@cloudbeaver/core-utils';
|
||||
import { ACTION_EXPORT, ActionService, DATA_CONTEXT_MENU, DATA_CONTEXT_MENU_NESTED, menuExtractItems, MenuService } from '@cloudbeaver/core-view';
|
||||
import { ACTION_EXPORT, ActionService, DATA_CONTEXT_MENU, menuExtractItems, MenuService } from '@cloudbeaver/core-view';
|
||||
import {
|
||||
DATA_CONTEXT_DV_DDM,
|
||||
DATA_CONTEXT_DV_DDM_RESULT_INDEX,
|
||||
@@ -111,6 +111,7 @@ export class DataExportMenuService {
|
||||
});
|
||||
|
||||
this.menuService.addCreator({
|
||||
root: true,
|
||||
isApplicable: context => {
|
||||
const node = context.tryGet(DATA_CONTEXT_NAV_NODE);
|
||||
|
||||
@@ -118,7 +119,7 @@ export class DataExportMenuService {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !this.isExportDisabled() && context.has(DATA_CONTEXT_CONNECTION) && !context.has(DATA_CONTEXT_MENU_NESTED);
|
||||
return !this.isExportDisabled() && context.has(DATA_CONTEXT_CONNECTION);
|
||||
},
|
||||
getItems: (context, items) => [...items, ACTION_EXPORT],
|
||||
});
|
||||
|
||||
+3
-2
@@ -11,7 +11,7 @@ import { CommonDialogService } from '@cloudbeaver/core-dialogs';
|
||||
import { NotificationService } from '@cloudbeaver/core-events';
|
||||
import { LocalizationService } from '@cloudbeaver/core-localization';
|
||||
import { DATA_CONTEXT_NAV_NODE, NavTreeResource, NodeManagerUtils } from '@cloudbeaver/core-navigation-tree';
|
||||
import { DATA_CONTEXT_MENU, DATA_CONTEXT_MENU_NESTED, MenuBaseItem, MenuService } from '@cloudbeaver/core-view';
|
||||
import { DATA_CONTEXT_MENU, MenuBaseItem, MenuService } from '@cloudbeaver/core-view';
|
||||
|
||||
import { MENU_NAVIGATION_TREE_FILTERS } from './MENU_NAVIGATION_TREE_FILTERS';
|
||||
|
||||
@@ -33,6 +33,7 @@ export class NavigationTreeFiltersBootstrap extends Bootstrap {
|
||||
|
||||
register(): void {
|
||||
this.menuService.addCreator({
|
||||
root: true,
|
||||
isApplicable: context => {
|
||||
const node = context.tryGet(DATA_CONTEXT_NAV_NODE);
|
||||
|
||||
@@ -40,7 +41,7 @@ export class NavigationTreeFiltersBootstrap extends Bootstrap {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !context.hasValue(DATA_CONTEXT_MENU, MENU_NAVIGATION_TREE_FILTERS) && !context.has(DATA_CONTEXT_MENU_NESTED);
|
||||
return !context.hasValue(DATA_CONTEXT_MENU, MENU_NAVIGATION_TREE_FILTERS);
|
||||
},
|
||||
getItems: (context, items) => [...items, MENU_NAVIGATION_TREE_FILTERS],
|
||||
});
|
||||
|
||||
+1
-2
@@ -32,7 +32,6 @@ import {
|
||||
ACTION_REFRESH,
|
||||
ACTION_RENAME,
|
||||
ActionService,
|
||||
DATA_CONTEXT_MENU_NESTED,
|
||||
menuExtractItems,
|
||||
MenuSeparatorItem,
|
||||
MenuService,
|
||||
@@ -185,8 +184,8 @@ export class NavNodeContextMenuService extends Bootstrap {
|
||||
});
|
||||
|
||||
this.menuService.addCreator({
|
||||
root: true,
|
||||
contexts: [DATA_CONTEXT_NAV_NODE],
|
||||
isApplicable: context => !context.has(DATA_CONTEXT_MENU_NESTED),
|
||||
getItems: (context, items) => {
|
||||
items = [ACTION_OPEN, ACTION_REFRESH, ...items];
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ export const SettingsList = observer<Props>(function SettingsList({ treeData, so
|
||||
{list.map(({ group, settings }) => (
|
||||
<SettingsGroup key={group.id} group={group} source={source} settings={settings} />
|
||||
))}
|
||||
<div style={{ height: 'calc(100% - 100px)' }} />
|
||||
<div style={{ height: 'calc(100% - 100px)' }} hidden />
|
||||
</Container>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -23,7 +23,7 @@ import { ExtensionUtils } from '@cloudbeaver/core-extensions';
|
||||
import { LocalizationService } from '@cloudbeaver/core-localization';
|
||||
import { DATA_CONTEXT_NAV_NODE, EObjectFeature, NodeManagerUtils } from '@cloudbeaver/core-navigation-tree';
|
||||
import { ISessionAction, sessionActionContext, SessionActionService } from '@cloudbeaver/core-root';
|
||||
import { ACTION_RENAME, ActionService, DATA_CONTEXT_MENU_NESTED, menuExtractItems, MenuService, ViewService } from '@cloudbeaver/core-view';
|
||||
import { ACTION_RENAME, ActionService, menuExtractItems, MenuService, ViewService } from '@cloudbeaver/core-view';
|
||||
import { MENU_CONNECTIONS } from '@cloudbeaver/plugin-connections';
|
||||
import { NavigationTabsService } from '@cloudbeaver/plugin-navigation-tabs';
|
||||
import {
|
||||
@@ -89,6 +89,7 @@ export class SqlEditorBootstrap extends Bootstrap {
|
||||
});
|
||||
|
||||
this.menuService.addCreator({
|
||||
root: true,
|
||||
contexts: [DATA_CONTEXT_CONNECTION],
|
||||
isApplicable: context => {
|
||||
const node = context.tryGet(DATA_CONTEXT_NAV_NODE);
|
||||
@@ -97,7 +98,7 @@ export class SqlEditorBootstrap extends Bootstrap {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !context.has(DATA_CONTEXT_MENU_NESTED);
|
||||
return true;
|
||||
},
|
||||
getItems: (context, items) => [...items, ACTION_SQL_EDITOR_OPEN],
|
||||
});
|
||||
|
||||
@@ -44,7 +44,7 @@ export class SqlGeneratorsBootstrap extends Bootstrap {
|
||||
},
|
||||
});
|
||||
this.menuService.addCreator({
|
||||
menus: [MENU_SQL_GENERATORS],
|
||||
root: true,
|
||||
contexts: [DATA_CONTEXT_NAV_NODE],
|
||||
isApplicable: context => {
|
||||
const node = context.get(DATA_CONTEXT_NAV_NODE);
|
||||
|
||||
Reference in New Issue
Block a user