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,11 @@
|
|
1
|
-
import React, {useState,
|
1
|
+
import React, {useState, useRef} from 'react';
|
2
2
|
import _ from 'lodash';
|
3
3
|
import cn from 'bem-cn-lite';
|
4
|
-
import {useSelector} from 'react-redux';
|
4
|
+
import {useDispatch, useSelector} from 'react-redux';
|
5
5
|
import {Dialog, DropdownMenu, Popup, TextInput, Button} from '@yandex-cloud/uikit';
|
6
6
|
|
7
|
-
import SavedQueries from '../SavedQueries/SavedQueries';
|
8
7
|
import Icon from '../../../../components/Icon/Icon';
|
8
|
+
import {setQueryNameToEdit} from '../../../../store/reducers/saveQuery';
|
9
9
|
|
10
10
|
import './SaveQuery.scss';
|
11
11
|
|
@@ -14,27 +14,21 @@ const b = cn('kv-save-query');
|
|
14
14
|
const EMBEDDED_VERSION_WARNING =
|
15
15
|
'Please be aware: after cookies delete your saved queries will be lost.';
|
16
16
|
|
17
|
-
function SaveQuery({
|
18
|
-
savedQueries,
|
19
|
-
onSaveQuery,
|
20
|
-
saveButtonDisabled,
|
21
|
-
changeUserInput,
|
22
|
-
onDeleteQuery,
|
23
|
-
}) {
|
17
|
+
function SaveQuery({savedQueries, onSaveQuery, saveButtonDisabled}) {
|
24
18
|
const singleClusterMode = useSelector((state) => state.singleClusterMode);
|
25
19
|
const [isDialogVisible, setIsDialogVisible] = useState(false);
|
26
20
|
const [isEmbeddedWarningVisible, setIsEmbeddedWarningVisible] = useState(false);
|
27
21
|
const [queryName, setQueryName] = useState('');
|
28
22
|
const [validationError, setValidationError] = useState(null);
|
29
|
-
const [queryNameToEdit, setQueryNameToEdit] = useState(null);
|
30
23
|
|
31
|
-
const
|
24
|
+
const queryNameToEdit = useSelector((state) => state.saveQuery);
|
25
|
+
const dispatch = useDispatch();
|
32
26
|
|
33
|
-
const
|
27
|
+
const warningRef = useRef();
|
34
28
|
|
35
29
|
const onSaveQueryClick = () => {
|
36
30
|
setIsDialogVisible(true);
|
37
|
-
setQueryNameToEdit(null);
|
31
|
+
dispatch(setQueryNameToEdit(null));
|
38
32
|
};
|
39
33
|
|
40
34
|
const onCloseDialog = () => {
|
@@ -71,7 +65,7 @@ function SaveQuery({
|
|
71
65
|
|
72
66
|
const onEditQueryClick = () => {
|
73
67
|
onSaveQuery(queryNameToEdit);
|
74
|
-
setQueryNameToEdit(null);
|
68
|
+
dispatch(setQueryNameToEdit(null));
|
75
69
|
};
|
76
70
|
|
77
71
|
const renderDialog = () => {
|
@@ -155,14 +149,7 @@ function SaveQuery({
|
|
155
149
|
<React.Fragment>
|
156
150
|
{queryNameToEdit ? renderSaveDropdownMenu() : renderSaveButton(onSaveQueryClick)}
|
157
151
|
{isDialogVisible && renderDialog()}
|
158
|
-
|
159
|
-
<SavedQueries
|
160
|
-
savedQueries={savedQueries}
|
161
|
-
changeUserInput={changeUserInput}
|
162
|
-
onDeleteQuery={onDeleteQuery}
|
163
|
-
setQueryNameToEdit={setQueryNameToEdit}
|
164
|
-
/>
|
165
|
-
)}
|
152
|
+
|
166
153
|
{singleClusterMode && renderEmbeddedVersionWarning()}
|
167
154
|
</React.Fragment>
|
168
155
|
);
|
@@ -6,44 +6,52 @@
|
|
6
6
|
align-items: flex-start;
|
7
7
|
}
|
8
8
|
&__field-title {
|
9
|
-
|
10
|
-
|
9
|
+
margin-right: 12px;
|
10
|
+
|
11
11
|
font-weight: 500;
|
12
|
+
line-height: 32px;
|
12
13
|
white-space: nowrap;
|
13
|
-
|
14
|
+
@include body2-typography();
|
14
15
|
&.required {
|
15
16
|
&::after {
|
16
17
|
content: '*';
|
18
|
+
|
17
19
|
color: var(--yc-color-text-danger);
|
18
20
|
}
|
19
21
|
}
|
20
22
|
}
|
21
23
|
&__control-wrapper {
|
22
|
-
flex-grow: 1;
|
23
24
|
display: flex;
|
25
|
+
flex-grow: 1;
|
24
26
|
flex-direction: column;
|
25
27
|
}
|
26
28
|
&__error {
|
27
29
|
display: inline-block;
|
30
|
+
|
28
31
|
height: 17px;
|
32
|
+
|
29
33
|
color: var(--yc-color-text-danger);
|
30
34
|
}
|
31
35
|
&__embedded-tooltip {
|
32
|
-
height: 100%;
|
33
36
|
display: flex;
|
34
37
|
align-items: center;
|
35
|
-
|
38
|
+
|
39
|
+
height: 100%;
|
36
40
|
margin-left: -10px;
|
41
|
+
|
42
|
+
color: var(--yc-color-text-secondary);
|
37
43
|
&:hover {
|
38
44
|
cursor: pointer;
|
45
|
+
|
39
46
|
color: var(--yc-color-text-complementary);
|
40
47
|
}
|
41
48
|
}
|
42
49
|
|
43
50
|
&__embedded-popup {
|
51
|
+
max-width: 150px !important;
|
44
52
|
padding: 10px;
|
53
|
+
|
45
54
|
border-radius: 5px;
|
46
|
-
max-width: 150px !important;
|
47
55
|
&::before {
|
48
56
|
border-radius: 5px;
|
49
57
|
}
|
@@ -6,17 +6,21 @@ import {Dialog, Popup, Button} from '@yandex-cloud/uikit';
|
|
6
6
|
import TruncatedQuery from '../../../../components/TruncatedQuery/TruncatedQuery';
|
7
7
|
import Icon from '../../../../components/Icon/Icon';
|
8
8
|
import './SavedQueries.scss';
|
9
|
+
import {setQueryNameToEdit} from '../../../../store/reducers/saveQuery';
|
10
|
+
import {useDispatch} from 'react-redux';
|
9
11
|
|
10
12
|
const b = cn('saved-queries');
|
11
13
|
|
12
14
|
const MAX_QUERY_HEIGHT = 3;
|
13
15
|
|
14
|
-
function SavedQueries({savedQueries, changeUserInput, onDeleteQuery
|
16
|
+
function SavedQueries({savedQueries, changeUserInput, onDeleteQuery}) {
|
15
17
|
const [isSavedQueriesVisible, setIsSavedQueriesVisible] = useState(false);
|
16
18
|
const [isDeleteDialogVisible, setIsDeleteDialogVisible] = useState(false);
|
17
19
|
const [queryNameToDelete, setQueryNameToDelete] = useState(null);
|
18
20
|
|
19
21
|
const [popupForceRender, setPopupForceRender] = useState(null);
|
22
|
+
|
23
|
+
const dispatch = useDispatch();
|
20
24
|
const anchor = useRef(null);
|
21
25
|
|
22
26
|
const onShowSavedQueriesClick = () => {
|
@@ -30,7 +34,7 @@ function SavedQueries({savedQueries, changeUserInput, onDeleteQuery, setQueryNam
|
|
30
34
|
const onSavedQueryClick = (queryText, queryName) => {
|
31
35
|
return () => {
|
32
36
|
changeUserInput({input: queryText});
|
33
|
-
setQueryNameToEdit(queryName);
|
37
|
+
dispatch(setQueryNameToEdit(queryName));
|
34
38
|
setIsSavedQueriesVisible(false);
|
35
39
|
};
|
36
40
|
};
|
@@ -89,7 +93,7 @@ function SavedQueries({savedQueries, changeUserInput, onDeleteQuery, setQueryNam
|
|
89
93
|
className={b('popup-wrapper')}
|
90
94
|
anchorRef={anchor}
|
91
95
|
open={isSavedQueriesVisible}
|
92
|
-
placement={['
|
96
|
+
placement={['bottom-end']}
|
93
97
|
onClose={onCloseSavedQueries}
|
94
98
|
>
|
95
99
|
<div className={b()}>
|
@@ -2,32 +2,38 @@ $popup-width: 700px;
|
|
2
2
|
|
3
3
|
.saved-queries {
|
4
4
|
$block: &;
|
5
|
-
padding: 12px 16px
|
5
|
+
padding: 12px 16px;
|
6
6
|
&__popup-wrapper {
|
7
|
-
|
7
|
+
overflow: hidden;
|
8
|
+
|
8
9
|
width: $popup-width;
|
9
10
|
max-width: $popup-width !important;
|
10
|
-
|
11
|
-
|
11
|
+
|
12
|
+
border-radius: 4px;
|
12
13
|
:nth-child(2) {
|
13
|
-
max-height: 70vh;
|
14
14
|
overflow-y: auto;
|
15
|
+
|
16
|
+
max-height: 50vh;
|
15
17
|
}
|
16
18
|
|
17
19
|
&::before {
|
18
|
-
border-radius: 4px;
|
19
20
|
width: $popup-width;
|
21
|
+
|
22
|
+
border-radius: 4px;
|
20
23
|
}
|
21
24
|
}
|
22
25
|
&__saved-queries-row {
|
23
26
|
display: flex;
|
24
27
|
align-items: center;
|
28
|
+
|
25
29
|
padding: 8px 5px;
|
30
|
+
|
26
31
|
border-bottom: 1px solid var(--yc-color-line-generic);
|
27
32
|
&:hover {
|
33
|
+
cursor: pointer;
|
34
|
+
|
28
35
|
color: var(--yc-color-text-link-hover);
|
29
36
|
background: var(--yc-color-base-simple-hover);
|
30
|
-
cursor: pointer;
|
31
37
|
#{$block}__query-controls {
|
32
38
|
display: flex;
|
33
39
|
}
|
@@ -35,29 +41,32 @@ $popup-width: 700px;
|
|
35
41
|
&_header {
|
36
42
|
font-weight: 500;
|
37
43
|
&:hover {
|
44
|
+
cursor: auto;
|
45
|
+
|
38
46
|
color: var(--yc-color-text-primary);
|
39
47
|
background: var(--yc-color-base-background);
|
40
|
-
cursor: auto;
|
41
48
|
}
|
42
49
|
}
|
43
50
|
}
|
44
51
|
&__query-name {
|
45
|
-
|
46
|
-
flex
|
52
|
+
overflow: hidden;
|
53
|
+
flex: 0 0 90px;
|
54
|
+
|
47
55
|
max-width: 90px;
|
48
|
-
|
49
|
-
|
56
|
+
margin-right: 8px;
|
57
|
+
|
58
|
+
font-weight: 500;
|
50
59
|
white-space: pre-wrap;
|
51
|
-
overflow: hidden;
|
52
60
|
text-overflow: ellipsis;
|
53
|
-
font-weight: 500;
|
54
61
|
}
|
55
62
|
&__query-body {
|
63
|
+
overflow: hidden;
|
56
64
|
flex-grow: 1;
|
65
|
+
|
66
|
+
max-width: 75%;
|
67
|
+
|
57
68
|
white-space: pre;
|
58
69
|
text-overflow: ellipsis;
|
59
|
-
overflow: hidden;
|
60
|
-
max-width: 75%;
|
61
70
|
&_header {
|
62
71
|
display: flex;
|
63
72
|
justify-content: center;
|
@@ -68,9 +77,11 @@ $popup-width: 700px;
|
|
68
77
|
}
|
69
78
|
&__control-button {
|
70
79
|
display: flex;
|
71
|
-
align-items: center;
|
72
80
|
justify-content: center;
|
81
|
+
align-items: center;
|
82
|
+
|
73
83
|
width: 24px;
|
84
|
+
|
74
85
|
color: var(--yc-color-text-hint);
|
75
86
|
&:hover {
|
76
87
|
color: var(--yc-color-text-secondary);
|
@@ -7,7 +7,7 @@ import {formatCPU, formatBytes} from '../../../../utils';
|
|
7
7
|
|
8
8
|
import InfoViewer from '../../../../components/InfoViewer/InfoViewer';
|
9
9
|
|
10
|
-
const b = cn('schema-viewer');
|
10
|
+
const b = cn('schema-info-viewer');
|
11
11
|
|
12
12
|
class SchemaInfoViewer extends React.Component {
|
13
13
|
static propTypes = {
|
@@ -26,7 +26,8 @@ class SchemaInfoViewer extends React.Component {
|
|
26
26
|
const {data} = this.props;
|
27
27
|
|
28
28
|
if (data) {
|
29
|
-
const {
|
29
|
+
const {PathDescription = {}} = data;
|
30
|
+
const {TableStats = {}, TabletMetrics = {}} = PathDescription;
|
30
31
|
const tableStatsInfo =
|
31
32
|
TableStats &&
|
32
33
|
Object.keys(TableStats).map((key) => ({
|
@@ -49,11 +50,10 @@ class SchemaInfoViewer extends React.Component {
|
|
49
50
|
return (
|
50
51
|
<div className={b()}>
|
51
52
|
<div className={b('item')}>
|
52
|
-
{
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
</>
|
53
|
+
{infoLength ? (
|
54
|
+
<InfoViewer info={generalInfo}></InfoViewer>
|
55
|
+
) : (
|
56
|
+
<div>Empty</div>
|
57
57
|
)}
|
58
58
|
</div>
|
59
59
|
</div>
|
@@ -1,5 +1,4 @@
|
|
1
|
-
.schema-viewer {
|
2
|
-
padding: 20px;
|
1
|
+
.schema-info-viewer {
|
3
2
|
overflow: auto;
|
4
3
|
|
5
4
|
&__item {
|
@@ -9,13 +8,4 @@
|
|
9
8
|
grid-template-columns: minmax(max-content, 280px);
|
10
9
|
}
|
11
10
|
}
|
12
|
-
|
13
|
-
&__title {
|
14
|
-
margin: 0;
|
15
|
-
color: var(--yc-color-text-primary);
|
16
|
-
font-size: var(--yc-text-body2-font-size);
|
17
|
-
font-weight: 500;
|
18
|
-
line-height: var(--yc-text-body2-line-height);
|
19
|
-
margin-bottom: 15px;
|
20
|
-
}
|
21
11
|
}
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import ReactDOM from 'react-dom';
|
3
2
|
import {connect} from 'react-redux';
|
4
3
|
import PropTypes from 'prop-types';
|
5
4
|
import cn from 'bem-cn-lite';
|
@@ -13,15 +12,16 @@ import {getDescribe} from '../../../../store/reducers/describe';
|
|
13
12
|
import {getSchemaAcl} from '../../../../store/reducers/schemaAcl';
|
14
13
|
|
15
14
|
import './SchemaNode.scss';
|
15
|
+
import SchemaNodeActions from '../SchemaNodeActions/SchemaNodeActions';
|
16
|
+
import {isTableType} from '../../Tenant';
|
16
17
|
|
17
18
|
const b = cn('schema-node');
|
18
19
|
|
19
|
-
export const
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
];
|
20
|
+
export const SUBDOMAIN_FOLDER_TYPE = 'EPathTypeSubDomain';
|
21
|
+
export const TABLE_TYPE = 'EPathTypeTable';
|
22
|
+
export const OLAP_TABLE_TYPE = 'EPathTypeOlapTable';
|
23
|
+
|
24
|
+
export const FOLDERS_TYPE = ['EPathTypeDir', 'EPathTypeExtSubDomain', 'EPathTypeOlapStore'];
|
25
25
|
|
26
26
|
class SchemaNode extends React.Component {
|
27
27
|
static propTypes = {
|
@@ -30,10 +30,12 @@ class SchemaNode extends React.Component {
|
|
30
30
|
getSchema: PropTypes.func.isRequired,
|
31
31
|
setCurrentSchemaPath: PropTypes.func,
|
32
32
|
currentSchemaPath: PropTypes.string,
|
33
|
+
isRoot: PropTypes.bool,
|
33
34
|
};
|
34
35
|
|
35
36
|
state = {
|
36
37
|
collapsed: true,
|
38
|
+
active: false,
|
37
39
|
};
|
38
40
|
|
39
41
|
schemaNodeRef = React.createRef();
|
@@ -42,7 +44,7 @@ class SchemaNode extends React.Component {
|
|
42
44
|
const {currentSchemaPath, isRoot} = this.props;
|
43
45
|
const schemaPath = this.getSchemaPath();
|
44
46
|
|
45
|
-
if (schemaPath === currentSchemaPath) {
|
47
|
+
if (schemaPath === currentSchemaPath && !this.state.active) {
|
46
48
|
this.addActiveClass();
|
47
49
|
}
|
48
50
|
|
@@ -56,6 +58,15 @@ class SchemaNode extends React.Component {
|
|
56
58
|
}
|
57
59
|
}
|
58
60
|
|
61
|
+
componentDidUpdate() {
|
62
|
+
const {currentSchemaPath} = this.props;
|
63
|
+
const schemaPath = this.getSchemaPath();
|
64
|
+
|
65
|
+
if (schemaPath === currentSchemaPath && !this.state.active) {
|
66
|
+
this.addActiveClass();
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
59
70
|
getSchemaPath = () => {
|
60
71
|
const {data, fullPath, isRoot} = this.props;
|
61
72
|
|
@@ -67,15 +78,18 @@ class SchemaNode extends React.Component {
|
|
67
78
|
};
|
68
79
|
|
69
80
|
setIcon = (data) => {
|
81
|
+
const viewBox = '0 0 16 16';
|
70
82
|
const {collapsed} = this.state;
|
71
83
|
if (FOLDERS_TYPE.indexOf(data.PathType) !== -1) {
|
72
84
|
return collapsed ? (
|
73
|
-
<Icon name="folder" viewBox=
|
85
|
+
<Icon name="folder" viewBox={viewBox} width={16} height={16} />
|
74
86
|
) : (
|
75
|
-
<Icon name="openFolder" viewBox=
|
87
|
+
<Icon name="openFolder" viewBox={viewBox} width={16} height={16} />
|
76
88
|
);
|
77
|
-
} else if (data.PathType ===
|
78
|
-
return <Icon name="table" viewBox=
|
89
|
+
} else if (data.PathType === TABLE_TYPE || data.PathType === OLAP_TABLE_TYPE) {
|
90
|
+
return <Icon name="table" viewBox={viewBox} width={16} height={16} />;
|
91
|
+
} else if (data.PathType === SUBDOMAIN_FOLDER_TYPE) {
|
92
|
+
return <Icon name="subdomain" viewBox={viewBox} width={16} height={16} />;
|
79
93
|
}
|
80
94
|
};
|
81
95
|
|
@@ -85,9 +99,9 @@ class SchemaNode extends React.Component {
|
|
85
99
|
if (currentActiveSchemaNode) {
|
86
100
|
currentActiveSchemaNode.classList.remove(activeClass);
|
87
101
|
}
|
88
|
-
|
89
|
-
const activeNode = ReactDOM.findDOMNode(this);
|
102
|
+
const activeNode = this.schemaNodeRef.current;
|
90
103
|
if (activeNode) {
|
104
|
+
this.setState({active: true});
|
91
105
|
activeNode.classList.add(activeClass);
|
92
106
|
}
|
93
107
|
};
|
@@ -105,18 +119,23 @@ class SchemaNode extends React.Component {
|
|
105
119
|
};
|
106
120
|
|
107
121
|
render() {
|
108
|
-
const {data, fullPath, isRoot = false} = this.props;
|
122
|
+
const {data, fullPath, isRoot = false, currentSchemaPath, currentItem = {}} = this.props;
|
109
123
|
const {collapsed} = this.state;
|
110
124
|
|
111
125
|
if (!data) {
|
112
126
|
return null;
|
113
127
|
}
|
128
|
+
const currentPathType = currentItem.PathDescription?.Self?.PathType;
|
129
|
+
const type = isTableType(currentPathType);
|
114
130
|
|
115
|
-
const hasArrow = data.PathType !==
|
131
|
+
const hasArrow = data.PathType !== TABLE_TYPE;
|
116
132
|
const label = (
|
117
133
|
<div className={b('label')}>
|
118
134
|
{this.setIcon(data)}
|
119
|
-
<div className={b('name')}>
|
135
|
+
<div className={b('name-wrapper')}>
|
136
|
+
<div className={b('name')}>{data.Name}</div>
|
137
|
+
<SchemaNodeActions name={currentSchemaPath} isTableType={type} />
|
138
|
+
</div>
|
120
139
|
</div>
|
121
140
|
);
|
122
141
|
return (
|
@@ -137,6 +156,7 @@ class SchemaNode extends React.Component {
|
|
137
156
|
function mapStateToProps(state) {
|
138
157
|
return {
|
139
158
|
currentSchemaPath: state.schema.currentSchemaPath,
|
159
|
+
currentItem: state.schema.currentSchema,
|
140
160
|
};
|
141
161
|
}
|
142
162
|
|
@@ -3,39 +3,60 @@
|
|
3
3
|
align-items: center;
|
4
4
|
|
5
5
|
.tree-view_item {
|
6
|
-
padding: 5px 0;
|
7
|
-
margin: 0;
|
8
6
|
flex-wrap: wrap;
|
7
|
+
|
8
|
+
margin: 0;
|
9
|
+
padding: 5px 0;
|
9
10
|
}
|
10
11
|
|
11
12
|
.tree-view_children {
|
12
|
-
padding-left: 15px;
|
13
13
|
margin: 0;
|
14
|
+
padding-left: 15px;
|
14
15
|
}
|
15
16
|
|
16
17
|
&__label {
|
17
18
|
display: flex;
|
18
|
-
align-items: center;
|
19
19
|
overflow: hidden;
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
align-items: center;
|
21
|
+
|
22
|
+
width: 100%;
|
23
23
|
height: 20px;
|
24
|
+
padding: 0 5px;
|
25
|
+
|
26
|
+
cursor: pointer;
|
24
27
|
|
25
|
-
|
26
|
-
|
28
|
+
& > svg {
|
29
|
+
color: var(--yc-color-text-hint);
|
27
30
|
}
|
28
31
|
}
|
29
32
|
|
30
|
-
&_active > .tree-view > .tree-view_item
|
33
|
+
&_active > .tree-view > .tree-view_item {
|
34
|
+
font-weight: 600;
|
35
|
+
|
31
36
|
background-color: var(--yc-color-base-info);
|
32
37
|
}
|
33
38
|
|
39
|
+
&__name-wrapper {
|
40
|
+
display: inline-flex;
|
41
|
+
justify-content: space-between;
|
42
|
+
|
43
|
+
width: 100%;
|
44
|
+
}
|
45
|
+
|
34
46
|
&__name {
|
35
47
|
display: inline;
|
36
|
-
text-overflow: ellipsis;
|
37
|
-
white-space: nowrap;
|
38
48
|
overflow: hidden;
|
49
|
+
|
39
50
|
margin-left: 6px;
|
51
|
+
|
52
|
+
white-space: nowrap;
|
53
|
+
text-overflow: ellipsis;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
.tree-view_item {
|
58
|
+
border-bottom: 1px solid var(--yc-color-line-generic);
|
59
|
+
&:hover {
|
60
|
+
background-color: var(--yc-color-base-simple-hover);
|
40
61
|
}
|
41
62
|
}
|
@@ -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;
|