ydb-embedded-ui 0.1.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +24 -0
- package/LICENSE +21 -0
- package/README.md +3 -3
- package/dist/assets/icons/cluster.svg +1 -0
- package/dist/assets/icons/hide.svg +1 -0
- package/dist/assets/icons/show.svg +1 -0
- package/dist/assets/icons/user-check.svg +1 -1
- package/dist/assets/icons/user-secret.svg +1 -1
- package/dist/components/AsideNavigation/AsideHeader.scss +1 -2
- package/dist/components/AsideNavigation/AsideHeaderFooterItem/AsideHeaderFooterItem.scss +7 -7
- package/dist/components/AsideNavigation/AsideHeaderTooltip/AsideHeaderTooltip.scss +2 -2
- package/dist/components/AsideNavigation/CompositeBar/CompositeBar.scss +6 -6
- package/dist/components/AsideNavigation/Drawer/Drawer.scss +5 -5
- package/dist/components/AsideNavigation/Logo/Logo.scss +3 -4
- package/dist/components/AsideNavigation/Settings/Settings.scss +27 -12
- package/dist/components/AsideNavigation/Settings/SettingsMenu/SettingsMenu.scss +14 -6
- package/dist/components/Breadcrumbs/Breadcrumbs.scss +2 -1
- package/dist/components/ClusterInfo/ClusterInfo.scss +19 -12
- package/dist/components/ClusterInfo/ClusterInfo.tsx +110 -10
- package/dist/components/CopyToClipboard/CopyToClipboard.tsx +39 -0
- package/dist/components/CriticalActionDialog/CriticalActionDialog.scss +5 -4
- package/dist/components/Divider/Divider.scss +7 -0
- package/dist/components/Divider/Divider.tsx +11 -0
- package/dist/components/EmptyState/EmptyState.scss +14 -10
- package/dist/components/EnableFullscreenButton/EnableFullscreenButton.tsx +22 -0
- package/dist/components/EntityStatus/EntityStatus.js +5 -3
- package/dist/components/EntityStatus/EntityStatus.scss +35 -13
- package/dist/components/FullGroupViewer/FullGroupViewer.js +2 -4
- package/dist/components/FullGroupViewer/FullGroupViewer.scss +6 -3
- package/dist/components/FullNodeViewer/FullNodeViewer.scss +19 -11
- package/dist/components/Fullscreen/Fullscreen.scss +28 -0
- package/dist/components/Fullscreen/Fullscreen.tsx +81 -0
- package/dist/components/GroupTreeViewer/GroupTreeViewer.scss +1 -0
- package/dist/components/GroupViewer/GroupViewer.scss +8 -4
- package/dist/components/Icon/Icon.js +2 -0
- package/dist/components/InfoViewer/InfoViewer.scss +22 -16
- package/dist/components/NodesViewer/NodesViewer.js +25 -35
- package/dist/components/NodesViewer/NodesViewer.scss +15 -11
- package/dist/components/PDiskViewer/PDiskViewer.scss +10 -4
- package/dist/components/Pagination/Pagination.scss +6 -3
- package/dist/components/PoolBar/PoolBar.scss +14 -10
- package/dist/components/PoolUsage/PoolUsage.scss +17 -9
- package/dist/components/ProgressViewer/ProgressViewer.js +1 -1
- package/dist/components/ProgressViewer/ProgressViewer.scss +28 -18
- package/dist/components/QueryExecutionStatus/QueryExecutionStatus.scss +14 -0
- package/dist/components/QueryExecutionStatus/QueryExecutionStatus.tsx +29 -0
- package/dist/components/SplitPane/SplitPane.scss +33 -40
- package/dist/components/SplitPane/SplitPane.tsx +94 -0
- package/dist/components/Tablet/Tablet.scss +9 -6
- package/dist/components/TabletsOverall/TabletsOverall.scss +19 -0
- package/dist/components/TabletsOverall/TabletsOverall.tsx +105 -0
- package/dist/components/TabletsStatistic/TabletsStatistic.scss +24 -18
- package/dist/components/TabletsViewer/TabletsViewer.scss +12 -9
- package/dist/components/Tag/Tag.scss +6 -4
- package/dist/components/Tags/Tags.scss +1 -1
- package/dist/components/TreeView/TreeView.js +1 -1
- package/dist/components/TreeView/TreeView.scss +9 -0
- package/dist/components/TruncatedQuery/TruncatedQuery.scss +4 -3
- package/dist/containers/App/App.js +1 -0
- package/dist/containers/App/App.scss +50 -31
- package/dist/containers/App/Content.js +2 -2
- package/dist/containers/App/NodesTable.scss +25 -0
- package/dist/containers/App/TipPopup/TipPopup.scss +10 -6
- package/dist/containers/AppIcons/AppIcons.js +46 -22
- package/dist/containers/AsideNavigation/AsideNavigation.scss +1 -1
- package/dist/containers/AsideNavigation/AsideNavigation.tsx +12 -5
- package/dist/containers/Authentication/Authentication.scss +63 -14
- package/dist/containers/Authentication/Authentication.tsx +42 -9
- package/dist/containers/Cluster/Cluster.scss +5 -3
- package/dist/containers/Cluster/Cluster.tsx +49 -0
- package/dist/containers/Group/Group.scss +1 -1
- package/dist/containers/Header/Header.scss +15 -59
- package/dist/containers/Header/Header.tsx +75 -0
- package/dist/containers/Header/Host/Host.scss +10 -3
- package/dist/containers/Heatmap/Heatmap.js +1 -1
- package/dist/containers/Heatmap/Heatmap.scss +16 -7
- package/dist/containers/Heatmap/HeatmapCanvas/HeatmapCanvas.js +3 -3
- package/dist/containers/Heatmap/Histogram/Histogram.scss +21 -9
- package/dist/containers/Node/Node.js +1 -1
- package/dist/containers/Node/Node.scss +6 -4
- package/dist/containers/Nodes/Nodes.js +28 -27
- package/dist/containers/Nodes/Nodes.scss +5 -17
- package/dist/containers/Pdisk/Pdisk.scss +6 -4
- package/dist/containers/Pool/Pool.scss +7 -4
- package/dist/containers/ReduxTooltip/ReduxTooltip.scss +5 -1
- package/dist/containers/Storage/DiskStateProgressBar/DiskStateProgressBar.scss +77 -0
- package/dist/containers/{StorageV2 → Storage}/DiskStateProgressBar/DiskStateProgressBar.tsx +1 -1
- package/dist/containers/{StorageV2 → Storage}/Pdisk/Pdisk.scss +6 -4
- package/dist/containers/{StorageV2 → Storage}/Pdisk/Pdisk.tsx +1 -2
- package/dist/containers/{StorageV2 → Storage}/Storage.js +72 -34
- package/dist/containers/{StorageV2 → Storage}/Storage.scss +12 -14
- package/dist/containers/{StorageV2 → Storage}/StorageFilter/StorageFilter.js +1 -9
- package/dist/containers/{StorageV2 → Storage}/StorageGroups/StorageGroups.scss +2 -0
- package/dist/containers/{StorageV2 → Storage}/StorageGroups/StorageGroups.tsx +1 -1
- package/dist/containers/{StorageV2 → Storage}/StorageNodes/StorageNodes.scss +2 -0
- package/dist/containers/{StorageV2 → Storage}/StorageNodes/StorageNodes.tsx +1 -1
- package/dist/containers/{StorageV2 → Storage}/Vdisk/Vdisk.js +0 -0
- package/dist/containers/{StorageV2 → Storage}/Vdisk/Vdisk.scss +6 -4
- package/dist/containers/Tablet/Tablet.scss +13 -9
- package/dist/containers/Tablets/Tablets.js +21 -90
- package/dist/containers/Tablets/Tablets.scss +9 -35
- package/dist/containers/TabletsFilters/TabletsFilters.js +2 -75
- package/dist/containers/TabletsFilters/TabletsFilters.scss +15 -35
- package/dist/containers/Tenant/Acl/Acl.js +54 -47
- package/dist/containers/Tenant/Acl/Acl.scss +15 -4
- package/dist/containers/Tenant/{Compute → Diagnostics/Compute}/Compute.js +35 -12
- package/dist/containers/Tenant/Diagnostics/Compute/Compute.scss +14 -0
- package/dist/containers/Tenant/{Describe → Diagnostics/Describe}/Describe.js +50 -1
- package/dist/containers/Tenant/{Describe → Diagnostics/Describe}/Describe.scss +5 -3
- package/dist/containers/Tenant/Diagnostics/DetailedOverview/DetailedOverview.scss +27 -0
- package/dist/containers/Tenant/Diagnostics/DetailedOverview/DetailedOverview.tsx +88 -0
- package/dist/containers/Tenant/Diagnostics/Diagnostics.scss +50 -0
- package/dist/containers/Tenant/Diagnostics/Diagnostics.tsx +208 -0
- package/dist/containers/Tenant/Diagnostics/DiagnosticsPages.ts +75 -0
- package/dist/containers/Tenant/Diagnostics/Healthcheck/Healthcheck.js +191 -0
- package/dist/containers/Tenant/Diagnostics/Healthcheck/Healthcheck.scss +79 -0
- package/dist/containers/Tenant/{Healthcheck → Diagnostics/Healthcheck}/IssuesViewer/IssueViewer.scss +25 -13
- package/dist/containers/Tenant/{Healthcheck → Diagnostics/Healthcheck}/IssuesViewer/IssuesViewer.js +2 -2
- package/dist/containers/Tenant/{Schema → Diagnostics}/HotKeys/HotKeys.js +14 -8
- package/dist/containers/Tenant/{Schema → Diagnostics}/HotKeys/HotKeys.scss +7 -5
- package/dist/containers/Tenant/{Network → Diagnostics/Network}/Network.js +39 -9
- package/dist/containers/Tenant/{Network → Diagnostics/Network}/Network.scss +35 -36
- package/dist/containers/Tenant/{Network → Diagnostics/Network}/NodeNetwork/NodeNetwork.js +0 -0
- package/dist/containers/Tenant/{Network → Diagnostics/Network}/NodeNetwork/NodeNetwork.scss +11 -9
- package/dist/containers/Tenant/Diagnostics/Overview/Overview.scss +13 -0
- package/dist/containers/Tenant/Diagnostics/Overview/Overview.tsx +123 -0
- package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.js +200 -0
- package/dist/{components → containers/Tenant/Diagnostics}/TenantOverview/TenantOverview.scss +24 -17
- package/dist/containers/Tenant/{TopQueries → Diagnostics/TopQueries}/TopQueries.js +32 -30
- package/dist/containers/Tenant/{TopQueries → Diagnostics/TopQueries}/TopQueries.scss +10 -9
- package/dist/containers/Tenant/{TopShards → Diagnostics/TopShards}/TopShards.js +25 -29
- package/dist/containers/Tenant/{TopShards → Diagnostics/TopShards}/TopShards.scss +1 -13
- package/dist/containers/Tenant/ObjectGeneral/ObjectGeneral.scss +38 -0
- package/dist/containers/Tenant/ObjectGeneral/ObjectGeneral.tsx +104 -0
- package/dist/containers/Tenant/ObjectSummary/ObjectSummary.scss +175 -0
- package/dist/containers/Tenant/ObjectSummary/ObjectSummary.tsx +319 -0
- package/dist/containers/Tenant/Preview/Preview.js +50 -12
- package/dist/containers/Tenant/Preview/Preview.scss +45 -3
- package/dist/containers/Tenant/QueryEditor/QueriesHistory/QueriesHistory.scss +85 -0
- package/dist/containers/Tenant/QueryEditor/QueriesHistory/QueriesHistory.tsx +95 -0
- package/dist/containers/Tenant/QueryEditor/QueryEditor.js +319 -268
- package/dist/containers/Tenant/QueryEditor/QueryEditor.scss +47 -18
- package/dist/containers/Tenant/QueryEditor/QueryExplain/QueryExplain.js +190 -75
- package/dist/containers/Tenant/QueryEditor/QueryExplain/QueryExplain.scss +47 -11
- package/dist/containers/Tenant/QueryEditor/QueryResult/QueryResult.js +89 -20
- package/dist/containers/Tenant/QueryEditor/QueryResult/QueryResult.scss +60 -6
- package/dist/containers/Tenant/QueryEditor/SaveQuery/SaveQuery.js +10 -23
- package/dist/containers/Tenant/QueryEditor/SaveQuery/SaveQuery.scss +15 -7
- package/dist/containers/Tenant/QueryEditor/SavedQueries/SavedQueries.js +7 -3
- package/dist/containers/Tenant/QueryEditor/SavedQueries/SavedQueries.scss +28 -17
- package/dist/containers/Tenant/Schema/SchemaInfoViewer/SchemaInfoViewer.js +7 -7
- package/dist/containers/Tenant/Schema/SchemaInfoViewer/SchemaInfoViewer.scss +1 -11
- package/dist/containers/Tenant/Schema/SchemaNode/SchemaNode.js +37 -17
- package/dist/containers/Tenant/Schema/SchemaNode/SchemaNode.scss +33 -12
- package/dist/containers/Tenant/Schema/SchemaNodeActions/SchemaNodeActions.scss +17 -0
- package/dist/containers/Tenant/Schema/SchemaNodeActions/SchemaNodeActions.tsx +125 -0
- package/dist/containers/Tenant/Schema/SchemaTree/SchemaTree.js +5 -4
- package/dist/containers/Tenant/Schema/SchemaTree/SchemaTree.scss +6 -2
- package/dist/containers/Tenant/Schema/SchemaViewer/SchemaViewer.js +53 -34
- package/dist/containers/Tenant/Schema/SchemaViewer/SchemaViewer.scss +1 -22
- package/dist/containers/Tenant/Tenant.scss +3 -32
- package/dist/containers/Tenant/Tenant.tsx +161 -0
- package/dist/containers/Tenant/TenantPages.tsx +48 -0
- package/dist/containers/Tenant/utils/ToggleButton.scss +26 -0
- package/dist/containers/Tenant/utils/paneVisibilityToggleHelpers.tsx +126 -0
- package/dist/containers/Tenants/Tenants.js +41 -55
- package/dist/containers/Tenants/Tenants.scss +4 -17
- package/dist/containers/UserSettings/UserSettings.tsx +0 -2
- package/dist/containers/Vdisk/Vdisk.scss +6 -4
- package/dist/containers/VdiskPdiskNode/VdiskPdiskNode.js +1 -1
- package/dist/containers/VdiskPdiskNode/VdiskPdiskNode.scss +5 -5
- package/dist/{routes.js → routes.ts} +14 -4
- package/dist/store/reducers/clusterNodes.js +1 -1
- package/dist/store/reducers/executeQuery.js +36 -2
- package/dist/store/reducers/fullscreen.ts +31 -0
- package/dist/store/reducers/header.ts +23 -0
- package/dist/store/reducers/hotKeys.js +1 -1
- package/dist/store/reducers/index.js +6 -0
- package/dist/store/reducers/saveQuery.ts +33 -0
- package/dist/store/reducers/schema.js +14 -0
- package/dist/store/reducers/shardsWorkload.js +1 -1
- package/dist/store/state-url-mapping.js +1 -1
- package/dist/store/utils.js +2 -6
- package/dist/styles/mixins.scss +49 -34
- package/dist/utils/autofetcher.ts +51 -0
- package/dist/utils/constants.js +26 -7
- package/dist/utils/createToast.tsx +23 -0
- package/dist/utils/getNodesColumns.js +25 -28
- package/dist/utils/index.js +6 -2
- package/package.json +8 -4
- package/dist/components/SplitPane/SplitPane.js +0 -368
- package/dist/components/TenantOverview/TenantOverview.js +0 -148
- package/dist/containers/Cluster/Cluster.js +0 -168
- package/dist/containers/Header/Header.js +0 -88
- package/dist/containers/StorageV2/DiskStateProgressBar/DiskStateProgressBar.scss +0 -81
- package/dist/containers/Tenant/Compute/Compute.scss +0 -6
- package/dist/containers/Tenant/Healthcheck/Healthcheck.js +0 -116
- package/dist/containers/Tenant/Healthcheck/Healthcheck.scss +0 -64
- package/dist/containers/Tenant/Schema/Info/Info.js +0 -84
- package/dist/containers/Tenant/Schema/Info/Info.scss +0 -3
- package/dist/containers/Tenant/Schema/SchemaMain/SchemaMain.js +0 -439
- package/dist/containers/Tenant/Schema/SchemaMain/SchemaMain.scss +0 -90
- package/dist/containers/Tenant/Schema/SchemaPages.js +0 -56
- package/dist/containers/Tenant/Tenant.js +0 -199
- package/dist/containers/Tenant/TenantPages.js +0 -35
@@ -0,0 +1,125 @@
|
|
1
|
+
import {useDispatch} from 'react-redux';
|
2
|
+
import {useHistory} from 'react-router';
|
3
|
+
import cn from 'bem-cn-lite';
|
4
|
+
import {DropdownMenu} from '@yandex-cloud/uikit';
|
5
|
+
import qs from 'qs';
|
6
|
+
|
7
|
+
import {changeUserInput} from '../../../../store/reducers/executeQuery';
|
8
|
+
import {setShowPreview} from '../../../../store/reducers/schema';
|
9
|
+
import routes, {createHref} from '../../../../routes';
|
10
|
+
|
11
|
+
import './SchemaNodeActions.scss';
|
12
|
+
import {TenantGeneralTabsIds, TenantTabsGroups} from '../../TenantPages';
|
13
|
+
import createToast from '../../../../utils/createToast';
|
14
|
+
|
15
|
+
const b = cn('kv-schema-node-actions');
|
16
|
+
|
17
|
+
const createTableTemplate = (path: string) => {
|
18
|
+
return `CREATE TABLE \`${path}/my_table\`
|
19
|
+
(
|
20
|
+
\`id\` Uint64,
|
21
|
+
\`name\` String,
|
22
|
+
PRIMARY KEY (\`id\`)
|
23
|
+
);`;
|
24
|
+
};
|
25
|
+
|
26
|
+
const alterTableTemplate = (path: string) => {
|
27
|
+
return `ALTER TABLE \`${path}\`
|
28
|
+
ADD COLUMN is_deleted Bool;`;
|
29
|
+
};
|
30
|
+
const selectQueryTemplate = (path: string) => {
|
31
|
+
return `SELECT \`id\`, \`name\`
|
32
|
+
FROM \`${path}\`
|
33
|
+
ORDER BY \`id\`
|
34
|
+
LIMIT 10;`;
|
35
|
+
};
|
36
|
+
const upsertQueryTemplate = (path: string) => {
|
37
|
+
return `UPSERT INTO \`${path}\`
|
38
|
+
( \`id\`, \`name\` )
|
39
|
+
VALUES ( );`;
|
40
|
+
};
|
41
|
+
|
42
|
+
interface SchemaNodeActionsProps {
|
43
|
+
name: string;
|
44
|
+
isTableType: boolean;
|
45
|
+
}
|
46
|
+
|
47
|
+
function SchemaNodeActions({name, isTableType}: SchemaNodeActionsProps) {
|
48
|
+
const dispatch = useDispatch();
|
49
|
+
const history = useHistory();
|
50
|
+
|
51
|
+
const queryParams = qs.parse(location.search, {
|
52
|
+
ignoreQueryPrefix: true,
|
53
|
+
});
|
54
|
+
|
55
|
+
const onCreateTableClick = () => {
|
56
|
+
dispatch(changeUserInput({input: createTableTemplate(name)}));
|
57
|
+
};
|
58
|
+
|
59
|
+
const onAlterTableClick = () => {
|
60
|
+
dispatch(changeUserInput({input: alterTableTemplate(name)}));
|
61
|
+
};
|
62
|
+
|
63
|
+
const onSelectQueryClick = () => {
|
64
|
+
dispatch(changeUserInput({input: selectQueryTemplate(name)}));
|
65
|
+
};
|
66
|
+
|
67
|
+
const onUpsertQueryClick = () => {
|
68
|
+
dispatch(changeUserInput({input: upsertQueryTemplate(name)}));
|
69
|
+
};
|
70
|
+
|
71
|
+
const onCopyPathClick = () => {
|
72
|
+
navigator.clipboard
|
73
|
+
.writeText(name)
|
74
|
+
.then(() => {
|
75
|
+
createToast({
|
76
|
+
name: 'Copied',
|
77
|
+
title: 'Path was copied to clipboard successfully',
|
78
|
+
type: 'success',
|
79
|
+
});
|
80
|
+
})
|
81
|
+
.catch(() => {
|
82
|
+
createToast({
|
83
|
+
name: 'Not copied',
|
84
|
+
title: 'Path was not copied to clipboard successfully',
|
85
|
+
type: 'error',
|
86
|
+
});
|
87
|
+
});
|
88
|
+
};
|
89
|
+
|
90
|
+
const onOpenPreviewClick = () => {
|
91
|
+
dispatch(setShowPreview(true));
|
92
|
+
history.push(
|
93
|
+
createHref(routes.tenant, undefined, {
|
94
|
+
...queryParams,
|
95
|
+
[TenantTabsGroups.general]: TenantGeneralTabsIds.query,
|
96
|
+
}),
|
97
|
+
);
|
98
|
+
};
|
99
|
+
|
100
|
+
const copyItem = {text: 'Copy path', action: onCopyPathClick};
|
101
|
+
|
102
|
+
const tableItems = [
|
103
|
+
[{text: 'Open preview', action: onOpenPreviewClick}, copyItem],
|
104
|
+
[
|
105
|
+
{text: 'Alter table', action: onAlterTableClick},
|
106
|
+
{text: 'Select query', action: onSelectQueryClick},
|
107
|
+
{text: 'Upsert query', action: onUpsertQueryClick},
|
108
|
+
],
|
109
|
+
];
|
110
|
+
|
111
|
+
const catalogItems = [[copyItem], [{text: 'Create table', action: onCreateTableClick}]];
|
112
|
+
|
113
|
+
const items = isTableType ? tableItems : catalogItems;
|
114
|
+
|
115
|
+
return (
|
116
|
+
<DropdownMenu
|
117
|
+
items={items}
|
118
|
+
switcherWrapperClassName={b()}
|
119
|
+
popupClassName={b('popup')}
|
120
|
+
popupPlacement={['bottom-end']}
|
121
|
+
/>
|
122
|
+
);
|
123
|
+
}
|
124
|
+
|
125
|
+
export default SchemaNodeActions;
|
@@ -33,14 +33,14 @@ class SchemaTree extends React.Component {
|
|
33
33
|
|
34
34
|
renderLoader() {
|
35
35
|
return (
|
36
|
-
<div className=
|
37
|
-
<Loader size="
|
36
|
+
<div className={b('loader')}>
|
37
|
+
<Loader size="m" />
|
38
38
|
</div>
|
39
39
|
);
|
40
40
|
}
|
41
41
|
|
42
42
|
removeArrow = () => {
|
43
|
-
//
|
43
|
+
// And how else to solve this problem, except to get into the DOM?
|
44
44
|
const nodeWithArrow =
|
45
45
|
// eslint-disable-next-line react/no-find-dom-node
|
46
46
|
ReactDOM.findDOMNode(this)?.parentNode?.parentNode?.querySelector('.tree-view_arrow');
|
@@ -75,12 +75,13 @@ class SchemaTree extends React.Component {
|
|
75
75
|
</div>
|
76
76
|
);
|
77
77
|
} else {
|
78
|
-
return
|
78
|
+
return null;
|
79
79
|
}
|
80
80
|
};
|
81
81
|
|
82
82
|
render() {
|
83
83
|
const {loading, wasLoaded, error, currentSchema: schema} = this.props;
|
84
|
+
|
84
85
|
if (loading && !wasLoaded) {
|
85
86
|
return this.renderLoader();
|
86
87
|
} else if (
|
@@ -2,12 +2,16 @@
|
|
2
2
|
|
3
3
|
.schema {
|
4
4
|
.tree-view_item {
|
5
|
-
padding: 2px 0;
|
6
5
|
margin: 0;
|
6
|
+
padding: 2px 0;
|
7
7
|
}
|
8
8
|
|
9
9
|
.tree-view_children {
|
10
|
-
padding-left: 15px;
|
11
10
|
margin: 0;
|
11
|
+
padding-left: 15px;
|
12
|
+
}
|
13
|
+
&__loader {
|
14
|
+
display: flex;
|
15
|
+
justify-content: center;
|
12
16
|
}
|
13
17
|
}
|
@@ -1,19 +1,29 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
import cn from 'bem-cn-lite';
|
4
|
-
import './SchemaViewer.scss';
|
5
4
|
|
6
5
|
import find from 'lodash/find';
|
7
6
|
|
8
7
|
import Icon from '../../../../components/Icon/Icon';
|
8
|
+
import DataTable from '@yandex-cloud/react-data-table';
|
9
|
+
import {DEFAULT_TABLE_SETTINGS} from '../../../../utils/constants';
|
10
|
+
import './SchemaViewer.scss';
|
9
11
|
|
10
12
|
const b = cn('schema-viewer');
|
11
13
|
|
14
|
+
const SchemaViewerColumns = {
|
15
|
+
id: 'Id',
|
16
|
+
name: 'Name',
|
17
|
+
key: 'Key',
|
18
|
+
type: 'Type',
|
19
|
+
};
|
20
|
+
|
12
21
|
class SchemaViewer extends React.Component {
|
13
22
|
static propTypes = {
|
14
23
|
data: PropTypes.arrayOf(PropTypes.object),
|
15
24
|
};
|
16
|
-
|
25
|
+
|
26
|
+
renderTable() {
|
17
27
|
const {data = {}} = this.props;
|
18
28
|
const keyColumnsIds = data.KeyColumnIds ?? [];
|
19
29
|
const keyColumns = keyColumnsIds.map((key) => {
|
@@ -22,42 +32,51 @@ class SchemaViewer extends React.Component {
|
|
22
32
|
});
|
23
33
|
const restColumns = data.Columns?.filter((item) => !keyColumnsIds.includes(item.Id)) ?? [];
|
24
34
|
|
25
|
-
const columns = [
|
35
|
+
const columns = [
|
36
|
+
{
|
37
|
+
name: SchemaViewerColumns.id,
|
38
|
+
width: 40,
|
39
|
+
},
|
40
|
+
{
|
41
|
+
name: SchemaViewerColumns.key,
|
42
|
+
width: 40,
|
43
|
+
sortAccessor: (row) => {
|
44
|
+
return keyColumnsIds.includes(row.Id) ? 1 : 0;
|
45
|
+
},
|
46
|
+
render: ({row}) => {
|
47
|
+
return keyColumnsIds.includes(row.Id) ? (
|
48
|
+
<div className={b('key-icon')}>
|
49
|
+
<Icon name="key" viewBox="0 0 12 7" width={12} height={7} />
|
50
|
+
</div>
|
51
|
+
) : null;
|
52
|
+
},
|
53
|
+
},
|
54
|
+
{
|
55
|
+
name: SchemaViewerColumns.name,
|
56
|
+
width: 100,
|
57
|
+
},
|
58
|
+
{
|
59
|
+
name: SchemaViewerColumns.type,
|
60
|
+
width: 100,
|
61
|
+
},
|
62
|
+
];
|
26
63
|
|
64
|
+
const tableData = [...keyColumns, ...restColumns];
|
27
65
|
return (
|
28
|
-
<
|
29
|
-
|
30
|
-
{
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
<div className={b('key-icon')}>
|
37
|
-
<Icon
|
38
|
-
name="key"
|
39
|
-
viewBox="0 0 12 7"
|
40
|
-
width={12}
|
41
|
-
height={7}
|
42
|
-
/>
|
43
|
-
</div>
|
44
|
-
)}
|
45
|
-
</td>
|
46
|
-
<td className={b('type')}>
|
47
|
-
<span>{info.Type}</span>
|
48
|
-
</td>
|
49
|
-
<td className={b('name')}>
|
50
|
-
<span>{info.Name}</span>
|
51
|
-
</td>
|
52
|
-
</tr>
|
53
|
-
))}
|
54
|
-
</table>
|
55
|
-
) : (
|
56
|
-
<div>no schema data</div>
|
57
|
-
)}
|
58
|
-
</div>
|
66
|
+
<DataTable
|
67
|
+
theme="yandex-cloud"
|
68
|
+
data={tableData}
|
69
|
+
columns={columns}
|
70
|
+
settings={DEFAULT_TABLE_SETTINGS}
|
71
|
+
dynamicRender={true}
|
72
|
+
initialSortOrder={{columnId: SchemaViewerColumns.key, order: DataTable.DESCENDING}}
|
73
|
+
/>
|
59
74
|
);
|
60
75
|
}
|
76
|
+
|
77
|
+
render() {
|
78
|
+
return <div className={b()}>{this.renderTable()}</div>;
|
79
|
+
}
|
61
80
|
}
|
62
81
|
|
63
82
|
export default SchemaViewer;
|
@@ -1,28 +1,7 @@
|
|
1
1
|
.schema-viewer {
|
2
|
-
|
3
|
-
font-weight: 500;
|
4
|
-
}
|
5
|
-
&__row {
|
6
|
-
position: relative;
|
7
|
-
margin-bottom: 5px;
|
8
|
-
}
|
2
|
+
padding: 0px 12px;
|
9
3
|
&__key-icon {
|
10
4
|
display: flex;
|
11
5
|
align-items: center;
|
12
6
|
}
|
13
|
-
&__table {
|
14
|
-
background: none;
|
15
|
-
text-align: left;
|
16
|
-
margin-top: -6px;
|
17
|
-
|
18
|
-
td {
|
19
|
-
padding: 5px 2px;
|
20
|
-
}
|
21
|
-
}
|
22
|
-
&__type {
|
23
|
-
color: var(--yc-color-text-secondary);
|
24
|
-
}
|
25
|
-
&__name {
|
26
|
-
padding-left: 10px !important;
|
27
|
-
}
|
28
7
|
}
|
@@ -1,26 +1,21 @@
|
|
1
1
|
@import '../../styles/mixins.scss';
|
2
2
|
|
3
3
|
.tenant-page {
|
4
|
-
overflow:
|
4
|
+
overflow: hidden;
|
5
5
|
|
6
6
|
font-size: var(--yc-text-body2-font-size);
|
7
7
|
line-height: var(--yc-text-body2-line-height);
|
8
|
+
@include flex-container();
|
8
9
|
|
9
10
|
.yc-tabs {
|
10
11
|
overflow: initial;
|
11
12
|
}
|
12
13
|
|
13
|
-
&__tab-label {
|
14
|
-
display: flex;
|
15
|
-
align-items: center;
|
16
|
-
gap: 5px;
|
17
|
-
}
|
18
|
-
|
19
14
|
&__loader {
|
20
15
|
display: flex;
|
21
|
-
align-items: center;
|
22
16
|
flex: 1 1 auto;
|
23
17
|
justify-content: center;
|
18
|
+
align-items: center;
|
24
19
|
}
|
25
20
|
|
26
21
|
&__content {
|
@@ -32,32 +27,9 @@
|
|
32
27
|
overflow: auto;
|
33
28
|
|
34
29
|
height: 100%;
|
35
|
-
|
36
30
|
padding-left: 20px;
|
37
31
|
}
|
38
32
|
|
39
|
-
&__tabs {
|
40
|
-
padding: 0 15px;
|
41
|
-
|
42
|
-
&_schema {
|
43
|
-
overflow: auto;
|
44
|
-
|
45
|
-
height: 100%;
|
46
|
-
padding: 0;
|
47
|
-
@include flex-container();
|
48
|
-
}
|
49
|
-
}
|
50
|
-
|
51
|
-
&__tab {
|
52
|
-
margin-right: 40px;
|
53
|
-
|
54
|
-
text-decoration: none;
|
55
|
-
|
56
|
-
&:first-letter {
|
57
|
-
text-transform: uppercase;
|
58
|
-
}
|
59
|
-
}
|
60
|
-
|
61
33
|
&__row {
|
62
34
|
display: flex;
|
63
35
|
align-items: flex-start;
|
@@ -90,5 +62,4 @@
|
|
90
62
|
border-left: 1px solid rgba(0, 0, 0, 0.07);
|
91
63
|
@include flex-container();
|
92
64
|
}
|
93
|
-
@include flex-container();
|
94
65
|
}
|
@@ -0,0 +1,161 @@
|
|
1
|
+
import {useEffect, useMemo, useReducer} from 'react';
|
2
|
+
import {useDispatch, useSelector} from 'react-redux';
|
3
|
+
import cn from 'bem-cn-lite';
|
4
|
+
import {useLocation} from 'react-router';
|
5
|
+
import qs from 'qs';
|
6
|
+
|
7
|
+
import ObjectSummary from './ObjectSummary/ObjectSummary';
|
8
|
+
import {setHeader} from '../../store/reducers/header';
|
9
|
+
import ObjectGeneral from './ObjectGeneral/ObjectGeneral';
|
10
|
+
//@ts-ignore
|
11
|
+
import SplitPane from '../../components/SplitPane';
|
12
|
+
//@ts-ignore
|
13
|
+
import {DEFAULT_IS_TENANT_SUMMARY_COLLAPSED, DEFAULT_SIZE_TENANT_KEY} from '../../utils/constants';
|
14
|
+
//@ts-ignore
|
15
|
+
import {disableAutorefresh, getSchema} from '../../store/reducers/schema';
|
16
|
+
//@ts-ignore
|
17
|
+
import {getSchemaAcl} from '../../store/reducers/schemaAcl';
|
18
|
+
import {
|
19
|
+
PaneVisibilityActionTypes,
|
20
|
+
paneVisibilityToggleReducerCreator,
|
21
|
+
} from './utils/paneVisibilityToggleHelpers';
|
22
|
+
//@ts-ignore
|
23
|
+
import {getTenantInfo, clearTenant} from '../../store/reducers/tenant';
|
24
|
+
import routes, {CLUSTER_PAGES, createHref} from '../../routes';
|
25
|
+
|
26
|
+
import './Tenant.scss';
|
27
|
+
|
28
|
+
const b = cn('tenant-page');
|
29
|
+
|
30
|
+
export const TABLE_TYPE = 'Table';
|
31
|
+
export const OLAP_TABLE_TYPE = 'OlapTable';
|
32
|
+
export const OLAP_STORE_TYPE = 'OlapStore';
|
33
|
+
|
34
|
+
export function calcEntityType(currentPathType?: string) {
|
35
|
+
return currentPathType && currentPathType.replace('EPathType', '');
|
36
|
+
}
|
37
|
+
|
38
|
+
export function isTableType(currentPathType?: string) {
|
39
|
+
const type = calcEntityType(currentPathType);
|
40
|
+
|
41
|
+
if (type === TABLE_TYPE || type === OLAP_TABLE_TYPE) {
|
42
|
+
return true;
|
43
|
+
}
|
44
|
+
return false;
|
45
|
+
}
|
46
|
+
|
47
|
+
const getInitialIsSummaryCollapsed = () => {
|
48
|
+
return Boolean(localStorage.getItem(DEFAULT_IS_TENANT_SUMMARY_COLLAPSED));
|
49
|
+
};
|
50
|
+
|
51
|
+
const initialTenantSummaryState = {
|
52
|
+
triggerExpand: false,
|
53
|
+
triggerCollapse: false,
|
54
|
+
collapsed: getInitialIsSummaryCollapsed(),
|
55
|
+
};
|
56
|
+
|
57
|
+
interface TenantProps {
|
58
|
+
additionalTenantInfo: any;
|
59
|
+
additionalNodesInfo: any;
|
60
|
+
}
|
61
|
+
|
62
|
+
function Tenant(props: TenantProps) {
|
63
|
+
const [summaryVisibilityState, dispatchSummaryVisibilityAction] = useReducer(
|
64
|
+
paneVisibilityToggleReducerCreator(DEFAULT_IS_TENANT_SUMMARY_COLLAPSED),
|
65
|
+
initialTenantSummaryState,
|
66
|
+
);
|
67
|
+
|
68
|
+
const {currentSchemaPath, currentSchema: currentItem = {}} = useSelector(
|
69
|
+
(state: any) => state.schema,
|
70
|
+
);
|
71
|
+
|
72
|
+
const dispatch = useDispatch();
|
73
|
+
|
74
|
+
const location = useLocation();
|
75
|
+
|
76
|
+
const queryParams = qs.parse(location.search, {
|
77
|
+
ignoreQueryPrefix: true,
|
78
|
+
});
|
79
|
+
|
80
|
+
const {name} = queryParams;
|
81
|
+
const tenantName = name as string;
|
82
|
+
|
83
|
+
useEffect(() => {
|
84
|
+
const schemaPath = currentSchemaPath || tenantName;
|
85
|
+
dispatch(getSchema({path: tenantName}));
|
86
|
+
dispatch(getSchema({path: schemaPath}));
|
87
|
+
dispatch(getSchemaAcl({path: schemaPath}));
|
88
|
+
}, [tenantName, currentSchemaPath, dispatch]);
|
89
|
+
|
90
|
+
useEffect(() => {
|
91
|
+
dispatch(disableAutorefresh());
|
92
|
+
}, [currentSchemaPath, tenantName]);
|
93
|
+
|
94
|
+
useEffect(() => {
|
95
|
+
if (tenantName) {
|
96
|
+
dispatch(getTenantInfo({path: tenantName}));
|
97
|
+
dispatch(
|
98
|
+
setHeader([
|
99
|
+
{
|
100
|
+
text: CLUSTER_PAGES.tenants.title,
|
101
|
+
link: createHref(routes.cluster, {activeTab: CLUSTER_PAGES.tenants.id}),
|
102
|
+
},
|
103
|
+
{
|
104
|
+
text: tenantName.startsWith('/') ? tenantName.slice(1) : tenantName,
|
105
|
+
link: createHref(routes.tenant, undefined, {
|
106
|
+
name: tenantName,
|
107
|
+
}),
|
108
|
+
},
|
109
|
+
]),
|
110
|
+
);
|
111
|
+
}
|
112
|
+
return () => {
|
113
|
+
dispatch(clearTenant());
|
114
|
+
};
|
115
|
+
}, [tenantName, dispatch]);
|
116
|
+
|
117
|
+
const currentPathType = currentItem.PathDescription?.Self?.PathType;
|
118
|
+
|
119
|
+
const entityType = useMemo(() => {
|
120
|
+
return calcEntityType(currentPathType);
|
121
|
+
}, [currentPathType]);
|
122
|
+
|
123
|
+
const onCollapseSummaryHandler = () => {
|
124
|
+
dispatchSummaryVisibilityAction(PaneVisibilityActionTypes.triggerCollapse);
|
125
|
+
};
|
126
|
+
const onExpandSummaryHandler = () => {
|
127
|
+
dispatchSummaryVisibilityAction(PaneVisibilityActionTypes.triggerExpand);
|
128
|
+
};
|
129
|
+
|
130
|
+
const onSplitStartDrugAdditional = () => {
|
131
|
+
dispatchSummaryVisibilityAction(PaneVisibilityActionTypes.clear);
|
132
|
+
};
|
133
|
+
|
134
|
+
return (
|
135
|
+
<div className={b()}>
|
136
|
+
<SplitPane
|
137
|
+
defaultSizePaneKey={DEFAULT_SIZE_TENANT_KEY}
|
138
|
+
defaultSizes={[25, 75]}
|
139
|
+
triggerCollapse={summaryVisibilityState.triggerCollapse}
|
140
|
+
triggerExpand={summaryVisibilityState.triggerExpand}
|
141
|
+
minSize={[36, 200]}
|
142
|
+
onSplitStartDrugAdditional={onSplitStartDrugAdditional}
|
143
|
+
>
|
144
|
+
<ObjectSummary
|
145
|
+
type={entityType as string}
|
146
|
+
onCollapseSummary={onCollapseSummaryHandler}
|
147
|
+
onExpandSummary={onExpandSummaryHandler}
|
148
|
+
isCollapsed={summaryVisibilityState.collapsed}
|
149
|
+
additionalTenantInfo={props.additionalTenantInfo}
|
150
|
+
/>
|
151
|
+
<ObjectGeneral
|
152
|
+
type={entityType as string}
|
153
|
+
additionalTenantInfo={props.additionalTenantInfo}
|
154
|
+
additionalNodesInfo={props.additionalNodesInfo}
|
155
|
+
/>
|
156
|
+
</SplitPane>
|
157
|
+
</div>
|
158
|
+
);
|
159
|
+
}
|
160
|
+
|
161
|
+
export default Tenant;
|
@@ -0,0 +1,48 @@
|
|
1
|
+
//@ts-ignore
|
2
|
+
import Icon from '../../components/Icon/Icon';
|
3
|
+
|
4
|
+
export enum TenantGeneralTabsIds {
|
5
|
+
query = 'query',
|
6
|
+
diagnostics = 'diagnostics',
|
7
|
+
}
|
8
|
+
export enum TenantInfoTabsIds {
|
9
|
+
overview = 'overview',
|
10
|
+
acl = 'acl',
|
11
|
+
schema = 'schema',
|
12
|
+
}
|
13
|
+
|
14
|
+
export enum TenantTabsGroups {
|
15
|
+
info = 'info',
|
16
|
+
general = 'general',
|
17
|
+
generalTab = 'generalTab'
|
18
|
+
}
|
19
|
+
|
20
|
+
export const TENANT_GENERAL_TABS = [
|
21
|
+
{
|
22
|
+
id: TenantGeneralTabsIds.query,
|
23
|
+
title: 'Query',
|
24
|
+
icon: <Icon name="query" viewBox="0 0 16 16" />,
|
25
|
+
},
|
26
|
+
{
|
27
|
+
id: TenantGeneralTabsIds.diagnostics,
|
28
|
+
title: 'Diagnostics',
|
29
|
+
icon: <Icon name="diagnostics" viewBox="0 0 17 16" />,
|
30
|
+
},
|
31
|
+
];
|
32
|
+
export const TENANT_INFO_TABS = [
|
33
|
+
{
|
34
|
+
id: TenantInfoTabsIds.overview,
|
35
|
+
title: 'Overview',
|
36
|
+
},
|
37
|
+
{
|
38
|
+
id: TenantInfoTabsIds.acl,
|
39
|
+
title: 'ACL',
|
40
|
+
},
|
41
|
+
];
|
42
|
+
|
43
|
+
export const TENANT_SCHEMA_TAB = [
|
44
|
+
{
|
45
|
+
id: TenantInfoTabsIds.schema,
|
46
|
+
title: 'Schema',
|
47
|
+
},
|
48
|
+
];
|
@@ -0,0 +1,26 @@
|
|
1
|
+
.kv-pane-visibility-button {
|
2
|
+
&_hidden {
|
3
|
+
display: none;
|
4
|
+
}
|
5
|
+
|
6
|
+
&_bottom {
|
7
|
+
transform: rotate(180deg);
|
8
|
+
}
|
9
|
+
|
10
|
+
&_bottom.rotate {
|
11
|
+
transform: rotate(0);
|
12
|
+
}
|
13
|
+
&_left {
|
14
|
+
transform: rotate(-90deg);
|
15
|
+
}
|
16
|
+
|
17
|
+
&_left.rotate {
|
18
|
+
transform: rotate(90deg);
|
19
|
+
}
|
20
|
+
&_top {
|
21
|
+
}
|
22
|
+
|
23
|
+
&_top.rotate {
|
24
|
+
transform: rotate(180deg);
|
25
|
+
}
|
26
|
+
}
|