mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
Merge pull request #135 from dbeaver/refactor-core
refactor(core): extract routing from core, make administration part of core
This commit is contained in:
+2
-11
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@cloudbeaver/plugin-administration",
|
||||
"name": "@cloudbeaver/core-administration",
|
||||
"sideEffects": false,
|
||||
"version": "0.1.0",
|
||||
"description": "",
|
||||
@@ -14,22 +14,13 @@
|
||||
"lint-fix": "eslint ./src/ --ext .ts,.tsx --fix"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@cloudbeaver/core-app": "^0.1.0",
|
||||
"@cloudbeaver/core-blocks": "^0.1.0",
|
||||
"@cloudbeaver/core-di": "^0.1.0",
|
||||
"@cloudbeaver/core-dialogs": "^0.1.0",
|
||||
"@cloudbeaver/core-events": "^0.1.0",
|
||||
"@cloudbeaver/core-extensions": "^0.1.0",
|
||||
"@cloudbeaver/core-localization": "^0.1.0",
|
||||
"@cloudbeaver/core-plugin": "^0.1.0",
|
||||
"@cloudbeaver/core-product": "^0.1.0",
|
||||
"@cloudbeaver/core-root": "^0.1.0",
|
||||
"@cloudbeaver/core-sdk": "^0.1.0",
|
||||
"@cloudbeaver/core-settings": "^0.1.0",
|
||||
"@cloudbeaver/core-routing": "^0.1.0",
|
||||
"@cloudbeaver/core-theming": "^0.1.0",
|
||||
"@cloudbeaver/core-utils": "^0.1.0",
|
||||
"react": "^16.x.x",
|
||||
"rxjs": "^6.x.x",
|
||||
"mobx": "^5.x.x",
|
||||
"mobx-react": "^6.x.x",
|
||||
"reshadow": "^0.0.1-alpha.78"
|
||||
+3
-2
@@ -20,8 +20,9 @@ export class AdministrationItemService {
|
||||
if (this.items.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.items[0].name;
|
||||
return this.items
|
||||
.concat()
|
||||
.sort((a, b) => a.order - b.order)[0].name;
|
||||
}
|
||||
|
||||
getItem(name: string): IAdministrationItem | null {
|
||||
+2
-3
@@ -8,9 +8,9 @@
|
||||
|
||||
import { computed } from 'mobx';
|
||||
|
||||
import { ScreenService, RouterService, AppScreenService } from '@cloudbeaver/core-app';
|
||||
import { injectable, Bootstrap } from '@cloudbeaver/core-di';
|
||||
import { PermissionsService } from '@cloudbeaver/core-root';
|
||||
import { ScreenService, RouterService } from '@cloudbeaver/core-routing';
|
||||
|
||||
import { AdministrationItemService } from '../AdministrationItem/AdministrationItemService';
|
||||
import { EAdminPermission } from '../EAdminPermission';
|
||||
@@ -49,7 +49,6 @@ export class AdministrationScreenService extends Bootstrap {
|
||||
private screenService: ScreenService,
|
||||
private routerService: RouterService,
|
||||
private permissionsService: PermissionsService,
|
||||
private appScreenService: AppScreenService,
|
||||
private administrationItemService: AdministrationItemService
|
||||
) {
|
||||
super();
|
||||
@@ -102,7 +101,7 @@ export class AdministrationScreenService extends Bootstrap {
|
||||
|
||||
private async handleActivate() {
|
||||
if (!this.permissionsService.has(EAdminPermission.admin)) {
|
||||
this.appScreenService.navigateToRoot();
|
||||
this.screenService.navigateToRoot();
|
||||
return;
|
||||
}
|
||||
|
||||
-3
@@ -6,7 +6,6 @@
|
||||
* you may not use this file except in compliance with the License.
|
||||
*/
|
||||
|
||||
import { SettingsMenu, Logo } from '@cloudbeaver/core-app';
|
||||
import { PlaceholderContainer } from '@cloudbeaver/core-blocks';
|
||||
import { injectable } from '@cloudbeaver/core-di';
|
||||
|
||||
@@ -17,8 +16,6 @@ export class AdministrationTopAppBarService {
|
||||
readonly placeholder = new PlaceholderContainer();
|
||||
|
||||
constructor() {
|
||||
this.placeholder.add(Logo, 0);
|
||||
this.placeholder.add(Fill, 3);
|
||||
this.placeholder.add(SettingsMenu, 4);
|
||||
}
|
||||
}
|
||||
+2
-5
@@ -1,10 +1,7 @@
|
||||
import { manifest } from './manifest';
|
||||
|
||||
export default manifest;
|
||||
|
||||
export * from './Administration/AdministrationTools/AdministrationTools';
|
||||
export * from './AdministrationItem/AdministrationItemService';
|
||||
export * from './AdministrationItem/IAdministrationItem';
|
||||
export * from './AdministrationScreen/AdministrationScreenService';
|
||||
export * from './AdministrationScreen/AdministrationTopAppBar/AdministrationTopAppBarService';
|
||||
export * from './AdministrationMenuService';
|
||||
export * from './AdministrationLocaleService';
|
||||
export * from './EAdminPermission';
|
||||
@@ -13,21 +13,19 @@
|
||||
"lint": "eslint ./src/ --ext .ts,.tsx",
|
||||
"lint-fix": "eslint ./src/ --ext .ts,.tsx --fix"
|
||||
},
|
||||
"dependencies": {
|
||||
"router5": "^8.x.x",
|
||||
"router5-plugin-browser": "^8.x.x"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@cloudbeaver/core-di": "^0.1.0",
|
||||
"@cloudbeaver/core-connections": "^0.1.0",
|
||||
"@cloudbeaver/core-plugin": "^0.1.0",
|
||||
"@cloudbeaver/core-localization": "^0.1.0",
|
||||
"@cloudbeaver/core-blocks": "^0.1.0",
|
||||
"@cloudbeaver/core-sdk": "^0.1.0",
|
||||
"@cloudbeaver/core-theming": "^0.1.0",
|
||||
"@cloudbeaver/core-connections": "^0.1.0",
|
||||
"@cloudbeaver/core-di": "^0.1.0",
|
||||
"@cloudbeaver/core-dialogs": "^0.1.0",
|
||||
"@cloudbeaver/core-extensions": "^0.1.0",
|
||||
"@cloudbeaver/core-localization": "^0.1.0",
|
||||
"@cloudbeaver/core-notifications": "^0.1.0",
|
||||
"@cloudbeaver/core-routing": "^0.1.0",
|
||||
"@cloudbeaver/core-plugin": "^0.1.0",
|
||||
"@cloudbeaver/core-sdk": "^0.1.0",
|
||||
"@cloudbeaver/core-settings": "^0.1.0",
|
||||
"@cloudbeaver/core-theming": "^0.1.0",
|
||||
"@cloudbeaver/core-utils": "^0.1.0",
|
||||
"@cloudbeaver/core-view": "^0.1.0",
|
||||
"react": "^16.x.x",
|
||||
|
||||
@@ -7,9 +7,8 @@
|
||||
*/
|
||||
|
||||
import { injectable } from '@cloudbeaver/core-di';
|
||||
import { ScreenService } from '@cloudbeaver/core-routing';
|
||||
|
||||
import { RouterService } from '../RouterService';
|
||||
import { ScreenService } from '../Screen/ScreenService';
|
||||
import { AppScreen } from './AppScreen';
|
||||
|
||||
@injectable()
|
||||
@@ -19,18 +18,14 @@ export class AppScreenService {
|
||||
|
||||
constructor(
|
||||
private screenService: ScreenService,
|
||||
private routerService: RouterService,
|
||||
) {}
|
||||
|
||||
navigateToRoot() {
|
||||
this.routerService.router.navigate(AppScreenService.screenName);
|
||||
}
|
||||
|
||||
register() {
|
||||
this.screenService.create({
|
||||
name: AppScreenService.screenName,
|
||||
routes: [{ name: AppScreenService.screenName, path: '/' }],
|
||||
component: AppScreen,
|
||||
root: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,10 +12,9 @@ import styled, { css } from 'reshadow';
|
||||
import { useService } from '@cloudbeaver/core-di';
|
||||
import { DialogsPortal } from '@cloudbeaver/core-dialogs';
|
||||
import { Notifications } from '@cloudbeaver/core-notifications';
|
||||
import { ScreenService } from '@cloudbeaver/core-routing';
|
||||
import { useStyles, useTheme } from '@cloudbeaver/core-theming';
|
||||
|
||||
import { ScreenService } from './Screen/ScreenService';
|
||||
|
||||
const bodyStyles = css`
|
||||
container {
|
||||
height: 100vh;
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* cloudbeaver - Cloud Database Manager
|
||||
* Copyright (C) 2020 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 { AdministrationTopAppBarService } from '@cloudbeaver/core-administration';
|
||||
import { injectable, Bootstrap } from '@cloudbeaver/core-di';
|
||||
|
||||
import { Logo } from './Logo';
|
||||
import { SettingsMenu } from './SettingsMenu/SettingsMenu';
|
||||
|
||||
@injectable()
|
||||
export class AdministrationTopAppBarBootstrapService extends Bootstrap {
|
||||
|
||||
constructor(private administrationTopAppBarService: AdministrationTopAppBarService) {
|
||||
super();
|
||||
}
|
||||
|
||||
register(): void | Promise<void> {
|
||||
this.administrationTopAppBarService.placeholder.add(Logo, 0);
|
||||
this.administrationTopAppBarService.placeholder.add(SettingsMenu, 4);
|
||||
}
|
||||
|
||||
load(): void | Promise<void> {}
|
||||
}
|
||||
@@ -11,16 +11,15 @@ import { observer } from 'mobx-react';
|
||||
import { AppLogo } from '@cloudbeaver/core-blocks';
|
||||
import { useService } from '@cloudbeaver/core-di';
|
||||
import { ServerService } from '@cloudbeaver/core-root';
|
||||
|
||||
import { AppScreenService } from '../AppScreen/AppScreenService';
|
||||
import { ScreenService } from '@cloudbeaver/core-routing';
|
||||
|
||||
declare const version: string; // declared in webpack DefinePlugin // todo move to enviroment?
|
||||
|
||||
export const Logo = observer(function Logo() {
|
||||
const serverService = useService(ServerService);
|
||||
const appScreenService = useService(AppScreenService);
|
||||
const screenService = useService(ScreenService);
|
||||
|
||||
const title = `Frontend: ${version}\nBackend: ${serverService.config.data?.version}`;
|
||||
|
||||
return <AppLogo title={title} onClick={() => appScreenService.navigateToRoot()}/>;
|
||||
return <AppLogo title={title} onClick={() => screenService.navigateToRoot()}/>;
|
||||
});
|
||||
|
||||
@@ -6,10 +6,12 @@
|
||||
* you may not use this file except in compliance with the License.
|
||||
*/
|
||||
|
||||
import { EAdminPermission, AdministrationScreenService } from '@cloudbeaver/core-administration';
|
||||
import { Bootstrap, injectable } from '@cloudbeaver/core-di';
|
||||
import { IComputedMenuItemOptions, StaticMenu } from '@cloudbeaver/core-dialogs';
|
||||
import { LocalizationService } from '@cloudbeaver/core-localization';
|
||||
import { ServerConfigResource } from '@cloudbeaver/core-root';
|
||||
import { ServerConfigResource, PermissionsService } from '@cloudbeaver/core-root';
|
||||
import { ScreenService } from '@cloudbeaver/core-routing';
|
||||
import { ThemeService } from '@cloudbeaver/core-theming';
|
||||
|
||||
@injectable()
|
||||
@@ -23,7 +25,10 @@ export class SettingsMenuService extends Bootstrap {
|
||||
constructor(
|
||||
private localizationService: LocalizationService,
|
||||
private themeService: ThemeService,
|
||||
private serverConfigResource: ServerConfigResource
|
||||
private permissionsService: PermissionsService,
|
||||
private serverConfigResource: ServerConfigResource,
|
||||
private screenService: ScreenService,
|
||||
private administrationScreenService: AdministrationScreenService
|
||||
) {
|
||||
super();
|
||||
}
|
||||
@@ -33,6 +38,7 @@ export class SettingsMenuService extends Bootstrap {
|
||||
}
|
||||
|
||||
async load(): Promise<void> {
|
||||
this.addAdministration();
|
||||
this.addThemes();
|
||||
await this.addLocales();
|
||||
}
|
||||
@@ -45,6 +51,30 @@ export class SettingsMenuService extends Bootstrap {
|
||||
this.menu.addMenuItem(panelId, options);
|
||||
}
|
||||
|
||||
private addAdministration() {
|
||||
this.addMenuItem(
|
||||
SettingsMenuService.settingsMenuToken,
|
||||
{
|
||||
id: 'administrationMenuEnter',
|
||||
order: 0,
|
||||
isHidden: () => !this.permissionsService.has(EAdminPermission.admin)
|
||||
|| this.screenService.isActive(AdministrationScreenService.screenName),
|
||||
title: 'administration_menu_enter',
|
||||
onClick: () => this.administrationScreenService.navigateToRoot(),
|
||||
}
|
||||
);
|
||||
this.addMenuItem(
|
||||
SettingsMenuService.settingsMenuToken,
|
||||
{
|
||||
id: 'administrationMenuBack',
|
||||
order: 0,
|
||||
isHidden: () => !this.screenService.isActive(AdministrationScreenService.screenName),
|
||||
title: 'administration_menu_back',
|
||||
onClick: () => this.screenService.navigateToRoot(),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private addThemes() {
|
||||
this.addMenuItem(
|
||||
SettingsMenuService.settingsMenuToken,
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
// Services
|
||||
export * from './RouterService';
|
||||
export * from './CoreSettingsService';
|
||||
export * from './Screen/IScreen';
|
||||
export * from './Screen/ScreenService';
|
||||
export * from './AppScreen/AppScreenService';
|
||||
export * from './TopNavBar/MainMenu/MainMenuService';
|
||||
export * from './TopNavBar/SettingsMenu/SettingsMenuService';
|
||||
export * from './TopNavBar/ConnectionSchemaManager/ConnectionSchemaManagerService';
|
||||
export * from './TopNavBar/TopNavBarService';
|
||||
export * from './TopNavBar/AdministrationTopAppBarBootstrapService';
|
||||
export * from './shared/NodesManager/ConnectionDialogsService';
|
||||
export * from './shared/NodesManager/extensions/IObjectCatalogProvider';
|
||||
export * from './shared/NodesManager/extensions/IObjectCatalogSetter';
|
||||
|
||||
@@ -36,7 +36,7 @@ export class PlaceholderContainer<T = any> {
|
||||
order,
|
||||
};
|
||||
|
||||
if (!order) {
|
||||
if (order === undefined) {
|
||||
this.placeholders.push(placeholder);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
"lint-fix": "eslint ./src/ --ext .ts,.tsx --fix"
|
||||
},
|
||||
"dependencies": {
|
||||
"@cloudbeaver/core-administration": "^0.1.0",
|
||||
"@cloudbeaver/core-app": "^0.1.0",
|
||||
"@cloudbeaver/core-blocks": "^0.1.0",
|
||||
"@cloudbeaver/core-connections": "^0.1.0",
|
||||
@@ -26,6 +27,7 @@
|
||||
"@cloudbeaver/core-plugin": "^0.1.0",
|
||||
"@cloudbeaver/core-product": "^0.1.0",
|
||||
"@cloudbeaver/core-root": "^0.1.0",
|
||||
"@cloudbeaver/core-routing": "^0.1.0",
|
||||
"@cloudbeaver/core-sdk": "^0.1.0",
|
||||
"@cloudbeaver/core-settings": "^0.1.0",
|
||||
"@cloudbeaver/core-theming": "^0.1.0",
|
||||
|
||||
@@ -12,12 +12,12 @@ import {
|
||||
NavigationTreeContextMenuService,
|
||||
LogViewerMenuService,
|
||||
ConnectionSchemaManagerService,
|
||||
RouterService,
|
||||
AppScreenService,
|
||||
} from '@cloudbeaver/core-app';
|
||||
import { injectable } from '@cloudbeaver/core-di';
|
||||
import { SessionExpireService } from '@cloudbeaver/core-dialogs';
|
||||
import { ExceptionsCatcherService } from '@cloudbeaver/core-events';
|
||||
import { RouterService } from '@cloudbeaver/core-routing';
|
||||
import { ThemeService } from '@cloudbeaver/core-theming';
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,6 +6,12 @@
|
||||
* you may not use this file except in compliance with the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
AdministrationLocaleService,
|
||||
AdministrationTopAppBarService,
|
||||
AdministrationScreenService,
|
||||
AdministrationItemService
|
||||
} from '@cloudbeaver/core-administration';
|
||||
import {
|
||||
ConnectionDialogsService,
|
||||
MainMenuService, NavigationService, NavigationTreeService,
|
||||
@@ -13,7 +19,7 @@ import {
|
||||
ConnectionSchemaManagerService,
|
||||
NavigationTabsService, NavigationTreeContextMenuService,
|
||||
SettingsMenuService, LogViewerService, LogViewerMenuService, TopNavService,
|
||||
RouterService, ScreenService, AppScreenService, CoreSettingsService
|
||||
AppScreenService, CoreSettingsService, AdministrationTopAppBarBootstrapService
|
||||
} from '@cloudbeaver/core-app';
|
||||
import {
|
||||
ConnectionsManagerService,
|
||||
@@ -39,6 +45,7 @@ import {
|
||||
PermissionsResource,
|
||||
SessionResource
|
||||
} from '@cloudbeaver/core-root';
|
||||
import { RouterService, ScreenService } from '@cloudbeaver/core-routing';
|
||||
import { EnvironmentService, GraphQLService } from '@cloudbeaver/core-sdk';
|
||||
import { LocalStorageSaveService, SettingsService } from '@cloudbeaver/core-settings';
|
||||
import { ThemeService } from '@cloudbeaver/core-theming';
|
||||
@@ -51,6 +58,11 @@ export const coreManifest: PluginManifest = {
|
||||
depends: [],
|
||||
|
||||
providers: [
|
||||
AdministrationLocaleService,
|
||||
AdministrationTopAppBarService,
|
||||
AdministrationScreenService,
|
||||
AdministrationItemService,
|
||||
AdministrationTopAppBarBootstrapService,
|
||||
ActiveViewService,
|
||||
ProductSettingsService,
|
||||
ProductManagerService,
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/lib
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.env*
|
||||
|
||||
# debug
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "@cloudbeaver/core-routing",
|
||||
"sideEffects": false,
|
||||
"version": "0.1.0",
|
||||
"description": "",
|
||||
"license": "Apache-2.0",
|
||||
"main": "lib/index.js",
|
||||
"module": "lib/index.js",
|
||||
"scripts": {
|
||||
"prebuild": "rimraf lib/*",
|
||||
"build": "webpack --config ../../configs/webpack.plugin.config",
|
||||
"postbuild": "tsc",
|
||||
"lint": "eslint ./src/ --ext .ts,.tsx",
|
||||
"lint-fix": "eslint ./src/ --ext .ts,.tsx --fix"
|
||||
},
|
||||
"dependencies": {
|
||||
"router5": "^8.x.x",
|
||||
"router5-plugin-browser": "^8.x.x"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@cloudbeaver/core-di": "^0.1.0",
|
||||
"mobx": "^5.x.x",
|
||||
"mobx-react": "^6.x.x"
|
||||
}
|
||||
}
|
||||
+1
@@ -14,6 +14,7 @@ export interface IScreen {
|
||||
name: string;
|
||||
routes: ScreenRoute[];
|
||||
component: ScreenComponent;
|
||||
root?: boolean;
|
||||
onActivate?: () => void | Promise<void>;
|
||||
onDeactivate?: () => void | Promise<void>;
|
||||
}
|
||||
+9
@@ -29,6 +29,15 @@ export class ScreenService {
|
||||
this.routerService.subscribe(this.onRouteChange.bind(this));
|
||||
}
|
||||
|
||||
navigateToRoot() {
|
||||
const screen = Array.from(this.screens.values())
|
||||
.find(screen => screen.root);
|
||||
|
||||
if (screen) {
|
||||
this.routerService.router.navigate(screen.name);
|
||||
}
|
||||
}
|
||||
|
||||
create(screen: IScreen) {
|
||||
if (this.screens.has(screen.name)) {
|
||||
return;
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from './Screen/IScreen';
|
||||
export * from './Screen/ScreenService';
|
||||
export * from './RouterService';
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "lib"
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
],
|
||||
"include": ["src/**/*"]
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
query createConnectionConfiguration($config: ConnectionConfig!) {
|
||||
connection: createConnectionConfiguration(config: $config) {
|
||||
id
|
||||
name
|
||||
description
|
||||
driverId
|
||||
|
||||
template
|
||||
connected
|
||||
readOnly
|
||||
|
||||
host
|
||||
port
|
||||
databaseName
|
||||
url
|
||||
properties
|
||||
|
||||
features
|
||||
|
||||
authNeeded
|
||||
authModel
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
query deleteConnectionConfiguration($id: ID!) {
|
||||
deleteConnectionConfiguration(id: $id)
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
query getConnections {
|
||||
connections: allConnections {
|
||||
id
|
||||
name
|
||||
description
|
||||
driverId
|
||||
|
||||
template
|
||||
connected
|
||||
readOnly
|
||||
|
||||
host
|
||||
port
|
||||
databaseName
|
||||
url
|
||||
properties
|
||||
|
||||
features
|
||||
|
||||
authNeeded
|
||||
authModel
|
||||
}
|
||||
}
|
||||
@@ -57,8 +57,6 @@ export type Query = {
|
||||
sqlDialectInfo?: Maybe<SqlDialectInfo>;
|
||||
sqlListContexts?: Maybe<Array<Maybe<SqlContextInfo>>>;
|
||||
templateConnections: Array<ConnectionInfo>;
|
||||
/** @deprecated Field no longer supported */
|
||||
templateDataSources: Array<DataSourceInfo>;
|
||||
updateConnectionConfiguration: ConnectionInfo;
|
||||
};
|
||||
|
||||
@@ -468,7 +466,11 @@ export type ConnectionInfo = {
|
||||
driverId: Scalars['ID'];
|
||||
name: Scalars['String'];
|
||||
description?: Maybe<Scalars['String']>;
|
||||
properties?: Maybe<Scalars['String']>;
|
||||
host?: Maybe<Scalars['String']>;
|
||||
port?: Maybe<Scalars['String']>;
|
||||
databaseName?: Maybe<Scalars['String']>;
|
||||
url?: Maybe<Scalars['String']>;
|
||||
properties?: Maybe<Scalars['Object']>;
|
||||
template: Scalars['Boolean'];
|
||||
connected: Scalars['Boolean'];
|
||||
provided: Scalars['Boolean'];
|
||||
@@ -484,18 +486,6 @@ export type ConnectionInfo = {
|
||||
navigatorSettings: NavigatorSettings;
|
||||
};
|
||||
|
||||
export type DataSourceInfo = {
|
||||
id: Scalars['ID'];
|
||||
driverId: Scalars['ID'];
|
||||
name: Scalars['String'];
|
||||
description?: Maybe<Scalars['String']>;
|
||||
host?: Maybe<Scalars['String']>;
|
||||
server?: Maybe<Scalars['String']>;
|
||||
port?: Maybe<Scalars['String']>;
|
||||
url?: Maybe<Scalars['String']>;
|
||||
properties?: Maybe<Scalars['String']>;
|
||||
};
|
||||
|
||||
export type ConnectionConfig = {
|
||||
name?: Maybe<Scalars['String']>;
|
||||
description?: Maybe<Scalars['String']>;
|
||||
@@ -656,6 +646,7 @@ export type SqlResultColumn = {
|
||||
scale?: Maybe<Scalars['Int']>;
|
||||
precision?: Maybe<Scalars['Int']>;
|
||||
readOnly: Scalars['Boolean'];
|
||||
readOnlyStatus?: Maybe<Scalars['String']>;
|
||||
};
|
||||
|
||||
export type SqlResultSet = {
|
||||
@@ -831,6 +822,22 @@ export type SetUserCredentialsQueryVariables = Exact<{
|
||||
|
||||
export type SetUserCredentialsQuery = Pick<Query, 'setUserCredentials'>;
|
||||
|
||||
export type CreateConnectionConfigurationQueryVariables = Exact<{
|
||||
config: ConnectionConfig;
|
||||
}>;
|
||||
|
||||
export type CreateConnectionConfigurationQuery = { connection: Pick<ConnectionInfo, 'id' | 'name' | 'description' | 'driverId' | 'template' | 'connected' | 'readOnly' | 'host' | 'port' | 'databaseName' | 'url' | 'properties' | 'features' | 'authNeeded' | 'authModel'> };
|
||||
|
||||
export type DeleteConnectionConfigurationQueryVariables = Exact<{
|
||||
id: Scalars['ID'];
|
||||
}>;
|
||||
|
||||
export type DeleteConnectionConfigurationQuery = Pick<Query, 'deleteConnectionConfiguration'>;
|
||||
|
||||
export type GetConnectionsQueryVariables = Exact<{ [key: string]: never }>;
|
||||
|
||||
export type GetConnectionsQuery = { connections: Array<Pick<ConnectionInfo, 'id' | 'name' | 'description' | 'driverId' | 'template' | 'connected' | 'readOnly' | 'host' | 'port' | 'databaseName' | 'url' | 'properties' | 'features' | 'authNeeded' | 'authModel'>> };
|
||||
|
||||
export type CloseConnectionMutationVariables = Exact<{
|
||||
id: Scalars['ID'];
|
||||
}>;
|
||||
@@ -1289,6 +1296,53 @@ export const SetUserCredentialsDocument = `
|
||||
setUserCredentials(userId: $userId, providerId: $providerId, credentials: $credentials)
|
||||
}
|
||||
`;
|
||||
export const CreateConnectionConfigurationDocument = `
|
||||
query createConnectionConfiguration($config: ConnectionConfig!) {
|
||||
connection: createConnectionConfiguration(config: $config) {
|
||||
id
|
||||
name
|
||||
description
|
||||
driverId
|
||||
template
|
||||
connected
|
||||
readOnly
|
||||
host
|
||||
port
|
||||
databaseName
|
||||
url
|
||||
properties
|
||||
features
|
||||
authNeeded
|
||||
authModel
|
||||
}
|
||||
}
|
||||
`;
|
||||
export const DeleteConnectionConfigurationDocument = `
|
||||
query deleteConnectionConfiguration($id: ID!) {
|
||||
deleteConnectionConfiguration(id: $id)
|
||||
}
|
||||
`;
|
||||
export const GetConnectionsDocument = `
|
||||
query getConnections {
|
||||
connections: allConnections {
|
||||
id
|
||||
name
|
||||
description
|
||||
driverId
|
||||
template
|
||||
connected
|
||||
readOnly
|
||||
host
|
||||
port
|
||||
databaseName
|
||||
url
|
||||
properties
|
||||
features
|
||||
authNeeded
|
||||
authModel
|
||||
}
|
||||
}
|
||||
`;
|
||||
export const CloseConnectionDocument = `
|
||||
mutation closeConnection($id: ID!) {
|
||||
connection: closeConnection(id: $id) {
|
||||
@@ -1958,6 +2012,15 @@ export function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper =
|
||||
setUserCredentials(variables: SetUserCredentialsQueryVariables): Promise<SetUserCredentialsQuery> {
|
||||
return withWrapper(() => client.request<SetUserCredentialsQuery>(SetUserCredentialsDocument, variables));
|
||||
},
|
||||
createConnectionConfiguration(variables: CreateConnectionConfigurationQueryVariables): Promise<CreateConnectionConfigurationQuery> {
|
||||
return withWrapper(() => client.request<CreateConnectionConfigurationQuery>(CreateConnectionConfigurationDocument, variables));
|
||||
},
|
||||
deleteConnectionConfiguration(variables: DeleteConnectionConfigurationQueryVariables): Promise<DeleteConnectionConfigurationQuery> {
|
||||
return withWrapper(() => client.request<DeleteConnectionConfigurationQuery>(DeleteConnectionConfigurationDocument, variables));
|
||||
},
|
||||
getConnections(variables?: GetConnectionsQueryVariables): Promise<GetConnectionsQuery> {
|
||||
return withWrapper(() => client.request<GetConnectionsQuery>(GetConnectionsDocument, variables));
|
||||
},
|
||||
closeConnection(variables: CloseConnectionMutationVariables): Promise<CloseConnectionMutation> {
|
||||
return withWrapper(() => client.request<CloseConnectionMutation>(CloseConnectionDocument, variables));
|
||||
},
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* cloudbeaver - Cloud Database Manager
|
||||
* Copyright (C) 2020 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 { SettingsMenuService, ScreenService, AppScreenService } from '@cloudbeaver/core-app';
|
||||
import { injectable, Bootstrap } from '@cloudbeaver/core-di';
|
||||
import { PermissionsService } from '@cloudbeaver/core-root';
|
||||
|
||||
import { AdministrationScreenService } from './AdministrationScreen/AdministrationScreenService';
|
||||
import { EAdminPermission } from './EAdminPermission';
|
||||
|
||||
@injectable()
|
||||
export class AdministrationMenuService extends Bootstrap {
|
||||
constructor(
|
||||
private settingsMenuService: SettingsMenuService,
|
||||
private permissionsService: PermissionsService,
|
||||
private screenService: ScreenService,
|
||||
private administrationScreenService: AdministrationScreenService,
|
||||
private appScreenService: AppScreenService
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
register() {
|
||||
this.settingsMenuService.addMenuItem(
|
||||
SettingsMenuService.settingsMenuToken,
|
||||
{
|
||||
id: 'administrationMenuEnter',
|
||||
order: 0,
|
||||
isHidden: () => !this.permissionsService.has(EAdminPermission.admin)
|
||||
|| this.screenService.isActive(AdministrationScreenService.screenName),
|
||||
title: 'administration_menu_enter',
|
||||
onClick: () => this.administrationScreenService.navigateToRoot(),
|
||||
}
|
||||
);
|
||||
this.settingsMenuService.addMenuItem(
|
||||
SettingsMenuService.settingsMenuToken,
|
||||
{
|
||||
id: 'administrationMenuBack',
|
||||
order: 0,
|
||||
isHidden: () => !this.screenService.isActive(AdministrationScreenService.screenName),
|
||||
title: 'administration_menu_back',
|
||||
onClick: () => this.appScreenService.navigateToRoot(),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
load(): void | Promise<void> { }
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* cloudbeaver - Cloud Database Manager
|
||||
* Copyright (C) 2020 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 { IServiceInjector, PluginManifest } from '@cloudbeaver/core-di';
|
||||
|
||||
import { AdministrationItemService } from './AdministrationItem/AdministrationItemService';
|
||||
import { AdministrationLocaleService } from './AdministrationLocaleService';
|
||||
import { AdministrationMenuService } from './AdministrationMenuService';
|
||||
import { AdministrationScreenService } from './AdministrationScreen/AdministrationScreenService';
|
||||
import { AdministrationTopAppBarService } from './AdministrationScreen/AdministrationTopAppBar/AdministrationTopAppBarService';
|
||||
|
||||
export const manifest: PluginManifest = {
|
||||
info: {
|
||||
name: 'Administration',
|
||||
},
|
||||
|
||||
providers: [
|
||||
AdministrationMenuService,
|
||||
AdministrationScreenService,
|
||||
AdministrationTopAppBarService,
|
||||
AdministrationItemService,
|
||||
AdministrationLocaleService,
|
||||
],
|
||||
|
||||
async initialize(services: IServiceInjector) {
|
||||
},
|
||||
};
|
||||
@@ -14,7 +14,7 @@
|
||||
"lint-fix": "eslint ./src/ --ext .ts,.tsx --fix"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@cloudbeaver/plugin-administration": "^0.1.0",
|
||||
"@cloudbeaver/core-administration": "^0.1.0",
|
||||
"@cloudbeaver/core-app": "^0.1.0",
|
||||
"@cloudbeaver/core-blocks": "^0.1.0",
|
||||
"@cloudbeaver/core-di": "^0.1.0",
|
||||
|
||||
+1
-1
@@ -6,8 +6,8 @@
|
||||
* you may not use this file except in compliance with the License.
|
||||
*/
|
||||
|
||||
import { AdministrationItemService } from '@cloudbeaver/core-administration';
|
||||
import { injectable, Bootstrap } from '@cloudbeaver/core-di';
|
||||
import { AdministrationItemService } from '@cloudbeaver/plugin-administration';
|
||||
|
||||
@injectable()
|
||||
export class AuthAdministrationService extends Bootstrap {
|
||||
|
||||
+1
-1
@@ -8,12 +8,12 @@
|
||||
|
||||
import { observable } from 'mobx';
|
||||
|
||||
import { AdministrationScreenService } from '@cloudbeaver/core-administration';
|
||||
import { injectable } from '@cloudbeaver/core-di';
|
||||
import { CommonDialogService } from '@cloudbeaver/core-dialogs';
|
||||
import { NotificationService } from '@cloudbeaver/core-events';
|
||||
import { ErrorDetailsDialog } from '@cloudbeaver/core-notifications';
|
||||
import { GQLErrorCatcher } from '@cloudbeaver/core-sdk';
|
||||
import { AdministrationScreenService } from '@cloudbeaver/plugin-administration';
|
||||
|
||||
import { UsersManagerService } from '../../UsersManagerService';
|
||||
|
||||
|
||||
+1
-1
@@ -9,10 +9,10 @@
|
||||
import { observer } from 'mobx-react';
|
||||
import styled, { css } from 'reshadow';
|
||||
|
||||
import { AdministrationTools } from '@cloudbeaver/core-administration';
|
||||
import { Loader, IconButton } from '@cloudbeaver/core-blocks';
|
||||
import { useController } from '@cloudbeaver/core-di';
|
||||
import { useStyles, composes } from '@cloudbeaver/core-theming';
|
||||
import { AdministrationTools } from '@cloudbeaver/plugin-administration';
|
||||
|
||||
import { UsersAdministrationController } from './UsersAdministrationController';
|
||||
import { UsersTable } from './UsersTable/UsersTable';
|
||||
|
||||
+2
-1
@@ -6,9 +6,9 @@
|
||||
* you may not use this file except in compliance with the License.
|
||||
*/
|
||||
|
||||
import { AdministrationItemService, AdministrationScreenService } from '@cloudbeaver/core-administration';
|
||||
import { injectable, Bootstrap } from '@cloudbeaver/core-di';
|
||||
import { NotificationService } from '@cloudbeaver/core-events';
|
||||
import { AdministrationItemService, AdministrationScreenService } from '@cloudbeaver/plugin-administration';
|
||||
|
||||
import { UsersManagerService } from '../UsersManagerService';
|
||||
import { CreateUser } from './CreateUser/CreateUser';
|
||||
@@ -29,6 +29,7 @@ export class UsersAdministrationService extends Bootstrap {
|
||||
register() {
|
||||
this.administrationItemService.create({
|
||||
name: 'users',
|
||||
order: 1,
|
||||
sub: [
|
||||
{
|
||||
name: 'create',
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
|
||||
import styled from 'reshadow';
|
||||
|
||||
import { AdministrationItemDrawerProps } from '@cloudbeaver/core-administration';
|
||||
import { Tab, TabTitle, TabIcon } from '@cloudbeaver/core-blocks';
|
||||
import { Translate } from '@cloudbeaver/core-localization';
|
||||
import { useStyles } from '@cloudbeaver/core-theming';
|
||||
import { AdministrationItemDrawerProps } from '@cloudbeaver/plugin-administration';
|
||||
|
||||
export function UsersDrawerItem({ item, onSelect, style }: AdministrationItemDrawerProps) {
|
||||
return styled(useStyles(...style))(
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
* you may not use this file except in compliance with the License.
|
||||
*/
|
||||
|
||||
import { AdministrationTopAppBarService } from '@cloudbeaver/core-administration';
|
||||
import { SettingsMenuService, TopNavService } from '@cloudbeaver/core-app';
|
||||
import { injectable } from '@cloudbeaver/core-di';
|
||||
import { NotificationService } from '@cloudbeaver/core-events';
|
||||
import { ServerService } from '@cloudbeaver/core-root';
|
||||
import { AdministrationTopAppBarService } from '@cloudbeaver/plugin-administration';
|
||||
|
||||
import { AuthenticationService } from './AuthenticationService';
|
||||
import { AuthInfoService } from './AuthInfoService';
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
"@cloudbeaver/core-bootstrap": "0.1.0",
|
||||
"@cloudbeaver/core-di": "0.1.0",
|
||||
"@cloudbeaver/core-product": "0.1.0",
|
||||
"@cloudbeaver/plugin-administration": "0.1.0",
|
||||
"@cloudbeaver/plugin-authentication": "0.1.0",
|
||||
"@cloudbeaver/plugin-connection-custom": "0.1.0",
|
||||
"@cloudbeaver/plugin-connection-template": "0.1.0",
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
import 'reflect-metadata';
|
||||
|
||||
import core, { bootstrap } from '@cloudbeaver/core-bootstrap';
|
||||
import administration from '@cloudbeaver/plugin-administration';
|
||||
import spreadsheet from '@cloudbeaver/plugin-data-spreadsheet';
|
||||
import authentication from '@cloudbeaver/plugin-authentication';
|
||||
import dataExport from '@cloudbeaver/plugin-data-export';
|
||||
@@ -17,7 +16,6 @@ import { defaultProductManifest } from './manifest';
|
||||
|
||||
const PLUGINS = [
|
||||
core,
|
||||
administration,
|
||||
spreadsheet,
|
||||
authentication,
|
||||
connectionCustom,
|
||||
|
||||
Reference in New Issue
Block a user