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,101 @@
|
|
1
|
+
import {
|
2
|
+
Link,
|
3
|
+
GraphNode,
|
4
|
+
TopologyNodeDataStats,
|
5
|
+
TopologyNodeDataStatsSection,
|
6
|
+
ExplainPlanNodeData,
|
7
|
+
} from '@yandex-cloud/paranoid';
|
8
|
+
|
9
|
+
interface PlanOperator {
|
10
|
+
Name: string;
|
11
|
+
[key: string]: any;
|
12
|
+
}
|
13
|
+
|
14
|
+
export interface Plan {
|
15
|
+
PlanNodeId: number;
|
16
|
+
'Node Type': string;
|
17
|
+
Plans?: Plan[];
|
18
|
+
Operators?: PlanOperator[];
|
19
|
+
Tables?: string[];
|
20
|
+
PlanNodeType?: string;
|
21
|
+
[key: string]: any;
|
22
|
+
}
|
23
|
+
|
24
|
+
export interface RootPlan {
|
25
|
+
Plan: Plan;
|
26
|
+
}
|
27
|
+
|
28
|
+
function prepareStats(plan: Plan) {
|
29
|
+
const stats: TopologyNodeDataStats[] = [];
|
30
|
+
|
31
|
+
if (plan.Operators) {
|
32
|
+
const operatorsSections: TopologyNodeDataStatsSection[] = [];
|
33
|
+
|
34
|
+
for (const operator of plan.Operators) {
|
35
|
+
const section: TopologyNodeDataStatsSection = {name: operator.Name, items: []};
|
36
|
+
|
37
|
+
for (const [name, data] of Object.entries(operator)) {
|
38
|
+
if (name === 'Name') {
|
39
|
+
continue;
|
40
|
+
}
|
41
|
+
|
42
|
+
const value = Array.isArray(data) ? data.join(', ') : data;
|
43
|
+
section.items.push({name, value});
|
44
|
+
}
|
45
|
+
|
46
|
+
operatorsSections.push(section);
|
47
|
+
}
|
48
|
+
|
49
|
+
stats.push({
|
50
|
+
group: 'Operators',
|
51
|
+
stats: operatorsSections,
|
52
|
+
});
|
53
|
+
}
|
54
|
+
|
55
|
+
return stats;
|
56
|
+
}
|
57
|
+
|
58
|
+
export function preparePlan(plan: Plan) {
|
59
|
+
const nodes: GraphNode[] = [];
|
60
|
+
const links: Link[] = [];
|
61
|
+
|
62
|
+
let graphDepth = 0;
|
63
|
+
|
64
|
+
function parsePlans(plans: Plan[] = [], from: string, curDepth: number) {
|
65
|
+
const depth = curDepth + 1;
|
66
|
+
plans.forEach((p) => {
|
67
|
+
const node: GraphNode<ExplainPlanNodeData> = {
|
68
|
+
name: String(p.PlanNodeId),
|
69
|
+
data: {
|
70
|
+
id: p.PlanNodeId,
|
71
|
+
type: p.PlanNodeType === 'Connection' ? 'connection' : 'stage',
|
72
|
+
name: p['Node Type'],
|
73
|
+
operators: p.Operators?.map((o) => o.Name),
|
74
|
+
stats: prepareStats(p),
|
75
|
+
tables: p.Tables,
|
76
|
+
},
|
77
|
+
};
|
78
|
+
nodes.push(node);
|
79
|
+
links.push({from, to: node.name});
|
80
|
+
graphDepth = Math.max(graphDepth, depth);
|
81
|
+
parsePlans(p.Plans, node.name, depth);
|
82
|
+
});
|
83
|
+
}
|
84
|
+
|
85
|
+
const rootPlan = plan;
|
86
|
+
const rootNode: GraphNode<ExplainPlanNodeData> = {
|
87
|
+
name: String(rootPlan.PlanNodeId),
|
88
|
+
data: {
|
89
|
+
id: rootPlan.PlanNodeId,
|
90
|
+
type: 'stage',
|
91
|
+
name: rootPlan['Node Type'],
|
92
|
+
},
|
93
|
+
};
|
94
|
+
nodes.push(rootNode);
|
95
|
+
parsePlans(rootPlan.Plans, rootNode.name, 0);
|
96
|
+
return {
|
97
|
+
nodes,
|
98
|
+
links,
|
99
|
+
graphDepth,
|
100
|
+
};
|
101
|
+
}
|
@@ -0,0 +1,197 @@
|
|
1
|
+
import cn from 'bem-cn-lite';
|
2
|
+
import {calcUptime} from '.';
|
3
|
+
import JSONTree from 'react-json-inspector';
|
4
|
+
|
5
|
+
const poolB = cn('pool-tooltip');
|
6
|
+
|
7
|
+
const PoolTooltip = (props) => {
|
8
|
+
const {data} = props;
|
9
|
+
const usage = (data.Usage * 100).toFixed(2);
|
10
|
+
return (
|
11
|
+
data && (
|
12
|
+
<div className={poolB()}>
|
13
|
+
<table>
|
14
|
+
<tbody>
|
15
|
+
<tr>
|
16
|
+
<td className={poolB('label')}>Pool</td>
|
17
|
+
<td>{data.Name}</td>
|
18
|
+
</tr>
|
19
|
+
<tr>
|
20
|
+
<td className={poolB('label')}>Usage</td>
|
21
|
+
<td>{usage} %</td>
|
22
|
+
</tr>
|
23
|
+
<tr>
|
24
|
+
<td className={poolB('label')}>Threads</td>
|
25
|
+
<td>{data.Threads}</td>
|
26
|
+
</tr>
|
27
|
+
</tbody>
|
28
|
+
</table>
|
29
|
+
</div>
|
30
|
+
)
|
31
|
+
);
|
32
|
+
};
|
33
|
+
|
34
|
+
const tabletB = cn('tablet-tooltip');
|
35
|
+
|
36
|
+
const TabletTooltip = (props) => {
|
37
|
+
const {data, additionalData} = props;
|
38
|
+
return (
|
39
|
+
data && (
|
40
|
+
<div className={tabletB()}>
|
41
|
+
<table>
|
42
|
+
<tbody>
|
43
|
+
<tr>
|
44
|
+
<td className={tabletB('label')}>Tablet</td>
|
45
|
+
<td className={tabletB('value')}>{data.TabletId}</td>
|
46
|
+
</tr>
|
47
|
+
<tr>
|
48
|
+
<td className={tabletB('label')}>NodeID</td>
|
49
|
+
<td className={tabletB('value')}>{data.NodeId}</td>
|
50
|
+
</tr>
|
51
|
+
<tr>
|
52
|
+
<td className={tabletB('label')}>State</td>
|
53
|
+
<td className={tabletB('value')}>{data.State}</td>
|
54
|
+
</tr>
|
55
|
+
<tr>
|
56
|
+
<td className={tabletB('label')}>Type</td>
|
57
|
+
<td className={tabletB('value')}>{data.Type}</td>
|
58
|
+
</tr>
|
59
|
+
<tr>
|
60
|
+
<td className={tabletB('label')}>Uptime</td>
|
61
|
+
<td className={tabletB('value')}>{calcUptime(data.ChangeTime)}</td>
|
62
|
+
</tr>
|
63
|
+
<tr>
|
64
|
+
<td className={tabletB('label')}>Generation</td>
|
65
|
+
<td className={tabletB('value')}>{data.Generation}</td>
|
66
|
+
</tr>
|
67
|
+
{additionalData && (
|
68
|
+
<tr>
|
69
|
+
<td className={tabletB('label')}>{additionalData.name}</td>
|
70
|
+
<td className={tabletB('value')}>{additionalData.value}</td>
|
71
|
+
</tr>
|
72
|
+
)}
|
73
|
+
</tbody>
|
74
|
+
</table>
|
75
|
+
</div>
|
76
|
+
)
|
77
|
+
);
|
78
|
+
};
|
79
|
+
|
80
|
+
const nodeB = cn('node-tootltip');
|
81
|
+
|
82
|
+
const NodeTooltip = (props) => {
|
83
|
+
const {data} = props;
|
84
|
+
return (
|
85
|
+
data && (
|
86
|
+
<div className={nodeB()}>
|
87
|
+
<table>
|
88
|
+
<tbody>
|
89
|
+
<tr>
|
90
|
+
<td className={nodeB('label')}>ID</td>
|
91
|
+
<td className={nodeB('value')}>{data.nodeId || '?'}</td>
|
92
|
+
</tr>
|
93
|
+
<tr>
|
94
|
+
<td className={nodeB('label')}>Rack</td>
|
95
|
+
<td className={nodeB('value')}>{data.rack || '?'}</td>
|
96
|
+
</tr>
|
97
|
+
{data.connected && data.capacity && (
|
98
|
+
<tr>
|
99
|
+
<td className={nodeB('label')}>Net</td>
|
100
|
+
<td className={nodeB('value')}>
|
101
|
+
{`${data.connected} / ${data.capacity}`}
|
102
|
+
</td>
|
103
|
+
</tr>
|
104
|
+
)}
|
105
|
+
</tbody>
|
106
|
+
</table>
|
107
|
+
</div>
|
108
|
+
)
|
109
|
+
);
|
110
|
+
};
|
111
|
+
|
112
|
+
const tabletsOverallB = cn('tabletsOverall-tooltip');
|
113
|
+
|
114
|
+
const TabletsOverallTooltip = (props) => {
|
115
|
+
const {data} = props;
|
116
|
+
return (
|
117
|
+
data && (
|
118
|
+
<div className={tabletsOverallB()}>
|
119
|
+
<table>
|
120
|
+
<tbody>
|
121
|
+
{data.map((colorInfo, key) => {
|
122
|
+
return (
|
123
|
+
<tr key={key}>
|
124
|
+
<td className={tabletsOverallB('label')}>{colorInfo.color}:</td>
|
125
|
+
<td className={tabletsOverallB('value')}>
|
126
|
+
{`${colorInfo.value}/${
|
127
|
+
colorInfo.total
|
128
|
+
} (${colorInfo.percents.toFixed(2)}%)`}
|
129
|
+
</td>
|
130
|
+
</tr>
|
131
|
+
);
|
132
|
+
})}
|
133
|
+
</tbody>
|
134
|
+
</table>
|
135
|
+
</div>
|
136
|
+
)
|
137
|
+
);
|
138
|
+
};
|
139
|
+
|
140
|
+
const histogramB = cn('histogram-tooltip');
|
141
|
+
|
142
|
+
const HistogramTooltip = (props) => {
|
143
|
+
const {data} = props;
|
144
|
+
return (
|
145
|
+
data && (
|
146
|
+
<div className={histogramB()}>
|
147
|
+
<table>
|
148
|
+
<tbody>
|
149
|
+
<tr>
|
150
|
+
<td className={histogramB('label')}>Count</td>
|
151
|
+
<td className={histogramB('value')}>{data.count || '?'}</td>
|
152
|
+
</tr>
|
153
|
+
<tr>
|
154
|
+
<td className={histogramB('label')}>From</td>
|
155
|
+
<td className={histogramB('value')}>{data.leftBound || '?'}</td>
|
156
|
+
</tr>
|
157
|
+
<tr>
|
158
|
+
<td className={histogramB('label')}>To</td>
|
159
|
+
<td className={histogramB('value')}>{data.rightBound || '?'}</td>
|
160
|
+
</tr>
|
161
|
+
</tbody>
|
162
|
+
</table>
|
163
|
+
</div>
|
164
|
+
)
|
165
|
+
);
|
166
|
+
};
|
167
|
+
|
168
|
+
const cellB = cn('cell-tooltip');
|
169
|
+
const jsonB = cn('json-tooltip');
|
170
|
+
|
171
|
+
export const tooltipTemplates = {
|
172
|
+
// eslint-disable-next-line react/display-name
|
173
|
+
pool: (data) => <PoolTooltip data={data} />,
|
174
|
+
// eslint-disable-next-line react/display-name
|
175
|
+
tablet: (data, additionalData) => <TabletTooltip data={data} additionalData={additionalData} />,
|
176
|
+
// eslint-disable-next-line react/display-name
|
177
|
+
node: (data) => <NodeTooltip data={data} />,
|
178
|
+
// eslint-disable-next-line react/display-name
|
179
|
+
tabletsOverall: (data) => <TabletsOverallTooltip data={data} />,
|
180
|
+
// eslint-disable-next-line react/display-name
|
181
|
+
histogram: (data) => <HistogramTooltip data={data} />,
|
182
|
+
// eslint-disable-next-line react/display-name
|
183
|
+
cell: (data) => <div className={cellB()}>{data}</div>,
|
184
|
+
// eslint-disable-next-line react/display-name
|
185
|
+
json: (data) => {
|
186
|
+
return (
|
187
|
+
<div className={jsonB()}>
|
188
|
+
<JSONTree
|
189
|
+
data={data}
|
190
|
+
search={false}
|
191
|
+
isExpanded={() => true}
|
192
|
+
className={jsonB('inspector')}
|
193
|
+
/>
|
194
|
+
</div>
|
195
|
+
);
|
196
|
+
},
|
197
|
+
};
|
@@ -0,0 +1,75 @@
|
|
1
|
+
export function parseJson(value) {
|
2
|
+
if (!value) {
|
3
|
+
return;
|
4
|
+
}
|
5
|
+
try {
|
6
|
+
return JSON.parse(value);
|
7
|
+
} catch (err) {
|
8
|
+
console.log(err);
|
9
|
+
return value;
|
10
|
+
}
|
11
|
+
}
|
12
|
+
|
13
|
+
export function getValueFromLS(key, defaultValue) {
|
14
|
+
try {
|
15
|
+
return localStorage.getItem(key) ?? defaultValue;
|
16
|
+
} catch (err) {
|
17
|
+
console.log(err);
|
18
|
+
}
|
19
|
+
return;
|
20
|
+
}
|
21
|
+
|
22
|
+
const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'];
|
23
|
+
const base = 1000;
|
24
|
+
|
25
|
+
export function bytesToSize(bytes) {
|
26
|
+
if (isNaN(bytes)) {
|
27
|
+
return '';
|
28
|
+
}
|
29
|
+
if (bytes < base) return String(bytes);
|
30
|
+
let i = parseInt(Math.floor(Math.log(bytes) / Math.log(base)));
|
31
|
+
if (i >= sizes.length) {
|
32
|
+
i = sizes.length - 1;
|
33
|
+
}
|
34
|
+
let val = bytes / Math.pow(base, i);
|
35
|
+
if (val > 999) {
|
36
|
+
val = val / base;
|
37
|
+
i++;
|
38
|
+
}
|
39
|
+
return val.toPrecision(3) + sizes[i];
|
40
|
+
}
|
41
|
+
|
42
|
+
function bytesToMB(bytes) {
|
43
|
+
if (isNaN(bytes)) {
|
44
|
+
return '';
|
45
|
+
}
|
46
|
+
const val = bytes / base ** 2;
|
47
|
+
if (val < 10) {
|
48
|
+
return val.toFixed(2) + sizes[2];
|
49
|
+
} else if (val < 100) {
|
50
|
+
return val.toFixed(1) + sizes[2];
|
51
|
+
} else {
|
52
|
+
return val.toFixed() + sizes[2];
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
export function bytesToSpeed(bytes) {
|
57
|
+
return `${bytesToMB(bytes)}${bytes ? 'ps' : ''}`;
|
58
|
+
}
|
59
|
+
|
60
|
+
export function bytesToGB(bytes, shouldRound) {
|
61
|
+
if (isNaN(bytes)) {
|
62
|
+
return 'N/A';
|
63
|
+
}
|
64
|
+
const val = bytes / 1000000000;
|
65
|
+
if (shouldRound) {
|
66
|
+
return val.toFixed() + sizes[3];
|
67
|
+
}
|
68
|
+
if (val < 10) {
|
69
|
+
return val.toFixed(2) + sizes[3];
|
70
|
+
} else if (val < 100) {
|
71
|
+
return val.toFixed(1) + sizes[3];
|
72
|
+
} else {
|
73
|
+
return val.toFixed() + sizes[3];
|
74
|
+
}
|
75
|
+
}
|
package/package.json
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
{
|
2
|
+
"name": "ydb-embedded-ui",
|
3
|
+
"version": "0.1.0",
|
4
|
+
"files": [
|
5
|
+
"dist"
|
6
|
+
],
|
7
|
+
"repository": {
|
8
|
+
"type": "git",
|
9
|
+
"url": "git@github.com:ydb-platform/ydb-embedded-ui.git"
|
10
|
+
},
|
11
|
+
"dependencies": {
|
12
|
+
"@testing-library/jest-dom": "^5.15.0",
|
13
|
+
"@testing-library/react": "^11.2.7",
|
14
|
+
"@testing-library/user-event": "^12.8.3",
|
15
|
+
"@yandex-cloud/i18n": "^0.2.0",
|
16
|
+
"@yandex-cloud/paranoid": "^1.0.0",
|
17
|
+
"@yandex-cloud/react-data-table": "^0.2.1",
|
18
|
+
"axios": "^0.19.2",
|
19
|
+
"bem-cn-lite": "^4.0.0",
|
20
|
+
"history": "^4.9.0",
|
21
|
+
"js-cookie": "^2.2.1",
|
22
|
+
"keymaster": "^1.6.2",
|
23
|
+
"lodash": "^4.17.11",
|
24
|
+
"monaco-editor": "^0.24.0",
|
25
|
+
"numeral": "^2.0.6",
|
26
|
+
"path-to-regexp": "^3.0.0",
|
27
|
+
"react-json-inspector": "^7.1.1",
|
28
|
+
"react-list": "^0.8.11",
|
29
|
+
"react-monaco-editor": "^0.30.1",
|
30
|
+
"react-redux": "^7.0.3",
|
31
|
+
"react-router": "^5.0.1",
|
32
|
+
"react-router-dom": "^5.0.1",
|
33
|
+
"react-scripts": "^4.0.3",
|
34
|
+
"react-transition-group": "^4.4.2",
|
35
|
+
"react-treeview": "^0.4.7",
|
36
|
+
"react-use": "^15.3.4",
|
37
|
+
"redux": "^4.0.1",
|
38
|
+
"redux-location-state": "^2.6.0",
|
39
|
+
"redux-thunk": "^2.3.0",
|
40
|
+
"reselect": "^4.0.0",
|
41
|
+
"sass": "^1.32.8",
|
42
|
+
"web-vitals": "^1.1.2"
|
43
|
+
},
|
44
|
+
"scripts": {
|
45
|
+
"start": "react-app-rewired start",
|
46
|
+
"dev": "REACT_APP_BACKEND=http://localhost:8765 npm start",
|
47
|
+
"build": "react-app-rewired build",
|
48
|
+
"build:embedded": "rm -rf build && REACT_APP_BACKEND=http://localhost:8765 npm run build && ./prepare-build.sh",
|
49
|
+
"package": "rm -rf dist && copyfiles -u 1 'src/**/*' dist",
|
50
|
+
"test": "react-app-rewired test",
|
51
|
+
"eject": "react-scripts eject",
|
52
|
+
"prepublishOnly": "npm run package"
|
53
|
+
},
|
54
|
+
"browserslist": {
|
55
|
+
"production": [
|
56
|
+
">0.2%",
|
57
|
+
"not dead",
|
58
|
+
"not op_mini all"
|
59
|
+
],
|
60
|
+
"development": [
|
61
|
+
"last 1 chrome version",
|
62
|
+
"last 1 firefox version",
|
63
|
+
"last 1 safari version"
|
64
|
+
]
|
65
|
+
},
|
66
|
+
"devDependencies": {
|
67
|
+
"@commitlint/cli": "^15.0.0",
|
68
|
+
"@commitlint/config-conventional": "^15.0.0",
|
69
|
+
"@types/lodash": "^4.14.178",
|
70
|
+
"@types/react-dom": "^17.0.11",
|
71
|
+
"@types/react-router": "^5.1.17",
|
72
|
+
"@types/react-router-dom": "^5.3.2",
|
73
|
+
"@types/react-transition-group": "^4.4.4",
|
74
|
+
"@types/react-virtualized-auto-sizer": "^1.0.1",
|
75
|
+
"@yandex-cloud/axios-wrapper": "^1.0.2",
|
76
|
+
"@yandex-cloud/eslint-config": "^1.0.0",
|
77
|
+
"@yandex-cloud/prettier-config": "^1.0.0",
|
78
|
+
"@yandex-cloud/stylelint-config": "^1.1.0",
|
79
|
+
"@yandex-cloud/tsconfig": "^1.0.0",
|
80
|
+
"@yandex-cloud/uikit": "^1.7.0",
|
81
|
+
"copyfiles": "^2.4.1",
|
82
|
+
"eslint-config-prettier": "^8.3.0",
|
83
|
+
"prettier": "^2.5.1",
|
84
|
+
"react": "^17.0.2",
|
85
|
+
"react-app-rewired": "^2.1.11",
|
86
|
+
"react-dom": "^17.0.2",
|
87
|
+
"typescript": "^4.5.4"
|
88
|
+
}
|
89
|
+
}
|