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,135 @@
|
|
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
|
+
//@ts-ignore
|
6
|
+
import {VisibleEntities} from '../../../store/reducers/storage';
|
7
|
+
import Pdisk from '../Pdisk/Pdisk';
|
8
|
+
|
9
|
+
import './StorageNodes.scss';
|
10
|
+
|
11
|
+
enum TableColumnsIds {
|
12
|
+
NodeId = 'NodeId',
|
13
|
+
FQDN = 'FQDN',
|
14
|
+
uptime = 'uptime',
|
15
|
+
PDisks = 'PDisks',
|
16
|
+
Missing = 'Missing',
|
17
|
+
}
|
18
|
+
|
19
|
+
type TableColumnsIdsKeys = keyof typeof TableColumnsIds;
|
20
|
+
type TableColumnsIdsValues = typeof TableColumnsIds[TableColumnsIdsKeys];
|
21
|
+
|
22
|
+
interface StorageGroupsProps {
|
23
|
+
data: any;
|
24
|
+
nodes: any;
|
25
|
+
tableSettings: Settings;
|
26
|
+
visibleEntities: keyof typeof VisibleEntities;
|
27
|
+
}
|
28
|
+
|
29
|
+
const tableColumnsNames: Record<TableColumnsIdsValues, string> = {
|
30
|
+
NodeId: 'Node ID',
|
31
|
+
FQDN: 'FQDN',
|
32
|
+
uptime: 'Uptime',
|
33
|
+
PDisks: 'PDisks',
|
34
|
+
Missing: 'Missing',
|
35
|
+
};
|
36
|
+
|
37
|
+
const b = cn('global-storage-groups');
|
38
|
+
|
39
|
+
function setSortOrder(visibleEntities: keyof typeof VisibleEntities): SortOrder | undefined {
|
40
|
+
switch (visibleEntities) {
|
41
|
+
case VisibleEntities.All: {
|
42
|
+
return {
|
43
|
+
columnId: TableColumnsIds.NodeId,
|
44
|
+
order: DataTable.ASCENDING,
|
45
|
+
};
|
46
|
+
}
|
47
|
+
case VisibleEntities.Missing: {
|
48
|
+
return {
|
49
|
+
columnId: TableColumnsIds.Missing,
|
50
|
+
order: DataTable.DESCENDING,
|
51
|
+
};
|
52
|
+
}
|
53
|
+
default: {
|
54
|
+
return undefined;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
function StorageNodes({data, tableSettings, visibleEntities}: StorageGroupsProps) {
|
60
|
+
const allColumns: Column<any>[] = [
|
61
|
+
{
|
62
|
+
name: TableColumnsIds.NodeId,
|
63
|
+
header: tableColumnsNames[TableColumnsIds.NodeId],
|
64
|
+
width: 100,
|
65
|
+
align: DataTable.RIGHT,
|
66
|
+
},
|
67
|
+
{
|
68
|
+
name: TableColumnsIds.FQDN,
|
69
|
+
header: tableColumnsNames[TableColumnsIds.FQDN],
|
70
|
+
width: 350,
|
71
|
+
render: ({value}) => {
|
72
|
+
return (
|
73
|
+
<div className={b('tooltip-wrapper')}>
|
74
|
+
<Tooltip
|
75
|
+
content={<span className={b('tooltip')}>{value as string}</span>}
|
76
|
+
placement={['right']}
|
77
|
+
behavior={TooltipBehavior.Immediate}
|
78
|
+
>
|
79
|
+
<span className={b('pool-name')}>{value as string}</span>
|
80
|
+
</Tooltip>
|
81
|
+
</div>
|
82
|
+
);
|
83
|
+
},
|
84
|
+
align: DataTable.LEFT,
|
85
|
+
},
|
86
|
+
{
|
87
|
+
name: TableColumnsIds.uptime,
|
88
|
+
header: tableColumnsNames[TableColumnsIds.uptime],
|
89
|
+
width: 130,
|
90
|
+
sortAccessor: ({StartTime}) => -StartTime,
|
91
|
+
align: DataTable.RIGHT,
|
92
|
+
},
|
93
|
+
{
|
94
|
+
name: TableColumnsIds.Missing,
|
95
|
+
header: tableColumnsNames[TableColumnsIds.Missing],
|
96
|
+
width: 100,
|
97
|
+
align: DataTable.CENTER,
|
98
|
+
defaultOrder: DataTable.DESCENDING,
|
99
|
+
},
|
100
|
+
{
|
101
|
+
name: TableColumnsIds.PDisks,
|
102
|
+
header: tableColumnsNames[TableColumnsIds.PDisks],
|
103
|
+
render: ({value, row}) => (
|
104
|
+
<div className={b('pdisks-wrapper')}>
|
105
|
+
{_.map(value as any, (el) => (
|
106
|
+
<Pdisk key={el.PDiskId} {...el} NodeId={row.NodeId} />
|
107
|
+
))}
|
108
|
+
</div>
|
109
|
+
),
|
110
|
+
align: DataTable.CENTER,
|
111
|
+
sortable: false,
|
112
|
+
width: 900,
|
113
|
+
},
|
114
|
+
];
|
115
|
+
|
116
|
+
let columns = allColumns;
|
117
|
+
|
118
|
+
if (visibleEntities === VisibleEntities.Space) {
|
119
|
+
columns = allColumns.filter((col) => col.name !== TableColumnsIds.Missing);
|
120
|
+
}
|
121
|
+
|
122
|
+
return data ? (
|
123
|
+
<DataTable
|
124
|
+
key={visibleEntities as string}
|
125
|
+
theme="internal"
|
126
|
+
data={data}
|
127
|
+
columns={columns}
|
128
|
+
settings={tableSettings}
|
129
|
+
initialSortOrder={setSortOrder(visibleEntities)}
|
130
|
+
emptyDataMessage="No such nodes."
|
131
|
+
/>
|
132
|
+
) : null;
|
133
|
+
}
|
134
|
+
|
135
|
+
export default StorageNodes;
|
@@ -0,0 +1,250 @@
|
|
1
|
+
import React, {useEffect, useState, useRef, useMemo} from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import cn from 'bem-cn-lite';
|
4
|
+
import _ from 'lodash';
|
5
|
+
import {Popup} from '@yandex-cloud/uikit';
|
6
|
+
|
7
|
+
import {bytesToGB, bytesToSpeed} from '../../../utils/utils';
|
8
|
+
import routes, {createHref} from '../../../routes';
|
9
|
+
import {stringifyVdiskId, getPDiskId} from '../../../utils';
|
10
|
+
import DiskStateProgressBar, {
|
11
|
+
diskProgressColors,
|
12
|
+
} from '../DiskStateProgressBar/DiskStateProgressBar';
|
13
|
+
|
14
|
+
import './Vdisk.scss';
|
15
|
+
|
16
|
+
const b = cn('vdisk-storage');
|
17
|
+
|
18
|
+
const propTypes = {
|
19
|
+
SatisfactionRank: PropTypes.object,
|
20
|
+
VDiskState: PropTypes.string,
|
21
|
+
DiskSpace: PropTypes.string,
|
22
|
+
FrontQueues: PropTypes.string,
|
23
|
+
Replicated: PropTypes.bool,
|
24
|
+
PoolName: PropTypes.string,
|
25
|
+
};
|
26
|
+
|
27
|
+
const stateSeverity = {
|
28
|
+
Initial: 3,
|
29
|
+
LocalRecoveryError: 5,
|
30
|
+
SyncGuidRecoveryError: 5,
|
31
|
+
SyncGuidRecovery: 3,
|
32
|
+
PDiskError: 5,
|
33
|
+
OK: 1,
|
34
|
+
};
|
35
|
+
|
36
|
+
const colorSeverity = {
|
37
|
+
Grey: 0,
|
38
|
+
Green: 1,
|
39
|
+
Blue: 2,
|
40
|
+
Yellow: 3,
|
41
|
+
Orange: 4,
|
42
|
+
Red: 5,
|
43
|
+
};
|
44
|
+
|
45
|
+
const getStateSeverity = (vDiskState) => {
|
46
|
+
return stateSeverity[vDiskState] ?? colorSeverity.Grey;
|
47
|
+
};
|
48
|
+
|
49
|
+
const getColorSeverity = (color) => {
|
50
|
+
return colorSeverity[color] ?? colorSeverity.Grey;
|
51
|
+
};
|
52
|
+
|
53
|
+
function Vdisk(props) {
|
54
|
+
const [severity, setSeverity] = useState(getStateSeverity(props.VDiskState));
|
55
|
+
const [isPopupVisible, setIsPopupVisible] = useState(false);
|
56
|
+
|
57
|
+
const anchor = useRef();
|
58
|
+
|
59
|
+
useEffect(() => {
|
60
|
+
const {DiskSpace, VDiskState, FrontQueues, Replicated} = props;
|
61
|
+
const DiskSpaceSeverity = getColorSeverity(DiskSpace);
|
62
|
+
const VDiskSpaceSeverity = getStateSeverity(VDiskState);
|
63
|
+
const FrontQueuesSeverity = Math.min(colorSeverity.Orange, getColorSeverity(FrontQueues));
|
64
|
+
let newSeverity = Math.max(DiskSpaceSeverity, VDiskSpaceSeverity, FrontQueuesSeverity);
|
65
|
+
if (!Replicated && newSeverity === colorSeverity.Green) {
|
66
|
+
newSeverity = colorSeverity.Blue;
|
67
|
+
}
|
68
|
+
setSeverity(newSeverity);
|
69
|
+
}, [props.VDiskState, props.DiskSpace, props.FrontQueues, props.Replicated]);
|
70
|
+
|
71
|
+
const showPopup = () => {
|
72
|
+
setIsPopupVisible(true);
|
73
|
+
};
|
74
|
+
|
75
|
+
const hidePopup = () => {
|
76
|
+
setIsPopupVisible(false);
|
77
|
+
};
|
78
|
+
/* eslint-disable */
|
79
|
+
const prepareVdiskData = () => {
|
80
|
+
const {
|
81
|
+
VDiskId,
|
82
|
+
VDiskState,
|
83
|
+
PoolName,
|
84
|
+
SatisfactionRank,
|
85
|
+
DiskSpace,
|
86
|
+
FrontQueues,
|
87
|
+
Replicated,
|
88
|
+
UnsyncedVDisks,
|
89
|
+
AllocatedSize,
|
90
|
+
ReadThroughput,
|
91
|
+
WriteThroughput,
|
92
|
+
} = props;
|
93
|
+
const vdiskData = [{property: 'VDisk', value: stringifyVdiskId(VDiskId)}];
|
94
|
+
vdiskData.push({property: 'State', value: VDiskState ?? 'not available'});
|
95
|
+
PoolName && vdiskData.push({property: 'StoragePool', value: PoolName});
|
96
|
+
|
97
|
+
SatisfactionRank &&
|
98
|
+
SatisfactionRank.FreshRank?.Flag !== diskProgressColors[colorSeverity.Green] &&
|
99
|
+
vdiskData.push({
|
100
|
+
property: 'Fresh',
|
101
|
+
value: SatisfactionRank.FreshRank.Flag,
|
102
|
+
});
|
103
|
+
|
104
|
+
SatisfactionRank &&
|
105
|
+
SatisfactionRank.LevelRank?.Flag !== diskProgressColors[colorSeverity.Green] &&
|
106
|
+
vdiskData.push({
|
107
|
+
property: 'Level',
|
108
|
+
value: SatisfactionRank.LevelRank.Flag,
|
109
|
+
});
|
110
|
+
|
111
|
+
SatisfactionRank &&
|
112
|
+
SatisfactionRank.FreshRank?.RankPercent &&
|
113
|
+
vdiskData.push({
|
114
|
+
property: 'Fresh',
|
115
|
+
value: SatisfactionRank.FreshRank.RankPercent,
|
116
|
+
});
|
117
|
+
|
118
|
+
SatisfactionRank &&
|
119
|
+
SatisfactionRank.LevelRank?.RankPercent &&
|
120
|
+
vdiskData.push({
|
121
|
+
property: 'Level',
|
122
|
+
value: SatisfactionRank.LevelRank.RankPercent,
|
123
|
+
});
|
124
|
+
|
125
|
+
DiskSpace &&
|
126
|
+
DiskSpace !== diskProgressColors[colorSeverity.Green] &&
|
127
|
+
vdiskData.push({property: 'Space', value: DiskSpace});
|
128
|
+
|
129
|
+
FrontQueues &&
|
130
|
+
FrontQueues !== diskProgressColors[colorSeverity.Green] &&
|
131
|
+
vdiskData.push({property: 'FrontQueues', value: FrontQueues});
|
132
|
+
|
133
|
+
!Replicated && vdiskData.push({property: 'Replicated', value: 'NO'});
|
134
|
+
|
135
|
+
UnsyncedVDisks && vdiskData.push({property: 'UnsyncVDisks', value: UnsyncedVDisks});
|
136
|
+
|
137
|
+
Boolean(Number(AllocatedSize)) &&
|
138
|
+
vdiskData.push({
|
139
|
+
property: 'Allocated',
|
140
|
+
value: bytesToGB(AllocatedSize),
|
141
|
+
});
|
142
|
+
|
143
|
+
Boolean(Number(ReadThroughput)) &&
|
144
|
+
vdiskData.push({property: 'Read', value: bytesToSpeed(ReadThroughput)});
|
145
|
+
|
146
|
+
Boolean(Number(WriteThroughput)) &&
|
147
|
+
vdiskData.push({
|
148
|
+
property: 'Write',
|
149
|
+
value: bytesToSpeed(WriteThroughput),
|
150
|
+
});
|
151
|
+
|
152
|
+
return vdiskData;
|
153
|
+
};
|
154
|
+
|
155
|
+
const preparePdiskData = () => {
|
156
|
+
const {PDisk, nodes} = props;
|
157
|
+
const errorColors = [
|
158
|
+
diskProgressColors[colorSeverity.Orange],
|
159
|
+
diskProgressColors[colorSeverity.Red],
|
160
|
+
diskProgressColors[colorSeverity.Yellow],
|
161
|
+
];
|
162
|
+
if (PDisk && nodes) {
|
163
|
+
const pdiskData = [{property: 'PDisk', value: getPDiskId(PDisk)}];
|
164
|
+
pdiskData.push({
|
165
|
+
property: 'State',
|
166
|
+
value: PDisk.State || 'not available',
|
167
|
+
});
|
168
|
+
PDisk.NodeId && pdiskData.push({property: 'Node Id', value: PDisk.NodeId});
|
169
|
+
PDisk.NodeId &&
|
170
|
+
nodes[PDisk.NodeId] &&
|
171
|
+
pdiskData.push({property: 'Host', value: nodes[PDisk.NodeId]});
|
172
|
+
PDisk.Path && pdiskData.push({property: 'Path', value: PDisk.Path});
|
173
|
+
pdiskData.push({
|
174
|
+
property: 'Available',
|
175
|
+
value: `${bytesToGB(PDisk.AvailableSize)} of ${bytesToGB(PDisk.TotalSize)}`,
|
176
|
+
});
|
177
|
+
errorColors.includes(PDisk.Realtime) &&
|
178
|
+
pdiskData.push({property: 'Realtime', value: PDisk.Realtime});
|
179
|
+
errorColors.includes(PDisk.Device) &&
|
180
|
+
pdiskData.push({property: 'Device', value: PDisk.Device});
|
181
|
+
return pdiskData;
|
182
|
+
}
|
183
|
+
return null;
|
184
|
+
};
|
185
|
+
/* eslint-enable */
|
186
|
+
|
187
|
+
const renderPopup = () => {
|
188
|
+
const vdiskData = prepareVdiskData();
|
189
|
+
const pdiskData = preparePdiskData();
|
190
|
+
return (
|
191
|
+
<Popup
|
192
|
+
className={b('popup-wrapper')}
|
193
|
+
anchorRef={anchor}
|
194
|
+
open={isPopupVisible}
|
195
|
+
placement={['top']}
|
196
|
+
hasArrow
|
197
|
+
>
|
198
|
+
<div className={b('popup-content')}>
|
199
|
+
<div className={b('popup-section-name')}>VDisk</div>
|
200
|
+
{_.map(vdiskData, (row) => (
|
201
|
+
<React.Fragment key={row.property}>
|
202
|
+
<div className={b('property')}>{row.property}</div>
|
203
|
+
<div className={b('value')}>{row.value}</div>
|
204
|
+
</React.Fragment>
|
205
|
+
))}
|
206
|
+
<div className={b('popup-section-name')}>PDisk</div>
|
207
|
+
{_.map(pdiskData, (row) => (
|
208
|
+
<React.Fragment key={row.property}>
|
209
|
+
<div className={b('property')}>{row.property}</div>
|
210
|
+
<div className={b('value')}>{row.value}</div>
|
211
|
+
</React.Fragment>
|
212
|
+
))}
|
213
|
+
</div>
|
214
|
+
</Popup>
|
215
|
+
);
|
216
|
+
};
|
217
|
+
|
218
|
+
const vdiskAllocatedPercent = useMemo(() => {
|
219
|
+
const {AvailableSize, AllocatedSize, PDisk} = props;
|
220
|
+
const available = AvailableSize ? AvailableSize : PDisk?.AvailableSize;
|
221
|
+
|
222
|
+
if (!available) {
|
223
|
+
return;
|
224
|
+
}
|
225
|
+
return !isNaN(Number(AllocatedSize))
|
226
|
+
? (Number(AllocatedSize) * 100) / (Number(available) + Number(AllocatedSize))
|
227
|
+
: undefined;
|
228
|
+
}, [props.AllocatedSize, props.AvailableSize, props.PDisk?.AvailableSize]);
|
229
|
+
|
230
|
+
return (
|
231
|
+
<React.Fragment>
|
232
|
+
{renderPopup()}
|
233
|
+
<div className={b()} ref={anchor} onMouseEnter={showPopup} onMouseLeave={hidePopup}>
|
234
|
+
<DiskStateProgressBar
|
235
|
+
diskAllocatedPercent={vdiskAllocatedPercent}
|
236
|
+
severity={severity}
|
237
|
+
href={createHref(routes.vdisk, null, {
|
238
|
+
vdiskId: stringifyVdiskId(props.VDiskId),
|
239
|
+
pdiskId: props.PDisk?.PDiskId,
|
240
|
+
nodeId: props.NodeId,
|
241
|
+
})}
|
242
|
+
/>
|
243
|
+
</div>
|
244
|
+
</React.Fragment>
|
245
|
+
);
|
246
|
+
}
|
247
|
+
|
248
|
+
Vdisk.propTypes = propTypes;
|
249
|
+
|
250
|
+
export default Vdisk;
|
@@ -0,0 +1,32 @@
|
|
1
|
+
.vdisk-storage {
|
2
|
+
flex-grow: 1;
|
3
|
+
|
4
|
+
margin-right: 10px;
|
5
|
+
|
6
|
+
cursor: pointer;
|
7
|
+
|
8
|
+
&:last-child {
|
9
|
+
margin-right: 0px;
|
10
|
+
}
|
11
|
+
&__popup-wrapper {
|
12
|
+
padding: 5px 10px;
|
13
|
+
}
|
14
|
+
&__popup-content {
|
15
|
+
display: grid;
|
16
|
+
column-gap: 5px;
|
17
|
+
justify-items: stretch;
|
18
|
+
}
|
19
|
+
&__popup-section-name {
|
20
|
+
margin: 5px 0;
|
21
|
+
|
22
|
+
text-align: center;
|
23
|
+
|
24
|
+
border-bottom: 1px solid var(--yc-color-line-generic);
|
25
|
+
|
26
|
+
font-weight: 500;
|
27
|
+
grid-column: 1 / 3;
|
28
|
+
}
|
29
|
+
&__property {
|
30
|
+
text-align: right;
|
31
|
+
}
|
32
|
+
}
|