ydb-embedded-ui 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/README.md +2 -2
- 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 +165 -0
- package/dist/containers/Tenant/ObjectSummary/ObjectSummary.tsx +310 -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 +94 -0
- package/dist/containers/Tenant/QueryEditor/QueryEditor.js +291 -264
- package/dist/containers/Tenant/QueryEditor/QueryEditor.scss +47 -18
- package/dist/containers/Tenant/QueryEditor/QueryExplain/QueryExplain.js +132 -32
- 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/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 +25 -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
@@ -1,11 +1,15 @@
|
|
1
1
|
@import '../../../styles/mixins.scss';
|
2
2
|
|
3
3
|
.query-editor {
|
4
|
+
position: relative;
|
5
|
+
|
4
6
|
display: flex;
|
5
|
-
flex-direction: column;
|
6
7
|
flex: 1 1 auto;
|
7
|
-
|
8
|
-
|
8
|
+
flex-direction: column;
|
9
|
+
|
10
|
+
height: calc(100% - 56px);
|
11
|
+
|
12
|
+
@include query-data-table;
|
9
13
|
|
10
14
|
& .yc-button__text {
|
11
15
|
display: flex;
|
@@ -14,44 +18,69 @@
|
|
14
18
|
}
|
15
19
|
|
16
20
|
&__monaco {
|
21
|
+
position: relative;
|
22
|
+
|
17
23
|
display: flex;
|
24
|
+
|
18
25
|
width: 100%;
|
19
26
|
height: 100%;
|
20
|
-
|
27
|
+
padding-top: 9px;
|
21
28
|
}
|
22
29
|
|
23
30
|
&__monaco-wrapper {
|
24
31
|
width: 100%;
|
25
|
-
height: 100
|
32
|
+
height: calc(100% - 49px);
|
26
33
|
min-height: 0;
|
27
34
|
}
|
28
35
|
|
29
36
|
&__pane-wrapper {
|
37
|
+
z-index: 2;
|
38
|
+
|
30
39
|
display: flex;
|
31
40
|
flex-direction: column;
|
32
|
-
|
33
|
-
|
41
|
+
|
42
|
+
background-color: var(--yc-color-base-background);
|
43
|
+
}
|
44
|
+
|
45
|
+
&__upper-controls {
|
46
|
+
position: absolute;
|
47
|
+
top: -38px;
|
48
|
+
right: 16px;
|
49
|
+
|
50
|
+
display: flex;
|
51
|
+
gap: 12px;
|
52
|
+
|
53
|
+
justify-content: flex-end;
|
54
|
+
align-items: center;
|
34
55
|
}
|
35
56
|
|
36
57
|
&__controls {
|
37
58
|
display: flex;
|
59
|
+
flex: 0 0 40px;
|
38
60
|
align-items: flex-end;
|
39
|
-
padding: 10px 0;
|
40
|
-
border-bottom: 1px solid var(--yc-color-line-generic);
|
41
|
-
min-height: 28px;
|
42
61
|
|
43
|
-
|
44
|
-
|
45
|
-
|
62
|
+
min-height: 40px;
|
63
|
+
padding: 5px 20px;
|
64
|
+
|
65
|
+
border-top: 1px solid var(--yc-color-line-generic);
|
66
|
+
border-bottom: 1px solid var(--yc-color-line-generic);
|
67
|
+
background-color: var(--yc-color-base-background);
|
68
|
+
gap: 12px;
|
46
69
|
}
|
47
70
|
|
48
71
|
&__control-run {
|
49
72
|
display: flex;
|
50
73
|
align-items: center;
|
51
|
-
|
74
|
+
.yc-select__option-text {
|
75
|
+
display: none;
|
76
|
+
}
|
52
77
|
|
53
|
-
|
54
|
-
|
78
|
+
.yc-button__text {
|
79
|
+
display: flex;
|
80
|
+
justify-content: center;
|
81
|
+
align-items: center;
|
82
|
+
gap: 8px;
|
83
|
+
}
|
55
84
|
}
|
56
85
|
|
57
86
|
&__history-controls {
|
@@ -61,9 +90,9 @@
|
|
61
90
|
|
62
91
|
&__history-label {
|
63
92
|
margin-right: 8px;
|
64
|
-
}
|
65
93
|
|
66
|
-
|
94
|
+
color: var(--yc-color-text-secondary);
|
95
|
+
}
|
67
96
|
|
68
97
|
&__cell {
|
69
98
|
@include cell-container;
|
@@ -1,11 +1,9 @@
|
|
1
1
|
import React, {useEffect, useState, useMemo} from 'react';
|
2
2
|
import cn from 'bem-cn-lite';
|
3
3
|
import MonacoEditor from 'react-monaco-editor';
|
4
|
-
import {Loader,
|
4
|
+
import {Loader, RadioButton} from '@yandex-cloud/uikit';
|
5
5
|
import JSONTree from 'react-json-inspector';
|
6
6
|
import {LANGUAGE_S_EXPRESSION_ID} from '../../../../utils/monaco';
|
7
|
-
|
8
|
-
import './QueryExplain.scss';
|
9
7
|
import {
|
10
8
|
TopologyWrapper,
|
11
9
|
CompactTopologyWrapper,
|
@@ -14,6 +12,16 @@ import {
|
|
14
12
|
} from '@yandex-cloud/paranoid';
|
15
13
|
import {renderExplainNode} from '../../../../utils';
|
16
14
|
import {explainVersions} from '../../../../store/reducers/explainQuery';
|
15
|
+
import QueryExecutionStatus from '../../../../components/QueryExecutionStatus/QueryExecutionStatus';
|
16
|
+
import Divider from '../../../../components/Divider/Divider';
|
17
|
+
import EnableFullscreenButton from '../../../../components/EnableFullscreenButton/EnableFullscreenButton';
|
18
|
+
import {PaneVisibilityToggleButtons} from '../../utils/paneVisibilityToggleHelpers';
|
19
|
+
import Fullscreen from '../../../../components/Fullscreen/Fullscreen';
|
20
|
+
|
21
|
+
import 'react-json-inspector/json-inspector.css';
|
22
|
+
import './QueryExplain.scss';
|
23
|
+
import {useDispatch, useSelector} from 'react-redux';
|
24
|
+
import { disableFullscreen } from '../../../../store/reducers/fullscreen';
|
17
25
|
|
18
26
|
const b = cn('kv-query-explain');
|
19
27
|
|
@@ -41,20 +49,29 @@ const EDITOR_OPTIONS = {
|
|
41
49
|
wrappingIndent: 'indent',
|
42
50
|
};
|
43
51
|
|
44
|
-
const
|
52
|
+
const ExplainOptionIds = {
|
45
53
|
schema: 'schema',
|
46
54
|
json: 'json',
|
47
55
|
ast: 'ast',
|
48
56
|
};
|
49
57
|
|
50
|
-
const
|
51
|
-
{
|
52
|
-
{
|
53
|
-
{
|
58
|
+
const explainOptions = [
|
59
|
+
{value: ExplainOptionIds.schema, content: 'Schema'},
|
60
|
+
{value: ExplainOptionIds.json, content: 'JSON'},
|
61
|
+
{value: ExplainOptionIds.ast, content: 'AST'},
|
54
62
|
];
|
55
63
|
|
56
64
|
function QueryExplain(props) {
|
57
|
-
const
|
65
|
+
const dispatch = useDispatch()
|
66
|
+
const [activeOption, setActiveOption] = useState(ExplainOptionIds.schema);
|
67
|
+
|
68
|
+
const isFullscreen = useSelector((state) => state.fullscreen);
|
69
|
+
|
70
|
+
useEffect(() => {
|
71
|
+
return () => {
|
72
|
+
dispatch(disableFullscreen());
|
73
|
+
};
|
74
|
+
}, []);
|
58
75
|
|
59
76
|
const {explain = {}, theme} = props;
|
60
77
|
const {links, nodes, version, graphDepth} = explain;
|
@@ -95,17 +112,36 @@ function QueryExplain(props) {
|
|
95
112
|
}, [links, nodes, theme, version]);
|
96
113
|
|
97
114
|
useEffect(() => {
|
98
|
-
if (!props.ast &&
|
115
|
+
if (!props.ast && activeOption === ExplainOptionIds.ast) {
|
99
116
|
props.astQuery();
|
100
117
|
}
|
101
|
-
}, [
|
118
|
+
}, [activeOption]);
|
102
119
|
|
103
|
-
const
|
104
|
-
|
120
|
+
const onSelectOption = (tabId) => {
|
121
|
+
setActiveOption(tabId);
|
105
122
|
};
|
106
123
|
|
107
|
-
const
|
124
|
+
const renderLoader = () => {
|
108
125
|
return (
|
126
|
+
<div className={b('loader')}>
|
127
|
+
<Loader size="m" />
|
128
|
+
</div>
|
129
|
+
);
|
130
|
+
};
|
131
|
+
|
132
|
+
const renderStub = () => {
|
133
|
+
const {explain} = props;
|
134
|
+
if (!explain) {
|
135
|
+
return 'Explain of query is empty';
|
136
|
+
}
|
137
|
+
if (!explain.nodes.length) {
|
138
|
+
return 'There is no explanation for the request';
|
139
|
+
}
|
140
|
+
return null;
|
141
|
+
};
|
142
|
+
|
143
|
+
const renderTextExplain = () => {
|
144
|
+
const content = (
|
109
145
|
<JSONTree
|
110
146
|
data={props.explain?.pristine}
|
111
147
|
isExpanded={() => true}
|
@@ -115,14 +151,24 @@ function QueryExplain(props) {
|
|
115
151
|
}}
|
116
152
|
/>
|
117
153
|
);
|
154
|
+
return (
|
155
|
+
<React.Fragment>
|
156
|
+
{content}
|
157
|
+
{renderStub()}
|
158
|
+
{isFullscreen && (
|
159
|
+
<Fullscreen>
|
160
|
+
<div className={b('inspector', {fullscreen: true})}>{content}</div>
|
161
|
+
</Fullscreen>
|
162
|
+
)}
|
163
|
+
</React.Fragment>
|
164
|
+
);
|
118
165
|
};
|
119
166
|
|
120
167
|
const renderAstExplain = () => {
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
) : (
|
168
|
+
if (!props.ast) {
|
169
|
+
return 'There is no AST explanation for the request';
|
170
|
+
}
|
171
|
+
const content = (
|
126
172
|
<div className={b('ast')}>
|
127
173
|
<MonacoEditor
|
128
174
|
language={LANGUAGE_S_EXPRESSION_ID}
|
@@ -132,35 +178,89 @@ function QueryExplain(props) {
|
|
132
178
|
/>
|
133
179
|
</div>
|
134
180
|
);
|
181
|
+
return (
|
182
|
+
<React.Fragment>
|
183
|
+
{content}
|
184
|
+
{isFullscreen && <Fullscreen>{content}</Fullscreen>}
|
185
|
+
</React.Fragment>
|
186
|
+
);
|
135
187
|
};
|
136
188
|
|
137
189
|
const renderGraph = () => {
|
138
190
|
const graphHeight = `${Math.max(graphDepth * 100, 200)}px`;
|
139
|
-
|
191
|
+
const content = (
|
140
192
|
<div
|
141
193
|
className={b('explain-canvas-container', {
|
142
|
-
hidden:
|
194
|
+
hidden: activeOption !== ExplainOptionIds.schema,
|
143
195
|
})}
|
144
|
-
style={{height: graphHeight, minHeight: graphHeight}}
|
196
|
+
style={{height: graphHeight, minHeight: graphHeight, width: '100%'}}
|
145
197
|
>
|
146
198
|
{graph}
|
147
199
|
</div>
|
148
200
|
);
|
201
|
+
return (
|
202
|
+
<React.Fragment>
|
203
|
+
{content}
|
204
|
+
{isFullscreen && <Fullscreen>{content}</Fullscreen>}
|
205
|
+
{renderStub()}
|
206
|
+
</React.Fragment>
|
207
|
+
);
|
208
|
+
};
|
209
|
+
|
210
|
+
const renderContent = () => {
|
211
|
+
const {error, loading, loadingAst} = props;
|
212
|
+
if (loading || loadingAst) {
|
213
|
+
return renderLoader();
|
214
|
+
}
|
215
|
+
|
216
|
+
if (error) {
|
217
|
+
return error.data ? error.data : error;
|
218
|
+
}
|
219
|
+
|
220
|
+
switch (activeOption) {
|
221
|
+
case ExplainOptionIds.json: {
|
222
|
+
return renderTextExplain();
|
223
|
+
}
|
224
|
+
case ExplainOptionIds.ast: {
|
225
|
+
return renderAstExplain();
|
226
|
+
}
|
227
|
+
case ExplainOptionIds.schema: {
|
228
|
+
return renderGraph();
|
229
|
+
}
|
230
|
+
default:
|
231
|
+
return null;
|
232
|
+
}
|
149
233
|
};
|
150
234
|
|
151
235
|
return (
|
152
236
|
<React.Fragment>
|
153
|
-
<div className={b('
|
154
|
-
<
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
237
|
+
<div className={b('controls')}>
|
238
|
+
<div className={b('controls-right')}>
|
239
|
+
<QueryExecutionStatus hasError={Boolean(props.error)} />
|
240
|
+
{!props.error && (
|
241
|
+
<React.Fragment>
|
242
|
+
<Divider />
|
243
|
+
<RadioButton
|
244
|
+
options={explainOptions}
|
245
|
+
value={activeOption}
|
246
|
+
onUpdate={onSelectOption}
|
247
|
+
/>
|
248
|
+
</React.Fragment>
|
249
|
+
)}
|
250
|
+
</div>
|
251
|
+
<div className={b('controls-left')}>
|
252
|
+
<EnableFullscreenButton
|
253
|
+
disabled={Boolean(props.error) || activeOption === ExplainOptionIds.schema}
|
254
|
+
/>
|
255
|
+
<PaneVisibilityToggleButtons
|
256
|
+
onCollapse={props.onCollapseResults}
|
257
|
+
onExpand={props.onExpandResults}
|
258
|
+
isCollapsed={props.isResultsCollapsed}
|
259
|
+
initialDirection="bottom"
|
260
|
+
/>
|
261
|
+
</div>
|
160
262
|
</div>
|
161
|
-
{
|
162
|
-
{activeTab === TabsIds.ast && renderAstExplain()}
|
163
|
-
{activeTab === TabsIds.schema && renderGraph()}
|
263
|
+
<div className={b('result')}>{renderContent()}</div>
|
164
264
|
</React.Fragment>
|
165
265
|
);
|
166
266
|
}
|
@@ -1,42 +1,78 @@
|
|
1
1
|
@import '../../../../styles/mixins.scss';
|
2
2
|
|
3
3
|
.kv-query-explain {
|
4
|
-
&
|
5
|
-
|
4
|
+
&__result {
|
5
|
+
display: flex;
|
6
|
+
overflow: auto;
|
7
|
+
flex-grow: 1;
|
8
|
+
flex-direction: column;
|
9
|
+
|
10
|
+
margin-top: 20px;
|
11
|
+
padding: 0px 8px;
|
6
12
|
}
|
7
|
-
&
|
13
|
+
&__controls {
|
8
14
|
position: sticky;
|
15
|
+
z-index: 2;
|
9
16
|
top: 0;
|
17
|
+
|
18
|
+
display: flex;
|
19
|
+
justify-content: space-between;
|
20
|
+
align-items: center;
|
21
|
+
|
22
|
+
padding: 12px 20px;
|
23
|
+
|
24
|
+
border-bottom: 1px solid var(--yc-color-line-generic);
|
10
25
|
background-color: var(--yc-color-base-background);
|
11
|
-
|
12
|
-
|
26
|
+
}
|
27
|
+
&__controls-right {
|
28
|
+
display: flex;
|
29
|
+
gap: 12px;
|
30
|
+
|
31
|
+
height: 100%;
|
32
|
+
}
|
33
|
+
&__controls-left {
|
34
|
+
display: flex;
|
35
|
+
gap: 4px;
|
36
|
+
.yc-button__text {
|
37
|
+
margin: 0 6px;
|
38
|
+
}
|
13
39
|
}
|
14
40
|
&__explain-canvas-container {
|
15
|
-
margin-bottom: 20px;
|
16
41
|
overflow-y: auto;
|
42
|
+
|
43
|
+
margin-bottom: 20px;
|
17
44
|
&_hidden {
|
18
45
|
display: none;
|
19
46
|
}
|
20
47
|
}
|
21
48
|
&__inspector {
|
22
|
-
@include json-tree-styles();
|
23
49
|
overflow-y: auto;
|
50
|
+
|
51
|
+
width: 100%;
|
52
|
+
@include json-tree-styles();
|
24
53
|
&
|
25
54
|
.json-inspector__leaf.json-inspector__leaf_root.json-inspector__leaf_expanded.json-inspector__leaf_composite {
|
26
55
|
max-width: calc(100% - 50px);
|
27
56
|
}
|
57
|
+
|
58
|
+
&_fullscreen {
|
59
|
+
padding: 10px;
|
60
|
+
}
|
28
61
|
}
|
29
62
|
|
30
63
|
&__ast {
|
64
|
+
width: 100%;
|
65
|
+
height: 100%;
|
31
66
|
margin: 20px 0;
|
67
|
+
|
32
68
|
white-space: pre-wrap;
|
33
|
-
height: 100%;
|
34
69
|
}
|
35
70
|
&__loader {
|
36
|
-
width: 100%;
|
37
|
-
margin-top: 20px;
|
38
71
|
display: flex;
|
39
|
-
align-items: center;
|
40
72
|
justify-content: center;
|
73
|
+
align-items: center;
|
74
|
+
|
75
|
+
width: 100%;
|
76
|
+
margin-top: 20px;
|
41
77
|
}
|
42
78
|
}
|
@@ -1,31 +1,61 @@
|
|
1
|
-
import React, {useState} from 'react';
|
1
|
+
import React, {useEffect, useState} from 'react';
|
2
|
+
import {useDispatch, useSelector} from 'react-redux';
|
2
3
|
import cn from 'bem-cn-lite';
|
3
|
-
import {
|
4
|
+
import {RadioButton} from '@yandex-cloud/uikit';
|
4
5
|
import JSONTree from 'react-json-inspector';
|
5
6
|
|
7
|
+
import CopyToClipboard from '../../../../components/CopyToClipboard/CopyToClipboard';
|
8
|
+
import Divider from '../../../../components/Divider/Divider';
|
9
|
+
import Fullscreen from '../../../../components/Fullscreen/Fullscreen';
|
10
|
+
import {disableFullscreen} from '../../../../store/reducers/fullscreen';
|
11
|
+
|
6
12
|
import './QueryResult.scss';
|
13
|
+
import {PaneVisibilityToggleButtons} from '../../utils/paneVisibilityToggleHelpers';
|
14
|
+
import QueryExecutionStatus from '../../../../components/QueryExecutionStatus/QueryExecutionStatus';
|
15
|
+
import EnableFullscreenButton from '../../../../components/EnableFullscreenButton/EnableFullscreenButton';
|
7
16
|
|
8
17
|
const b = cn('kv-query-result');
|
9
18
|
|
10
|
-
const
|
19
|
+
const resultOptionsIds = {
|
11
20
|
result: 'result',
|
12
21
|
stats: 'stats',
|
13
22
|
};
|
14
23
|
|
15
|
-
const
|
16
|
-
{
|
17
|
-
{
|
24
|
+
const resultOptions = [
|
25
|
+
{value: resultOptionsIds.result, content: 'Result'},
|
26
|
+
{value: resultOptionsIds.stats, content: 'Stats'},
|
18
27
|
];
|
19
28
|
|
20
29
|
function QueryResult(props) {
|
21
|
-
const [
|
30
|
+
const [activeSection, setActiveSection] = useState(resultOptionsIds.result);
|
31
|
+
const isFullscreen = useSelector((state) => state.fullscreen);
|
32
|
+
const dispatch = useDispatch();
|
33
|
+
|
34
|
+
useEffect(() => {
|
35
|
+
return () => {
|
36
|
+
dispatch(disableFullscreen());
|
37
|
+
};
|
38
|
+
}, []);
|
22
39
|
|
23
|
-
const
|
24
|
-
|
40
|
+
const onSelectSection = (value) => {
|
41
|
+
setActiveSection(value);
|
25
42
|
};
|
26
43
|
|
27
|
-
const
|
44
|
+
const renderClipboardButton = () => {
|
45
|
+
const {textResults, copyDisabled} = props;
|
46
|
+
|
28
47
|
return (
|
48
|
+
<CopyToClipboard
|
49
|
+
text={textResults}
|
50
|
+
title="Copy results"
|
51
|
+
toastText="Results were copied to clipboard successfully"
|
52
|
+
disabled={copyDisabled}
|
53
|
+
/>
|
54
|
+
);
|
55
|
+
};
|
56
|
+
|
57
|
+
const renderStats = () => {
|
58
|
+
const content = (
|
29
59
|
<JSONTree
|
30
60
|
data={props.stats}
|
31
61
|
isExpanded={() => true}
|
@@ -35,21 +65,60 @@ function QueryResult(props) {
|
|
35
65
|
}}
|
36
66
|
/>
|
37
67
|
);
|
68
|
+
return (
|
69
|
+
<React.Fragment>
|
70
|
+
{content}
|
71
|
+
{isFullscreen && (
|
72
|
+
<Fullscreen>
|
73
|
+
<div className={b('inspector', {fullscreen: true})}>{content}</div>
|
74
|
+
</Fullscreen>
|
75
|
+
)}
|
76
|
+
</React.Fragment>
|
77
|
+
);
|
78
|
+
};
|
79
|
+
|
80
|
+
const renderResult = () => {
|
81
|
+
const {result} = props;
|
82
|
+
|
83
|
+
return (
|
84
|
+
<React.Fragment>
|
85
|
+
{result}
|
86
|
+
{isFullscreen && <Fullscreen><div className={b('result', {fullscreen: true})}>{result}</div></Fullscreen>}
|
87
|
+
</React.Fragment>
|
88
|
+
);
|
38
89
|
};
|
39
90
|
|
40
91
|
return (
|
41
92
|
<React.Fragment>
|
42
|
-
{
|
43
|
-
<
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
93
|
+
<div className={b('controls')}>
|
94
|
+
<div className={b('controls-right')}>
|
95
|
+
<QueryExecutionStatus hasError={Boolean(props.error)} />
|
96
|
+
|
97
|
+
{props.stats && !props.error && (
|
98
|
+
<React.Fragment>
|
99
|
+
<Divider />
|
100
|
+
<RadioButton
|
101
|
+
options={resultOptions}
|
102
|
+
value={activeSection}
|
103
|
+
onUpdate={onSelectSection}
|
104
|
+
/>
|
105
|
+
</React.Fragment>
|
106
|
+
)}
|
107
|
+
</div>
|
108
|
+
<div className={b('controls-left')}>
|
109
|
+
{renderClipboardButton()}
|
110
|
+
<EnableFullscreenButton disabled={Boolean(props.error)}/>
|
111
|
+
<PaneVisibilityToggleButtons
|
112
|
+
onCollapse={props.onCollapseResults}
|
113
|
+
onExpand={props.onExpandResults}
|
114
|
+
isCollapsed={props.isResultsCollapsed}
|
115
|
+
initialDirection="bottom"
|
116
|
+
/>
|
117
|
+
</div>
|
118
|
+
</div>
|
50
119
|
<div className={b('result')}>
|
51
|
-
{
|
52
|
-
{
|
120
|
+
{activeSection === resultOptionsIds.result && renderResult()}
|
121
|
+
{activeSection === resultOptionsIds.stats && renderStats()}
|
53
122
|
</div>
|
54
123
|
</React.Fragment>
|
55
124
|
);
|
@@ -2,23 +2,77 @@
|
|
2
2
|
|
3
3
|
.kv-query-result {
|
4
4
|
&__result {
|
5
|
-
overflow: auto;
|
6
|
-
margin-top: 20px;
|
7
5
|
display: flex;
|
8
|
-
|
6
|
+
overflow: auto;
|
9
7
|
flex-grow: 1;
|
8
|
+
flex-direction: column;
|
9
|
+
|
10
|
+
margin-top: 20px;
|
11
|
+
padding: 0px 8px;
|
12
|
+
@include query-data-table();
|
10
13
|
& .data-table__table-wrapper {
|
11
14
|
padding-bottom: 0;
|
12
15
|
}
|
16
|
+
&_fullscreen {
|
17
|
+
width: 100%;
|
18
|
+
padding: 10px;
|
19
|
+
}
|
13
20
|
}
|
14
|
-
|
21
|
+
|
22
|
+
&__controls {
|
15
23
|
position: sticky;
|
24
|
+
z-index: 2;
|
16
25
|
top: 0;
|
26
|
+
|
27
|
+
display: flex;
|
28
|
+
justify-content: space-between;
|
29
|
+
align-items: center;
|
30
|
+
|
31
|
+
padding: 12px 20px;
|
32
|
+
|
33
|
+
border-bottom: 1px solid var(--yc-color-line-generic);
|
17
34
|
background-color: var(--yc-color-base-background);
|
18
|
-
|
35
|
+
}
|
36
|
+
|
37
|
+
&__controls-right {
|
38
|
+
display: flex;
|
39
|
+
gap: 12px;
|
40
|
+
|
41
|
+
height: 100%;
|
42
|
+
}
|
43
|
+
&__controls-left {
|
44
|
+
display: flex;
|
45
|
+
gap: 4px;
|
46
|
+
.yc-button__text {
|
47
|
+
margin: 0 6px;
|
48
|
+
}
|
19
49
|
}
|
20
50
|
&__inspector {
|
21
|
-
@include json-tree-styles();
|
22
51
|
max-width: calc(100% - 50px);
|
52
|
+
@include json-tree-styles();
|
53
|
+
&_fullscreen {
|
54
|
+
overflow: auto;
|
55
|
+
|
56
|
+
width: 100%;
|
57
|
+
height: 100%;
|
58
|
+
padding: 10px;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
&__fullscreen-table-wrapper {
|
63
|
+
overflow: auto;
|
64
|
+
|
65
|
+
width: 100%;
|
66
|
+
height: 100%;
|
67
|
+
margin: 20px;
|
68
|
+
|
69
|
+
background-color: var(--yc-color-base-background);
|
70
|
+
@include table-styles();
|
71
|
+
table {
|
72
|
+
width: 100% !important;
|
73
|
+
}
|
74
|
+
.data-table__table-wrapper {
|
75
|
+
padding: 0 !important;
|
76
|
+
}
|
23
77
|
}
|
24
78
|
}
|