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,185 @@
|
|
1
|
+
import {useCallback, useEffect, useState} from 'react';
|
2
|
+
import cn from 'bem-cn-lite';
|
3
|
+
import JSONTree from 'react-json-inspector';
|
4
|
+
import _ from 'lodash';
|
5
|
+
import _flow from 'lodash/fp/flow';
|
6
|
+
import _filter from 'lodash/fp/filter';
|
7
|
+
import _sortBy from 'lodash/fp/sortBy';
|
8
|
+
import _uniqBy from 'lodash/fp/uniqBy';
|
9
|
+
|
10
|
+
import TreeView from '../../../../components/TreeView/TreeView';
|
11
|
+
import EntityStatus from '../../../../components/EntityStatus/EntityStatus';
|
12
|
+
|
13
|
+
import './IssueViewer.scss';
|
14
|
+
|
15
|
+
// const indicatorBlock = cn('indicator');
|
16
|
+
|
17
|
+
// const IssueStatus = ({status, name}) => {
|
18
|
+
// const modifier = status && status.toLowerCase();
|
19
|
+
|
20
|
+
// return (
|
21
|
+
// <React.Fragment>
|
22
|
+
// <div className={indicatorBlock({[modifier]: true})} />
|
23
|
+
// {name}
|
24
|
+
// </React.Fragment>
|
25
|
+
// );
|
26
|
+
// };
|
27
|
+
|
28
|
+
const issueBlock = cn('issue');
|
29
|
+
|
30
|
+
const IssueRow = ({data, treeLevel, active, setInfoForActive, onClick}) => {
|
31
|
+
// eslint-disable-next-line no-unused-vars
|
32
|
+
const {id, status, message, type, ...rest} = data;
|
33
|
+
|
34
|
+
useEffect(() => {
|
35
|
+
if (active) {
|
36
|
+
setInfoForActive(rest);
|
37
|
+
}
|
38
|
+
}, [active, setInfoForActive]);
|
39
|
+
|
40
|
+
return (
|
41
|
+
<div className={issueBlock({active})} onClick={onClick}>
|
42
|
+
<div className={issueBlock('field', {status: true})}>
|
43
|
+
<EntityStatus status={status} name={id} />
|
44
|
+
{/* <IssueStatus status={status} name={id} /> */}
|
45
|
+
</div>
|
46
|
+
<div
|
47
|
+
className={issueBlock('field', {message: true})}
|
48
|
+
style={{marginLeft: -treeLevel * 25 + 'px'}}
|
49
|
+
>
|
50
|
+
{message}
|
51
|
+
</div>
|
52
|
+
<div className={issueBlock('field', {type: true})}>{type}</div>
|
53
|
+
</div>
|
54
|
+
);
|
55
|
+
};
|
56
|
+
|
57
|
+
const issueViewerBlock = cn('issue-viewer');
|
58
|
+
|
59
|
+
const IssuesViewer = ({issues}) => {
|
60
|
+
const [data, setData] = useState([]);
|
61
|
+
const [collapsedIssues, setCollapsedIssues] = useState({});
|
62
|
+
const [activeItem, setActiveItem] = useState();
|
63
|
+
const [infoData, setInfoData] = useState();
|
64
|
+
|
65
|
+
useEffect(() => {
|
66
|
+
if (!activeItem && data.length) {
|
67
|
+
const {id} = data[0];
|
68
|
+
setActiveItem(id);
|
69
|
+
}
|
70
|
+
}, [data]);
|
71
|
+
|
72
|
+
useEffect(() => {
|
73
|
+
const newData = getInvertedConsequencesTree({data: issues});
|
74
|
+
|
75
|
+
setData(newData);
|
76
|
+
}, [issues]);
|
77
|
+
|
78
|
+
const renderTree = useCallback(
|
79
|
+
(data, childrenKey, treeLevel = 0) => {
|
80
|
+
return _.map(data, (item) => {
|
81
|
+
const {id} = item;
|
82
|
+
const isActive = activeItem === item.id;
|
83
|
+
const hasArrow = item[childrenKey].length;
|
84
|
+
|
85
|
+
return (
|
86
|
+
<TreeView
|
87
|
+
key={id}
|
88
|
+
nodeLabel={
|
89
|
+
<IssueRow
|
90
|
+
data={item}
|
91
|
+
treeLevel={treeLevel}
|
92
|
+
active={isActive}
|
93
|
+
setInfoForActive={setInfoData}
|
94
|
+
onClick={() => setActiveItem(id)}
|
95
|
+
/>
|
96
|
+
}
|
97
|
+
className={issueBlock('wpapper', {active: isActive})}
|
98
|
+
collapsed={
|
99
|
+
typeof collapsedIssues[id] === 'undefined' || collapsedIssues[id]
|
100
|
+
}
|
101
|
+
hasArrow={hasArrow}
|
102
|
+
onClick={() => {
|
103
|
+
const newValue =
|
104
|
+
typeof collapsedIssues[id] === 'undefined'
|
105
|
+
? false
|
106
|
+
: !collapsedIssues[id];
|
107
|
+
const newCollapsedIssues = {...collapsedIssues, [id]: newValue};
|
108
|
+
setCollapsedIssues(newCollapsedIssues);
|
109
|
+
}}
|
110
|
+
>
|
111
|
+
{renderTree(item[childrenKey], childrenKey, treeLevel + 1)}
|
112
|
+
</TreeView>
|
113
|
+
);
|
114
|
+
});
|
115
|
+
},
|
116
|
+
[data, collapsedIssues, activeItem],
|
117
|
+
);
|
118
|
+
|
119
|
+
const renderInfoPanel = useCallback(() => {
|
120
|
+
if (!infoData) {
|
121
|
+
return null;
|
122
|
+
}
|
123
|
+
|
124
|
+
return (
|
125
|
+
<div className={issueViewerBlock('info-panel')}>
|
126
|
+
<h3>Additional info for {activeItem}</h3>
|
127
|
+
<JSONTree
|
128
|
+
data={infoData}
|
129
|
+
search={false}
|
130
|
+
isExpanded={() => true}
|
131
|
+
className={issueViewerBlock('inspector')}
|
132
|
+
/>
|
133
|
+
</div>
|
134
|
+
);
|
135
|
+
}, [data, infoData, activeItem]);
|
136
|
+
|
137
|
+
return (
|
138
|
+
<div className={issueViewerBlock()}>
|
139
|
+
<div className={issueViewerBlock('tree')}>{renderTree(data, 'reasonsItems')}</div>
|
140
|
+
{renderInfoPanel()}
|
141
|
+
</div>
|
142
|
+
);
|
143
|
+
};
|
144
|
+
|
145
|
+
function getReasonsForIssue({issue, data}) {
|
146
|
+
return _.filter(data, (item) => issue.reason && issue.reason.indexOf(item.id) !== -1);
|
147
|
+
}
|
148
|
+
|
149
|
+
const mapStatusToPriority = {
|
150
|
+
RED: 0,
|
151
|
+
ORANGE: 1,
|
152
|
+
YELLOW: 2,
|
153
|
+
BLUE: 3,
|
154
|
+
GREEN: 4,
|
155
|
+
};
|
156
|
+
|
157
|
+
function getInvertedConsequencesTree({data, roots: receivedRoots}) {
|
158
|
+
let roots = receivedRoots;
|
159
|
+
if (!roots && data) {
|
160
|
+
roots = _flow([
|
161
|
+
_filter((item) => {
|
162
|
+
return !_.find(
|
163
|
+
data,
|
164
|
+
(issue) => issue.reason && issue.reason.indexOf(item.id) !== -1,
|
165
|
+
);
|
166
|
+
}),
|
167
|
+
_uniqBy((item) => item.id),
|
168
|
+
_sortBy(({status}) => mapStatusToPriority[status]),
|
169
|
+
])(data);
|
170
|
+
}
|
171
|
+
|
172
|
+
return _.map(roots, (issue) => {
|
173
|
+
const reasonsItems = getInvertedConsequencesTree({
|
174
|
+
roots: getReasonsForIssue({issue, data}),
|
175
|
+
data,
|
176
|
+
});
|
177
|
+
|
178
|
+
return {
|
179
|
+
...issue,
|
180
|
+
reasonsItems,
|
181
|
+
};
|
182
|
+
});
|
183
|
+
}
|
184
|
+
|
185
|
+
export default IssuesViewer;
|
@@ -0,0 +1,341 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import cn from 'bem-cn-lite';
|
3
|
+
import PropTypes from 'prop-types';
|
4
|
+
import {connect} from 'react-redux';
|
5
|
+
import _ from 'lodash';
|
6
|
+
|
7
|
+
import {Link} from 'react-router-dom';
|
8
|
+
import {Loader, Checkbox} from '@yandex-cloud/uikit';
|
9
|
+
|
10
|
+
import NodeNetwork from './NodeNetwork/NodeNetwork';
|
11
|
+
import Icon from '../../../components/Icon/Icon';
|
12
|
+
import ProblemFilter, {problemFilterType} from '../../../components/ProblemFilter/ProblemFilter';
|
13
|
+
|
14
|
+
import {getNetworkInfo} from '../../../store/reducers/network';
|
15
|
+
import {hideTooltip, showTooltip} from '../../../store/reducers/tooltip';
|
16
|
+
import {ALL, PROBLEMS} from '../../../utils/constants';
|
17
|
+
import routes, {createHref} from '../../../routes';
|
18
|
+
import {changeFilter} from '../../../store/reducers/settings';
|
19
|
+
|
20
|
+
import './Network.scss';
|
21
|
+
|
22
|
+
const b = cn('network');
|
23
|
+
|
24
|
+
class Network extends React.Component {
|
25
|
+
static propTypes = {
|
26
|
+
getNetworkInfo: PropTypes.func,
|
27
|
+
netWorkInfo: PropTypes.object,
|
28
|
+
hideTooltip: PropTypes.func,
|
29
|
+
showTooltip: PropTypes.func,
|
30
|
+
error: PropTypes.object,
|
31
|
+
wasLoaded: PropTypes.bool,
|
32
|
+
loading: PropTypes.bool,
|
33
|
+
path: PropTypes.string,
|
34
|
+
filter: problemFilterType,
|
35
|
+
changeFilter: PropTypes.func,
|
36
|
+
};
|
37
|
+
|
38
|
+
static defaultProps = {};
|
39
|
+
|
40
|
+
static renderLoader() {
|
41
|
+
return (
|
42
|
+
<div className="loader">
|
43
|
+
<Loader size="l" />
|
44
|
+
</div>
|
45
|
+
);
|
46
|
+
}
|
47
|
+
|
48
|
+
state = {
|
49
|
+
howNodeSeeOtherNodesSortType: '',
|
50
|
+
howOthersSeeNodeSortType: '',
|
51
|
+
howNodeSeeOtherSearch: '',
|
52
|
+
howOtherSeeNodeSearch: '',
|
53
|
+
hoveredNode: undefined,
|
54
|
+
clickedNode: undefined,
|
55
|
+
highlightedNodes: [],
|
56
|
+
showId: false,
|
57
|
+
showRacks: false,
|
58
|
+
};
|
59
|
+
|
60
|
+
componentDidMount() {
|
61
|
+
const {path} = this.props;
|
62
|
+
this.props.getNetworkInfo(path);
|
63
|
+
}
|
64
|
+
|
65
|
+
onChange = (field, num) => {
|
66
|
+
this.setState({[field]: num});
|
67
|
+
};
|
68
|
+
|
69
|
+
handleSortChange = (sortItem) => {
|
70
|
+
this.setState({sort: sortItem});
|
71
|
+
};
|
72
|
+
|
73
|
+
handleNodeClickWrap = (nodeInfo) => {
|
74
|
+
return () => {
|
75
|
+
const {clickedNode} = this.state;
|
76
|
+
const {NodeId} = nodeInfo;
|
77
|
+
if (!clickedNode) {
|
78
|
+
this.setState({
|
79
|
+
clickedNode: nodeInfo,
|
80
|
+
rightNodes: this.groupNodesByField(nodeInfo.Peers, 'NodeType'),
|
81
|
+
});
|
82
|
+
} else if (NodeId === clickedNode.nodeId) {
|
83
|
+
this.setState({clickedNode: undefined});
|
84
|
+
} else {
|
85
|
+
this.setState({
|
86
|
+
clickedNode: nodeInfo,
|
87
|
+
rightNodes: this.groupNodesByField(nodeInfo.Peers, 'NodeType'),
|
88
|
+
});
|
89
|
+
}
|
90
|
+
};
|
91
|
+
};
|
92
|
+
|
93
|
+
groupNodesByField = (nodes, field) => {
|
94
|
+
return _.reduce(
|
95
|
+
nodes,
|
96
|
+
(acc, node) => {
|
97
|
+
if (!acc[node[field]]) {
|
98
|
+
acc[node[field]] = [node];
|
99
|
+
} else {
|
100
|
+
acc[node[field]].push(node);
|
101
|
+
}
|
102
|
+
return acc;
|
103
|
+
},
|
104
|
+
{},
|
105
|
+
);
|
106
|
+
};
|
107
|
+
|
108
|
+
getConnectedNodesCount = (peers) => {
|
109
|
+
const res = peers?.reduce((acc, item) => (item.Connected ? acc + 1 : acc), 0);
|
110
|
+
return res;
|
111
|
+
};
|
112
|
+
|
113
|
+
renderNodes = (nodes, isRight) => {
|
114
|
+
const {showId, showRacks, clickedNode} = this.state;
|
115
|
+
let problemNodesCount = 0;
|
116
|
+
const {showTooltip, hideTooltip, filter} = this.props;
|
117
|
+
const result = Object.keys(nodes).map((key, j) => {
|
118
|
+
const nodesGroupedByRack = this.groupNodesByField(nodes[key], 'Rack');
|
119
|
+
return (
|
120
|
+
<div key={j} className={b('nodes-container', {right: isRight})}>
|
121
|
+
<div className={b('nodes-title')}>{key} nodes</div>
|
122
|
+
<div className={b('nodes')}>
|
123
|
+
{showRacks
|
124
|
+
? Object.keys(nodesGroupedByRack).map((key, i) => (
|
125
|
+
<div key={i} className={b('rack-column')}>
|
126
|
+
<div className={b('rack-index')}>
|
127
|
+
{key === 'undefined' ? '?' : key}
|
128
|
+
</div>
|
129
|
+
{/* eslint-disable-next-line array-callback-return */}
|
130
|
+
{nodesGroupedByRack[key].map((nodeInfo, index) => {
|
131
|
+
let capacity, connected;
|
132
|
+
if (!isRight && nodeInfo?.Peers) {
|
133
|
+
capacity = Object.keys(nodeInfo?.Peers).length;
|
134
|
+
connected = this.getConnectedNodesCount(
|
135
|
+
nodeInfo?.Peers,
|
136
|
+
);
|
137
|
+
}
|
138
|
+
|
139
|
+
if (
|
140
|
+
(filter === PROBLEMS && capacity !== connected) ||
|
141
|
+
filter === ALL ||
|
142
|
+
isRight
|
143
|
+
) {
|
144
|
+
problemNodesCount++;
|
145
|
+
return (
|
146
|
+
<NodeNetwork
|
147
|
+
key={index}
|
148
|
+
nodeId={nodeInfo.NodeId}
|
149
|
+
showID={showId}
|
150
|
+
rack={nodeInfo.Rack}
|
151
|
+
status={nodeInfo.ConnectStatus}
|
152
|
+
capacity={capacity}
|
153
|
+
connected={connected}
|
154
|
+
onMouseEnter={showTooltip}
|
155
|
+
onMouseLeave={hideTooltip}
|
156
|
+
onClick={
|
157
|
+
!isRight &&
|
158
|
+
this.handleNodeClickWrap(nodeInfo)
|
159
|
+
}
|
160
|
+
isBlurred={
|
161
|
+
!isRight &&
|
162
|
+
clickedNode &&
|
163
|
+
clickedNode.NodeId !== nodeInfo.NodeId
|
164
|
+
}
|
165
|
+
/>
|
166
|
+
);
|
167
|
+
}
|
168
|
+
})}
|
169
|
+
</div>
|
170
|
+
))
|
171
|
+
: // eslint-disable-next-line array-callback-return
|
172
|
+
nodes[key].map((nodeInfo, index) => {
|
173
|
+
let capacity, connected;
|
174
|
+
if (!isRight) {
|
175
|
+
capacity = nodeInfo?.Peers?.length;
|
176
|
+
connected = this.getConnectedNodesCount(nodeInfo?.Peers);
|
177
|
+
}
|
178
|
+
|
179
|
+
if (
|
180
|
+
(filter === PROBLEMS && capacity !== connected) ||
|
181
|
+
filter === ALL ||
|
182
|
+
isRight
|
183
|
+
) {
|
184
|
+
problemNodesCount++;
|
185
|
+
return (
|
186
|
+
<NodeNetwork
|
187
|
+
key={index}
|
188
|
+
nodeId={nodeInfo.NodeId}
|
189
|
+
showID={showId}
|
190
|
+
rack={nodeInfo.Rack}
|
191
|
+
status={nodeInfo.ConnectStatus}
|
192
|
+
capacity={nodeInfo?.Peers && nodeInfo?.Peers.length}
|
193
|
+
connected={
|
194
|
+
nodeInfo?.Peers &&
|
195
|
+
this.getConnectedNodesCount(nodeInfo?.Peers)
|
196
|
+
}
|
197
|
+
onMouseEnter={showTooltip}
|
198
|
+
onMouseLeave={hideTooltip}
|
199
|
+
onClick={
|
200
|
+
!isRight && this.handleNodeClickWrap(nodeInfo)
|
201
|
+
}
|
202
|
+
isBlurred={
|
203
|
+
!isRight &&
|
204
|
+
clickedNode &&
|
205
|
+
clickedNode.NodeId !== nodeInfo.NodeId
|
206
|
+
}
|
207
|
+
/>
|
208
|
+
);
|
209
|
+
}
|
210
|
+
})}
|
211
|
+
</div>
|
212
|
+
</div>
|
213
|
+
);
|
214
|
+
});
|
215
|
+
|
216
|
+
if (filter === PROBLEMS && problemNodesCount === 0) {
|
217
|
+
return <div className="no-problem" />;
|
218
|
+
} else {
|
219
|
+
return result;
|
220
|
+
}
|
221
|
+
};
|
222
|
+
|
223
|
+
renderContent = () => {
|
224
|
+
const {netWorkInfo, filter, changeFilter} = this.props;
|
225
|
+
|
226
|
+
const {showId, showRacks, rightNodes} = this.state;
|
227
|
+
const {clickedNode} = this.state;
|
228
|
+
|
229
|
+
const nodes = netWorkInfo.Tenants && netWorkInfo.Tenants[0].Nodes;
|
230
|
+
const nodesGroupedByType = this.groupNodesByField(nodes, 'NodeType');
|
231
|
+
|
232
|
+
if (!nodes?.length) {
|
233
|
+
return <div className="error">no nodes data</div>;
|
234
|
+
}
|
235
|
+
|
236
|
+
return (
|
237
|
+
<div className={b()}>
|
238
|
+
<div className={b('inner')}>
|
239
|
+
<div className={b('nodes-row')}>
|
240
|
+
<div className={b('left')}>
|
241
|
+
<div className={b('controls-wrapper')}>
|
242
|
+
<div className={b('controls')}>
|
243
|
+
<ProblemFilter
|
244
|
+
value={filter}
|
245
|
+
onChange={changeFilter}
|
246
|
+
className={b('problem-filter')}
|
247
|
+
/>
|
248
|
+
<div className={b('checkbox-wrapper')}>
|
249
|
+
<Checkbox
|
250
|
+
onUpdate={() => this.onChange('showId', !showId)}
|
251
|
+
checked={showId}
|
252
|
+
>
|
253
|
+
ID
|
254
|
+
</Checkbox>
|
255
|
+
</div>
|
256
|
+
<div className={b('checkbox-wrapper')}>
|
257
|
+
<Checkbox
|
258
|
+
onUpdate={() => this.onChange('showRacks', !showRacks)}
|
259
|
+
checked={showRacks}
|
260
|
+
>
|
261
|
+
Racks
|
262
|
+
</Checkbox>
|
263
|
+
</div>
|
264
|
+
</div>
|
265
|
+
</div>
|
266
|
+
{this.renderNodes(nodesGroupedByType)}
|
267
|
+
</div>
|
268
|
+
|
269
|
+
<div className={b('right')}>
|
270
|
+
{clickedNode ? (
|
271
|
+
<div>
|
272
|
+
<div className={b('label')}>
|
273
|
+
Connectivity of node{' '}
|
274
|
+
<Link
|
275
|
+
className={b('link')}
|
276
|
+
to={createHref(routes.node, {
|
277
|
+
id: clickedNode.NodeId,
|
278
|
+
activeTab: 'storage',
|
279
|
+
})}
|
280
|
+
>
|
281
|
+
{clickedNode.NodeId}
|
282
|
+
</Link>{' '}
|
283
|
+
to other nodes
|
284
|
+
</div>
|
285
|
+
<div className={b('nodes-row')}>
|
286
|
+
{this.renderNodes(rightNodes, true)}
|
287
|
+
</div>
|
288
|
+
</div>
|
289
|
+
) : (
|
290
|
+
<div className={b('placeholder')}>
|
291
|
+
<div className={b('placeholder-img')}>
|
292
|
+
<Icon
|
293
|
+
name="network-placeholder"
|
294
|
+
viewBox="0 0 221 204"
|
295
|
+
width={221}
|
296
|
+
height={204}
|
297
|
+
/>
|
298
|
+
</div>
|
299
|
+
|
300
|
+
<div className={b('placeholder-text')}>
|
301
|
+
Select node to see its connectivity to other nodes
|
302
|
+
</div>
|
303
|
+
</div>
|
304
|
+
)}
|
305
|
+
</div>
|
306
|
+
</div>
|
307
|
+
</div>
|
308
|
+
</div>
|
309
|
+
);
|
310
|
+
};
|
311
|
+
|
312
|
+
render() {
|
313
|
+
const {loading, wasLoaded, error} = this.props;
|
314
|
+
if (loading && !wasLoaded) {
|
315
|
+
return Network.renderLoader();
|
316
|
+
} else if (error) {
|
317
|
+
return <div>{error.statusText}</div>;
|
318
|
+
} else {
|
319
|
+
return this.renderContent();
|
320
|
+
}
|
321
|
+
}
|
322
|
+
}
|
323
|
+
|
324
|
+
const mapStateToProps = (state) => {
|
325
|
+
const {wasLoaded, loading, data: netWorkInfo} = state.network;
|
326
|
+
return {
|
327
|
+
netWorkInfo,
|
328
|
+
wasLoaded,
|
329
|
+
loading,
|
330
|
+
filter: state.settings.problemFilter,
|
331
|
+
};
|
332
|
+
};
|
333
|
+
|
334
|
+
const mapDispatchToProps = {
|
335
|
+
getNetworkInfo,
|
336
|
+
hideTooltip,
|
337
|
+
showTooltip,
|
338
|
+
changeFilter,
|
339
|
+
};
|
340
|
+
|
341
|
+
export default connect(mapStateToProps, mapDispatchToProps)(Network);
|
@@ -0,0 +1,145 @@
|
|
1
|
+
@import '../../../styles/mixins.scss';
|
2
|
+
|
3
|
+
.network {
|
4
|
+
@include container-fluid();
|
5
|
+
font-size: var(--yc-text-body2-font-size);
|
6
|
+
line-height: var(--yc-text-body2-line-height);
|
7
|
+
max-width: 1305px;
|
8
|
+
display: flex;
|
9
|
+
@include flex-container();
|
10
|
+
overflow: auto;
|
11
|
+
justify-content: space-between;
|
12
|
+
|
13
|
+
&__problem-filter {
|
14
|
+
margin-right: 15px;
|
15
|
+
}
|
16
|
+
|
17
|
+
&__nodes-row {
|
18
|
+
display: flex;
|
19
|
+
@include flex-container();
|
20
|
+
overflow: auto;
|
21
|
+
flex-direction: row;
|
22
|
+
height: 100%;
|
23
|
+
align-items: flex-start;
|
24
|
+
}
|
25
|
+
|
26
|
+
&__inner {
|
27
|
+
@include flex-container();
|
28
|
+
overflow: auto;
|
29
|
+
}
|
30
|
+
|
31
|
+
&__right {
|
32
|
+
width: 100%;
|
33
|
+
height: 100%;
|
34
|
+
padding-left: 55px;
|
35
|
+
}
|
36
|
+
|
37
|
+
&__left {
|
38
|
+
padding-right: 55px;
|
39
|
+
border-right: 1px solid var(--yc-color-base-generic-accent);
|
40
|
+
height: 100%;
|
41
|
+
}
|
42
|
+
|
43
|
+
&__placeholder {
|
44
|
+
display: flex;
|
45
|
+
flex-direction: column;
|
46
|
+
align-items: center;
|
47
|
+
justify-content: center;
|
48
|
+
width: 100%;
|
49
|
+
flex-grow: 1;
|
50
|
+
height: 100%;
|
51
|
+
}
|
52
|
+
|
53
|
+
&__placeholder-text {
|
54
|
+
margin-top: 15px;
|
55
|
+
}
|
56
|
+
|
57
|
+
&__placeholder-img {
|
58
|
+
color: transparent;
|
59
|
+
}
|
60
|
+
|
61
|
+
&__nodes {
|
62
|
+
display: flex;
|
63
|
+
flex-wrap: wrap;
|
64
|
+
}
|
65
|
+
|
66
|
+
&__nodes-container {
|
67
|
+
min-width: 325px;
|
68
|
+
|
69
|
+
&_right {
|
70
|
+
margin-right: 60px;
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
&__nodes-title {
|
75
|
+
color: var(--yc-color-text-secondary);
|
76
|
+
font-size: var(--yc-text-body2-font-size);
|
77
|
+
line-height: var(--yc-text-body2-line-height);
|
78
|
+
border-bottom: 1px solid var(--yc-color-base-generic-accent);
|
79
|
+
margin: 0 0 15px 0;
|
80
|
+
}
|
81
|
+
|
82
|
+
&__link {
|
83
|
+
color: var(--yc-color-base-special);
|
84
|
+
text-decoration: none;
|
85
|
+
}
|
86
|
+
|
87
|
+
&__title {
|
88
|
+
font-size: var(--yc-text-body-font-size);
|
89
|
+
font-weight: 500;
|
90
|
+
line-height: var(--yc-text-body-line-height);
|
91
|
+
margin: 20px 0;
|
92
|
+
}
|
93
|
+
|
94
|
+
&__checkbox-wrapper {
|
95
|
+
display: flex;
|
96
|
+
align-items: center;
|
97
|
+
margin-right: 10px;
|
98
|
+
label {
|
99
|
+
white-space: nowrap;
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
&__label {
|
104
|
+
margin: 25px 0 16px 0;
|
105
|
+
}
|
106
|
+
|
107
|
+
&__controls {
|
108
|
+
display: flex;
|
109
|
+
align-items: center;
|
110
|
+
margin-bottom: 13px;
|
111
|
+
margin-top: 15px;
|
112
|
+
margin-right: 144px;
|
113
|
+
|
114
|
+
& .radiobox {
|
115
|
+
margin-right: 15px;
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
&__controls-wrapper {
|
120
|
+
display: flex;
|
121
|
+
align-items: center;
|
122
|
+
@include flex-container();
|
123
|
+
flex-direction: row;
|
124
|
+
}
|
125
|
+
|
126
|
+
&__select {
|
127
|
+
max-width: 115px;
|
128
|
+
margin: 0 15px;
|
129
|
+
}
|
130
|
+
|
131
|
+
&__rack-column {
|
132
|
+
border-radius: 4px;
|
133
|
+
background-color: rgba(0, 0, 0, 0.07);
|
134
|
+
display: flex;
|
135
|
+
align-items: center;
|
136
|
+
flex-direction: column;
|
137
|
+
padding: 2px;
|
138
|
+
margin-right: 5px;
|
139
|
+
margin-bottom: 5px;
|
140
|
+
|
141
|
+
.node-network {
|
142
|
+
margin-right: 0;
|
143
|
+
}
|
144
|
+
}
|
145
|
+
}
|