ydb-embedded-ui 4.10.0 → 4.11.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +30 -0
- package/dist/components/InfoViewer/formatters/schema.ts +3 -1
- package/dist/components/QueryResultTable/Cell/Cell.tsx +8 -8
- package/dist/components/QueryResultTable/i18n/en.json +1 -1
- package/dist/components/QueryResultTable/i18n/ru.json +1 -1
- package/dist/components/ShortyString/ShortyString.tsx +3 -6
- package/dist/components/ShortyString/i18n/en.json +8 -8
- package/dist/components/ShortyString/i18n/ru.json +8 -8
- package/dist/components/SpeedMultiMeter/i18n/index.ts +0 -2
- package/dist/components/Stack/Stack.tsx +16 -16
- package/dist/components/TableSkeleton/TableSkeleton.tsx +3 -3
- package/dist/components/TableWithControlsLayout/TableWithControlsLayout.scss +32 -0
- package/dist/components/TableWithControlsLayout/TableWithControlsLayout.tsx +43 -0
- package/dist/containers/AsideNavigation/AsideNavigation.tsx +2 -2
- package/dist/containers/Cluster/Cluster.scss +4 -5
- package/dist/containers/Cluster/Cluster.tsx +3 -22
- package/dist/containers/Cluster/ClusterInfo/ClusterInfo.scss +4 -0
- package/dist/containers/Cluster/ClusterInfo/ClusterInfo.tsx +14 -3
- package/dist/containers/Cluster/ClusterInfoSkeleton/ClusterInfoSkeleton.tsx +1 -1
- package/dist/containers/Cluster/utils.tsx +0 -11
- package/dist/containers/Header/Header.scss +1 -5
- package/dist/containers/Header/Header.tsx +2 -2
- package/dist/containers/Header/breadcrumbs.ts +2 -1
- package/dist/containers/Heatmap/Heatmap.tsx +4 -3
- package/dist/containers/Node/NodeStructure/PDiskTitleBadge.tsx +2 -8
- package/dist/containers/Nodes/Nodes.scss +1 -24
- package/dist/containers/Nodes/Nodes.tsx +29 -39
- package/dist/containers/Storage/EmptyFilter/i18n/en.json +2 -2
- package/dist/containers/Storage/EmptyFilter/i18n/ru.json +2 -2
- package/dist/containers/Storage/Storage.scss +1 -14
- package/dist/containers/Storage/Storage.tsx +15 -18
- package/dist/containers/Storage/StorageGroups/i18n/en.json +5 -5
- package/dist/containers/Storage/StorageGroups/i18n/ru.json +5 -5
- package/dist/containers/Storage/StorageTypeFilter/StorageTypeFilter.tsx +3 -1
- package/dist/containers/Storage/{StorageVisibleEntityFilter/StorageVisibleEntityFilter.tsx → StorageVisibleEntitiesFilter/StorageVisibleEntitiesFilter.tsx} +4 -2
- package/dist/containers/Storage/UsageFilter/i18n/en.json +3 -8
- package/dist/containers/Storage/UsageFilter/i18n/ru.json +3 -8
- package/dist/containers/Tablet/Tablet.tsx +2 -2
- package/dist/containers/Tenant/Acl/Acl.scss +1 -9
- package/dist/containers/Tenant/Acl/Acl.tsx +137 -0
- package/dist/containers/Tenant/Diagnostics/Describe/Describe.tsx +2 -2
- package/dist/containers/Tenant/Diagnostics/Diagnostics.scss +6 -2
- package/dist/containers/Tenant/Diagnostics/DiagnosticsPages.ts +6 -0
- package/dist/containers/Tenant/Diagnostics/HotKeys/HotKeys.js +3 -3
- package/dist/containers/Tenant/Diagnostics/Overview/Overview.tsx +2 -0
- package/dist/containers/Tenant/Diagnostics/Overview/utils/prepareTopicSchemaInfo.ts +2 -3
- package/dist/containers/Tenant/ObjectSummary/ObjectSummary.scss +3 -18
- package/dist/containers/Tenant/ObjectSummary/ObjectSummary.tsx +95 -88
- package/dist/containers/Tenant/Query/Issues/Issues.tsx +27 -23
- package/dist/containers/Tenant/Query/Issues/models.ts +0 -11
- package/dist/containers/Tenant/Query/Preview/Preview.tsx +3 -3
- package/dist/containers/Tenant/Query/i18n/en.json +1 -1
- package/dist/containers/Tenant/Query/i18n/ru.json +1 -1
- package/dist/containers/Tenant/Schema/SchemaTree/SchemaTree.tsx +2 -2
- package/dist/containers/Tenant/Schema/SchemaViewer/SchemaViewer.tsx +99 -0
- package/dist/containers/Tenant/Tenant.tsx +1 -5
- package/dist/containers/Tenant/TenantPages.tsx +9 -14
- package/dist/containers/Tenant/i18n/en.json +11 -0
- package/dist/containers/Tenant/i18n/index.ts +11 -0
- package/dist/containers/Tenant/i18n/ru.json +11 -0
- package/dist/containers/Tenant/utils/schema.ts +24 -0
- package/dist/containers/Tenant/utils/schemaActions.ts +28 -24
- package/dist/containers/Tenants/Tenants.scss +1 -13
- package/dist/containers/Tenants/Tenants.tsx +18 -28
- package/dist/services/api.ts +6 -7
- package/dist/store/index.js +1 -1
- package/dist/store/reducers/nodes/nodes.ts +12 -111
- package/dist/store/reducers/nodes/selectors.ts +74 -0
- package/dist/store/reducers/nodes/types.ts +22 -3
- package/dist/store/reducers/nodes/utils.ts +59 -0
- package/dist/store/reducers/preview.ts +6 -4
- package/dist/store/reducers/schemaAcl/schemaAcl.ts +17 -0
- package/dist/store/reducers/schemaAcl/types.ts +9 -7
- package/dist/store/reducers/storage/selectors.ts +1 -1
- package/dist/store/reducers/tenant/constants.ts +6 -0
- package/dist/store/reducers/tenant/tenant.ts +15 -0
- package/dist/store/reducers/tenant/types.ts +18 -3
- package/dist/store/state-url-mapping.js +3 -0
- package/dist/types/api/cluster.ts +1 -1
- package/dist/types/api/compute.ts +27 -2
- package/dist/types/api/error.ts +2 -2
- package/dist/types/api/netInfo.ts +3 -3
- package/dist/types/api/nodes.ts +13 -1
- package/dist/types/api/query.ts +1 -1
- package/dist/types/api/schema/cdcStream.ts +32 -0
- package/dist/types/api/schema/columnEntity.ts +138 -0
- package/dist/types/api/schema/externalDataSource.ts +24 -0
- package/dist/types/api/schema/externalTable.ts +14 -0
- package/dist/types/api/schema/index.ts +10 -0
- package/dist/types/api/schema/persQueueGroup.ts +191 -0
- package/dist/types/api/schema/schema.ts +302 -0
- package/dist/types/api/schema/shared.ts +42 -0
- package/dist/types/api/schema/table.ts +616 -0
- package/dist/types/api/schema/tableIndex.ts +33 -0
- package/dist/types/api/storage.ts +1 -1
- package/dist/types/assets.d.ts +1 -2
- package/dist/types/store/executeQuery.ts +2 -3
- package/dist/types/store/executeTopQueries.ts +8 -5
- package/dist/types/store/explainQuery.ts +4 -4
- package/dist/types/store/query.ts +4 -3
- package/dist/types/store/shardsWorkload.ts +8 -5
- package/dist/utils/constants.ts +4 -1
- package/dist/utils/error.ts +2 -3
- package/dist/utils/query.ts +3 -9
- package/dist/utils/tests/providers.tsx +6 -9
- package/package.json +6 -2
- package/dist/assets/icons/versions.svg +0 -3
- package/dist/containers/Tenant/Acl/Acl.js +0 -153
- package/dist/containers/Tenant/Schema/SchemaViewer/SchemaViewer.js +0 -94
- package/dist/types/api/schema.ts +0 -1326
@@ -9,9 +9,8 @@ import {
|
|
9
9
|
MONACO_HOT_KEY_ACTIONS,
|
10
10
|
} from '../../store/reducers/executeQuery';
|
11
11
|
import type {ApiRequestAction} from '../../store/utils';
|
12
|
-
import type {ErrorResponse} from '../api/query';
|
13
12
|
import type {ValueOf} from '../common';
|
14
|
-
import type {IQueryResult, QueryError} from './query';
|
13
|
+
import type {IQueryResult, QueryError, QueryErrorResponse} from './query';
|
15
14
|
|
16
15
|
export type MonacoHotKeyAction = ValueOf<typeof MONACO_HOT_KEY_ACTIONS>;
|
17
16
|
|
@@ -26,7 +25,7 @@ export interface ExecuteQueryState {
|
|
26
25
|
tenantPath?: string;
|
27
26
|
data?: IQueryResult;
|
28
27
|
stats?: IQueryResult['stats'];
|
29
|
-
error?: string |
|
28
|
+
error?: string | QueryErrorResponse;
|
30
29
|
}
|
31
30
|
|
32
31
|
type SendQueryAction = ApiRequestAction<typeof SEND_QUERY, IQueryResult, QueryError>;
|
@@ -1,7 +1,10 @@
|
|
1
|
-
import {
|
1
|
+
import {
|
2
|
+
FETCH_TOP_QUERIES,
|
3
|
+
setTopQueriesState,
|
4
|
+
setTopQueriesFilters,
|
5
|
+
} from '../../store/reducers/executeTopQueries';
|
2
6
|
import type {ApiRequestAction} from '../../store/utils';
|
3
|
-
import type {
|
4
|
-
import type {IQueryResult} from './query';
|
7
|
+
import type {IQueryResult, QueryErrorResponse} from './query';
|
5
8
|
|
6
9
|
export interface ITopQueriesFilters {
|
7
10
|
/** ms from epoch */
|
@@ -15,12 +18,12 @@ export interface ITopQueriesState {
|
|
15
18
|
loading: boolean;
|
16
19
|
wasLoaded: boolean;
|
17
20
|
data?: IQueryResult;
|
18
|
-
error?:
|
21
|
+
error?: QueryErrorResponse;
|
19
22
|
filters: ITopQueriesFilters;
|
20
23
|
}
|
21
24
|
|
22
25
|
export type ITopQueriesAction =
|
23
|
-
| ApiRequestAction<typeof FETCH_TOP_QUERIES, IQueryResult,
|
26
|
+
| ApiRequestAction<typeof FETCH_TOP_QUERIES, IQueryResult, QueryErrorResponse>
|
24
27
|
| ReturnType<typeof setTopQueriesState>
|
25
28
|
| ReturnType<typeof setTopQueriesFilters>;
|
26
29
|
|
@@ -2,8 +2,8 @@ import type {ExplainPlanNodeData, GraphNode, Link} from '@gravity-ui/paranoid';
|
|
2
2
|
|
3
3
|
import {GET_EXPLAIN_QUERY, GET_EXPLAIN_QUERY_AST} from '../../store/reducers/explainQuery';
|
4
4
|
import type {ApiRequestAction} from '../../store/utils';
|
5
|
-
import type {PlanTable,
|
6
|
-
import type {IQueryResult, QueryError} from './query';
|
5
|
+
import type {PlanTable, QueryPlan, ScriptPlan} from '../api/query';
|
6
|
+
import type {IQueryResult, QueryError, QueryErrorResponse} from './query';
|
7
7
|
|
8
8
|
export interface PreparedExplainResponse {
|
9
9
|
plan?: {
|
@@ -20,8 +20,8 @@ export interface ExplainQueryState {
|
|
20
20
|
loading: boolean;
|
21
21
|
data?: PreparedExplainResponse['plan'];
|
22
22
|
dataAst?: PreparedExplainResponse['ast'];
|
23
|
-
error?: string |
|
24
|
-
errorAst?: string |
|
23
|
+
error?: string | QueryErrorResponse;
|
24
|
+
errorAst?: string | QueryErrorResponse;
|
25
25
|
}
|
26
26
|
|
27
27
|
type GetExplainQueryAstAction = ApiRequestAction<
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import {QUERY_ACTIONS, QUERY_MODES} from '../../utils/query';
|
2
2
|
|
3
|
-
import type {NetworkError} from '../api/error';
|
3
|
+
import type {IResponseError, NetworkError} from '../api/error';
|
4
4
|
import type {
|
5
5
|
KeyValueRow,
|
6
6
|
ColumnType,
|
7
|
-
ErrorResponse,
|
7
|
+
ErrorResponse as QueryErrorResponseData,
|
8
8
|
ScriptPlan,
|
9
9
|
QueryPlan,
|
10
10
|
TKqpStatsQuery,
|
@@ -24,7 +24,8 @@ export interface QueryRequestParams {
|
|
24
24
|
query: string;
|
25
25
|
}
|
26
26
|
|
27
|
-
export type
|
27
|
+
export type QueryErrorResponse = IResponseError<QueryErrorResponseData>;
|
28
|
+
export type QueryError = NetworkError | QueryErrorResponse;
|
28
29
|
|
29
30
|
export type QueryAction = ValueOf<typeof QUERY_ACTIONS>;
|
30
31
|
export type QueryMode = ValueOf<typeof QUERY_MODES>;
|
@@ -1,7 +1,10 @@
|
|
1
|
-
import {
|
1
|
+
import {
|
2
|
+
SEND_SHARD_QUERY,
|
3
|
+
setShardsState,
|
4
|
+
setShardsQueryFilters,
|
5
|
+
} from '../../store/reducers/shardsWorkload';
|
2
6
|
import type {ApiRequestAction} from '../../store/utils';
|
3
|
-
import type {
|
4
|
-
import type {IQueryResult} from './query';
|
7
|
+
import type {IQueryResult, QueryErrorResponse} from './query';
|
5
8
|
|
6
9
|
export enum EShardsWorkloadMode {
|
7
10
|
Immediate = 'immediate',
|
@@ -20,12 +23,12 @@ export interface IShardsWorkloadState {
|
|
20
23
|
loading: boolean;
|
21
24
|
wasLoaded: boolean;
|
22
25
|
data?: IQueryResult;
|
23
|
-
error?:
|
26
|
+
error?: QueryErrorResponse;
|
24
27
|
filters: IShardsWorkloadFilters;
|
25
28
|
}
|
26
29
|
|
27
30
|
export type IShardsWorkloadAction =
|
28
|
-
| ApiRequestAction<typeof SEND_SHARD_QUERY, IQueryResult,
|
31
|
+
| ApiRequestAction<typeof SEND_SHARD_QUERY, IQueryResult, QueryErrorResponse>
|
29
32
|
| ReturnType<typeof setShardsState>
|
30
33
|
| ReturnType<typeof setShardsQueryFilters>;
|
31
34
|
|
package/dist/utils/constants.ts
CHANGED
@@ -75,8 +75,11 @@ export const COLORS_PRIORITY = {
|
|
75
75
|
grey: 1,
|
76
76
|
};
|
77
77
|
|
78
|
-
|
78
|
+
// ==== Titles ====
|
79
|
+
export const DEVELOPER_UI_TITLE = 'Developer UI';
|
80
|
+
export const CLUSTER_DEFAULT_TITLE = 'Cluster';
|
79
81
|
|
82
|
+
// ==== Settings ====
|
80
83
|
export const THEME_KEY = 'theme';
|
81
84
|
export const INVERTED_DISKS_KEY = 'invertedDisks';
|
82
85
|
export const USE_NODES_ENDPOINT_IN_DIAGNOSTICS_KEY = 'useNodesEndpointInDiagnostics';
|
package/dist/utils/error.ts
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
import type {AxiosError} from 'axios';
|
2
2
|
|
3
3
|
import type {IResponseError, NetworkError} from '../types/api/error';
|
4
|
-
import type {
|
5
|
-
import type {QueryError} from '../types/store/query';
|
4
|
+
import type {QueryError, QueryErrorResponse} from '../types/store/query';
|
6
5
|
|
7
|
-
type RequestError = NetworkError | IResponseError | AxiosError |
|
6
|
+
type RequestError = NetworkError | IResponseError | AxiosError | unknown;
|
8
7
|
|
9
8
|
const isNetworkError = (error: RequestError): error is NetworkError => {
|
10
9
|
return Boolean(
|
package/dist/utils/query.ts
CHANGED
@@ -7,7 +7,7 @@ import type {
|
|
7
7
|
QueryPlan,
|
8
8
|
ScriptPlan,
|
9
9
|
} from '../types/api/query';
|
10
|
-
import type {IQueryResult} from '../types/store/query';
|
10
|
+
import type {IQueryResult, QueryErrorResponse} from '../types/store/query';
|
11
11
|
|
12
12
|
export const QUERY_ACTIONS = {
|
13
13
|
execute: 'execute',
|
@@ -169,12 +169,6 @@ export const prepareQueryResponse = (data?: KeyValueRow[]) => {
|
|
169
169
|
});
|
170
170
|
};
|
171
171
|
|
172
|
-
export function prepareQueryError(error:
|
173
|
-
return
|
174
|
-
error.data?.error?.message ||
|
175
|
-
error.message ||
|
176
|
-
error.data ||
|
177
|
-
error.statusText ||
|
178
|
-
JSON.stringify(error)
|
179
|
-
);
|
172
|
+
export function prepareQueryError(error: QueryErrorResponse) {
|
173
|
+
return error.data?.error?.message || error.statusText;
|
180
174
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, {PropsWithChildren} from 'react';
|
2
|
-
import {Provider} from 'react-redux'
|
3
|
-
import {render} from '@testing-library/react'
|
4
|
-
import type {RenderOptions} from '@testing-library/react'
|
2
|
+
import {Provider} from 'react-redux';
|
3
|
+
import {render} from '@testing-library/react';
|
4
|
+
import type {RenderOptions} from '@testing-library/react';
|
5
5
|
|
6
6
|
import configureStore from '../../store';
|
7
7
|
|
@@ -14,16 +14,13 @@ interface ExtendedRenderOptions extends Omit<RenderOptions, 'queries'> {
|
|
14
14
|
|
15
15
|
export const renderWithStore = (
|
16
16
|
ui: React.ReactElement,
|
17
|
-
{
|
18
|
-
storeConfiguration = configureStore(),
|
19
|
-
...renderOptions
|
20
|
-
}: ExtendedRenderOptions = {}
|
17
|
+
{storeConfiguration = configureStore(), ...renderOptions}: ExtendedRenderOptions = {},
|
21
18
|
) => {
|
22
19
|
const {store} = storeConfiguration;
|
23
20
|
|
24
21
|
function Wrapper({children}: PropsWithChildren<{}>) {
|
25
|
-
return <Provider store={store}>{children}</Provider
|
22
|
+
return <Provider store={store}>{children}</Provider>;
|
26
23
|
}
|
27
24
|
|
28
|
-
return {store, ...render(ui, {wrapper: Wrapper, ...renderOptions})}
|
25
|
+
return {store, ...render(ui, {wrapper: Wrapper, ...renderOptions})};
|
29
26
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "ydb-embedded-ui",
|
3
|
-
"version": "4.
|
3
|
+
"version": "4.11.0",
|
4
4
|
"files": [
|
5
5
|
"dist"
|
6
6
|
],
|
@@ -17,6 +17,7 @@
|
|
17
17
|
"@gravity-ui/react-data-table": "^1.0.3",
|
18
18
|
"axios": "0.19.2",
|
19
19
|
"bem-cn-lite": "4.0.0",
|
20
|
+
"copy-to-clipboard": "^3.3.3",
|
20
21
|
"history": "4.10.1",
|
21
22
|
"js-cookie": "2.2.1",
|
22
23
|
"keymaster": "1.6.2",
|
@@ -39,7 +40,7 @@
|
|
39
40
|
"reselect": "4.1.6",
|
40
41
|
"sass": "1.32.8",
|
41
42
|
"web-vitals": "1.1.2",
|
42
|
-
"ydb-ui-components": "^3.1
|
43
|
+
"ydb-ui-components": "^3.2.1"
|
43
44
|
},
|
44
45
|
"scripts": {
|
45
46
|
"start": "react-app-rewired start",
|
@@ -64,6 +65,9 @@
|
|
64
65
|
],
|
65
66
|
"*.{js,jsx,ts,tsx}": [
|
66
67
|
"eslint --fix --quiet"
|
68
|
+
],
|
69
|
+
"*.{json}": [
|
70
|
+
"prettier --write"
|
67
71
|
]
|
68
72
|
},
|
69
73
|
"jest": {
|
@@ -1,3 +0,0 @@
|
|
1
|
-
<svg width="14" height="14" viewBox="0 0 14 14" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
2
|
-
<path d="M8.625 13.0156C8.625 13.2695 8.47266 13.498 8.24414 13.5742C8.04102 13.6758 7.76172 13.6504 7.58398 13.4727L5.55273 11.6445C5.42578 11.543 5.375 11.3652 5.375 11.1875C5.375 11.0352 5.42578 10.8574 5.55273 10.7559L7.58398 8.92773C7.76172 8.75 8.04102 8.72461 8.24414 8.82617C8.47266 8.90234 8.625 9.13086 8.625 9.35938V10.5781H9.03125C10.0215 10.5781 10.8594 9.76562 10.8594 8.75V4.61133C10.0215 4.35742 9.4375 3.57031 9.4375 2.65625C9.4375 1.53906 10.3262 0.625 11.4688 0.625C12.5859 0.625 13.5 1.53906 13.5 2.65625C13.5 3.57031 12.8906 4.35742 12.0781 4.61133V8.75C12.0781 10.4512 10.707 11.7969 9.03125 11.7969H8.625V13.0156ZM12.2812 2.65625C12.2812 2.22461 11.9004 1.84375 11.4688 1.84375C11.0117 1.84375 10.6562 2.22461 10.6562 2.65625C10.6562 3.11328 11.0117 3.46875 11.4688 3.46875C11.9004 3.46875 12.2812 3.11328 12.2812 2.65625ZM5.375 1.23438C5.375 1.00586 5.50195 0.777344 5.73047 0.701172C5.93359 0.599609 6.21289 0.625 6.39062 0.802734L8.42188 2.63086C8.54883 2.73242 8.625 2.91016 8.625 3.0625C8.625 3.24023 8.54883 3.41797 8.42188 3.51953L6.39062 5.34766C6.21289 5.52539 5.93359 5.55078 5.73047 5.44922C5.50195 5.37305 5.375 5.14453 5.375 4.89062V3.67188H4.96875C3.95312 3.67188 3.14062 4.50977 3.14062 5.5V9.66406C3.95312 9.91797 4.5625 10.7051 4.5625 11.5938C4.5625 12.7363 3.64844 13.625 2.53125 13.625C1.38867 13.625 0.5 12.7363 0.5 11.5938C0.5 10.7051 1.08398 9.91797 1.92188 9.66406V5.5C1.92188 3.82422 3.26758 2.45312 4.96875 2.45312H5.375V1.23438ZM1.71875 11.5938C1.71875 12.0508 2.07422 12.4062 2.53125 12.4062C2.96289 12.4062 3.34375 12.0508 3.34375 11.5938C3.34375 11.1621 2.96289 10.7812 2.53125 10.7812C2.07422 10.7812 1.71875 11.1621 1.71875 11.5938Z"/>
|
3
|
-
</svg>
|
@@ -1,153 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import PropTypes from 'prop-types';
|
3
|
-
import cn from 'bem-cn-lite';
|
4
|
-
import _ from 'lodash';
|
5
|
-
import {connect} from 'react-redux';
|
6
|
-
import {Loader} from '@gravity-ui/uikit';
|
7
|
-
import DataTable from '@gravity-ui/react-data-table';
|
8
|
-
import {DEFAULT_TABLE_SETTINGS} from '../../../utils/constants';
|
9
|
-
|
10
|
-
import './Acl.scss';
|
11
|
-
|
12
|
-
const b = cn('kv-acl');
|
13
|
-
|
14
|
-
const COLUMN_WIDTH = 140;
|
15
|
-
|
16
|
-
const TABLE_SETTINGS = {
|
17
|
-
...DEFAULT_TABLE_SETTINGS,
|
18
|
-
dynamicRender: false,
|
19
|
-
stickyTop: 36,
|
20
|
-
};
|
21
|
-
|
22
|
-
class Acl extends React.Component {
|
23
|
-
static propTypes = {
|
24
|
-
error: PropTypes.string,
|
25
|
-
acl: PropTypes.array,
|
26
|
-
loading: PropTypes.bool,
|
27
|
-
additionalTenantInfo: PropTypes.object,
|
28
|
-
};
|
29
|
-
|
30
|
-
COLUMNS = [
|
31
|
-
{
|
32
|
-
name: 'AccessType',
|
33
|
-
header: 'Access Type',
|
34
|
-
sortable: false,
|
35
|
-
},
|
36
|
-
{
|
37
|
-
name: 'AccessRights',
|
38
|
-
header: 'Access Rights',
|
39
|
-
render: ({value}) => {
|
40
|
-
return _.map(value, (item, index) => {
|
41
|
-
return <div key={index}>{item}</div>;
|
42
|
-
});
|
43
|
-
},
|
44
|
-
sortable: false,
|
45
|
-
},
|
46
|
-
{
|
47
|
-
name: 'Subject',
|
48
|
-
sortable: false,
|
49
|
-
// eslint-disable-next-line react/display-name
|
50
|
-
render: ({value}) => {
|
51
|
-
return this.prepareLogin(value);
|
52
|
-
},
|
53
|
-
width: COLUMN_WIDTH,
|
54
|
-
},
|
55
|
-
{
|
56
|
-
name: 'InheritanceType',
|
57
|
-
header: 'Inheritance Type',
|
58
|
-
render: ({value}) => {
|
59
|
-
return _.map(value, (item, index) => {
|
60
|
-
return <div key={index}>{item}</div>;
|
61
|
-
});
|
62
|
-
},
|
63
|
-
sortable: false,
|
64
|
-
},
|
65
|
-
];
|
66
|
-
|
67
|
-
prepareLogin = (value) => {
|
68
|
-
if (this.props.prepareLogin) {
|
69
|
-
return this.props.additionalTenantInfo?.prepareLogin(value);
|
70
|
-
}
|
71
|
-
if (value && value.endsWith('@staff') && !value.startsWith('svc_')) {
|
72
|
-
const login = value.split('@')[0];
|
73
|
-
return login;
|
74
|
-
}
|
75
|
-
|
76
|
-
return value;
|
77
|
-
};
|
78
|
-
|
79
|
-
renderTable = () => {
|
80
|
-
const {acl} = this.props;
|
81
|
-
|
82
|
-
if (!acl) {
|
83
|
-
return null;
|
84
|
-
}
|
85
|
-
|
86
|
-
return <DataTable columns={this.COLUMNS} data={acl} settings={TABLE_SETTINGS} />;
|
87
|
-
};
|
88
|
-
|
89
|
-
renderOwner = () => {
|
90
|
-
const {owner} = this.props;
|
91
|
-
|
92
|
-
if (!owner) {
|
93
|
-
return null;
|
94
|
-
}
|
95
|
-
|
96
|
-
return (
|
97
|
-
<div className={b('owner-container')}>
|
98
|
-
<span className={b('owner-label')}>Owner: </span>
|
99
|
-
{this.prepareLogin(owner)}
|
100
|
-
</div>
|
101
|
-
);
|
102
|
-
};
|
103
|
-
renderResult = () => {
|
104
|
-
return (
|
105
|
-
<React.Fragment>
|
106
|
-
{this.renderOwner()}
|
107
|
-
{this.renderTable()}
|
108
|
-
</React.Fragment>
|
109
|
-
);
|
110
|
-
};
|
111
|
-
|
112
|
-
render() {
|
113
|
-
const {error, loading, acl, owner, wasLoaded} = this.props;
|
114
|
-
|
115
|
-
if (loading && !wasLoaded) {
|
116
|
-
return (
|
117
|
-
<div className={b('loader-container')}>
|
118
|
-
<Loader size="m" />
|
119
|
-
</div>
|
120
|
-
);
|
121
|
-
}
|
122
|
-
|
123
|
-
if (error && !error.isCancelled) {
|
124
|
-
const message = (error.data || error).slice(0, 100);
|
125
|
-
|
126
|
-
return <div className={b('message-container')}>{message}</div>;
|
127
|
-
}
|
128
|
-
|
129
|
-
if (!loading && !acl && !owner) {
|
130
|
-
return <div className={b('message-container')}>Empty</div>;
|
131
|
-
}
|
132
|
-
|
133
|
-
return (
|
134
|
-
<div className={b()}>
|
135
|
-
<div className={b('result')}>{this.renderResult()}</div>
|
136
|
-
</div>
|
137
|
-
);
|
138
|
-
}
|
139
|
-
}
|
140
|
-
|
141
|
-
const mapStateToProps = (state) => {
|
142
|
-
const {loading, error, acl, owner, wasLoaded} = state.schemaAcl;
|
143
|
-
|
144
|
-
return {
|
145
|
-
acl,
|
146
|
-
owner,
|
147
|
-
loading,
|
148
|
-
error,
|
149
|
-
wasLoaded,
|
150
|
-
};
|
151
|
-
};
|
152
|
-
|
153
|
-
export default connect(mapStateToProps)(Acl);
|
@@ -1,94 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import PropTypes from 'prop-types';
|
3
|
-
import cn from 'bem-cn-lite';
|
4
|
-
|
5
|
-
import find from 'lodash/find';
|
6
|
-
|
7
|
-
import {Icon} from '../../../../components/Icon';
|
8
|
-
import DataTable from '@gravity-ui/react-data-table';
|
9
|
-
import {DEFAULT_TABLE_SETTINGS} from '../../../../utils/constants';
|
10
|
-
import './SchemaViewer.scss';
|
11
|
-
|
12
|
-
const b = cn('schema-viewer');
|
13
|
-
|
14
|
-
const SchemaViewerColumns = {
|
15
|
-
id: 'Id',
|
16
|
-
name: 'Name',
|
17
|
-
key: 'Key',
|
18
|
-
type: 'Type',
|
19
|
-
notNull: 'NotNull',
|
20
|
-
};
|
21
|
-
|
22
|
-
class SchemaViewer extends React.Component {
|
23
|
-
static propTypes = {
|
24
|
-
data: PropTypes.arrayOf(PropTypes.object),
|
25
|
-
};
|
26
|
-
|
27
|
-
renderTable() {
|
28
|
-
const {data = {}} = this.props;
|
29
|
-
const keyColumnsIds = data.KeyColumnIds ?? [];
|
30
|
-
const keyColumns = keyColumnsIds.map((key) => {
|
31
|
-
const keyColumn = find(data.Columns, {Id: key});
|
32
|
-
return keyColumn;
|
33
|
-
});
|
34
|
-
const restColumns = data.Columns?.filter((item) => !keyColumnsIds.includes(item.Id)) ?? [];
|
35
|
-
|
36
|
-
const columns = [
|
37
|
-
{
|
38
|
-
name: SchemaViewerColumns.id,
|
39
|
-
width: 40,
|
40
|
-
},
|
41
|
-
{
|
42
|
-
name: SchemaViewerColumns.key,
|
43
|
-
width: 40,
|
44
|
-
sortAccessor: (row) => {
|
45
|
-
return keyColumnsIds.includes(row.Id) ? 1 : 0;
|
46
|
-
},
|
47
|
-
render: ({row}) => {
|
48
|
-
return keyColumnsIds.includes(row.Id) ? (
|
49
|
-
<div className={b('key-icon')}>
|
50
|
-
<Icon name="key" viewBox="0 0 12 7" width={12} height={7} />
|
51
|
-
</div>
|
52
|
-
) : null;
|
53
|
-
},
|
54
|
-
},
|
55
|
-
{
|
56
|
-
name: SchemaViewerColumns.name,
|
57
|
-
width: 100,
|
58
|
-
},
|
59
|
-
{
|
60
|
-
name: SchemaViewerColumns.type,
|
61
|
-
width: 100,
|
62
|
-
},
|
63
|
-
{
|
64
|
-
name: SchemaViewerColumns.notNull,
|
65
|
-
width: 100,
|
66
|
-
render: ({row}) => {
|
67
|
-
if (row.NotNull) {
|
68
|
-
return '\u2713';
|
69
|
-
}
|
70
|
-
|
71
|
-
return undefined;
|
72
|
-
},
|
73
|
-
},
|
74
|
-
];
|
75
|
-
|
76
|
-
const tableData = [...keyColumns, ...restColumns];
|
77
|
-
return (
|
78
|
-
<DataTable
|
79
|
-
theme="yandex-cloud"
|
80
|
-
data={tableData}
|
81
|
-
columns={columns}
|
82
|
-
settings={DEFAULT_TABLE_SETTINGS}
|
83
|
-
dynamicRender={true}
|
84
|
-
initialSortOrder={{columnId: SchemaViewerColumns.key, order: DataTable.DESCENDING}}
|
85
|
-
/>
|
86
|
-
);
|
87
|
-
}
|
88
|
-
|
89
|
-
render() {
|
90
|
-
return <div className={b()}>{this.renderTable()}</div>;
|
91
|
-
}
|
92
|
-
}
|
93
|
-
|
94
|
-
export default SchemaViewer;
|