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,249 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import {connect} from 'react-redux';
|
4
|
+
import cn from 'bem-cn-lite';
|
5
|
+
import DataTable from '@yandex-cloud/react-data-table';
|
6
|
+
import {Loader, RadioButton, Label} from '@yandex-cloud/uikit';
|
7
|
+
|
8
|
+
import StorageFilter from './StorageFilter/StorageFilter';
|
9
|
+
import {AutoFetcher} from '../Cluster/Cluster';
|
10
|
+
|
11
|
+
import {
|
12
|
+
getStorageInfo,
|
13
|
+
setInitialState,
|
14
|
+
getFilteredEntities,
|
15
|
+
VisibleEntities,
|
16
|
+
setVisibleEntities,
|
17
|
+
setStorageFilter,
|
18
|
+
getNodesObject,
|
19
|
+
StorageTypes,
|
20
|
+
setStorageType,
|
21
|
+
} from '../../store/reducers/storage';
|
22
|
+
import {getNodesList} from '../../store/reducers/clusterNodes';
|
23
|
+
import StorageGroups from './StorageGroups/StorageGroups';
|
24
|
+
import StorageNodes from './StorageNodes/StorageNodes';
|
25
|
+
|
26
|
+
import './Storage.scss';
|
27
|
+
|
28
|
+
const b = cn('global-storage');
|
29
|
+
|
30
|
+
const FILTER_OPTIONS = {
|
31
|
+
Missing: 'missing',
|
32
|
+
Space: 'space',
|
33
|
+
};
|
34
|
+
|
35
|
+
const tableSettings = {
|
36
|
+
displayIndices: false,
|
37
|
+
stickyHead: DataTable.MOVING,
|
38
|
+
syncHeadOnResize: true,
|
39
|
+
dynamicRender: true,
|
40
|
+
defaultOrder: DataTable.DESCENDING,
|
41
|
+
stripedRows: true,
|
42
|
+
stickyTop: 68,
|
43
|
+
};
|
44
|
+
|
45
|
+
class Storage extends React.Component {
|
46
|
+
static propTypes = {
|
47
|
+
loading: PropTypes.bool,
|
48
|
+
error: PropTypes.object,
|
49
|
+
wasLoaded: PropTypes.bool,
|
50
|
+
getStorageInfo: PropTypes.func,
|
51
|
+
setInitialState: PropTypes.func,
|
52
|
+
flatListStorageEntities: PropTypes.array,
|
53
|
+
setStorageFilter: PropTypes.func,
|
54
|
+
setVisibleEntities: PropTypes.func,
|
55
|
+
visibleEntities: PropTypes.string,
|
56
|
+
};
|
57
|
+
|
58
|
+
componentDidMount() {
|
59
|
+
const {tenant, nodeId, setVisibleEntities, storageType} = this.props;
|
60
|
+
this.autofetcher = new AutoFetcher();
|
61
|
+
this.props.getNodesList();
|
62
|
+
if (tenant || nodeId) {
|
63
|
+
setVisibleEntities(VisibleEntities.All);
|
64
|
+
} else {
|
65
|
+
this.props.getStorageInfo({
|
66
|
+
tenant,
|
67
|
+
nodeId,
|
68
|
+
filter: FILTER_OPTIONS.Missing,
|
69
|
+
type: storageType,
|
70
|
+
});
|
71
|
+
this.autofetcher.fetch(() =>
|
72
|
+
this.props.getStorageInfo({
|
73
|
+
tenant,
|
74
|
+
nodeId,
|
75
|
+
filter: FILTER_OPTIONS.Missing,
|
76
|
+
type: storageType,
|
77
|
+
}),
|
78
|
+
);
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
componentDidUpdate(prevProps) {
|
83
|
+
const {tenant, visibleEntities, getStorageInfo, nodeId, storageType} = this.props;
|
84
|
+
if (
|
85
|
+
storageType !== prevProps.storageType ||
|
86
|
+
visibleEntities !== prevProps.visibleEntities
|
87
|
+
) {
|
88
|
+
this.autofetcher.stop();
|
89
|
+
this.autofetcher.start();
|
90
|
+
this.autofetcher.fetch(() =>
|
91
|
+
getStorageInfo({
|
92
|
+
tenant,
|
93
|
+
filter: FILTER_OPTIONS[visibleEntities],
|
94
|
+
nodeId,
|
95
|
+
type: storageType,
|
96
|
+
}),
|
97
|
+
);
|
98
|
+
|
99
|
+
getStorageInfo({
|
100
|
+
tenant,
|
101
|
+
filter: FILTER_OPTIONS[visibleEntities],
|
102
|
+
nodeId,
|
103
|
+
type: storageType,
|
104
|
+
});
|
105
|
+
}
|
106
|
+
}
|
107
|
+
|
108
|
+
componentWillUnmount() {
|
109
|
+
this.autofetcher.stop();
|
110
|
+
this.props.setInitialState();
|
111
|
+
}
|
112
|
+
|
113
|
+
renderLoader() {
|
114
|
+
return (
|
115
|
+
<div className={b('loader')}>
|
116
|
+
<Loader size="l" />
|
117
|
+
</div>
|
118
|
+
);
|
119
|
+
}
|
120
|
+
|
121
|
+
renderDataTable() {
|
122
|
+
const {flatListStorageEntities, visibleEntities, nodes, storageType} = this.props;
|
123
|
+
|
124
|
+
return (
|
125
|
+
<div className={b('table-wrapper')}>
|
126
|
+
{storageType === StorageTypes.groups && (
|
127
|
+
<StorageGroups
|
128
|
+
visibleEntities={visibleEntities}
|
129
|
+
data={flatListStorageEntities}
|
130
|
+
tableSettings={tableSettings}
|
131
|
+
nodes={nodes}
|
132
|
+
/>
|
133
|
+
)}
|
134
|
+
{storageType === StorageTypes.nodes && (
|
135
|
+
<StorageNodes
|
136
|
+
visibleEntities={visibleEntities}
|
137
|
+
data={flatListStorageEntities}
|
138
|
+
tableSettings={tableSettings}
|
139
|
+
/>
|
140
|
+
)}
|
141
|
+
</div>
|
142
|
+
);
|
143
|
+
}
|
144
|
+
|
145
|
+
onGroupVisibilityChange = (value) => {
|
146
|
+
const {setVisibleEntities} = this.props;
|
147
|
+
setVisibleEntities(value);
|
148
|
+
};
|
149
|
+
|
150
|
+
onStorageTypeChange = (value) => {
|
151
|
+
const {setStorageType} = this.props;
|
152
|
+
setStorageType(value);
|
153
|
+
};
|
154
|
+
|
155
|
+
renderControls() {
|
156
|
+
const {setStorageFilter, visibleEntities, storageType, flatListStorageEntities} =
|
157
|
+
this.props;
|
158
|
+
return (
|
159
|
+
<div className={b('controls')}>
|
160
|
+
<div className={b('filter')}>
|
161
|
+
<StorageFilter
|
162
|
+
changeReduxStorageFilter={setStorageFilter}
|
163
|
+
storageType={storageType}
|
164
|
+
/>
|
165
|
+
</div>
|
166
|
+
<RadioButton
|
167
|
+
value={visibleEntities}
|
168
|
+
onUpdate={this.onGroupVisibilityChange}
|
169
|
+
className={b('control')}
|
170
|
+
>
|
171
|
+
<RadioButton.Option value={VisibleEntities.Missing}>
|
172
|
+
{VisibleEntities.Missing}
|
173
|
+
</RadioButton.Option>
|
174
|
+
<RadioButton.Option value={VisibleEntities.Space}>
|
175
|
+
{VisibleEntities.Space}
|
176
|
+
</RadioButton.Option>
|
177
|
+
<RadioButton.Option value={VisibleEntities.All}>
|
178
|
+
{VisibleEntities.All}
|
179
|
+
</RadioButton.Option>
|
180
|
+
</RadioButton>
|
181
|
+
|
182
|
+
<RadioButton
|
183
|
+
value={storageType}
|
184
|
+
onUpdate={this.onStorageTypeChange}
|
185
|
+
className={b('control')}
|
186
|
+
>
|
187
|
+
<RadioButton.Option value={StorageTypes.groups}>
|
188
|
+
{StorageTypes.groups}
|
189
|
+
</RadioButton.Option>
|
190
|
+
<RadioButton.Option value={StorageTypes.nodes}>
|
191
|
+
{StorageTypes.nodes}
|
192
|
+
</RadioButton.Option>
|
193
|
+
</RadioButton>
|
194
|
+
<Label theme="info" size="m">{`${
|
195
|
+
storageType === StorageTypes.groups ? 'Groups' : 'Nodes'
|
196
|
+
}: ${flatListStorageEntities.length}`}</Label>
|
197
|
+
</div>
|
198
|
+
);
|
199
|
+
}
|
200
|
+
|
201
|
+
render() {
|
202
|
+
const {loading, wasLoaded, error} = this.props;
|
203
|
+
if (loading && !wasLoaded) {
|
204
|
+
return this.renderLoader();
|
205
|
+
} else if (error) {
|
206
|
+
return <div>{error.statusText}</div>;
|
207
|
+
} else {
|
208
|
+
return (
|
209
|
+
<div className={b()}>
|
210
|
+
{this.renderControls()}
|
211
|
+
{this.renderDataTable()}
|
212
|
+
</div>
|
213
|
+
);
|
214
|
+
}
|
215
|
+
}
|
216
|
+
}
|
217
|
+
|
218
|
+
function mapStateToProps(state) {
|
219
|
+
const {
|
220
|
+
loading,
|
221
|
+
wasLoaded,
|
222
|
+
error,
|
223
|
+
visible: visibleEntities,
|
224
|
+
type: storageType,
|
225
|
+
filter,
|
226
|
+
} = state.storage;
|
227
|
+
|
228
|
+
return {
|
229
|
+
flatListStorageEntities: getFilteredEntities(state),
|
230
|
+
nodes: getNodesObject(state),
|
231
|
+
loading,
|
232
|
+
wasLoaded,
|
233
|
+
error,
|
234
|
+
visibleEntities,
|
235
|
+
storageType,
|
236
|
+
filter,
|
237
|
+
};
|
238
|
+
}
|
239
|
+
|
240
|
+
const mapDispatchToProps = {
|
241
|
+
getStorageInfo,
|
242
|
+
setInitialState,
|
243
|
+
setStorageFilter,
|
244
|
+
setVisibleEntities: setVisibleEntities,
|
245
|
+
getNodesList,
|
246
|
+
setStorageType,
|
247
|
+
};
|
248
|
+
|
249
|
+
export default connect(mapStateToProps, mapDispatchToProps)(Storage);
|
@@ -0,0 +1,57 @@
|
|
1
|
+
.global-storage {
|
2
|
+
display: flex;
|
3
|
+
overflow: auto;
|
4
|
+
align-items: flex-start;
|
5
|
+
flex-direction: column;
|
6
|
+
|
7
|
+
height: 100%;
|
8
|
+
max-height: 100%;
|
9
|
+
|
10
|
+
&__controls {
|
11
|
+
position: sticky;
|
12
|
+
z-index: 2;
|
13
|
+
top: 0;
|
14
|
+
|
15
|
+
display: flex;
|
16
|
+
align-items: center;
|
17
|
+
|
18
|
+
width: 100%;
|
19
|
+
padding: 20px 0;
|
20
|
+
|
21
|
+
background-color: var(--yc-color-base-background);
|
22
|
+
}
|
23
|
+
&__filter {
|
24
|
+
display: inline-block;
|
25
|
+
|
26
|
+
width: 300px;
|
27
|
+
margin-right: 15px;
|
28
|
+
}
|
29
|
+
&__control {
|
30
|
+
margin-right: 15px;
|
31
|
+
}
|
32
|
+
&__table-wrapper {
|
33
|
+
display: flex;
|
34
|
+
flex: 1 1 auto;
|
35
|
+
flex-direction: column;
|
36
|
+
|
37
|
+
width: 100%;
|
38
|
+
|
39
|
+
font-size: var(--yc-text-body2-font-size);
|
40
|
+
line-height: var(--yc-text-body2-line-height);
|
41
|
+
|
42
|
+
.yc-tooltip {
|
43
|
+
// stylelint-disable-next-line declaration-no-important
|
44
|
+
height: var(--yc-text-body2-line-height) !important;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
&__loader {
|
49
|
+
display: flex;
|
50
|
+
justify-content: center;
|
51
|
+
|
52
|
+
margin-top: 100px;
|
53
|
+
}
|
54
|
+
.entity-status {
|
55
|
+
justify-content: center;
|
56
|
+
}
|
57
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import {useEffect, useState} from 'react';
|
2
|
+
import {TextInput} from '@yandex-cloud/uikit';
|
3
|
+
import {StorageTypes} from '../../../store/reducers/storage';
|
4
|
+
|
5
|
+
function StorageFilter(props) {
|
6
|
+
const [filter, setFilter] = useState('');
|
7
|
+
let timer;
|
8
|
+
|
9
|
+
useEffect(() => {
|
10
|
+
return () => clearTimeout(timer);
|
11
|
+
}, []);
|
12
|
+
|
13
|
+
useEffect(() => {
|
14
|
+
setFilter('');
|
15
|
+
props.changeReduxStorageFilter('');
|
16
|
+
}, [props.storageType]);
|
17
|
+
|
18
|
+
const changeFilter = (value) => {
|
19
|
+
clearTimeout(timer);
|
20
|
+
setFilter(value);
|
21
|
+
timer = setTimeout(() => {
|
22
|
+
props.changeReduxStorageFilter(value);
|
23
|
+
}, 200);
|
24
|
+
};
|
25
|
+
const placeholder =
|
26
|
+
props.storageType === StorageTypes.groups ? 'Group ID, Pool name' : 'Node ID, FQDN';
|
27
|
+
|
28
|
+
return (
|
29
|
+
<TextInput
|
30
|
+
autoFocus
|
31
|
+
placeholder={placeholder}
|
32
|
+
value={filter}
|
33
|
+
onUpdate={changeFilter}
|
34
|
+
hasClear
|
35
|
+
/>
|
36
|
+
);
|
37
|
+
}
|
38
|
+
|
39
|
+
export default StorageFilter;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
.global-storage-groups {
|
2
|
+
&__vdisks-wrapper {
|
3
|
+
display: flex;
|
4
|
+
overflow-x: auto;
|
5
|
+
overflow-y: hidden;
|
6
|
+
justify-content: center;
|
7
|
+
}
|
8
|
+
&__pool-name-wrapper {
|
9
|
+
display: flex;
|
10
|
+
align-items: flex-end;
|
11
|
+
}
|
12
|
+
&__pool-name {
|
13
|
+
display: inline-block;
|
14
|
+
overflow: hidden;
|
15
|
+
|
16
|
+
max-width: 150px;
|
17
|
+
|
18
|
+
text-overflow: ellipsis;
|
19
|
+
}
|
20
|
+
&__group-id {
|
21
|
+
font-weight: 500;
|
22
|
+
}
|
23
|
+
&__tooltip {
|
24
|
+
word-break: break-all;
|
25
|
+
}
|
26
|
+
}
|
@@ -0,0 +1,234 @@
|
|
1
|
+
import _ from 'lodash';
|
2
|
+
import cn from 'bem-cn-lite';
|
3
|
+
import DataTable, {Column, Settings, SortOrder} from '@yandex-cloud/react-data-table';
|
4
|
+
import {Tooltip, TooltipBehavior} from '@yandex-cloud/uikit';
|
5
|
+
|
6
|
+
import Vdisk from '../Vdisk/Vdisk';
|
7
|
+
//@ts-ignore
|
8
|
+
import EntityStatus from '../../../components/EntityStatus/EntityStatus';
|
9
|
+
//@ts-ignore
|
10
|
+
import {VisibleEntities} from '../../../store/reducers/storage';
|
11
|
+
//@ts-ignore
|
12
|
+
import {bytesToGB, bytesToSpeed} from '../../../utils/utils';
|
13
|
+
//@ts-ignore
|
14
|
+
import {stringifyVdiskId} from '../../../utils';
|
15
|
+
|
16
|
+
import './StorageGroups.scss';
|
17
|
+
|
18
|
+
enum TableColumnsIds {
|
19
|
+
PoolName = 'PoolName',
|
20
|
+
GroupID = 'GroupID',
|
21
|
+
Used = 'Used',
|
22
|
+
Limit = 'Limit',
|
23
|
+
UsedPercents = 'UsedPercents',
|
24
|
+
UsedSpaceFlag = 'UsedSpaceFlag',
|
25
|
+
Read = 'Read',
|
26
|
+
Write = 'Write',
|
27
|
+
VDisks = 'VDisks',
|
28
|
+
Missing = 'Missing',
|
29
|
+
}
|
30
|
+
|
31
|
+
type TableColumnsIdsKeys = keyof typeof TableColumnsIds;
|
32
|
+
type TableColumnsIdsValues = typeof TableColumnsIds[TableColumnsIdsKeys];
|
33
|
+
|
34
|
+
interface StorageGroupsProps {
|
35
|
+
data: any;
|
36
|
+
nodes: any;
|
37
|
+
tableSettings: Settings;
|
38
|
+
visibleEntities: keyof typeof VisibleEntities;
|
39
|
+
}
|
40
|
+
|
41
|
+
const tableColumnsNames: Record<TableColumnsIdsValues, string> = {
|
42
|
+
PoolName: 'Pool Name',
|
43
|
+
GroupID: 'Group ID',
|
44
|
+
Used: 'Used',
|
45
|
+
Limit: 'Limit',
|
46
|
+
UsedSpaceFlag: 'Space',
|
47
|
+
UsedPercents: 'Used percents',
|
48
|
+
Read: 'Read',
|
49
|
+
Write: 'Write',
|
50
|
+
VDisks: 'VDisks',
|
51
|
+
Missing: 'Missing',
|
52
|
+
};
|
53
|
+
|
54
|
+
const b = cn('global-storage-groups');
|
55
|
+
|
56
|
+
function setSortOrder(visibleEntities: keyof typeof VisibleEntities): SortOrder | undefined {
|
57
|
+
switch (visibleEntities) {
|
58
|
+
case VisibleEntities.All: {
|
59
|
+
return {
|
60
|
+
columnId: TableColumnsIds.GroupID,
|
61
|
+
order: DataTable.ASCENDING,
|
62
|
+
};
|
63
|
+
}
|
64
|
+
case VisibleEntities.Missing: {
|
65
|
+
return {
|
66
|
+
columnId: TableColumnsIds.Missing,
|
67
|
+
order: DataTable.DESCENDING,
|
68
|
+
};
|
69
|
+
}
|
70
|
+
case VisibleEntities.Space: {
|
71
|
+
return {
|
72
|
+
columnId: TableColumnsIds.UsedSpaceFlag,
|
73
|
+
order: DataTable.ASCENDING,
|
74
|
+
};
|
75
|
+
}
|
76
|
+
default: {
|
77
|
+
return undefined;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
function StorageGroups({data, tableSettings, visibleEntities, nodes}: StorageGroupsProps) {
|
83
|
+
const allColumns: Column<any>[] = [
|
84
|
+
{
|
85
|
+
name: TableColumnsIds.PoolName,
|
86
|
+
header: tableColumnsNames[TableColumnsIds.PoolName],
|
87
|
+
width: 160,
|
88
|
+
render: ({value}) => {
|
89
|
+
const splitted = (value as string)?.split('/');
|
90
|
+
return (
|
91
|
+
<div className={b('pool-name-wrapper')}>
|
92
|
+
{splitted && (
|
93
|
+
<Tooltip
|
94
|
+
content={<span className={b('tooltip')}>{value as string}</span>}
|
95
|
+
placement={['right']}
|
96
|
+
behavior={TooltipBehavior.Immediate}
|
97
|
+
>
|
98
|
+
<span className={b('pool-name')}>
|
99
|
+
{splitted[splitted.length - 1]}
|
100
|
+
</span>
|
101
|
+
</Tooltip>
|
102
|
+
)}
|
103
|
+
</div>
|
104
|
+
);
|
105
|
+
},
|
106
|
+
align: DataTable.LEFT,
|
107
|
+
},
|
108
|
+
{
|
109
|
+
name: TableColumnsIds.GroupID,
|
110
|
+
header: tableColumnsNames[TableColumnsIds.GroupID],
|
111
|
+
width: 130,
|
112
|
+
render: ({value}) => {
|
113
|
+
return <span className={b('group-id')}>{value as number}</span>;
|
114
|
+
},
|
115
|
+
align: DataTable.RIGHT,
|
116
|
+
},
|
117
|
+
{
|
118
|
+
name: TableColumnsIds.Used,
|
119
|
+
header: tableColumnsNames[TableColumnsIds.Used],
|
120
|
+
width: 100,
|
121
|
+
render: ({value}) => {
|
122
|
+
return bytesToGB(value, true);
|
123
|
+
},
|
124
|
+
align: DataTable.RIGHT,
|
125
|
+
},
|
126
|
+
{
|
127
|
+
name: TableColumnsIds.Limit,
|
128
|
+
header: tableColumnsNames[TableColumnsIds.Limit],
|
129
|
+
width: 100,
|
130
|
+
render: ({value}) => {
|
131
|
+
return bytesToGB(value);
|
132
|
+
},
|
133
|
+
align: DataTable.RIGHT,
|
134
|
+
},
|
135
|
+
// {
|
136
|
+
// name: tableColumnsIds.UsedPercents,
|
137
|
+
// header: tableColumnsNames[tableColumnsIds.UsedPercents],
|
138
|
+
// width: '100px',
|
139
|
+
// render: ({row}) => {
|
140
|
+
// return (
|
141
|
+
// Math.round((row[tableColumnsIds.Used] * 100) / row[tableColumnsIds.Limit]) +
|
142
|
+
// '%'
|
143
|
+
// );
|
144
|
+
// },
|
145
|
+
// align: DataTable.RIGHT,
|
146
|
+
// },
|
147
|
+
{
|
148
|
+
name: TableColumnsIds.UsedSpaceFlag,
|
149
|
+
header: tableColumnsNames[TableColumnsIds.UsedSpaceFlag],
|
150
|
+
width: 110,
|
151
|
+
render: ({value}) => {
|
152
|
+
const val = value as number;
|
153
|
+
let color = 'Red';
|
154
|
+
if (val < 100) {
|
155
|
+
color = 'Green';
|
156
|
+
} else if (val < 10000) {
|
157
|
+
color = 'Yellow';
|
158
|
+
} else if (val < 1000000) {
|
159
|
+
value = 'Orange';
|
160
|
+
}
|
161
|
+
return <EntityStatus status={color} />;
|
162
|
+
},
|
163
|
+
align: DataTable.CENTER,
|
164
|
+
},
|
165
|
+
|
166
|
+
{
|
167
|
+
name: TableColumnsIds.Read,
|
168
|
+
header: tableColumnsNames[TableColumnsIds.Read],
|
169
|
+
width: 100,
|
170
|
+
render: ({value}) => {
|
171
|
+
return value ? bytesToSpeed(value) : '-';
|
172
|
+
},
|
173
|
+
align: DataTable.RIGHT,
|
174
|
+
},
|
175
|
+
{
|
176
|
+
name: TableColumnsIds.Write,
|
177
|
+
header: tableColumnsNames[TableColumnsIds.Write],
|
178
|
+
width: 100,
|
179
|
+
render: ({value}) => {
|
180
|
+
return value ? bytesToSpeed(value) : '-';
|
181
|
+
},
|
182
|
+
align: DataTable.RIGHT,
|
183
|
+
},
|
184
|
+
{
|
185
|
+
name: TableColumnsIds.Missing,
|
186
|
+
header: tableColumnsNames[TableColumnsIds.Missing],
|
187
|
+
width: 100,
|
188
|
+
align: DataTable.CENTER,
|
189
|
+
defaultOrder: DataTable.DESCENDING,
|
190
|
+
},
|
191
|
+
{
|
192
|
+
name: TableColumnsIds.VDisks,
|
193
|
+
header: tableColumnsNames[TableColumnsIds.VDisks],
|
194
|
+
render: ({value, row}) => (
|
195
|
+
<div className={b('vdisks-wrapper')}>
|
196
|
+
{_.map(value as any, (el) => (
|
197
|
+
<Vdisk
|
198
|
+
key={stringifyVdiskId(el.VDiskId)}
|
199
|
+
{...el}
|
200
|
+
PoolName={row[TableColumnsIds.PoolName]}
|
201
|
+
nodes={nodes}
|
202
|
+
/>
|
203
|
+
))}
|
204
|
+
</div>
|
205
|
+
),
|
206
|
+
align: DataTable.CENTER,
|
207
|
+
sortable: false,
|
208
|
+
width: 900,
|
209
|
+
},
|
210
|
+
];
|
211
|
+
|
212
|
+
let columns = allColumns;
|
213
|
+
|
214
|
+
if (visibleEntities === VisibleEntities.Space) {
|
215
|
+
columns = allColumns.filter((col) => col.name !== TableColumnsIds.Missing);
|
216
|
+
}
|
217
|
+
|
218
|
+
if (visibleEntities === VisibleEntities.Missing) {
|
219
|
+
columns = allColumns.filter((col) => col.name !== TableColumnsIds.UsedSpaceFlag);
|
220
|
+
}
|
221
|
+
return data ? (
|
222
|
+
<DataTable
|
223
|
+
key={visibleEntities as string}
|
224
|
+
theme="internal"
|
225
|
+
data={data}
|
226
|
+
columns={columns}
|
227
|
+
settings={tableSettings}
|
228
|
+
initialSortOrder={setSortOrder(visibleEntities)}
|
229
|
+
emptyDataMessage="No such groups."
|
230
|
+
/>
|
231
|
+
) : null;
|
232
|
+
}
|
233
|
+
|
234
|
+
export default StorageGroups;
|
@@ -0,0 +1,30 @@
|
|
1
|
+
.global-storage-groups {
|
2
|
+
&__pdisks-wrapper {
|
3
|
+
display: flex;
|
4
|
+
overflow-x: auto;
|
5
|
+
overflow-y: hidden;
|
6
|
+
justify-content: center;
|
7
|
+
}
|
8
|
+
&__pool-name-wrapper {
|
9
|
+
display: flex;
|
10
|
+
align-items: flex-end;
|
11
|
+
}
|
12
|
+
&__pool-name {
|
13
|
+
display: inline-block;
|
14
|
+
overflow: hidden;
|
15
|
+
|
16
|
+
max-width: 340px;
|
17
|
+
|
18
|
+
text-overflow: ellipsis;
|
19
|
+
}
|
20
|
+
&__group-id {
|
21
|
+
font-weight: 500;
|
22
|
+
}
|
23
|
+
&__tooltip-wrapper {
|
24
|
+
display: flex;
|
25
|
+
align-items: center;
|
26
|
+
}
|
27
|
+
&__tooltip {
|
28
|
+
word-break: break-all;
|
29
|
+
}
|
30
|
+
}
|