ydb-embedded-ui 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +8 -0
- package/README.md +28 -0
- package/dist/HOCS/WithSearch/WithSearch.js +26 -0
- package/dist/HOCS/index.js +1 -0
- package/dist/assets/icons/bug.svg +1 -0
- package/dist/assets/icons/close.svg +1 -0
- package/dist/assets/icons/control-menu-button.svg +1 -0
- package/dist/assets/icons/databases.svg +3 -0
- package/dist/assets/icons/dots.svg +1 -0
- package/dist/assets/icons/server.svg +1 -0
- package/dist/assets/icons/settings-with-dot.svg +1 -0
- package/dist/assets/icons/settings.svg +1 -0
- package/dist/assets/icons/signIn.svg +1 -0
- package/dist/assets/icons/signOut.svg +1 -0
- package/dist/assets/icons/star.svg +1 -0
- package/dist/assets/icons/storage.svg +1 -0
- package/dist/assets/icons/support.svg +1 -0
- package/dist/assets/icons/user-check.svg +1 -0
- package/dist/assets/icons/user-secret.svg +1 -0
- package/dist/assets/icons/ydb.svg +4 -0
- package/dist/components/AsideNavigation/AsideHeader.scss +148 -0
- package/dist/components/AsideNavigation/AsideHeader.tsx +388 -0
- package/dist/components/AsideNavigation/AsideHeaderFooterItem/AsideHeaderFooterItem.scss +82 -0
- package/dist/components/AsideNavigation/AsideHeaderFooterItem/AsideHeaderFooterItem.tsx +138 -0
- package/dist/components/AsideNavigation/AsideHeaderFooterSlot/AsideHeaderFooterSlot.tsx +33 -0
- package/dist/components/AsideNavigation/AsideHeaderFooterSlot/SlotsContext.tsx +49 -0
- package/dist/components/AsideNavigation/AsideHeaderTooltip/AsideHeaderTooltip.scss +16 -0
- package/dist/components/AsideNavigation/AsideHeaderTooltip/AsideHeaderTooltip.tsx +37 -0
- package/dist/components/AsideNavigation/CompositeBar/CompositeBar.scss +108 -0
- package/dist/components/AsideNavigation/CompositeBar/CompositeBar.tsx +282 -0
- package/dist/components/AsideNavigation/Content/Content.tsx +35 -0
- package/dist/components/AsideNavigation/Drawer/Drawer.scss +76 -0
- package/dist/components/AsideNavigation/Drawer/Drawer.tsx +134 -0
- package/dist/components/AsideNavigation/Drawer/index.ts +1 -0
- package/dist/components/AsideNavigation/Logo/Logo.scss +44 -0
- package/dist/components/AsideNavigation/Logo/Logo.tsx +82 -0
- package/dist/components/AsideNavigation/Settings/README.md +92 -0
- package/dist/components/AsideNavigation/Settings/Settings.scss +113 -0
- package/dist/components/AsideNavigation/Settings/Settings.tsx +270 -0
- package/dist/components/AsideNavigation/Settings/SettingsMenu/SettingsMenu.scss +70 -0
- package/dist/components/AsideNavigation/Settings/SettingsMenu/SettingsMenu.tsx +141 -0
- package/dist/components/AsideNavigation/Settings/SettingsSearch/SettingsSearch.tsx +57 -0
- package/dist/components/AsideNavigation/Settings/collect-settings.ts +156 -0
- package/dist/components/AsideNavigation/Settings/filter-settings.ts +38 -0
- package/dist/components/AsideNavigation/Settings/helpers.ts +39 -0
- package/dist/components/AsideNavigation/Settings/i18n/en.json +5 -0
- package/dist/components/AsideNavigation/Settings/i18n/index.ts +11 -0
- package/dist/components/AsideNavigation/Settings/i18n/ru.json +5 -0
- package/dist/components/AsideNavigation/Settings/index.ts +1 -0
- package/dist/components/AsideNavigation/constants.ts +28 -0
- package/dist/components/AsideNavigation/helpers.ts +34 -0
- package/dist/components/AsideNavigation/i18n/en.json +4 -0
- package/dist/components/AsideNavigation/i18n/index.ts +11 -0
- package/dist/components/AsideNavigation/i18n/ru.json +4 -0
- package/dist/components/AsideNavigation/icons.ts +32 -0
- package/dist/components/AsideNavigation/types.ts +23 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js +25 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.scss +4 -0
- package/dist/components/ClusterInfo/ClusterInfo.scss +65 -0
- package/dist/components/ClusterInfo/ClusterInfo.tsx +157 -0
- package/dist/components/Collapse/Collapse.js +84 -0
- package/dist/components/Collapse/Collapse.scss +70 -0
- package/dist/components/CriticalActionDialog/CriticalActionDialog.js +53 -0
- package/dist/components/CriticalActionDialog/CriticalActionDialog.scss +31 -0
- package/dist/components/EmptyState/EmptyState.js +48 -0
- package/dist/components/EmptyState/EmptyState.scss +70 -0
- package/dist/components/EntityStatus/EntityStatus.js +96 -0
- package/dist/components/EntityStatus/EntityStatus.scss +81 -0
- package/dist/components/FullGroupViewer/FullGroupViewer.js +149 -0
- package/dist/components/FullGroupViewer/FullGroupViewer.scss +32 -0
- package/dist/components/FullNodeViewer/FullNodeViewer.js +108 -0
- package/dist/components/FullNodeViewer/FullNodeViewer.scss +78 -0
- package/dist/components/GroupTreeViewer/GroupTreeViewer.js +86 -0
- package/dist/components/GroupTreeViewer/GroupTreeViewer.scss +17 -0
- package/dist/components/GroupViewer/GroupViewer.js +100 -0
- package/dist/components/GroupViewer/GroupViewer.scss +41 -0
- package/dist/components/Hotkey/Hotkey.js +102 -0
- package/dist/components/Icon/Icon.js +26 -0
- package/dist/components/InfoViewer/InfoViewer.js +47 -0
- package/dist/components/InfoViewer/InfoViewer.scss +48 -0
- package/dist/components/InternalLink/InternalLink.js +15 -0
- package/dist/components/NodesViewer/NodesViewer.js +183 -0
- package/dist/components/NodesViewer/NodesViewer.scss +66 -0
- package/dist/components/PDiskViewer/PDiskViewer.js +80 -0
- package/dist/components/PDiskViewer/PDiskViewer.scss +40 -0
- package/dist/components/Pagination/Pagination.js +63 -0
- package/dist/components/Pagination/Pagination.scss +25 -0
- package/dist/components/PoolBar/PoolBar.js +52 -0
- package/dist/components/PoolBar/PoolBar.scss +40 -0
- package/dist/components/PoolUsage/PoolUsage.js +54 -0
- package/dist/components/PoolUsage/PoolUsage.scss +65 -0
- package/dist/components/PoolsGraph/PoolsGraph.js +33 -0
- package/dist/components/PoolsGraph/PoolsGraph.scss +3 -0
- package/dist/components/ProblemFilter/ProblemFilter.js +24 -0
- package/dist/components/ProgressViewer/ProgressViewer.js +92 -0
- package/dist/components/ProgressViewer/ProgressViewer.scss +84 -0
- package/dist/components/SplitPane/SplitPane.js +368 -0
- package/dist/components/SplitPane/SplitPane.scss +107 -0
- package/dist/components/SplitPane/index.js +3 -0
- package/dist/components/Tablet/Tablet.js +61 -0
- package/dist/components/Tablet/Tablet.scss +49 -0
- package/dist/components/TabletsStatistic/TabletsStatistic.js +58 -0
- package/dist/components/TabletsStatistic/TabletsStatistic.scss +41 -0
- package/dist/components/TabletsViewer/TabletsViewer.js +44 -0
- package/dist/components/TabletsViewer/TabletsViewer.scss +37 -0
- package/dist/components/Tag/Tag.js +14 -0
- package/dist/components/Tag/Tag.scss +17 -0
- package/dist/components/Tags/Tags.js +36 -0
- package/dist/components/Tags/Tags.scss +5 -0
- package/dist/components/TenantOverview/TenantOverview.js +148 -0
- package/dist/components/TenantOverview/TenantOverview.scss +75 -0
- package/dist/components/TreeView/TreeView.js +60 -0
- package/dist/components/TreeView/TreeView.scss +30 -0
- package/dist/components/TruncatedQuery/TruncatedQuery.js +26 -0
- package/dist/components/TruncatedQuery/TruncatedQuery.scss +12 -0
- package/dist/containers/App/App.js +67 -0
- package/dist/containers/App/App.scss +154 -0
- package/dist/containers/App/Content.js +109 -0
- package/dist/containers/App/TipPopup/TipPopup.js +66 -0
- package/dist/containers/App/TipPopup/TipPopup.scss +42 -0
- package/dist/containers/AppIcons/AppIcons.js +477 -0
- package/dist/containers/AsideNavigation/AsideNavigation.scss +43 -0
- package/dist/containers/AsideNavigation/AsideNavigation.tsx +228 -0
- package/dist/containers/Authentication/Authentication.scss +37 -0
- package/dist/containers/Authentication/Authentication.tsx +89 -0
- package/dist/containers/Cluster/Cluster.js +168 -0
- package/dist/containers/Cluster/Cluster.scss +52 -0
- package/dist/containers/Group/Group.js +97 -0
- package/dist/containers/Group/Group.scss +6 -0
- package/dist/containers/Header/Header.js +88 -0
- package/dist/containers/Header/Header.scss +72 -0
- package/dist/containers/Header/Host/Host.js +66 -0
- package/dist/containers/Header/Host/Host.scss +43 -0
- package/dist/containers/Heatmap/Heatmap.js +246 -0
- package/dist/containers/Heatmap/Heatmap.scss +94 -0
- package/dist/containers/Heatmap/HeatmapCanvas/HeatmapCanvas.js +167 -0
- package/dist/containers/Heatmap/Histogram/Histogram.js +108 -0
- package/dist/containers/Heatmap/Histogram/Histogram.scss +49 -0
- package/dist/containers/Heatmap/util.js +110 -0
- package/dist/containers/Node/Node.js +184 -0
- package/dist/containers/Node/Node.scss +34 -0
- package/dist/containers/Node/NodePages.js +13 -0
- package/dist/containers/Nodes/Nodes.js +193 -0
- package/dist/containers/Nodes/Nodes.scss +50 -0
- package/dist/containers/Pdisk/Pdisk.js +159 -0
- package/dist/containers/Pdisk/Pdisk.scss +40 -0
- package/dist/containers/Pool/Pool.js +169 -0
- package/dist/containers/Pool/Pool.scss +32 -0
- package/dist/containers/ReduxTooltip/ReduxTooltip.js +108 -0
- package/dist/containers/ReduxTooltip/ReduxTooltip.scss +67 -0
- package/dist/containers/StorageV2/DiskStateProgressBar/DiskStateProgressBar.scss +81 -0
- package/dist/containers/StorageV2/DiskStateProgressBar/DiskStateProgressBar.tsx +56 -0
- package/dist/containers/StorageV2/Pdisk/Pdisk.scss +32 -0
- package/dist/containers/StorageV2/Pdisk/Pdisk.tsx +167 -0
- package/dist/containers/StorageV2/Storage.js +249 -0
- package/dist/containers/StorageV2/Storage.scss +57 -0
- package/dist/containers/StorageV2/StorageFilter/StorageFilter.js +39 -0
- package/dist/containers/StorageV2/StorageGroups/StorageGroups.scss +26 -0
- package/dist/containers/StorageV2/StorageGroups/StorageGroups.tsx +234 -0
- package/dist/containers/StorageV2/StorageNodes/StorageNodes.scss +30 -0
- package/dist/containers/StorageV2/StorageNodes/StorageNodes.tsx +135 -0
- package/dist/containers/StorageV2/Vdisk/Vdisk.js +250 -0
- package/dist/containers/StorageV2/Vdisk/Vdisk.scss +32 -0
- package/dist/containers/Tablet/Tablet.js +453 -0
- package/dist/containers/Tablet/Tablet.scss +88 -0
- package/dist/containers/Tablets/Tablets.js +306 -0
- package/dist/containers/Tablets/Tablets.scss +77 -0
- package/dist/containers/TabletsFilters/TabletsFilters.js +412 -0
- package/dist/containers/TabletsFilters/TabletsFilters.scss +104 -0
- package/dist/containers/Tenant/Acl/Acl.js +149 -0
- package/dist/containers/Tenant/Acl/Acl.scss +34 -0
- package/dist/containers/Tenant/Compute/Compute.js +110 -0
- package/dist/containers/Tenant/Compute/Compute.scss +6 -0
- package/dist/containers/Tenant/Describe/Describe.js +81 -0
- package/dist/containers/Tenant/Describe/Describe.scss +25 -0
- package/dist/containers/Tenant/Healthcheck/Healthcheck.js +116 -0
- package/dist/containers/Tenant/Healthcheck/Healthcheck.scss +64 -0
- package/dist/containers/Tenant/Healthcheck/IssuesViewer/IssueViewer.scss +164 -0
- package/dist/containers/Tenant/Healthcheck/IssuesViewer/IssuesViewer.js +185 -0
- package/dist/containers/Tenant/Network/Network.js +341 -0
- package/dist/containers/Tenant/Network/Network.scss +145 -0
- package/dist/containers/Tenant/Network/NodeNetwork/NodeNetwork.js +71 -0
- package/dist/containers/Tenant/Network/NodeNetwork/NodeNetwork.scss +52 -0
- package/dist/containers/Tenant/Preview/Preview.js +169 -0
- package/dist/containers/Tenant/Preview/Preview.scss +20 -0
- package/dist/containers/Tenant/QueryEditor/QueryEditor.js +649 -0
- package/dist/containers/Tenant/QueryEditor/QueryEditor.scss +71 -0
- package/dist/containers/Tenant/QueryEditor/QueryExplain/QueryExplain.js +168 -0
- package/dist/containers/Tenant/QueryEditor/QueryExplain/QueryExplain.scss +42 -0
- package/dist/containers/Tenant/QueryEditor/QueryResult/QueryResult.js +58 -0
- package/dist/containers/Tenant/QueryEditor/QueryResult/QueryResult.scss +24 -0
- package/dist/containers/Tenant/QueryEditor/SaveQuery/SaveQuery.js +171 -0
- package/dist/containers/Tenant/QueryEditor/SaveQuery/SaveQuery.scss +51 -0
- package/dist/containers/Tenant/QueryEditor/SavedQueries/SavedQueries.js +156 -0
- package/dist/containers/Tenant/QueryEditor/SavedQueries/SavedQueries.scss +82 -0
- package/dist/containers/Tenant/Schema/HotKeys/HotKeys.js +149 -0
- package/dist/containers/Tenant/Schema/HotKeys/HotKeys.scss +48 -0
- package/dist/containers/Tenant/Schema/Info/Info.js +84 -0
- package/dist/containers/Tenant/Schema/Info/Info.scss +3 -0
- package/dist/containers/Tenant/Schema/SchemaInfoViewer/SchemaInfoViewer.js +67 -0
- package/dist/containers/Tenant/Schema/SchemaInfoViewer/SchemaInfoViewer.scss +21 -0
- package/dist/containers/Tenant/Schema/SchemaMain/SchemaMain.js +439 -0
- package/dist/containers/Tenant/Schema/SchemaMain/SchemaMain.scss +90 -0
- package/dist/containers/Tenant/Schema/SchemaNode/SchemaNode.js +150 -0
- package/dist/containers/Tenant/Schema/SchemaNode/SchemaNode.scss +41 -0
- package/dist/containers/Tenant/Schema/SchemaPages.js +56 -0
- package/dist/containers/Tenant/Schema/SchemaTree/SchemaTree.js +115 -0
- package/dist/containers/Tenant/Schema/SchemaTree/SchemaTree.scss +13 -0
- package/dist/containers/Tenant/Schema/SchemaViewer/SchemaViewer.js +63 -0
- package/dist/containers/Tenant/Schema/SchemaViewer/SchemaViewer.scss +28 -0
- package/dist/containers/Tenant/Tenant.js +199 -0
- package/dist/containers/Tenant/Tenant.scss +94 -0
- package/dist/containers/Tenant/TenantPages.js +35 -0
- package/dist/containers/Tenant/TopQueries/TopQueries.js +184 -0
- package/dist/containers/Tenant/TopQueries/TopQueries.scss +53 -0
- package/dist/containers/Tenant/TopShards/TopShards.js +171 -0
- package/dist/containers/Tenant/TopShards/TopShards.scss +23 -0
- package/dist/containers/Tenants/Tenants.js +375 -0
- package/dist/containers/Tenants/Tenants.scss +73 -0
- package/dist/containers/UserSettings/UserSettings.tsx +57 -0
- package/dist/containers/Vdisk/Vdisk.js +160 -0
- package/dist/containers/Vdisk/Vdisk.scss +40 -0
- package/dist/containers/VdiskPdiskNode/VdiskPdiskNode.js +528 -0
- package/dist/containers/VdiskPdiskNode/VdiskPdiskNode.scss +60 -0
- package/dist/contexts/HistoryContext.ts +6 -0
- package/dist/index.css +11 -0
- package/dist/index.js +28 -0
- package/dist/index.test.js +5 -0
- package/dist/react-app-env.d.ts +1 -0
- package/dist/reportWebVitals.js +13 -0
- package/dist/routes.js +40 -0
- package/dist/services/api.js +224 -0
- package/dist/setupTests.js +5 -0
- package/dist/store/index.js +61 -0
- package/dist/store/reducers/authentication.js +77 -0
- package/dist/store/reducers/cluster.js +52 -0
- package/dist/store/reducers/clusterInfo.js +48 -0
- package/dist/store/reducers/clusterNodes.js +70 -0
- package/dist/store/reducers/describe.js +45 -0
- package/dist/store/reducers/executeQuery.js +158 -0
- package/dist/store/reducers/executeTopQueries.js +69 -0
- package/dist/store/reducers/explainQuery.js +174 -0
- package/dist/store/reducers/group.js +49 -0
- package/dist/store/reducers/healthcheckInfo.js +45 -0
- package/dist/store/reducers/heatmap.js +105 -0
- package/dist/store/reducers/host.js +44 -0
- package/dist/store/reducers/hotKeys.js +57 -0
- package/dist/store/reducers/index.js +78 -0
- package/dist/store/reducers/network.js +45 -0
- package/dist/store/reducers/node.js +42 -0
- package/dist/store/reducers/nodes.js +58 -0
- package/dist/store/reducers/olapStats.js +74 -0
- package/dist/store/reducers/pdisk.js +51 -0
- package/dist/store/reducers/pool.js +42 -0
- package/dist/store/reducers/preview.js +73 -0
- package/dist/store/reducers/schema.js +95 -0
- package/dist/store/reducers/schemaAcl.js +44 -0
- package/dist/store/reducers/settings.js +76 -0
- package/dist/store/reducers/shardsWorkload.js +75 -0
- package/dist/store/reducers/storage.js +280 -0
- package/dist/store/reducers/tablet.js +94 -0
- package/dist/store/reducers/tablets.js +90 -0
- package/dist/store/reducers/tabletsFilters.js +126 -0
- package/dist/store/reducers/tenant.js +76 -0
- package/dist/store/reducers/tenants.js +61 -0
- package/dist/store/reducers/tooltip.js +64 -0
- package/dist/store/reducers/vdisk.js +49 -0
- package/dist/store/state-url-mapping.js +133 -0
- package/dist/store/utils.js +55 -0
- package/dist/styles/mixins.scss +254 -0
- package/dist/styles/react-treeview.scss +45 -0
- package/dist/types/assets.d.ts +12 -0
- package/dist/types/react-list.d.ts +4 -0
- package/dist/types/window.d.ts +33 -0
- package/dist/utils/actionsConstants.js +4 -0
- package/dist/utils/constants.js +126 -0
- package/dist/utils/getNodesColumns.js +156 -0
- package/dist/utils/i18n/i18n.ts +7 -0
- package/dist/utils/i18n/index.ts +1 -0
- package/dist/utils/index.js +136 -0
- package/dist/utils/monaco.js +69 -0
- package/dist/utils/prepareQueryExplain.ts +101 -0
- package/dist/utils/tooltip.js +197 -0
- package/dist/utils/utils.js +75 -0
- package/package.json +89 -0
@@ -0,0 +1,156 @@
|
|
1
|
+
import React, {useRef, useState} from 'react';
|
2
|
+
import _ from 'lodash';
|
3
|
+
import cn from 'bem-cn-lite';
|
4
|
+
import {Dialog, Popup, Button} from '@yandex-cloud/uikit';
|
5
|
+
|
6
|
+
import TruncatedQuery from '../../../../components/TruncatedQuery/TruncatedQuery';
|
7
|
+
import Icon from '../../../../components/Icon/Icon';
|
8
|
+
import './SavedQueries.scss';
|
9
|
+
|
10
|
+
const b = cn('saved-queries');
|
11
|
+
|
12
|
+
const MAX_QUERY_HEIGHT = 3;
|
13
|
+
|
14
|
+
function SavedQueries({savedQueries, changeUserInput, onDeleteQuery, setQueryNameToEdit}) {
|
15
|
+
const [isSavedQueriesVisible, setIsSavedQueriesVisible] = useState(false);
|
16
|
+
const [isDeleteDialogVisible, setIsDeleteDialogVisible] = useState(false);
|
17
|
+
const [queryNameToDelete, setQueryNameToDelete] = useState(null);
|
18
|
+
|
19
|
+
const [popupForceRender, setPopupForceRender] = useState(null);
|
20
|
+
const anchor = useRef(null);
|
21
|
+
|
22
|
+
const onShowSavedQueriesClick = () => {
|
23
|
+
setIsSavedQueriesVisible(true);
|
24
|
+
};
|
25
|
+
|
26
|
+
const onCloseSavedQueries = () => {
|
27
|
+
setIsSavedQueriesVisible(false);
|
28
|
+
};
|
29
|
+
|
30
|
+
const onSavedQueryClick = (queryText, queryName) => {
|
31
|
+
return () => {
|
32
|
+
changeUserInput({input: queryText});
|
33
|
+
setQueryNameToEdit(queryName);
|
34
|
+
setIsSavedQueriesVisible(false);
|
35
|
+
};
|
36
|
+
};
|
37
|
+
|
38
|
+
const onDeleteQueryClick = (queryName) => {
|
39
|
+
return (event) => {
|
40
|
+
event.stopPropagation();
|
41
|
+
setIsDeleteDialogVisible(true);
|
42
|
+
setQueryNameToDelete(queryName);
|
43
|
+
};
|
44
|
+
};
|
45
|
+
|
46
|
+
const closeDeleteDialog = () => {
|
47
|
+
setIsDeleteDialogVisible(false);
|
48
|
+
setQueryNameToDelete(null);
|
49
|
+
};
|
50
|
+
|
51
|
+
const onClickCancelDelete = (e) => {
|
52
|
+
e.stopPropagation();
|
53
|
+
closeDeleteDialog();
|
54
|
+
};
|
55
|
+
|
56
|
+
const onConfirmDeleteClick = (e) => {
|
57
|
+
e.stopPropagation();
|
58
|
+
onDeleteQuery(queryNameToDelete);
|
59
|
+
closeDeleteDialog();
|
60
|
+
setPopupForceRender(queryNameToDelete);
|
61
|
+
};
|
62
|
+
|
63
|
+
const renderDialog = () => {
|
64
|
+
return (
|
65
|
+
<Dialog
|
66
|
+
open={isDeleteDialogVisible}
|
67
|
+
hasCloseButton={false}
|
68
|
+
size="s"
|
69
|
+
onClose={onClickCancelDelete}
|
70
|
+
>
|
71
|
+
<Dialog.Header caption="Delete query" />
|
72
|
+
<Dialog.Body className={b('dialog-body')}>
|
73
|
+
Are you sure you want to delete query
|
74
|
+
<span className={b('dialog-query-name')}>{` ${queryNameToDelete}?`}</span>
|
75
|
+
</Dialog.Body>
|
76
|
+
<Dialog.Footer
|
77
|
+
textButtonApply="Delete"
|
78
|
+
textButtonCancel="Cancel"
|
79
|
+
onClickButtonCancel={onClickCancelDelete}
|
80
|
+
onClickButtonApply={onConfirmDeleteClick}
|
81
|
+
/>
|
82
|
+
</Dialog>
|
83
|
+
);
|
84
|
+
};
|
85
|
+
const renderSavedQueries = () => {
|
86
|
+
return (
|
87
|
+
<Popup
|
88
|
+
key={popupForceRender}
|
89
|
+
className={b('popup-wrapper')}
|
90
|
+
anchorRef={anchor}
|
91
|
+
open={isSavedQueriesVisible}
|
92
|
+
placement={['top']}
|
93
|
+
onClose={onCloseSavedQueries}
|
94
|
+
>
|
95
|
+
<div className={b()}>
|
96
|
+
<div className={b('saved-queries-row', {header: true})}>
|
97
|
+
<div className={b('query-name')}>Name</div>
|
98
|
+
<div className={b('query-body', {header: true})}>
|
99
|
+
<span>QueryText</span>
|
100
|
+
</div>
|
101
|
+
</div>
|
102
|
+
<div>
|
103
|
+
{_.sortBy(savedQueries, (query) => query.name.toLowerCase()).map(
|
104
|
+
(query) => {
|
105
|
+
return (
|
106
|
+
<div
|
107
|
+
className={b('saved-queries-row')}
|
108
|
+
onClick={onSavedQueryClick(query.body, query.name)}
|
109
|
+
key={query.name}
|
110
|
+
>
|
111
|
+
<div className={b('query-name')}>{query.name}</div>
|
112
|
+
<div className={b('query-body')}>
|
113
|
+
<TruncatedQuery
|
114
|
+
value={query.body}
|
115
|
+
maxQueryHeight={MAX_QUERY_HEIGHT}
|
116
|
+
/>
|
117
|
+
</div>
|
118
|
+
<div className={b('query-controls')}>
|
119
|
+
<Icon
|
120
|
+
name="pencil"
|
121
|
+
viewBox="0 0 24 24"
|
122
|
+
height={14}
|
123
|
+
width={14}
|
124
|
+
className={b('control-button')}
|
125
|
+
/>
|
126
|
+
<Icon
|
127
|
+
name="trash"
|
128
|
+
viewBox="0 0 24 24"
|
129
|
+
height={14}
|
130
|
+
width={14}
|
131
|
+
className={b('control-button')}
|
132
|
+
onClick={onDeleteQueryClick(query.name)}
|
133
|
+
/>
|
134
|
+
</div>
|
135
|
+
</div>
|
136
|
+
);
|
137
|
+
},
|
138
|
+
)}
|
139
|
+
</div>
|
140
|
+
</div>
|
141
|
+
</Popup>
|
142
|
+
);
|
143
|
+
};
|
144
|
+
|
145
|
+
return (
|
146
|
+
<React.Fragment>
|
147
|
+
<Button ref={anchor} onClick={onShowSavedQueriesClick}>
|
148
|
+
Saved queries
|
149
|
+
</Button>
|
150
|
+
{isSavedQueriesVisible && renderSavedQueries()}
|
151
|
+
{isDeleteDialogVisible && queryNameToDelete && renderDialog()}
|
152
|
+
</React.Fragment>
|
153
|
+
);
|
154
|
+
}
|
155
|
+
|
156
|
+
export default SavedQueries;
|
@@ -0,0 +1,82 @@
|
|
1
|
+
$popup-width: 700px;
|
2
|
+
|
3
|
+
.saved-queries {
|
4
|
+
$block: &;
|
5
|
+
padding: 12px 16px 12px;
|
6
|
+
&__popup-wrapper {
|
7
|
+
border-radius: 4px;
|
8
|
+
width: $popup-width;
|
9
|
+
max-width: $popup-width !important;
|
10
|
+
// max-height: 70vh;
|
11
|
+
overflow: hidden;
|
12
|
+
:nth-child(2) {
|
13
|
+
max-height: 70vh;
|
14
|
+
overflow-y: auto;
|
15
|
+
}
|
16
|
+
|
17
|
+
&::before {
|
18
|
+
border-radius: 4px;
|
19
|
+
width: $popup-width;
|
20
|
+
}
|
21
|
+
}
|
22
|
+
&__saved-queries-row {
|
23
|
+
display: flex;
|
24
|
+
align-items: center;
|
25
|
+
padding: 8px 5px;
|
26
|
+
border-bottom: 1px solid var(--yc-color-line-generic);
|
27
|
+
&:hover {
|
28
|
+
color: var(--yc-color-text-link-hover);
|
29
|
+
background: var(--yc-color-base-simple-hover);
|
30
|
+
cursor: pointer;
|
31
|
+
#{$block}__query-controls {
|
32
|
+
display: flex;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
&_header {
|
36
|
+
font-weight: 500;
|
37
|
+
&:hover {
|
38
|
+
color: var(--yc-color-text-primary);
|
39
|
+
background: var(--yc-color-base-background);
|
40
|
+
cursor: auto;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
44
|
+
&__query-name {
|
45
|
+
margin-right: 8px;
|
46
|
+
flex-basis: 90px;
|
47
|
+
max-width: 90px;
|
48
|
+
flex-shrink: 0;
|
49
|
+
flex-grow: 0;
|
50
|
+
white-space: pre-wrap;
|
51
|
+
overflow: hidden;
|
52
|
+
text-overflow: ellipsis;
|
53
|
+
font-weight: 500;
|
54
|
+
}
|
55
|
+
&__query-body {
|
56
|
+
flex-grow: 1;
|
57
|
+
white-space: pre;
|
58
|
+
text-overflow: ellipsis;
|
59
|
+
overflow: hidden;
|
60
|
+
max-width: 75%;
|
61
|
+
&_header {
|
62
|
+
display: flex;
|
63
|
+
justify-content: center;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
&__query-controls {
|
67
|
+
display: none;
|
68
|
+
}
|
69
|
+
&__control-button {
|
70
|
+
display: flex;
|
71
|
+
align-items: center;
|
72
|
+
justify-content: center;
|
73
|
+
width: 24px;
|
74
|
+
color: var(--yc-color-text-hint);
|
75
|
+
&:hover {
|
76
|
+
color: var(--yc-color-text-secondary);
|
77
|
+
}
|
78
|
+
}
|
79
|
+
&__dialog-query-name {
|
80
|
+
font-weight: 500;
|
81
|
+
}
|
82
|
+
}
|
@@ -0,0 +1,149 @@
|
|
1
|
+
import {useEffect, useMemo} from 'react';
|
2
|
+
import cn from 'bem-cn-lite';
|
3
|
+
import {connect} from 'react-redux';
|
4
|
+
import {Loader} from '@yandex-cloud/uikit';
|
5
|
+
import DataTable from '@yandex-cloud/react-data-table';
|
6
|
+
|
7
|
+
import Icon from '../../../../components/Icon/Icon';
|
8
|
+
|
9
|
+
import {AutoFetcher} from '../../../Cluster/Cluster';
|
10
|
+
import {getHotKeys, setHotKeysOptions} from '../../../../store/reducers/hotKeys';
|
11
|
+
|
12
|
+
import './HotKeys.scss';
|
13
|
+
|
14
|
+
const b = cn('hot-keys');
|
15
|
+
|
16
|
+
const TABLE_SETTINGS = {
|
17
|
+
displayIndices: false,
|
18
|
+
syncHeadOnResize: true,
|
19
|
+
stickyHead: DataTable.MOVING,
|
20
|
+
stickyTop: 0,
|
21
|
+
};
|
22
|
+
|
23
|
+
const tableColumnsIds = {
|
24
|
+
accessSample: 'accessSample',
|
25
|
+
keyValues: 'keyValues',
|
26
|
+
};
|
27
|
+
|
28
|
+
const autofetcher = new AutoFetcher();
|
29
|
+
|
30
|
+
function HotKeys({
|
31
|
+
getHotKeys,
|
32
|
+
currentSchemaPath,
|
33
|
+
loading,
|
34
|
+
wasLoaded,
|
35
|
+
error,
|
36
|
+
data,
|
37
|
+
autorefresh,
|
38
|
+
setHotKeysOptions,
|
39
|
+
currentSchema,
|
40
|
+
}) {
|
41
|
+
useEffect(() => {
|
42
|
+
getHotKeys(currentSchemaPath);
|
43
|
+
if (autorefresh) {
|
44
|
+
autofetcher.start();
|
45
|
+
autofetcher.fetch(() => getHotKeys(currentSchemaPath));
|
46
|
+
} else {
|
47
|
+
autofetcher.stop();
|
48
|
+
}
|
49
|
+
return () => {
|
50
|
+
autofetcher.stop();
|
51
|
+
};
|
52
|
+
}, [autorefresh]);
|
53
|
+
|
54
|
+
useEffect(() => {
|
55
|
+
getHotKeys(currentSchemaPath);
|
56
|
+
setHotKeysOptions({
|
57
|
+
wasLoaded: false,
|
58
|
+
data: undefined,
|
59
|
+
});
|
60
|
+
}, [currentSchemaPath]);
|
61
|
+
|
62
|
+
const renderLoader = () => {
|
63
|
+
return (
|
64
|
+
<div className={b('loader')}>
|
65
|
+
<Loader size="l" />
|
66
|
+
</div>
|
67
|
+
);
|
68
|
+
};
|
69
|
+
|
70
|
+
const tableColumns = useMemo(() => {
|
71
|
+
const keyColumnsIds = currentSchema?.PathDescription?.Table?.KeyColumnNames;
|
72
|
+
|
73
|
+
return [
|
74
|
+
{
|
75
|
+
name: tableColumnsIds.accessSample,
|
76
|
+
header: 'Samples',
|
77
|
+
sortable: false,
|
78
|
+
align: DataTable.RIGHT,
|
79
|
+
},
|
80
|
+
...keyColumnsIds?.map((col, index) => ({
|
81
|
+
name: col,
|
82
|
+
header: (
|
83
|
+
<div className={b('primary-key-column')}>
|
84
|
+
<Icon name="key" viewBox="0 0 12 7" width={12} height={7} />
|
85
|
+
{col}
|
86
|
+
</div>
|
87
|
+
),
|
88
|
+
render: ({row}) => row[tableColumnsIds.keyValues][index],
|
89
|
+
align: DataTable.RIGHT,
|
90
|
+
sortable: false,
|
91
|
+
})),
|
92
|
+
];
|
93
|
+
}, [currentSchema]);
|
94
|
+
|
95
|
+
const renderStub = () => {
|
96
|
+
return <div className={b('stub')}>Cluster version does not support hot keys viewing</div>;
|
97
|
+
};
|
98
|
+
|
99
|
+
const renderContent = () => {
|
100
|
+
if (error) {
|
101
|
+
return error.data;
|
102
|
+
}
|
103
|
+
return data !== null ? (
|
104
|
+
<div className={b('table-content')}>
|
105
|
+
<DataTable
|
106
|
+
columns={tableColumns}
|
107
|
+
data={data}
|
108
|
+
settings={TABLE_SETTINGS}
|
109
|
+
theme="internal"
|
110
|
+
initialSortOrder={{
|
111
|
+
columnId: tableColumnsIds.accessSample,
|
112
|
+
order: DataTable.DESCENDING,
|
113
|
+
}}
|
114
|
+
/>
|
115
|
+
</div>
|
116
|
+
) : (
|
117
|
+
<div className={b('stub')}>No information about hot keys</div>
|
118
|
+
);
|
119
|
+
};
|
120
|
+
|
121
|
+
return !loading && data === undefined ? (
|
122
|
+
renderStub()
|
123
|
+
) : (
|
124
|
+
<div className={b()}>{loading && !wasLoaded ? renderLoader() : renderContent()}</div>
|
125
|
+
);
|
126
|
+
}
|
127
|
+
|
128
|
+
const mapStateToProps = (state) => {
|
129
|
+
const {loading, data, error, wasLoaded} = state.hotKeys;
|
130
|
+
const {currentSchema = {}} = state.schema;
|
131
|
+
const {Path} = currentSchema;
|
132
|
+
const {autorefresh} = state.schema;
|
133
|
+
return {
|
134
|
+
loading,
|
135
|
+
data,
|
136
|
+
error,
|
137
|
+
currentSchemaPath: Path,
|
138
|
+
autorefresh,
|
139
|
+
wasLoaded,
|
140
|
+
currentSchema,
|
141
|
+
};
|
142
|
+
};
|
143
|
+
|
144
|
+
const mapDispatchToProps = {
|
145
|
+
getHotKeys,
|
146
|
+
setHotKeysOptions,
|
147
|
+
};
|
148
|
+
|
149
|
+
export default connect(mapStateToProps, mapDispatchToProps)(HotKeys);
|
@@ -0,0 +1,48 @@
|
|
1
|
+
@import '../../../../styles/mixins.scss';
|
2
|
+
|
3
|
+
.hot-keys {
|
4
|
+
display: flex;
|
5
|
+
overflow: auto;
|
6
|
+
align-items: flex-start;
|
7
|
+
flex-direction: column;
|
8
|
+
flex-grow: 1;
|
9
|
+
|
10
|
+
max-height: 100%;
|
11
|
+
|
12
|
+
background-color: var(--yc-color-base-background);
|
13
|
+
|
14
|
+
&__table-content {
|
15
|
+
overflow: auto;
|
16
|
+
height: 100%;
|
17
|
+
width: 100%;
|
18
|
+
@include freeze-nth-column(1);
|
19
|
+
}
|
20
|
+
|
21
|
+
&__header {
|
22
|
+
position: sticky;
|
23
|
+
z-index: 2;
|
24
|
+
top: 0px;
|
25
|
+
left: 0;
|
26
|
+
|
27
|
+
width: 100%;
|
28
|
+
padding: 10px 0;
|
29
|
+
|
30
|
+
background-color: var(--yc-color-base-background);
|
31
|
+
}
|
32
|
+
&__loader {
|
33
|
+
display: flex;
|
34
|
+
align-items: center;
|
35
|
+
justify-content: center;
|
36
|
+
|
37
|
+
width: 100%;
|
38
|
+
height: 100%;
|
39
|
+
}
|
40
|
+
&__stub {
|
41
|
+
margin: 10px;
|
42
|
+
}
|
43
|
+
&__primary-key-column {
|
44
|
+
display: flex;
|
45
|
+
align-items: center;
|
46
|
+
gap: 5px;
|
47
|
+
}
|
48
|
+
}
|
@@ -0,0 +1,84 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import cn from 'bem-cn-lite';
|
4
|
+
import './Info.scss';
|
5
|
+
|
6
|
+
import SchemaInfoViewer from '../../../Tenant/Schema/SchemaInfoViewer/SchemaInfoViewer';
|
7
|
+
import SchemaViewer from '../../../Tenant/Schema/SchemaViewer/SchemaViewer';
|
8
|
+
import {OLAP_TABLE_TYPE} from '../SchemaMain/SchemaMain';
|
9
|
+
|
10
|
+
const b = cn('schema-info');
|
11
|
+
|
12
|
+
function prepareOlapTableSchema(tableSchema) {
|
13
|
+
const {Name, Schema = {}} = tableSchema;
|
14
|
+
const {Columns, KeyColumnNames} = Schema;
|
15
|
+
const KeyColumnIds = KeyColumnNames?.map((name) => {
|
16
|
+
const column = Columns?.find((el) => el.Name === name);
|
17
|
+
return column.Id;
|
18
|
+
});
|
19
|
+
|
20
|
+
return {
|
21
|
+
Columns,
|
22
|
+
KeyColumnNames,
|
23
|
+
Name,
|
24
|
+
KeyColumnIds,
|
25
|
+
};
|
26
|
+
}
|
27
|
+
|
28
|
+
function prepareOlapTableGeneral(tableData, olapStats) {
|
29
|
+
const {ColumnShardCount} = tableData;
|
30
|
+
const Bytes = olapStats?.reduce((acc, el) => {
|
31
|
+
acc += parseInt(el.Bytes) ?? 0;
|
32
|
+
return acc;
|
33
|
+
}, 0);
|
34
|
+
const Rows = olapStats?.reduce((acc, el) => {
|
35
|
+
acc += parseInt(el.Rows) ?? 0;
|
36
|
+
return acc;
|
37
|
+
}, 0);
|
38
|
+
const tabletIds = olapStats?.reduce((acc, el) => {
|
39
|
+
acc.add(el.TabletId);
|
40
|
+
return acc;
|
41
|
+
}, new Set());
|
42
|
+
|
43
|
+
return {
|
44
|
+
PathDescription: {
|
45
|
+
TableStats: {
|
46
|
+
ColumnShardCount,
|
47
|
+
Bytes: Bytes?.toLocaleString('ru-RU', {useGrouping: true}) ?? 0,
|
48
|
+
Rows: Rows?.toLocaleString('ru-RU', {useGrouping: true}) ?? 0,
|
49
|
+
Parts: tabletIds?.size ?? 0,
|
50
|
+
},
|
51
|
+
},
|
52
|
+
};
|
53
|
+
}
|
54
|
+
|
55
|
+
class Info extends React.Component {
|
56
|
+
static propTypes = {
|
57
|
+
fullPath: PropTypes.string,
|
58
|
+
currentItem: PropTypes.string,
|
59
|
+
tableSchema: PropTypes.object,
|
60
|
+
olapStats: PropTypes.array,
|
61
|
+
type: PropTypes.string,
|
62
|
+
};
|
63
|
+
render() {
|
64
|
+
const {currentItem, tableSchema, olapStats} = this.props;
|
65
|
+
const fullPath = currentItem.Path;
|
66
|
+
|
67
|
+
const schema =
|
68
|
+
this.props.type === OLAP_TABLE_TYPE ? prepareOlapTableSchema(tableSchema) : tableSchema;
|
69
|
+
|
70
|
+
const data =
|
71
|
+
this.props.type === OLAP_TABLE_TYPE
|
72
|
+
? prepareOlapTableGeneral(tableSchema, olapStats)
|
73
|
+
: currentItem;
|
74
|
+
|
75
|
+
return (
|
76
|
+
<div className={b()}>
|
77
|
+
<SchemaInfoViewer fullPath={fullPath} data={data} />
|
78
|
+
{schema && <SchemaViewer data={schema} />}
|
79
|
+
</div>
|
80
|
+
);
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
84
|
+
export default Info;
|
@@ -0,0 +1,67 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import cn from 'bem-cn-lite';
|
4
|
+
import './SchemaInfoViewer.scss';
|
5
|
+
|
6
|
+
import {formatCPU, formatBytes} from '../../../../utils';
|
7
|
+
|
8
|
+
import InfoViewer from '../../../../components/InfoViewer/InfoViewer';
|
9
|
+
|
10
|
+
const b = cn('schema-viewer');
|
11
|
+
|
12
|
+
class SchemaInfoViewer extends React.Component {
|
13
|
+
static propTypes = {
|
14
|
+
data: PropTypes.object.isRequired,
|
15
|
+
};
|
16
|
+
formatTabletMetricsValue = (key, value) => {
|
17
|
+
if (key === 'CPU') {
|
18
|
+
return formatCPU(value);
|
19
|
+
} else if (key === 'Memory' || key === 'Storage') {
|
20
|
+
return formatBytes(value);
|
21
|
+
} else {
|
22
|
+
return value;
|
23
|
+
}
|
24
|
+
};
|
25
|
+
render() {
|
26
|
+
const {data} = this.props;
|
27
|
+
|
28
|
+
if (data) {
|
29
|
+
const {TableStats = {}, TabletMetrics = {}} = data.PathDescription;
|
30
|
+
const tableStatsInfo =
|
31
|
+
TableStats &&
|
32
|
+
Object.keys(TableStats).map((key) => ({
|
33
|
+
label: key,
|
34
|
+
value: TableStats[key].toString(),
|
35
|
+
}));
|
36
|
+
|
37
|
+
const tabletMetricsInfo =
|
38
|
+
TableStats &&
|
39
|
+
Object.keys(TabletMetrics).map((key) => ({
|
40
|
+
label: key,
|
41
|
+
value: this.formatTabletMetricsValue(key, TabletMetrics[key].toString()),
|
42
|
+
}));
|
43
|
+
|
44
|
+
let generalInfo = Object.assign(tableStatsInfo, tabletMetricsInfo);
|
45
|
+
generalInfo = Object.assign(generalInfo);
|
46
|
+
|
47
|
+
const infoLength = Object.keys(generalInfo).length;
|
48
|
+
|
49
|
+
return (
|
50
|
+
<div className={b()}>
|
51
|
+
<div className={b('item')}>
|
52
|
+
{Boolean(infoLength) && (
|
53
|
+
<>
|
54
|
+
<div className={b('title')}>General</div>
|
55
|
+
<InfoViewer info={generalInfo}></InfoViewer>
|
56
|
+
</>
|
57
|
+
)}
|
58
|
+
</div>
|
59
|
+
</div>
|
60
|
+
);
|
61
|
+
} else {
|
62
|
+
return <div className="error">no schema data</div>;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
export default SchemaInfoViewer;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
.schema-viewer {
|
2
|
+
padding: 20px;
|
3
|
+
overflow: auto;
|
4
|
+
|
5
|
+
&__item {
|
6
|
+
margin-bottom: 20px;
|
7
|
+
|
8
|
+
.info-viewer__items {
|
9
|
+
grid-template-columns: minmax(max-content, 280px);
|
10
|
+
}
|
11
|
+
}
|
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
|
+
}
|