mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
chore: linting improvements
This commit is contained in:
+76
-146
@@ -8,7 +8,6 @@ module.exports = {
|
||||
],
|
||||
|
||||
extends: [
|
||||
// 'airbnb-typescript',
|
||||
"eslint:recommended",
|
||||
"plugin:react/recommended",
|
||||
"plugin:react-hooks/recommended",
|
||||
@@ -17,20 +16,6 @@ module.exports = {
|
||||
],
|
||||
|
||||
settings: {
|
||||
'import/parsers': {
|
||||
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
||||
},
|
||||
|
||||
'import/resolver': {
|
||||
typescript: {
|
||||
alwaysTryTypes: true,
|
||||
},
|
||||
},
|
||||
|
||||
typescript: {
|
||||
directory: './',
|
||||
},
|
||||
|
||||
react: {
|
||||
createClass: 'createReactClass',
|
||||
pragma: 'React',
|
||||
@@ -49,10 +34,69 @@ module.exports = {
|
||||
},
|
||||
|
||||
rules: {
|
||||
'arrow-parens': ['error', 'as-needed', { 'requireForBlockBody': true }],
|
||||
'@typescript-eslint/dot-notation': 'off',
|
||||
'@typescript-eslint/no-throw-literal': 'off',
|
||||
'@typescript-eslint/no-base-to-string': 'off',
|
||||
'@typescript-eslint/no-floating-promises': 'off',
|
||||
'@typescript-eslint/no-implied-eval': 'off',
|
||||
'@typescript-eslint/no-misused-promises': 'off',
|
||||
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'off',
|
||||
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
|
||||
'@typescript-eslint/prefer-includes': 'off',
|
||||
'@typescript-eslint/prefer-nullish-coalescing': 'off',
|
||||
'@typescript-eslint/prefer-readonly': 'off',
|
||||
'@typescript-eslint/prefer-reduce-type-parameter': 'off',
|
||||
'@typescript-eslint/promise-function-async': 'off',
|
||||
'@typescript-eslint/require-array-sort-compare': 'off',
|
||||
'@typescript-eslint/restrict-plus-operands': 'off',
|
||||
'@typescript-eslint/restrict-template-expressions': 'off',
|
||||
'@typescript-eslint/return-await': 'off',
|
||||
'@typescript-eslint/strict-boolean-expressions': 'off',
|
||||
|
||||
|
||||
'import/no-duplicates': 'off',
|
||||
'import/export': 'off',
|
||||
'standard/no-callback-literal': 'off',
|
||||
'no-empty': 'off',
|
||||
'curly': ['error', 'all'],
|
||||
'class-methods-use-this': 'off',
|
||||
'default-case': 'off',
|
||||
'arrow-body-style': ['error', 'as-needed'],
|
||||
'function-call-argument-newline': ['error', 'consistent'],
|
||||
'prefer-arrow-callback': [
|
||||
'error',
|
||||
{
|
||||
'allowNamedFunctions': true
|
||||
}
|
||||
],
|
||||
'operator-linebreak': ['warn', 'before'],
|
||||
'no-nested-ternary': 'warn',
|
||||
'arrow-parens': ['error', 'as-needed'],
|
||||
'comma-dangle': ['warn', { // the rule enforces consistent use of trailing commas in object and array literals
|
||||
'arrays': 'always-multiline',
|
||||
'objects': 'always-multiline',
|
||||
'imports': 'only-multiline',
|
||||
'exports': 'only-multiline',
|
||||
'functions': 'only-multiline'
|
||||
}],
|
||||
'max-len': [
|
||||
'error',
|
||||
{
|
||||
code: 120,
|
||||
ignoreTrailingComments: true,
|
||||
ignoreStrings: true,
|
||||
ignoreTemplateLiterals: true,
|
||||
ignorePattern: "^export\\s(const\\s\\w+:?.+=.+function\\s|function\\s)\\w+\\s*\\(\\s*\\{$"
|
||||
}
|
||||
],
|
||||
'import-helpers/order-imports': [
|
||||
'warn',
|
||||
{
|
||||
newlinesBetween: 'always',
|
||||
groups: ['module', '/^@/', '/^~/', ['parent', 'sibling', 'index']],
|
||||
alphabetize: { order: 'asc', ignoreCase: true },
|
||||
},
|
||||
],
|
||||
|
||||
'react/destructuring-assignment': 'off',
|
||||
'react/require-render-return': 'off',
|
||||
'react/no-string-refs': 'off',
|
||||
'react/no-deprecated': 'off',
|
||||
@@ -61,16 +105,23 @@ module.exports = {
|
||||
'react/display-name': 'off',
|
||||
'react/jsx-no-literals': 'off',
|
||||
'react/react-in-jsx-scope': 'off',
|
||||
'react/jsx-max-props-per-line': [1, { "when": "multiline" }],
|
||||
'react/jsx-closing-bracket-location': 'error',
|
||||
'react/jsx-closing-tag-location': 'error',
|
||||
'react/jsx-boolean-value': 'error',
|
||||
'react/self-closing-comp': "error",
|
||||
'react/jsx-curly-newline': 'error',
|
||||
'react/jsx-curly-brace-presence': ['error', "never"],
|
||||
'react/jsx-fragments': ['error', 'syntax'],
|
||||
'react/jsx-equals-spacing': ['error', 'never'],
|
||||
'react/jsx-curly-spacing': ['error', { "when": "never", "children": true }],
|
||||
'react/jsx-first-prop-new-line': ['warn', 'multiline'],
|
||||
'react/jsx-max-props-per-line': [1, { "when": "multiline" }],
|
||||
'react/jsx-tag-spacing': ['error', {
|
||||
"closingSlash": "never",
|
||||
"beforeSelfClosing": "always",
|
||||
"afterOpening": "never",
|
||||
"beforeClosing": "never"
|
||||
}],
|
||||
'react/jsx-boolean-value': 'error',
|
||||
'react/jsx-wrap-multilines': ['error', {
|
||||
"declaration": "parens-new-line",
|
||||
"assignment": "parens-new-line",
|
||||
@@ -80,7 +131,6 @@ module.exports = {
|
||||
"logical": "parens-new-line",
|
||||
"prop": "parens-new-line"
|
||||
}],
|
||||
'react/self-closing-comp': ["error"],
|
||||
'react/jsx-sort-props': ['error', {
|
||||
"callbacksLast": true,
|
||||
"shorthandLast": true,
|
||||
@@ -88,117 +138,15 @@ module.exports = {
|
||||
"noSortAlphabetically": true,
|
||||
"reservedFirst": true,
|
||||
}],
|
||||
'react/destructuring-assignment': ['error'],
|
||||
'react/jsx-curly-brace-presence': ['error', "never"],
|
||||
'react/jsx-curly-newline': ['error'],
|
||||
'react/jsx-curly-spacing': ['error', { "when": "never", "children": true }],
|
||||
'react/jsx-equals-spacing': ['error', 'never'],
|
||||
'react/jsx-first-prop-new-line': ['warn', 'multiline'],
|
||||
'react/jsx-fragments': ['error', 'syntax'],
|
||||
// 'brace-style': ["error", "1tbs", { "allowSingleLine": false }],
|
||||
'operator-linebreak': ['warn', 'before'],
|
||||
'consistent-return': 'off',
|
||||
'comma-dangle': ['warn', { // the rule enforces consistent use of trailing commas in object and array literals
|
||||
'arrays': 'always-multiline',
|
||||
'objects': 'always-multiline',
|
||||
'imports': 'only-multiline',
|
||||
'exports': 'only-multiline',
|
||||
'functions': 'only-multiline'
|
||||
}],
|
||||
"semi": "off",
|
||||
'eqeqeq': 'warn',
|
||||
'radix': 'off',
|
||||
'no-unmodified-loop-condition': 'off',
|
||||
'no-use-before-define': 'off',
|
||||
'no-constant-condition': 'off',
|
||||
'no-console': 'off',
|
||||
'no-dupe-class-members': 'off',
|
||||
'no-unreachable': 'off',
|
||||
'no-unused-expressions': 'off',
|
||||
'no-nested-ternary': 'warn',
|
||||
'no-empty': 'off',
|
||||
'no-return-assign': 'off',
|
||||
'no-continue': 'off',
|
||||
'no-shadow': 'off',
|
||||
'no-restricted-syntax': 'off',
|
||||
'no-underscore-dangle': 'off',
|
||||
'no-undef': 'off',
|
||||
'no-plusplus': 'off',
|
||||
'no-param-reassign': 'off',
|
||||
'no-await-in-loop': 'off',
|
||||
'no-restricted-globals': 'off',
|
||||
'no-useless-constructor': 'off',
|
||||
'max-classes-per-file': 'off',
|
||||
'arrow-body-style': ['error', 'as-needed'],
|
||||
'function-call-argument-newline': ['error', 'consistent'],
|
||||
'max-len': [
|
||||
'error',
|
||||
{
|
||||
code: 120,
|
||||
ignoreTrailingComments: true,
|
||||
ignoreStrings: true,
|
||||
ignoreTemplateLiterals: true,
|
||||
ignorePattern: "^export\\s(const\\s\\w+:?.+=\\s*function\\s|function\\s)\\w+\\s*\\(\\s*\\{$"
|
||||
}
|
||||
],
|
||||
'lines-between-class-members': 'off',
|
||||
'require-atomic-updates': 'off',
|
||||
'prefer-destructuring': 'off',
|
||||
'prefer-arrow-callback': [
|
||||
'error',
|
||||
{
|
||||
'allowNamedFunctions': true
|
||||
}
|
||||
],
|
||||
'padded-blocks': 'off',
|
||||
'import/no-duplicates': 'off',
|
||||
'standard/no-callback-literal': 'off',
|
||||
'@typescript-eslint/dot-notation': 'off',
|
||||
'@typescript-eslint/no-throw-literal': 'off',
|
||||
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'off',
|
||||
'@typescript-eslint/prefer-includes': 'off',
|
||||
'@typescript-eslint/prefer-nullish-coalescing': 'off',
|
||||
'@typescript-eslint/prefer-readonly': 'off',
|
||||
'@typescript-eslint/prefer-reduce-type-parameter': 'off',
|
||||
'@typescript-eslint/require-array-sort-compare': 'off',
|
||||
'@typescript-eslint/restrict-plus-operands': 'off',
|
||||
'@typescript-eslint/return-await': 'off',
|
||||
|
||||
|
||||
'@typescript-eslint/indent': [
|
||||
'warn', 2, {
|
||||
'MemberExpression': 1,
|
||||
"FunctionDeclaration": {"body": 1, "parameters": 1},
|
||||
"FunctionExpression": {"body": 1, "parameters": 1},
|
||||
"CallExpression": {"arguments": 1},
|
||||
'ArrayExpression': 1,
|
||||
'SwitchCase': 1,
|
||||
'ObjectExpression': 1,
|
||||
'ImportDeclaration': 1,
|
||||
"offsetTernaryExpressions": true
|
||||
}
|
||||
],
|
||||
'@typescript-eslint/restrict-template-expressions': 'off',
|
||||
'@typescript-eslint/no-base-to-string': 'off',
|
||||
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
|
||||
'@typescript-eslint/no-implied-eval': 'off',
|
||||
'@typescript-eslint/no-misused-promises': 'off',
|
||||
'@typescript-eslint/no-floating-promises': 'off',
|
||||
'@typescript-eslint/promise-function-async': 'off',
|
||||
'@typescript-eslint/space-before-function-paren': ["error", { "anonymous": "always", "named": "never", "asyncArrow": "always" }],
|
||||
'@typescript-eslint/no-empty-interface': 'off',
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
'@typescript-eslint/no-use-before-define': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'off',
|
||||
'@typescript-eslint/no-empty-function': 'off',
|
||||
'@typescript-eslint/interface-name-prefix': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'warn',
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'@typescript-eslint/triple-slash-reference': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/strict-boolean-expressions': ['off'],
|
||||
'@typescript-eslint/consistent-type-assertions': ['error', { assertionStyle: 'as', objectLiteralTypeAssertions: 'allow' }],
|
||||
// '@typescript-eslint/no-extraneous-class': [],
|
||||
'@typescript-eslint/no-empty-function': 'off',
|
||||
"@typescript-eslint/semi": ["error", "always"],
|
||||
'@typescript-eslint/consistent-type-assertions': ['error', { assertionStyle: 'as', objectLiteralTypeAssertions: 'allow' }],
|
||||
'@typescript-eslint/space-before-function-paren': ["error", { "anonymous": "always", "named": "never", "asyncArrow": "always" }],
|
||||
"@typescript-eslint/member-delimiter-style": ['warn', {
|
||||
"multiline": {
|
||||
"delimiter": "semi",
|
||||
@@ -209,23 +157,5 @@ module.exports = {
|
||||
"requireLast": false
|
||||
}
|
||||
}],
|
||||
'import/named': 'off',
|
||||
'import/export': 'off',
|
||||
'import/extensions': 'off',
|
||||
'import/no-unresolved': 'off',
|
||||
// import/no-extraneous-dependencies off because peer dependencies are moved to builder
|
||||
// todo probably there is a way to tune this (see packageDir option in documentation)
|
||||
'import/no-extraneous-dependencies': 'off',
|
||||
'import/prefer-default-export': 'off',
|
||||
'import/no-cycle': 'off',
|
||||
'import-helpers/order-imports': [
|
||||
'warn',
|
||||
{
|
||||
newlinesBetween: 'always',
|
||||
groups: ['module', '/^@/', '/^~/', ['parent', 'sibling', 'index']],
|
||||
alphabetize: { order: 'asc', ignoreCase: true },
|
||||
},
|
||||
],
|
||||
'indent': 'off'
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -19,7 +19,6 @@ type Props = React.PropsWithChildren<{
|
||||
}>;
|
||||
|
||||
export function AdministrationTools({ children, className }: Props) {
|
||||
|
||||
return styled(styles)(
|
||||
<administration-tools as='div' className={className}>
|
||||
{children}
|
||||
|
||||
-1
@@ -21,7 +21,6 @@ const ADMINISTRATION_ITEMS_STATE = 'administration_items_state';
|
||||
|
||||
@injectable()
|
||||
export class AdministrationScreenService {
|
||||
|
||||
static screenName = 'administration';
|
||||
static itemRouteName = 'administration.item';
|
||||
static itemSubRouteName = 'administration.item.sub';
|
||||
|
||||
-1
@@ -18,7 +18,6 @@ import { ConfigurationWizardScreen } from './ConfigurationWizard/ConfigurationWi
|
||||
|
||||
@injectable()
|
||||
export class AdministrationScreenServiceBootstrap extends Bootstrap {
|
||||
|
||||
constructor(
|
||||
private screenService: ScreenService,
|
||||
private permissionsService: PermissionsService,
|
||||
|
||||
+1
-3
@@ -20,7 +20,6 @@ import { AdministrationScreenService } from '../AdministrationScreenService';
|
||||
|
||||
@injectable()
|
||||
export class ConfigurationWizardService {
|
||||
|
||||
@computed get steps(): IAdministrationItem[] {
|
||||
return this.administrationItemService.items
|
||||
.filter(filterConfigurationWizard(true))
|
||||
@@ -46,7 +45,7 @@ export class ConfigurationWizardService {
|
||||
}
|
||||
|
||||
@computed get canFinish(): boolean {
|
||||
return this.steps.every((step) => {
|
||||
return this.steps.every(step => {
|
||||
if (step.configurationWizardOptions?.isDone
|
||||
&& !step.configurationWizardOptions?.isDone()) {
|
||||
return false;
|
||||
@@ -158,7 +157,6 @@ export class ConfigurationWizardService {
|
||||
|
||||
private async finish() {
|
||||
for (const step of this.steps) {
|
||||
|
||||
if (step?.configurationWizardOptions?.onConfigurationFinish) {
|
||||
await step.configurationWizardOptions.onConfigurationFinish();
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import { TopNavBar } from '../TopNavBar/TopNavBar';
|
||||
import { Main } from './Main';
|
||||
|
||||
export function AppScreen() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<TopNavBar />
|
||||
|
||||
@@ -13,11 +13,10 @@ import { AppScreen } from './AppScreen';
|
||||
|
||||
@injectable()
|
||||
export class AppScreenService extends Bootstrap {
|
||||
|
||||
static screenName = 'app';
|
||||
|
||||
constructor(
|
||||
private screenService: ScreenService,
|
||||
private screenService: ScreenService
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
import styled, { css } from 'reshadow';
|
||||
|
||||
import {
|
||||
splitStyles, Split, ResizerControls, Pane,
|
||||
splitStyles, Split, ResizerControls, Pane
|
||||
} from '@cloudbeaver/core-blocks';
|
||||
import { useStyles, composes } from '@cloudbeaver/core-theming';
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import { observer } from 'mobx-react';
|
||||
import styled, { css } from 'reshadow';
|
||||
|
||||
import {
|
||||
Pane, ResizerControls, Split, splitHorizontalStyles, splitStyles,
|
||||
Pane, ResizerControls, Split, splitHorizontalStyles, splitStyles
|
||||
} from '@cloudbeaver/core-blocks';
|
||||
import { useController } from '@cloudbeaver/core-di';
|
||||
import { useStyles, composes } from '@cloudbeaver/core-theming';
|
||||
|
||||
@@ -20,7 +20,6 @@ export type CoreSettings = typeof defaultSettings;
|
||||
|
||||
@injectable()
|
||||
export class CoreSettingsService {
|
||||
|
||||
readonly settings = this.pluginManagerService.getPluginSettings('core', defaultSettings);
|
||||
|
||||
constructor(private pluginManagerService: PluginManagerService) { }
|
||||
|
||||
@@ -45,7 +45,7 @@ export class NavigationTreeContextMenuService {
|
||||
},
|
||||
order: 1,
|
||||
title: 'app_navigationTree_openNodeTab',
|
||||
onClick: (context) => {
|
||||
onClick: context => {
|
||||
const node = context.data;
|
||||
this.navNodeManagerService.navToNode(node.id, node.parentId);
|
||||
},
|
||||
@@ -61,7 +61,7 @@ export class NavigationTreeContextMenuService {
|
||||
},
|
||||
order: Number.MAX_SAFE_INTEGER,
|
||||
title: 'app_navigationTree_refreshNode',
|
||||
onClick: (context) => {
|
||||
onClick: context => {
|
||||
const node = context.data;
|
||||
this.navNodeManagerService.refreshTree(node.id);
|
||||
},
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
|
||||
import { observer } from 'mobx-react';
|
||||
import {
|
||||
MouseEvent, KeyboardEvent, useCallback, PropsWithChildren,
|
||||
MouseEvent, KeyboardEvent, useCallback, PropsWithChildren
|
||||
} from 'react';
|
||||
import styled, { use } from 'reshadow';
|
||||
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@ export function useNavigationNode(node: NavNode, nodeLoading: boolean, nodeLoade
|
||||
setProcessing(true);
|
||||
navigationTreeService
|
||||
.loadNestedNodes(node.id)
|
||||
.then((state) => {
|
||||
.then(state => {
|
||||
setProcessing(false);
|
||||
if (!state) {
|
||||
switchExpand(false);
|
||||
|
||||
@@ -14,7 +14,6 @@ import { SettingsMenu } from './SettingsMenu/SettingsMenu';
|
||||
|
||||
@injectable()
|
||||
export class AdministrationTopAppBarBootstrapService extends Bootstrap {
|
||||
|
||||
constructor(
|
||||
private administrationTopAppBarService: AdministrationTopAppBarService,
|
||||
private wizardTopAppBarService: WizardTopAppBarService
|
||||
|
||||
+2
-3
@@ -45,7 +45,6 @@ interface IActiveItem<T> {
|
||||
|
||||
@injectable()
|
||||
export class ConnectionSchemaManagerService {
|
||||
|
||||
get currentConnectionId(): string | undefined {
|
||||
if (!this.activeItem?.getCurrentConnectionId) {
|
||||
return;
|
||||
@@ -121,7 +120,7 @@ export class ConnectionSchemaManagerService {
|
||||
private connectionInfo: ConnectionInfoResource,
|
||||
private connectionsManagerService: ConnectionsManagerService,
|
||||
private dbDriverResource: DBDriverResource,
|
||||
private notificationService: NotificationService,
|
||||
private notificationService: NotificationService
|
||||
) {
|
||||
|
||||
}
|
||||
@@ -195,7 +194,7 @@ export class ConnectionSchemaManagerService {
|
||||
} catch (exception) {
|
||||
this.notificationService.logException(
|
||||
exception,
|
||||
`Can't load objectContainers for ${connectionId}@${catalogId}`,
|
||||
`Can't load objectContainers for ${connectionId}@${catalogId}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-5
@@ -22,7 +22,6 @@ import { ConnectionSchemaManagerService } from '../ConnectionSchemaManagerServic
|
||||
|
||||
@injectable()
|
||||
export class ConnectionSelectorController {
|
||||
|
||||
connectionMenu: IMenuItem;
|
||||
objectContainerMenu: IMenuItem;
|
||||
|
||||
@@ -79,9 +78,8 @@ export class ConnectionSelectorController {
|
||||
constructor(
|
||||
private connectionSelectorService: ConnectionSchemaManagerService,
|
||||
private dbDriverResource: DBDriverResource,
|
||||
private connectionInfo: ConnectionInfoResource,
|
||||
private connectionInfo: ConnectionInfoResource
|
||||
) {
|
||||
|
||||
this.connectionMenu = new ComputedMenuItemModel({
|
||||
id: 'connectionsDropdown',
|
||||
isDisabled: () => !this.connectionSelectorService.isConnectionChangeable,
|
||||
@@ -106,7 +104,7 @@ export class ConnectionSelectorController {
|
||||
}
|
||||
|
||||
private getConnectionItems(): IMenuItem[] {
|
||||
return Array.from(this.connectionInfo.data.values()).map((item) => {
|
||||
return Array.from(this.connectionInfo.data.values()).map(item => {
|
||||
const menuItem: IMenuItem = {
|
||||
id: item.id,
|
||||
title: item.name || item.id,
|
||||
@@ -122,7 +120,7 @@ export class ConnectionSelectorController {
|
||||
}
|
||||
return this.connectionSelectorService.objectContainerList
|
||||
.filter(item => !!item.name)
|
||||
.map((item) => {
|
||||
.map(item => {
|
||||
if (item.features?.includes(EObjectFeature.catalog)) {
|
||||
const title = NodeManagerUtils.concatSchemaAndCatalog(
|
||||
item.name,
|
||||
|
||||
@@ -18,7 +18,6 @@ export enum EMainMenu {
|
||||
|
||||
@injectable()
|
||||
export class MainMenuService {
|
||||
|
||||
readonly onConnectionClick: Observable<unknown>;
|
||||
|
||||
private menuOptions = new StaticMenu();
|
||||
|
||||
@@ -86,7 +86,7 @@ export class SettingsMenuService extends Bootstrap {
|
||||
}
|
||||
);
|
||||
|
||||
this.themeService.themes.forEach((theme) => {
|
||||
this.themeService.themes.forEach(theme => {
|
||||
this.addMenuItem(
|
||||
this.themeMenuToken,
|
||||
{
|
||||
@@ -94,7 +94,7 @@ export class SettingsMenuService extends Bootstrap {
|
||||
title: theme.name,
|
||||
isDisabled: () => theme.id === this.themeService.currentThemeId,
|
||||
onClick: () => this.themeService.changeThemeAsync(theme.id),
|
||||
},
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -116,7 +116,7 @@ export class SettingsMenuService extends Bootstrap {
|
||||
}
|
||||
);
|
||||
|
||||
config.supportedLanguages.forEach((lang) => {
|
||||
config.supportedLanguages.forEach(lang => {
|
||||
this.addMenuItem(
|
||||
this.langMenuToken,
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import { observer } from 'mobx-react';
|
||||
import {
|
||||
useState, useCallback, ChangeEvent, useRef, useEffect,
|
||||
useState, useCallback, ChangeEvent, useRef, useEffect
|
||||
} from 'react';
|
||||
import styled, { css } from 'reshadow';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import { observer } from 'mobx-react';
|
||||
import {
|
||||
useEffect, useRef, useCallback, ChangeEvent,
|
||||
useEffect, useRef, useCallback, ChangeEvent
|
||||
} from 'react';
|
||||
import styled, { use } from 'reshadow';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import {
|
||||
observable, action,
|
||||
computed, IKeyValueMap,
|
||||
computed, IKeyValueMap
|
||||
} from 'mobx';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
@@ -127,7 +127,7 @@ export class NavigationTabsService {
|
||||
}
|
||||
|
||||
@action registerTabHandler<TState>(
|
||||
options: TabHandlerOptions<TState>,
|
||||
options: TabHandlerOptions<TState>
|
||||
): TabHandler<TState> {
|
||||
const tabHandler = new TabHandler(options);
|
||||
this.handlers.set(options.key, tabHandler);
|
||||
|
||||
@@ -18,7 +18,6 @@ import { NodeManagerUtils } from './NodeManagerUtils';
|
||||
|
||||
@injectable()
|
||||
export class ConnectionDialogsService {
|
||||
|
||||
constructor(
|
||||
private mainMenuService: MainMenuService,
|
||||
private contextMenuService: ContextMenuService,
|
||||
@@ -27,7 +26,6 @@ export class ConnectionDialogsService {
|
||||
) {}
|
||||
|
||||
registerMenuItems() {
|
||||
|
||||
this.mainMenuService.registerMenuItem(
|
||||
EMainMenu.mainMenuConnectionsPanel,
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ import { NavNodeInfoResource } from './NavNodeInfoResource';
|
||||
export class DBObjectService extends CachedMapResource<string, DBObject> {
|
||||
constructor(
|
||||
private graphQLService: GraphQLService,
|
||||
private navNodeInfoResource: NavNodeInfoResource,
|
||||
private navNodeInfoResource: NavNodeInfoResource
|
||||
) {
|
||||
super(new Map());
|
||||
this.navNodeInfoResource.onDataOutdated.subscribe(key => this.markOutdated(key));
|
||||
|
||||
@@ -20,7 +20,7 @@ export class NavNodeExtensionsService {
|
||||
readonly extensions: Array<IExtension<string>>;
|
||||
|
||||
constructor(
|
||||
private navNodeManagerService: NavNodeManagerService,
|
||||
private navNodeManagerService: NavNodeManagerService
|
||||
) {
|
||||
this.extensions = [
|
||||
connectionProvider(this.getConnection.bind(this)),
|
||||
|
||||
@@ -99,7 +99,7 @@ export class NavNodeManagerService extends Bootstrap {
|
||||
private connectionAuthService: ConnectionAuthService,
|
||||
private notificationService: NotificationService,
|
||||
private sessionResource: SessionResource,
|
||||
private serverService: ServerService,
|
||||
private serverService: ServerService
|
||||
) {
|
||||
super();
|
||||
this.activeNavigationNodes = [];
|
||||
|
||||
@@ -23,7 +23,7 @@ import { NavNodeInfoResource } from './NavNodeInfoResource';
|
||||
export class NavTreeResource extends CachedMapResource<string, string[]> {
|
||||
constructor(
|
||||
private graphQLService: GraphQLService,
|
||||
private navNodeInfoResource: NavNodeInfoResource,
|
||||
private navNodeInfoResource: NavNodeInfoResource
|
||||
) {
|
||||
super(new Map());
|
||||
this.onDataOutdated.subscribe(navNodeInfoResource.markOutdated.bind(navNodeInfoResource));
|
||||
|
||||
@@ -39,6 +39,5 @@ export class SessionExpiredDialogService extends Bootstrap {
|
||||
onAction: () => location.reload(),
|
||||
}, { title: 'app_root_session_expired_title', persistent: true, type: ENotificationType.Error });
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,9 +15,8 @@ import { ITabContainerEntity, TabContainerToken } from './TabContainerToken';
|
||||
import { TabEntity } from './TabEntity';
|
||||
|
||||
export class TabContainerEntity extends Entity implements ITabContainer, ITabContainerEntity {
|
||||
|
||||
@computed get tabs(): ITab[] {
|
||||
return this.tabsOrder.map((id) => {
|
||||
return this.tabsOrder.map(id => {
|
||||
const tabEntity = this.getTabEntity(id);
|
||||
return tabEntity.getViewModel();
|
||||
});
|
||||
|
||||
@@ -8,14 +8,13 @@
|
||||
|
||||
import { ITab } from '@cloudbeaver/core-blocks';
|
||||
import {
|
||||
Entity, isConstructor, ITypedConstructor, MixinProvider,
|
||||
Entity, isConstructor, ITypedConstructor, MixinProvider
|
||||
} from '@cloudbeaver/core-di';
|
||||
|
||||
import { TabToken } from './TabToken';
|
||||
import { TabViewModel } from './TabViewModel';
|
||||
|
||||
export class TabEntity extends Entity {
|
||||
|
||||
constructor(tab: ITab | ITypedConstructor<ITab>,
|
||||
providers: Array<MixinProvider<any>> = []) {
|
||||
super(providers, isConstructor(tab) ? undefined : tab.tabId);
|
||||
|
||||
@@ -34,7 +34,6 @@ export class TabViewModel implements ITab {
|
||||
constructor(@inject(TabToken) private tabModel: ITab,
|
||||
private entity: Entity,
|
||||
@inject(TabContainerToken) private tabContainer: ITabContainerEntity) {
|
||||
|
||||
this.tabId = this.entity.id;
|
||||
this.panel = () => TabContext(tabContainer.getTabServiceInjector(this.tabId), this.tabModel.panel);
|
||||
}
|
||||
|
||||
-2
@@ -14,7 +14,6 @@ import { LogEntryDetailsDialog } from './LogEntryDetailsDialog';
|
||||
|
||||
@injectable()
|
||||
export class LogEntryController implements IInitializableController {
|
||||
|
||||
get hasDetails() {
|
||||
return Boolean(this.item.stackTrace);
|
||||
}
|
||||
@@ -29,5 +28,4 @@ export class LogEntryController implements IInitializableController {
|
||||
init(item: ILogEntry) {
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-1
@@ -30,7 +30,6 @@ const styles = css`
|
||||
|
||||
export const LogEntryDetailsDialog: DialogComponent<ILogEntry, null> = observer(
|
||||
function LogEntryDetailsDialog(props: DialogComponentProps<ILogEntry, null>) {
|
||||
|
||||
return styled(useStyles(styles))(
|
||||
<CommonDialogWrapper
|
||||
title={`${props.payload.type} ${props.payload.time}`}
|
||||
|
||||
@@ -12,7 +12,6 @@ import { LogViewerService } from './LogViewerService';
|
||||
|
||||
@injectable()
|
||||
export class LogViewTabController {
|
||||
|
||||
get isActive(): boolean {
|
||||
return this.logViewerService.isActive;
|
||||
}
|
||||
@@ -25,5 +24,4 @@ export class LogViewTabController {
|
||||
|
||||
constructor(private logViewerService: LogViewerService) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { LogViewerService } from './LogViewerService';
|
||||
|
||||
@injectable()
|
||||
export class LogViewerMenuService {
|
||||
|
||||
constructor(private mainMenuService: MainMenuService,
|
||||
private logViewerService: LogViewerService) {
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import { ILogEntry } from './ILogEntry';
|
||||
|
||||
@injectable()
|
||||
export class LogViewerService {
|
||||
|
||||
@observable _isActive = false;
|
||||
|
||||
get isActive(): boolean {
|
||||
|
||||
@@ -23,7 +23,7 @@ export class AuthInfoService {
|
||||
private graphQLService: GraphQLService,
|
||||
private notificationService: NotificationService,
|
||||
private authProviderService: AuthProviderService,
|
||||
private sessionService: SessionService,
|
||||
private sessionService: SessionService
|
||||
) { }
|
||||
|
||||
get userInfo(): UserAuthInfo | null {
|
||||
|
||||
@@ -14,9 +14,8 @@ import { AuthProvidersResource } from './AuthProvidersResource';
|
||||
|
||||
@injectable()
|
||||
export class AuthProviderService {
|
||||
|
||||
constructor(
|
||||
private providers: AuthProvidersResource,
|
||||
private providers: AuthProvidersResource
|
||||
) { }
|
||||
|
||||
async processCredentials(providerId: string, credentials: Record<string, any>) {
|
||||
|
||||
@@ -13,7 +13,7 @@ import { RolesResource } from './RolesResource';
|
||||
@injectable()
|
||||
export class RolesManagerService {
|
||||
constructor(
|
||||
readonly roles: RolesResource,
|
||||
readonly roles: RolesResource
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
isResourceKeyList,
|
||||
AdminConnectionGrantInfo
|
||||
} from '@cloudbeaver/core-sdk';
|
||||
import { MetadataMap, uuid } from '@cloudbeaver/core-utils';
|
||||
import { MetadataMap } from '@cloudbeaver/core-utils';
|
||||
|
||||
import { AuthInfoService } from './AuthInfoService';
|
||||
import { AuthProviderService } from './AuthProviderService';
|
||||
@@ -37,7 +37,7 @@ export class UsersResource extends CachedMapResource<string, AdminUserInfo> {
|
||||
constructor(
|
||||
private graphQLService: GraphQLService,
|
||||
private authProviderService: AuthProviderService,
|
||||
private authInfoService: AuthInfoService,
|
||||
private authInfoService: AuthInfoService
|
||||
) {
|
||||
super(new Map());
|
||||
this.metadata = new MetadataMap(() => false);
|
||||
|
||||
@@ -6,14 +6,12 @@
|
||||
* you may not use this file except in compliance with the License.
|
||||
*/
|
||||
|
||||
import styled, { use } from 'reshadow';
|
||||
import { css } from 'reshadow';
|
||||
import styled, { use, css } from 'reshadow';
|
||||
|
||||
import { useStyles } from '@cloudbeaver/core-theming';
|
||||
|
||||
import { baseFormControlStyles } from '../baseFormControlStyles';
|
||||
import { Checkbox } from './Checkbox';
|
||||
import { CheckboxType, CheckboxControlledProps, CheckboxObjectProps } from './Checkbox';
|
||||
import { Checkbox, CheckboxType, CheckboxControlledProps, CheckboxObjectProps } from './Checkbox';
|
||||
|
||||
const fieldCheckboxStyles = css`
|
||||
field {
|
||||
@@ -35,7 +33,6 @@ export const FieldCheckbox: CheckboxType = function FieldCheckbox({
|
||||
onChange,
|
||||
...rest
|
||||
}: CheckboxControlledProps | CheckboxObjectProps<any, any>) {
|
||||
|
||||
return styled(useStyles(baseFormControlStyles, fieldCheckboxStyles))(
|
||||
<field className={className} as="div" {...use({ long })}>
|
||||
<field-label as="div">{children}</field-label>
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
useMenuState,
|
||||
Menu,
|
||||
MenuItem,
|
||||
MenuButton,
|
||||
MenuButton
|
||||
} from 'reakit/Menu';
|
||||
import styled, { css, use } from 'reshadow';
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ export function InputGroup({
|
||||
className,
|
||||
long,
|
||||
}: Props) {
|
||||
|
||||
return styled(useStyles(baseFormControlStyles, styles))(
|
||||
<field as="div" className={className}>
|
||||
<field-label as='label' {...use({ long })}>{children}</field-label>
|
||||
|
||||
@@ -62,7 +62,6 @@ export const RadioGroup: RadioGroupType = observer(function RadioGroup({
|
||||
if (formContext) {
|
||||
formContext.onChange(value, name);
|
||||
}
|
||||
|
||||
}, [name, state, formContext, onChange]);
|
||||
|
||||
const value = state ? state[name] : controlledValue ?? selfValue;
|
||||
|
||||
@@ -18,7 +18,6 @@ export interface IconOrImageProps {
|
||||
}
|
||||
|
||||
export const IconOrImage = function IconOrImage({ icon, className, viewBox }: IconOrImageProps) {
|
||||
|
||||
const isStaticIcon = useMemo(
|
||||
() => icon && (icon.startsWith('platform:') || icon.startsWith('/')),
|
||||
[icon]
|
||||
|
||||
@@ -20,7 +20,6 @@ type ItemListProps = React.PropsWithChildren<{
|
||||
export function ItemList({
|
||||
children, className, styles,
|
||||
}: ItemListProps) {
|
||||
|
||||
return styled(useStyles(...(styles || ITEM_LIST_STYLES_ARRAY)))(
|
||||
<item-list as="div" className={className}>
|
||||
<Styles.Provider value={styles || ITEM_LIST_STYLES_ARRAY}>
|
||||
|
||||
@@ -24,12 +24,12 @@ function LoadingScreen() {
|
||||
setTimeout(() => (loadingNode as any).classList.add(styles.fadeIn));
|
||||
setTimeout(() => appContainer.removeChild(loadingNode), FADE_IN_DELAY);
|
||||
},
|
||||
[],
|
||||
[]
|
||||
);
|
||||
|
||||
return styled(styles)(
|
||||
<div ref={ref}>
|
||||
<Icon name="logo" viewBox="0 0 1755.6533 681.13202" />
|
||||
</div>,
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
useMenuState,
|
||||
Menu,
|
||||
MenuItem,
|
||||
MenuButton,
|
||||
MenuButton
|
||||
} from 'reakit/Menu';
|
||||
import styled, { css } from 'reshadow';
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
* Licensed under the Apache License, Version 2.0.
|
||||
* you may not use this file except in compliance with the License.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
|
||||
/// <reference path="react-sanitized-html.d.ts" />
|
||||
|
||||
import Sanitized from 'react-sanitized-html';
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import { SplitContext } from 'go-split';
|
||||
import {
|
||||
useCallback, useContext, useState, useEffect,
|
||||
useCallback, useContext, useState, useEffect
|
||||
} from 'react';
|
||||
import styled, { use } from 'reshadow';
|
||||
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
|
||||
import { observer } from 'mobx-react';
|
||||
import { useContext, useCallback } from 'react';
|
||||
import styled from 'reshadow';
|
||||
import { css } from 'reshadow';
|
||||
import styled, { css } from 'reshadow';
|
||||
|
||||
import { useStyles } from '@cloudbeaver/core-theming';
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ export const TableItemSeparator = observer(function TableItemSeparator({
|
||||
onClick,
|
||||
onDoubleClick,
|
||||
}: Props) {
|
||||
|
||||
return styled(useStyles())(
|
||||
<tr {...use({ noHover: true })} className={className} onClick={onClick} onDoubleClick={onDoubleClick}>
|
||||
<td colSpan={colSpan} {...use({ expandArea: true })}>
|
||||
|
||||
@@ -29,7 +29,6 @@ export const TabsBox = forwardRef<HTMLDivElement, TabsBoxProps>(function TabsBox
|
||||
className,
|
||||
style = [],
|
||||
}: TabsBoxProps, ref) {
|
||||
|
||||
return styled(useStyles(...style))(
|
||||
<TabsState currentTabId={currentTabId}>
|
||||
<tabs-box ref={ref} as="div" className={className} tabIndex={tabIndex}>
|
||||
|
||||
@@ -23,7 +23,6 @@ type VerticalTabHeaderProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'style'
|
||||
};
|
||||
|
||||
export const VerticalTabHeader = observer(function VerticalTabHeader({ tab, style, ...props }: VerticalTabHeaderProps) {
|
||||
|
||||
return styled(useStyles(verticalTabStyles, ...style))(
|
||||
<Tab
|
||||
tabId={tab.tabId}
|
||||
|
||||
@@ -24,7 +24,6 @@ type VerticalTabsProps = Omit<React.DOMAttributes<HTMLDivElement>, 'style'> & {
|
||||
};
|
||||
|
||||
export const VerticalTabs = observer(function VerticalTabs({ tabContainer, style, ...props }: VerticalTabsProps) {
|
||||
|
||||
return styled(useStyles(verticalTabStyles, ...style))(
|
||||
<TabsState currentTabId={tabContainer.currentTabId} orientation='vertical'>
|
||||
<vertical-tabs as="div" {...props}>
|
||||
|
||||
@@ -34,7 +34,7 @@ export class AppBootstrap {
|
||||
private sessionExpireService: SessionExpireService,
|
||||
private navigationTreeContextMenuService: NavigationTreeContextMenuService,
|
||||
private navigationTabsService: NavigationTabsService,
|
||||
private connectionSchemaManagerService: ConnectionSchemaManagerService,
|
||||
private connectionSchemaManagerService: ConnectionSchemaManagerService
|
||||
) { }
|
||||
|
||||
register(): void | Promise<void> {
|
||||
@@ -48,7 +48,6 @@ export class AppBootstrap {
|
||||
|
||||
async load() {
|
||||
await this.themeService.init();
|
||||
|
||||
}
|
||||
|
||||
async doAfterPluginsInit() {
|
||||
|
||||
@@ -5,7 +5,6 @@ import { showErrorPage } from './ErrorPage';
|
||||
import { renderLayout } from './renderLayout';
|
||||
|
||||
export async function bootstrap(plugins: PluginManifest[]) {
|
||||
|
||||
const app = new App(plugins);
|
||||
app.registerServices();
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
AdministrationItemService,
|
||||
ConfigurationWizardService,
|
||||
WizardTopAppBarService,
|
||||
AdministrationScreenServiceBootstrap,
|
||||
AdministrationScreenServiceBootstrap
|
||||
} from '@cloudbeaver/core-administration';
|
||||
import {
|
||||
ConnectionDialogsService,
|
||||
@@ -43,7 +43,7 @@ import {
|
||||
AuthProvidersResource,
|
||||
RolesManagerService,
|
||||
RolesResource,
|
||||
UsersResource,
|
||||
UsersResource
|
||||
} from '@cloudbeaver/core-authentication';
|
||||
import { BlocksLocaleService } from '@cloudbeaver/core-blocks';
|
||||
import {
|
||||
@@ -57,7 +57,7 @@ import {
|
||||
ConnectionsResource,
|
||||
ConnectionsLocaleService,
|
||||
DriverPropertiesService,
|
||||
ConnectionsAdministrationNavService,
|
||||
ConnectionsAdministrationNavService
|
||||
} from '@cloudbeaver/core-connections';
|
||||
import { PluginManifest } from '@cloudbeaver/core-di';
|
||||
import { CommonDialogService, ContextMenuService } from '@cloudbeaver/core-dialogs';
|
||||
|
||||
@@ -21,7 +21,7 @@ import ReactDOM from 'react-dom';
|
||||
import { Body } from '@cloudbeaver/core-app';
|
||||
import { AppContext, IServiceInjector } from '@cloudbeaver/core-di';
|
||||
|
||||
export function renderLayout(serviceInjector: IServiceInjector) {
|
||||
export function renderLayout(serviceInjector: IServiceInjector): void {
|
||||
ReactDOM.render(
|
||||
<AppContext app={serviceInjector}>
|
||||
<Body />
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ implements IInitializableController {
|
||||
|
||||
constructor(
|
||||
private usersResource: UsersResource,
|
||||
private rolesResource: RolesResource,
|
||||
private rolesResource: RolesResource
|
||||
) { }
|
||||
|
||||
init(model: IConnectionFormModel) {
|
||||
|
||||
+38
-38
@@ -178,46 +178,46 @@ export const ConnectionForm = observer(function ConnectionForm({
|
||||
{controller.isLoading
|
||||
? <Loader />
|
||||
: (
|
||||
<>
|
||||
<TabPanel tabId='options'>
|
||||
<Options
|
||||
model={model}
|
||||
type={controller.connectionType}
|
||||
disabled={controller.isDisabled}
|
||||
onTypeChange={controller.setType}
|
||||
onSave={controller.save}
|
||||
/>
|
||||
<>
|
||||
<TabPanel tabId='options'>
|
||||
<Options
|
||||
model={model}
|
||||
type={controller.connectionType}
|
||||
disabled={controller.isDisabled}
|
||||
onTypeChange={controller.setType}
|
||||
onSave={controller.save}
|
||||
/>
|
||||
</TabPanel>
|
||||
{model.connection.driverId && (
|
||||
<TabPanel tabId='driver_properties'>
|
||||
{state => (
|
||||
<DriverProperties
|
||||
driverId={model.connection.driverId}
|
||||
state={model.connection.properties}
|
||||
loadProperties={state.selectedId === 'driver_properties'}
|
||||
/>
|
||||
)}
|
||||
</TabPanel>
|
||||
{model.connection.driverId && (
|
||||
<TabPanel tabId='driver_properties'>
|
||||
{state => (
|
||||
<DriverProperties
|
||||
driverId={model.connection.driverId}
|
||||
state={model.connection.properties}
|
||||
loadProperties={state.selectedId === 'driver_properties'}
|
||||
/>
|
||||
)}
|
||||
</TabPanel>
|
||||
)}
|
||||
<TabPanel tabId='access'>
|
||||
{(state) => {
|
||||
if (state.selectedId === 'access') {
|
||||
controller.loadAccessSubjects();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
)}
|
||||
<TabPanel tabId='access'>
|
||||
{state => {
|
||||
if (state.selectedId === 'access') {
|
||||
controller.loadAccessSubjects();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<ConnectionAccess
|
||||
model={model}
|
||||
disabled={controller.isDisabled}
|
||||
onChange={controller.handleAccessChange}
|
||||
/>
|
||||
);
|
||||
}}
|
||||
</TabPanel>
|
||||
</>
|
||||
)}
|
||||
return (
|
||||
<ConnectionAccess
|
||||
model={model}
|
||||
disabled={controller.isDisabled}
|
||||
onChange={controller.handleAccessChange}
|
||||
/>
|
||||
);
|
||||
}}
|
||||
</TabPanel>
|
||||
</>
|
||||
)}
|
||||
{controller.error.responseMessage && (
|
||||
<ErrorMessage
|
||||
text={controller.error.responseMessage}
|
||||
|
||||
+2
-3
@@ -52,7 +52,7 @@ implements IInitializableController, IDestructibleController {
|
||||
private connectionsResource: ConnectionsResource,
|
||||
private notificationService: NotificationService,
|
||||
private commonDialogService: CommonDialogService,
|
||||
private dbDriverResource: DBDriverResource,
|
||||
private dbDriverResource: DBDriverResource
|
||||
) { }
|
||||
|
||||
init(
|
||||
@@ -112,7 +112,7 @@ implements IInitializableController, IDestructibleController {
|
||||
}
|
||||
};
|
||||
|
||||
handleAccessChange = () => this.accessChanged = true;
|
||||
handleAccessChange = () => { this.accessChanged = true; };
|
||||
|
||||
loadAccessSubjects = async () => {
|
||||
if (this.accessLoaded || this.isLoading) {
|
||||
@@ -122,7 +122,6 @@ implements IInitializableController, IDestructibleController {
|
||||
this.isLoading = true;
|
||||
try {
|
||||
this.model.grantedSubjects = await this.connectionsResource.loadAccessSubjects(this.model.connection.id);
|
||||
|
||||
} catch (exception) {
|
||||
this.notificationService.logException(exception, 'connections_connection_edit_access_load_failed');
|
||||
}
|
||||
|
||||
+2
-2
@@ -49,7 +49,7 @@ export class DriverPropertiesController implements IInitializableController {
|
||||
id: uuid(),
|
||||
key: key ?? 'property',
|
||||
defaultValue: value ?? '',
|
||||
new: !key
|
||||
new: !key,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -66,7 +66,7 @@ export class DriverPropertiesController implements IInitializableController {
|
||||
displayName: property.displayName,
|
||||
defaultValue: property.defaultValue,
|
||||
description: property.description,
|
||||
validValues: property.validValues
|
||||
validValues: property.validValues,
|
||||
})));
|
||||
|
||||
for (const key of Object.keys(this.state)) {
|
||||
|
||||
+1
-2
@@ -18,7 +18,6 @@ import { IConnectionFormModel } from '../IConnectionFormModel';
|
||||
@injectable()
|
||||
export class OptionsController
|
||||
implements IInitializableController {
|
||||
|
||||
@computed get drivers() {
|
||||
return Array.from(this.dbDriverResource.data.values())
|
||||
.filter(({ id }) => this.model.availableDrivers.includes(id));
|
||||
@@ -45,7 +44,7 @@ implements IInitializableController {
|
||||
constructor(
|
||||
private notificationService: NotificationService,
|
||||
private dbAuthModelsResource: DatabaseAuthModelsResource,
|
||||
private dbDriverResource: DBDriverResource,
|
||||
private dbDriverResource: DBDriverResource
|
||||
) { }
|
||||
|
||||
init(model: IConnectionFormModel) {
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ const styles = composes(
|
||||
export const ConnectionsAdministration: React.FC<AdministrationItemContentProps> = observer(function ConnectionsAdministration({
|
||||
sub,
|
||||
param,
|
||||
configurationWizard
|
||||
configurationWizard,
|
||||
}) {
|
||||
const controller = useController(ConnectionsAdministrationController);
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ import { injectable } from '@cloudbeaver/core-di';
|
||||
@injectable()
|
||||
export class ConnectionsAdministrationNavService {
|
||||
constructor(
|
||||
private administrationScreenService: AdministrationScreenService,
|
||||
private administrationScreenService: AdministrationScreenService
|
||||
) { }
|
||||
|
||||
navToRoot() {
|
||||
|
||||
+1
-2
@@ -21,13 +21,12 @@ export class ConnectionsAdministrationService extends Bootstrap {
|
||||
private administrationItemService: AdministrationItemService,
|
||||
private notificationService: NotificationService,
|
||||
private connectionsResource: ConnectionsResource,
|
||||
private dbDriverResource: DBDriverResource,
|
||||
private dbDriverResource: DBDriverResource
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
register() {
|
||||
|
||||
this.administrationItemService.create({
|
||||
name: 'connections',
|
||||
type: AdministrationItemType.Default,
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ implements IInitializableController, IDestructibleController {
|
||||
constructor(
|
||||
private connectionsResource: ConnectionsResource,
|
||||
private notificationService: NotificationService,
|
||||
private dbDriverResource: DBDriverResource,
|
||||
private dbDriverResource: DBDriverResource
|
||||
) { }
|
||||
|
||||
init(id: string) {
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ export class CreateConnectionController {
|
||||
constructor(
|
||||
private notificationService: NotificationService,
|
||||
private connectionsResource: ConnectionsResource,
|
||||
private dbDriverResource: DBDriverResource,
|
||||
private dbDriverResource: DBDriverResource
|
||||
) {
|
||||
this.credentials = {};
|
||||
this.databases = [];
|
||||
|
||||
-1
@@ -31,7 +31,6 @@ export const SearchDatabase = observer(function SearchDatabase({
|
||||
onSearch,
|
||||
className,
|
||||
}: Props) {
|
||||
|
||||
return (
|
||||
<DatabaseList
|
||||
databases={databases}
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
isResourceKeyList,
|
||||
AdminConnectionGrantInfo,
|
||||
AdminConnectionSearchInfo,
|
||||
ObjectPropertyInfo,
|
||||
ObjectPropertyInfo
|
||||
} from '@cloudbeaver/core-sdk';
|
||||
import { uuid, MetadataMap } from '@cloudbeaver/core-utils';
|
||||
|
||||
@@ -36,7 +36,7 @@ export class ConnectionsResource extends CachedMapResource<string, ConnectionInf
|
||||
private connectionCreateSubject: Subject<ConnectionInfo>;
|
||||
|
||||
constructor(
|
||||
private graphQLService: GraphQLService,
|
||||
private graphQLService: GraphQLService
|
||||
) {
|
||||
super(new Map());
|
||||
this.connectionCreateSubject = new Subject<ConnectionInfo>();
|
||||
|
||||
@@ -14,10 +14,9 @@ import { DatabaseAuthDialog } from './DatabaseAuthDialog/DatabaseAuthDialog';
|
||||
|
||||
@injectable()
|
||||
export class ConnectionAuthService {
|
||||
|
||||
constructor(
|
||||
private connectionInfoResource: ConnectionInfoResource,
|
||||
private commonDialogService: CommonDialogService,
|
||||
private commonDialogService: CommonDialogService
|
||||
) {}
|
||||
|
||||
async auth(connectionId: string) {
|
||||
|
||||
@@ -10,7 +10,7 @@ import { injectable } from '@cloudbeaver/core-di';
|
||||
import {
|
||||
GraphQLService,
|
||||
CachedDataResource,
|
||||
DatabaseObjectInfo,
|
||||
DatabaseObjectInfo
|
||||
} from '@cloudbeaver/core-sdk';
|
||||
|
||||
export type ObjectContainer = Pick<DatabaseObjectInfo, 'name' | 'description' | 'type' | 'features'>;
|
||||
|
||||
@@ -10,7 +10,7 @@ import { injectable } from '@cloudbeaver/core-di';
|
||||
import {
|
||||
GraphQLService,
|
||||
CachedMapResource,
|
||||
DriverInfo,
|
||||
DriverInfo
|
||||
} from '@cloudbeaver/core-sdk';
|
||||
import { MetadataMap } from '@cloudbeaver/core-utils';
|
||||
|
||||
@@ -54,7 +54,6 @@ export class DBDriverResource extends CachedMapResource<string, DBDriver> {
|
||||
}
|
||||
|
||||
compare(driverA: DBDriver, driverB: DBDriver): number {
|
||||
|
||||
if (driverA.promotedScore === driverB.promotedScore) {
|
||||
return (driverA.name || '').localeCompare((driverB.name || ''));
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ export class DBAuthDialogController implements IInitializableController, IDestru
|
||||
private notificationService: NotificationService,
|
||||
private connectionInfoResource: ConnectionInfoResource,
|
||||
private commonDialogService: CommonDialogService,
|
||||
private dbDriverResource: DBDriverResource,
|
||||
private dbDriverResource: DBDriverResource
|
||||
) { }
|
||||
|
||||
init(connectionId: string, onClose: () => void) {
|
||||
|
||||
@@ -81,15 +81,15 @@ export const DatabaseAuthDialog = observer(function DatabaseAuthDialog({
|
||||
{(!connection.isLoaded() || connection.isLoading())
|
||||
? <Loader />
|
||||
: (
|
||||
<SubmittingForm ref={focusedRef} onSubmit={controller.login}>
|
||||
<ObjectPropertyInfoForm
|
||||
autofillToken={`section-${connection.connectionInfo?.id || ''} section-auth`}
|
||||
properties={connection.connectionInfo?.authProperties}
|
||||
credentials={controller.credentials}
|
||||
disabled={controller.isAuthenticating}
|
||||
/>
|
||||
</SubmittingForm>
|
||||
)}
|
||||
<SubmittingForm ref={focusedRef} onSubmit={controller.login}>
|
||||
<ObjectPropertyInfoForm
|
||||
autofillToken={`section-${connection.connectionInfo?.id || ''} section-auth`}
|
||||
properties={connection.connectionInfo?.authProperties}
|
||||
credentials={controller.credentials}
|
||||
disabled={controller.isAuthenticating}
|
||||
/>
|
||||
</SubmittingForm>
|
||||
)}
|
||||
{controller.error.responseMessage && (
|
||||
<ErrorMessage
|
||||
text={controller.error.responseMessage}
|
||||
|
||||
@@ -11,9 +11,8 @@ import { GraphQLService, ObjectPropertyInfo } from '@cloudbeaver/core-sdk';
|
||||
|
||||
@injectable()
|
||||
export class DriverPropertiesService {
|
||||
|
||||
constructor(
|
||||
private graphQLService: GraphQLService,
|
||||
private graphQLService: GraphQLService
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ export class App {
|
||||
plugin.registerServices(this.getServiceCollection());
|
||||
}
|
||||
if (plugin.providers?.length) {
|
||||
plugin.providers.forEach((provider) => {
|
||||
plugin.providers.forEach(provider => {
|
||||
// console.log('provider', provider.name);
|
||||
this.diWrapper.collection.addServiceByClass(provider);
|
||||
});
|
||||
|
||||
@@ -21,7 +21,6 @@ export type InjectionToken<T> = ITypedConstructor<T> | ValueToken<T>;
|
||||
export function createValueToken<T extends Record<string, any>>(
|
||||
obj: string | ITypedConstructor<T> | T
|
||||
): ValueToken<T> {
|
||||
|
||||
// just fake function to keep type T
|
||||
const token = () => null as unknown as T;
|
||||
const name = getName(obj);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import {
|
||||
IServiceConstructor, IServiceCollection, IServiceInjector,
|
||||
IServiceConstructor, IServiceCollection, IServiceInjector
|
||||
} from './IApp';
|
||||
|
||||
export interface PluginManifest {
|
||||
|
||||
@@ -82,7 +82,7 @@ export class Entity {
|
||||
* Destroy mixins in the reverse order of addition
|
||||
*/
|
||||
destroyEntity() {
|
||||
this.mixins.reverse().forEach((token) => {
|
||||
this.mixins.reverse().forEach(token => {
|
||||
const mixin = this.getMixin(token) as IDestroyableMixin;
|
||||
if (mixin.destruct) {
|
||||
mixin.destruct();
|
||||
@@ -91,7 +91,7 @@ export class Entity {
|
||||
}
|
||||
|
||||
protected addProviders(providers: Array<MixinProvider<any>>) {
|
||||
providers.forEach((provider) => {
|
||||
providers.forEach(provider => {
|
||||
if (typeof provider === 'function') {
|
||||
this.addMixin(provider);
|
||||
} else {
|
||||
@@ -114,7 +114,6 @@ export class Entity {
|
||||
getMixin<T>(token: InjectionToken<T>): T {
|
||||
return this.container.getServiceByToken<T>(token);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export type MixinProvider<T extends Record<string, any>> = ITypedConstructor<T> | {
|
||||
|
||||
@@ -14,7 +14,6 @@ import { Entity } from './Entity';
|
||||
* Method 'register' will be added during app bootstrap when root container is created
|
||||
*/
|
||||
export class RootContainerService {
|
||||
|
||||
private readonly register: (container: DIContainer) => void;
|
||||
|
||||
constructor(register: (container: DIContainer) => void) {
|
||||
@@ -26,5 +25,4 @@ export class RootContainerService {
|
||||
// eslint-disable-next-line dot-notation
|
||||
this.register(entity['container']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
*/
|
||||
|
||||
import {
|
||||
useContext, useEffect, useRef, useMemo,
|
||||
useContext, useEffect, useRef, useMemo
|
||||
} from 'react';
|
||||
|
||||
import { appContext } from './AppContext';
|
||||
import {
|
||||
IServiceConstructor, IInitializableController, IDestructibleController, ExtractInitArgs,
|
||||
IServiceConstructor, IInitializableController, IDestructibleController, ExtractInitArgs
|
||||
} from './IApp';
|
||||
|
||||
export function useController<T extends IInitializableController>(
|
||||
|
||||
@@ -36,7 +36,6 @@ export const CommonDialogWrapper: React.FC<CommonDialogWrapperProps> = function
|
||||
onReject,
|
||||
children,
|
||||
}) {
|
||||
|
||||
return styled(useStyles(commonDialogStyle))(
|
||||
<dialog className={className}>
|
||||
<header>
|
||||
|
||||
@@ -39,7 +39,7 @@ export class CommonDialogService {
|
||||
async open<TPayload, TResult>(
|
||||
component: DialogComponent<TPayload, TResult>,
|
||||
payload: TPayload,
|
||||
options?: DialogOptions,
|
||||
options?: DialogOptions
|
||||
): Promise<TResult | null> {
|
||||
return new Promise<TResult>((resolve, reject) => {
|
||||
const dialogInternal: DialogInternal = {
|
||||
|
||||
@@ -11,7 +11,7 @@ import { useCallback, useRef } from 'react';
|
||||
import {
|
||||
Dialog,
|
||||
DialogBackdrop,
|
||||
useDialogState,
|
||||
useDialogState
|
||||
} from 'reakit/Dialog';
|
||||
import styled from 'reshadow';
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ export class ContextMenu {
|
||||
params: IContextMenuItem<T>,
|
||||
context: IMenuContext<T>
|
||||
): ComputedMenuItemModel {
|
||||
|
||||
// depends on context
|
||||
const modelOptions = new ComputedMenuItemOptionsWithContext(params, context);
|
||||
const model = new ComputedMenuItemModel(modelOptions);
|
||||
@@ -60,20 +59,17 @@ export class ContextMenu {
|
||||
panelId: string,
|
||||
context: IMenuContext<T>
|
||||
): IMenuPanel {
|
||||
|
||||
const panel = this.menuStore.getPanel(panelId);
|
||||
return new ContextMenuPanel(
|
||||
`${panelId}-${context.contextId!}-panel`,
|
||||
() => this.constructMenuItems(panel.menuItems.values, context)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
private constructMenuItems<T>(
|
||||
menuItems: Array<IContextMenuItem<any>>,
|
||||
context: IMenuContext<T>
|
||||
): ComputedMenuItemModel[] {
|
||||
|
||||
return menuItems
|
||||
.filter(item => item.isPresent(context)) // show menu items based on context
|
||||
.map(item => this.constructMenuItemWithContext(item, context));
|
||||
@@ -118,7 +114,6 @@ class ComputedMenuItemOptionsWithContext<T> implements IComputedMenuItemOptions
|
||||
}
|
||||
|
||||
class ContextMenuPanel implements IMenuPanel {
|
||||
|
||||
get menuItems() {
|
||||
if (!this.items) {
|
||||
this.items = this.itemsGetter();
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
} from 'react';
|
||||
import {
|
||||
MenuButton,
|
||||
Menu, MenuItem, MenuStateReturn, useMenuState,
|
||||
Menu, MenuItem, MenuStateReturn, useMenuState
|
||||
} from 'reakit/Menu';
|
||||
import styled, { use } from 'reshadow';
|
||||
|
||||
@@ -64,7 +64,6 @@ const MenuPanel = observer(function MenuPanel({
|
||||
menu,
|
||||
style = [],
|
||||
}: MenuPanelProps) {
|
||||
|
||||
return styled(useStyles(menuPanelStyles, ...style))(
|
||||
<Menu {...menu} aria-label={panel.id}>
|
||||
{menu.visible && panel.menuItems.map(item => (
|
||||
@@ -138,7 +137,6 @@ export const MenuInnerTrigger = forwardRef(function MenuInnerTrigger(
|
||||
props: MenuInnerTriggerProps,
|
||||
ref: Ref<HTMLButtonElement>
|
||||
) {
|
||||
|
||||
const {
|
||||
menuItem, style = [], ...rest
|
||||
} = props;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import { IMenuPanel } from '../IMenuPanel';
|
||||
import {
|
||||
ComputedMenuItemModel, IComputedMenuItemOptions,
|
||||
ComputedMenuItemModel, IComputedMenuItemOptions
|
||||
} from '../models/ComputedMenuItemModel';
|
||||
import { ComputedMenuPanelModel } from '../models/ComputedMenuPanelModel';
|
||||
import { MenuOptionsStore } from '../models/MenuOptionsStore';
|
||||
|
||||
@@ -16,7 +16,6 @@ export interface IComputedMenuPanelOptions {
|
||||
}
|
||||
|
||||
export class ComputedMenuPanelModel implements IMenuPanel {
|
||||
|
||||
id: string;
|
||||
|
||||
@computed get menuItems() {
|
||||
|
||||
@@ -19,7 +19,6 @@ export type EventsSettings = typeof defaultSettings;
|
||||
|
||||
@injectable()
|
||||
export class EventsSettingsService {
|
||||
|
||||
readonly settings = this.pluginManagerService.getPluginSettings('core_events', defaultSettings);
|
||||
|
||||
constructor(private pluginManagerService: PluginManagerService) { }
|
||||
|
||||
@@ -26,7 +26,7 @@ export class NotificationService {
|
||||
}
|
||||
|
||||
constructor(
|
||||
private settings: EventsSettingsService,
|
||||
private settings: EventsSettingsService
|
||||
) {}
|
||||
|
||||
notify<TProps extends INotificationExtraProps<any> = INotificationExtraProps>(
|
||||
|
||||
@@ -18,7 +18,7 @@ export function createExtension<T>(
|
||||
|
||||
export function isExtension<T>(
|
||||
obj: Record<any, any> | IExtension<T>,
|
||||
key?: symbol,
|
||||
key?: symbol
|
||||
): obj is IExtension<T> {
|
||||
if (!(EXTENSION_SYMBOL in obj)) {
|
||||
return false;
|
||||
|
||||
+1
-3
@@ -19,7 +19,6 @@ export interface IErrorModelOptions {
|
||||
}
|
||||
|
||||
export class ErrorModel {
|
||||
|
||||
reason: string;
|
||||
errors: IErrorInfo[] = [];
|
||||
textToCopy = '';
|
||||
@@ -32,7 +31,7 @@ export class ErrorModel {
|
||||
this.textToCopy = this.reason;
|
||||
} else if (error instanceof GQLError) { // GQL Error
|
||||
this.errors = (error.response?.errors || [])
|
||||
.map((error) => {
|
||||
.map(error => {
|
||||
const errorInfo: IErrorInfo = {
|
||||
message: error.message,
|
||||
stackTrace: error.extensions?.stackTrace || '',
|
||||
@@ -49,7 +48,6 @@ export class ErrorModel {
|
||||
if (error.isTextBody) {
|
||||
this.htmlBody = error.errorText;
|
||||
}
|
||||
|
||||
} else if (error instanceof ServerInternalError) {
|
||||
this.errors = [
|
||||
{
|
||||
|
||||
@@ -13,7 +13,6 @@ import { PluginSettings } from './PluginSettings';
|
||||
|
||||
@injectable()
|
||||
export class PluginManagerService {
|
||||
|
||||
constructor(private productManagerService: ProductManagerService) { }
|
||||
|
||||
getPluginSettings<T>(scope: string, defaults: T) {
|
||||
|
||||
@@ -19,7 +19,7 @@ export class PermissionsResource extends CachedDataResource<Set<string>, null> {
|
||||
|
||||
constructor(
|
||||
private graphQLService: GraphQLService,
|
||||
private sessionResource: SessionResource,
|
||||
private sessionResource: SessionResource
|
||||
) {
|
||||
super(new Set());
|
||||
this.loaded = false;
|
||||
|
||||
@@ -23,7 +23,7 @@ export class PermissionsService {
|
||||
}
|
||||
|
||||
constructor(
|
||||
private permissions: PermissionsResource,
|
||||
private permissions: PermissionsResource
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import { GraphQLService, CachedDataResource, ServerConfig } from '@cloudbeaver/c
|
||||
export class ServerConfigResource extends CachedDataResource<ServerConfig | null, null> {
|
||||
@observable private loaded: boolean;
|
||||
constructor(
|
||||
private graphQLService: GraphQLService,
|
||||
private graphQLService: GraphQLService
|
||||
) {
|
||||
super(null);
|
||||
this.loaded = false;
|
||||
|
||||
@@ -20,9 +20,8 @@ export class ServerService {
|
||||
private lastConfig: any = null;
|
||||
constructor(
|
||||
readonly config: ServerConfigResource,
|
||||
private sessionService: SessionService,
|
||||
private sessionService: SessionService
|
||||
) {
|
||||
|
||||
this.config.onDataUpdate.subscribe(this.refreshConfigAsync.bind(this));
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ export class SessionExpireService {
|
||||
|
||||
onSessionExpire = new Subject();
|
||||
constructor(
|
||||
private graphQLService: GraphQLService,
|
||||
private graphQLService: GraphQLService
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ export class SessionResource extends CachedDataResource<SessionState | null, nul
|
||||
|
||||
constructor(
|
||||
private graphQLService: GraphQLService,
|
||||
private serverConfiguration: ServerConfigResource,
|
||||
private serverConfiguration: ServerConfigResource
|
||||
) {
|
||||
super(null);
|
||||
this.serverConfiguration.onDataOutdated.subscribe(this.markOutdated.bind(this));
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user