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,102 @@
|
|
1
|
+
import {Component} from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
|
4
|
+
import key from 'keymaster';
|
5
|
+
|
6
|
+
const propTypes = {
|
7
|
+
settings: PropTypes.arrayOf(
|
8
|
+
PropTypes.shape({
|
9
|
+
keys: PropTypes.string.isRequired,
|
10
|
+
handler: PropTypes.func.isRequired,
|
11
|
+
scope: PropTypes.string,
|
12
|
+
preventDefault: PropTypes.bool,
|
13
|
+
}),
|
14
|
+
).isRequired,
|
15
|
+
};
|
16
|
+
|
17
|
+
function eventOnInput(evt) {
|
18
|
+
const tagName = (evt.target || evt.srcElement).tagName;
|
19
|
+
|
20
|
+
return /^(INPUT|TEXTAREA|SELECT)$/.test(tagName);
|
21
|
+
}
|
22
|
+
|
23
|
+
export default class Hotkey extends Component {
|
24
|
+
componentDidMount() {
|
25
|
+
const {settings} = this.props;
|
26
|
+
|
27
|
+
if (!key) {
|
28
|
+
return;
|
29
|
+
}
|
30
|
+
|
31
|
+
this.preparedSettings = this.prepareSettings(settings);
|
32
|
+
|
33
|
+
// To use hotkeys inside inputs we need to specify scope, other events are filtered.
|
34
|
+
key.filter = function (evt) {
|
35
|
+
const currentScope = key.getScope();
|
36
|
+
|
37
|
+
return !(eventOnInput(evt) && currentScope === 'all');
|
38
|
+
};
|
39
|
+
|
40
|
+
this.preparedSettings.forEach((setting) => {
|
41
|
+
this.bindKey(setting.combo, setting.scope, setting.handler, setting.preventDefault);
|
42
|
+
});
|
43
|
+
}
|
44
|
+
|
45
|
+
componentWillUnmount() {
|
46
|
+
if (!key) {
|
47
|
+
return;
|
48
|
+
}
|
49
|
+
|
50
|
+
this.preparedSettings.forEach((setting) => {
|
51
|
+
this.unbindKey(setting.combo, setting.scope);
|
52
|
+
});
|
53
|
+
}
|
54
|
+
|
55
|
+
prepareSettings(settings) {
|
56
|
+
const preparedSettings = [];
|
57
|
+
|
58
|
+
settings.forEach((item) => {
|
59
|
+
const keyCombinations = item.keys.split(/\s*,\s*/);
|
60
|
+
const scopes = item.scope.split(/\s*,\s*/);
|
61
|
+
const preventDefault =
|
62
|
+
typeof item.preventDefault !== 'undefined' ? item.preventDefault : true;
|
63
|
+
|
64
|
+
keyCombinations.forEach((combo) => {
|
65
|
+
scopes.forEach((scope) => {
|
66
|
+
if (typeof item.handler === 'function') {
|
67
|
+
preparedSettings.push({
|
68
|
+
combo: combo,
|
69
|
+
scope: scope,
|
70
|
+
handler: item.handler,
|
71
|
+
preventDefault: preventDefault,
|
72
|
+
});
|
73
|
+
}
|
74
|
+
});
|
75
|
+
});
|
76
|
+
});
|
77
|
+
|
78
|
+
return preparedSettings;
|
79
|
+
}
|
80
|
+
|
81
|
+
bindKey(combination, scope, handler, preventDefault) {
|
82
|
+
key(combination, scope, (evt, shortcut) => {
|
83
|
+
if (key.getScope() === shortcut.scope) {
|
84
|
+
handler(evt, shortcut);
|
85
|
+
|
86
|
+
if (preventDefault) {
|
87
|
+
evt.preventDefault();
|
88
|
+
}
|
89
|
+
}
|
90
|
+
});
|
91
|
+
}
|
92
|
+
|
93
|
+
unbindKey(combination, scope) {
|
94
|
+
key.unbind(combination, scope);
|
95
|
+
}
|
96
|
+
|
97
|
+
render() {
|
98
|
+
return null;
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
Hotkey.propTypes = propTypes;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import PropTypes from 'prop-types';
|
2
|
+
import {Icon as UiKitIcon} from '@yandex-cloud/uikit';
|
3
|
+
|
4
|
+
export default function Icon({name, height, width, viewBox, className, onClick}) {
|
5
|
+
return (
|
6
|
+
<UiKitIcon
|
7
|
+
data={{id: `icon.${name}`, viewBox}}
|
8
|
+
height={height}
|
9
|
+
width={width}
|
10
|
+
className={className}
|
11
|
+
onClick={onClick}
|
12
|
+
/>
|
13
|
+
);
|
14
|
+
}
|
15
|
+
|
16
|
+
Icon.propTypes = {
|
17
|
+
name: PropTypes.string.isRequired,
|
18
|
+
height: PropTypes.number,
|
19
|
+
width: PropTypes.number,
|
20
|
+
viewBox: PropTypes.string,
|
21
|
+
};
|
22
|
+
Icon.defaultProps = {
|
23
|
+
height: 16,
|
24
|
+
width: 16,
|
25
|
+
viewBox: '0 0 16 16',
|
26
|
+
};
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import cn from 'bem-cn-lite';
|
4
|
+
import './InfoViewer.scss';
|
5
|
+
|
6
|
+
const b = cn('info-viewer');
|
7
|
+
|
8
|
+
class InfoViewer extends React.Component {
|
9
|
+
render() {
|
10
|
+
const {info, className, title} = this.props;
|
11
|
+
|
12
|
+
return (
|
13
|
+
<div className={`${b()} ${className}`}>
|
14
|
+
{title && <div className={b('title')}>{title}</div>}
|
15
|
+
{info && info.length > 0 ? (
|
16
|
+
<div className={b('items')}>
|
17
|
+
{info.map((data, infoIndex) => (
|
18
|
+
<div className={b('row')} key={infoIndex}>
|
19
|
+
<div className={b('label')}>
|
20
|
+
{data.label}
|
21
|
+
<div className={b('dots')}></div>
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<div className={b('value')}>{data.value}</div>
|
25
|
+
</div>
|
26
|
+
))}
|
27
|
+
</div>
|
28
|
+
) : (
|
29
|
+
<div>no {title} data</div>
|
30
|
+
)}
|
31
|
+
</div>
|
32
|
+
);
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
InfoViewer.propTypes = {
|
37
|
+
className: PropTypes.string,
|
38
|
+
info: PropTypes.array.isRequired,
|
39
|
+
title: PropTypes.string,
|
40
|
+
dots: PropTypes.bool,
|
41
|
+
};
|
42
|
+
|
43
|
+
InfoViewer.defaultProps = {
|
44
|
+
className: '',
|
45
|
+
};
|
46
|
+
|
47
|
+
export default InfoViewer;
|
@@ -0,0 +1,48 @@
|
|
1
|
+
.info-viewer {
|
2
|
+
font-size: var(--yc-text-body2-font-size);
|
3
|
+
line-height: var(--yc-text-body2-line-height);
|
4
|
+
&__title {
|
5
|
+
font-size: var(--yc-text-body2-font-size);
|
6
|
+
line-height: var(--yc-text-body2-line-height);
|
7
|
+
font-weight: 500;
|
8
|
+
margin: 0 0 16px;
|
9
|
+
}
|
10
|
+
|
11
|
+
&__items {
|
12
|
+
display: grid;
|
13
|
+
grid-template-columns: max-content max-content;
|
14
|
+
grid-column-gap: 15px;
|
15
|
+
grid-row-gap: 7px;
|
16
|
+
}
|
17
|
+
|
18
|
+
&__row {
|
19
|
+
display: flex;
|
20
|
+
align-items: center;
|
21
|
+
align-items: flex-end;
|
22
|
+
height: 24px;
|
23
|
+
}
|
24
|
+
|
25
|
+
&__label {
|
26
|
+
color: var(--yc-color-text-primary);
|
27
|
+
// font-size: var(--yc-text-body-font-size);
|
28
|
+
white-space: nowrap;
|
29
|
+
max-width: 200px;
|
30
|
+
min-width: 200px;
|
31
|
+
align-items: baseline;
|
32
|
+
display: flex;
|
33
|
+
flex: 1 1 auto;
|
34
|
+
}
|
35
|
+
|
36
|
+
&__dots {
|
37
|
+
min-width: 20px;
|
38
|
+
display: flex;
|
39
|
+
flex: 1 1 auto;
|
40
|
+
border-bottom: 1px dotted var(--yc-color-text-complementary);
|
41
|
+
margin: 0 2px;
|
42
|
+
}
|
43
|
+
|
44
|
+
&__value {
|
45
|
+
white-space: nowrap;
|
46
|
+
display: flex;
|
47
|
+
}
|
48
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import cn from 'bem-cn-lite';
|
2
|
+
|
3
|
+
import {Link} from 'react-router-dom';
|
4
|
+
|
5
|
+
const bLink = cn('yc-link');
|
6
|
+
|
7
|
+
export default function InternalLink({to, children, onClick, className}) {
|
8
|
+
return to ? (
|
9
|
+
<Link className={bLink({view: 'normal'}, className)} to={to} onClick={onClick}>
|
10
|
+
{children}
|
11
|
+
</Link>
|
12
|
+
) : (
|
13
|
+
children
|
14
|
+
);
|
15
|
+
}
|
@@ -0,0 +1,183 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import cn from 'bem-cn-lite';
|
3
|
+
import PropTypes from 'prop-types';
|
4
|
+
import _ from 'lodash';
|
5
|
+
import {connect} from 'react-redux';
|
6
|
+
|
7
|
+
import {TextInput, Label} from '@yandex-cloud/uikit';
|
8
|
+
import DataTable from '@yandex-cloud/react-data-table';
|
9
|
+
|
10
|
+
import ProblemFilter, {problemFilterType} from '../ProblemFilter/ProblemFilter';
|
11
|
+
|
12
|
+
import {withSearch} from '../../HOCS';
|
13
|
+
import {calcUptime} from '../../utils';
|
14
|
+
import {ALL} from '../../utils/constants';
|
15
|
+
import {changeFilter} from '../../store/reducers/settings';
|
16
|
+
import {hideTooltip, showTooltip} from '../../store/reducers/tooltip';
|
17
|
+
import {getNodesColumns} from '../../utils/getNodesColumns';
|
18
|
+
|
19
|
+
import './NodesViewer.scss';
|
20
|
+
|
21
|
+
const b = cn('nodes-viewer');
|
22
|
+
|
23
|
+
const tableSettings = {
|
24
|
+
displayIndices: false,
|
25
|
+
stickyHead: DataTable.MOVING,
|
26
|
+
syncHeadOnResize: true,
|
27
|
+
dynamicRender: true,
|
28
|
+
};
|
29
|
+
|
30
|
+
class NodesViewer extends React.PureComponent {
|
31
|
+
static propTypes = {
|
32
|
+
nodes: PropTypes.array.isRequired,
|
33
|
+
className: PropTypes.string,
|
34
|
+
searchQuery: PropTypes.string,
|
35
|
+
handleSearchQuery: PropTypes.func,
|
36
|
+
showTooltip: PropTypes.func,
|
37
|
+
hideTooltip: PropTypes.func,
|
38
|
+
filter: problemFilterType,
|
39
|
+
changeFilter: PropTypes.func,
|
40
|
+
showControls: PropTypes.bool,
|
41
|
+
additionalNodesInfo: PropTypes.object,
|
42
|
+
};
|
43
|
+
|
44
|
+
static defaultProps = {
|
45
|
+
className: '',
|
46
|
+
showSearch: true,
|
47
|
+
showControls: true,
|
48
|
+
};
|
49
|
+
|
50
|
+
state = {
|
51
|
+
filteredNodes: [],
|
52
|
+
nodesToShow: [],
|
53
|
+
};
|
54
|
+
|
55
|
+
static getDerivedStateFromProps(props, state) {
|
56
|
+
const {nodes, filter} = props;
|
57
|
+
if (!_.isEqual(nodes, state.nodes)) {
|
58
|
+
return {
|
59
|
+
nodes,
|
60
|
+
filteredNodes: NodesViewer.filterNodes(nodes, filter),
|
61
|
+
};
|
62
|
+
}
|
63
|
+
return null;
|
64
|
+
}
|
65
|
+
|
66
|
+
static filterNodes(nodes, filter) {
|
67
|
+
if (filter === ALL) {
|
68
|
+
return nodes;
|
69
|
+
}
|
70
|
+
|
71
|
+
return _.filter(nodes, (node) => {
|
72
|
+
return node.Overall && node.Overall !== 'Green';
|
73
|
+
});
|
74
|
+
}
|
75
|
+
|
76
|
+
static selectNodesToShow(nodes, searchQuery) {
|
77
|
+
let preparedNodes = nodes;
|
78
|
+
if (nodes && Array.isArray(nodes)) {
|
79
|
+
preparedNodes = nodes
|
80
|
+
.map((node) => {
|
81
|
+
node.uptime = calcUptime(node.StartTime);
|
82
|
+
return node;
|
83
|
+
})
|
84
|
+
/* Filter by nodes with the Host field.
|
85
|
+
If a node does not have a Host field it is also
|
86
|
+
included in the filter and displayed with a dash in the corresponding column
|
87
|
+
*/
|
88
|
+
.filter((node) => (node.Host ? node.Host.includes(searchQuery) : true));
|
89
|
+
}
|
90
|
+
return preparedNodes;
|
91
|
+
}
|
92
|
+
|
93
|
+
onChangeProblemFilter = (filter) => {
|
94
|
+
const {nodes, changeFilter} = this.props;
|
95
|
+
const filteredNodes = NodesViewer.filterNodes(nodes, filter);
|
96
|
+
|
97
|
+
changeFilter(filter);
|
98
|
+
this.setState({filteredNodes});
|
99
|
+
};
|
100
|
+
|
101
|
+
renderControls() {
|
102
|
+
const {searchQuery, handleSearchQuery, filter} = this.props;
|
103
|
+
const nodesToShow = NodesViewer.selectNodesToShow(this.state.filteredNodes, searchQuery);
|
104
|
+
|
105
|
+
return (
|
106
|
+
<div className={b('controls')}>
|
107
|
+
<TextInput
|
108
|
+
className={b('search')}
|
109
|
+
size="s"
|
110
|
+
placeholder="Host name…"
|
111
|
+
text={searchQuery}
|
112
|
+
onUpdate={handleSearchQuery}
|
113
|
+
hasClear
|
114
|
+
/>
|
115
|
+
<ProblemFilter value={filter} onChange={this.onChangeProblemFilter} />
|
116
|
+
<Label theme="info" size="m">{`Nodes: ${nodesToShow.length}`}</Label>
|
117
|
+
</div>
|
118
|
+
);
|
119
|
+
}
|
120
|
+
|
121
|
+
render() {
|
122
|
+
const {
|
123
|
+
className,
|
124
|
+
searchQuery,
|
125
|
+
path,
|
126
|
+
filter,
|
127
|
+
showControls,
|
128
|
+
hideTooltip,
|
129
|
+
showTooltip,
|
130
|
+
additionalNodesInfo={},
|
131
|
+
} = this.props;
|
132
|
+
const {filteredNodes} = this.state;
|
133
|
+
|
134
|
+
const columns = getNodesColumns({
|
135
|
+
tabletsPath: path,
|
136
|
+
hideTooltip,
|
137
|
+
showTooltip,
|
138
|
+
getNodeRef: additionalNodesInfo.getNodeRef,
|
139
|
+
});
|
140
|
+
|
141
|
+
if (filteredNodes && Array.isArray(filteredNodes)) {
|
142
|
+
const nodesToShow = NodesViewer.selectNodesToShow(filteredNodes, searchQuery);
|
143
|
+
|
144
|
+
return (
|
145
|
+
<div className={`${b()} ${className}`}>
|
146
|
+
{showControls ? this.renderControls() : null}
|
147
|
+
<div className={b('table-wrapper')}>
|
148
|
+
{nodesToShow.length === 0 ? (
|
149
|
+
<div className="no-problem" />
|
150
|
+
) : (
|
151
|
+
<div className={b('table-content')}>
|
152
|
+
<DataTable
|
153
|
+
theme="internal"
|
154
|
+
key={filter}
|
155
|
+
data={nodesToShow}
|
156
|
+
columns={columns}
|
157
|
+
settings={tableSettings}
|
158
|
+
/>
|
159
|
+
</div>
|
160
|
+
)}
|
161
|
+
</div>
|
162
|
+
</div>
|
163
|
+
);
|
164
|
+
}
|
165
|
+
|
166
|
+
return <div className="error">no nodes data</div>;
|
167
|
+
}
|
168
|
+
}
|
169
|
+
|
170
|
+
const mapStateToProps = (state) => {
|
171
|
+
return {
|
172
|
+
filter: state.settings.problemFilter,
|
173
|
+
};
|
174
|
+
};
|
175
|
+
|
176
|
+
const mapDispatchToProps = {
|
177
|
+
changeFilter,
|
178
|
+
hideTooltip,
|
179
|
+
showTooltip,
|
180
|
+
};
|
181
|
+
|
182
|
+
const ConnectedNodesViewer = connect(mapStateToProps, mapDispatchToProps)(NodesViewer);
|
183
|
+
export default withSearch(ConnectedNodesViewer);
|
@@ -0,0 +1,66 @@
|
|
1
|
+
@import '../../styles/mixins.scss';
|
2
|
+
|
3
|
+
.nodes-viewer {
|
4
|
+
@include flex-container();
|
5
|
+
overflow: auto;
|
6
|
+
|
7
|
+
&__controls {
|
8
|
+
margin: 25px 0 20px 20px;
|
9
|
+
display: flex;
|
10
|
+
align-items: center;
|
11
|
+
|
12
|
+
& > * {
|
13
|
+
margin-right: 25px;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
&__name {
|
18
|
+
color: var(--yc-color-base-special);
|
19
|
+
cursor: pointer;
|
20
|
+
text-decoration: none;
|
21
|
+
display: inline-block;
|
22
|
+
}
|
23
|
+
|
24
|
+
&__search {
|
25
|
+
width: 255px;
|
26
|
+
}
|
27
|
+
|
28
|
+
&__progress {
|
29
|
+
margin: 0 auto;
|
30
|
+
}
|
31
|
+
|
32
|
+
&__tablets {
|
33
|
+
padding: 0 !important;
|
34
|
+
overflow-x: auto;
|
35
|
+
|
36
|
+
.tablets-viewer__grid {
|
37
|
+
justify-content: center;
|
38
|
+
grid-template-columns: 125px;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
&__table-wrapper {
|
43
|
+
@include flex-container();
|
44
|
+
overflow: auto;
|
45
|
+
}
|
46
|
+
|
47
|
+
&__table-content {
|
48
|
+
overflow: auto;
|
49
|
+
height: 100%;
|
50
|
+
@include freeze-nth-column(1);
|
51
|
+
@include freeze-nth-column(2, 80px);
|
52
|
+
@include freeze-nth-column(3, 120px);
|
53
|
+
|
54
|
+
@include table-styles;
|
55
|
+
@include table-sticky-styles;
|
56
|
+
}
|
57
|
+
&__version-tooltip {
|
58
|
+
width: 100%;
|
59
|
+
span {
|
60
|
+
display: block;
|
61
|
+
width: 100%;
|
62
|
+
overflow: hidden;
|
63
|
+
text-overflow: ellipsis;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}
|
@@ -0,0 +1,80 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import cn from 'bem-cn-lite';
|
4
|
+
|
5
|
+
import ProgressViewer from '../ProgressViewer/ProgressViewer';
|
6
|
+
import EntityStatus from '../EntityStatus/EntityStatus';
|
7
|
+
|
8
|
+
import {formatStorageValues} from '../../utils';
|
9
|
+
import routes, {createHref} from '../../routes';
|
10
|
+
|
11
|
+
import './PDiskViewer.scss';
|
12
|
+
|
13
|
+
const b = cn('pdisk-viewer');
|
14
|
+
|
15
|
+
class PDiskViewer extends React.Component {
|
16
|
+
static propTypes = {
|
17
|
+
disk: PropTypes.object.isRequired,
|
18
|
+
className: PropTypes.string,
|
19
|
+
};
|
20
|
+
|
21
|
+
static defaultProps = {
|
22
|
+
className: '',
|
23
|
+
};
|
24
|
+
|
25
|
+
render() {
|
26
|
+
const {disk, className} = this.props;
|
27
|
+
|
28
|
+
if (disk) {
|
29
|
+
return (
|
30
|
+
<div className={`${b()} ${className}`}>
|
31
|
+
{disk && (
|
32
|
+
<div className={b('item')}>
|
33
|
+
<EntityStatus
|
34
|
+
status={disk.Realtime}
|
35
|
+
path={createHref(
|
36
|
+
routes.pdisk,
|
37
|
+
{id: disk.PDiskId},
|
38
|
+
{node_id: disk.NodeId},
|
39
|
+
)}
|
40
|
+
label="PDiskID"
|
41
|
+
name={disk.PDiskId}
|
42
|
+
/>
|
43
|
+
</div>
|
44
|
+
)}
|
45
|
+
|
46
|
+
{disk && (
|
47
|
+
<div className={b('item')}>
|
48
|
+
<EntityStatus
|
49
|
+
status={'green'}
|
50
|
+
label="NodeID"
|
51
|
+
path={createHref(routes.node, {
|
52
|
+
id: disk.NodeId,
|
53
|
+
activeTab: 'storage',
|
54
|
+
})}
|
55
|
+
name={disk.NodeId}
|
56
|
+
/>
|
57
|
+
</div>
|
58
|
+
)}
|
59
|
+
|
60
|
+
{disk && (
|
61
|
+
<ProgressViewer
|
62
|
+
value={disk.TotalSize - disk.AvailableSize || 0}
|
63
|
+
capacity={disk.TotalSize || 0}
|
64
|
+
formatValues={formatStorageValues}
|
65
|
+
colorizeProgress={true}
|
66
|
+
className={b('size')}
|
67
|
+
/>
|
68
|
+
)}
|
69
|
+
<div className={b('item')}>
|
70
|
+
{disk && <div className={b('label')}>{disk.Path || 'no path'}</div>}
|
71
|
+
</div>
|
72
|
+
</div>
|
73
|
+
);
|
74
|
+
} else {
|
75
|
+
return <div className="error">no PDisk data</div>;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
export default PDiskViewer;
|
@@ -0,0 +1,40 @@
|
|
1
|
+
.pdisk-viewer {
|
2
|
+
display: flex;
|
3
|
+
align-items: center;
|
4
|
+
|
5
|
+
&__item,
|
6
|
+
&__size {
|
7
|
+
margin-right: 24px;
|
8
|
+
color: var(--yc-color-text-complementary);
|
9
|
+
font-size: var(--yc-text-body2-font-size);
|
10
|
+
line-height: 0;
|
11
|
+
}
|
12
|
+
|
13
|
+
&__item .entity-status {
|
14
|
+
min-width: 100px;
|
15
|
+
}
|
16
|
+
|
17
|
+
&__item .entity-status a {
|
18
|
+
overflow: initial;
|
19
|
+
}
|
20
|
+
|
21
|
+
&__row {
|
22
|
+
display: flex;
|
23
|
+
align-items: center;
|
24
|
+
}
|
25
|
+
|
26
|
+
&__size {
|
27
|
+
width: 120px;
|
28
|
+
color: var(--yc-color-text-complementary);
|
29
|
+
font-size: 10px;
|
30
|
+
}
|
31
|
+
|
32
|
+
&__label {
|
33
|
+
margin: 0 5px;
|
34
|
+
&_link {
|
35
|
+
color: var(--yc-color-base-special);
|
36
|
+
text-decoration: none;
|
37
|
+
display: inline-block;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import cn from 'bem-cn-lite';
|
4
|
+
import {Button} from '@yandex-cloud/uikit';
|
5
|
+
import Icon from '../Icon/Icon';
|
6
|
+
import Hotkey from '../Hotkey/Hotkey';
|
7
|
+
|
8
|
+
import './Pagination.scss';
|
9
|
+
|
10
|
+
const b = cn('elements-pagination');
|
11
|
+
|
12
|
+
const paginationControlComponent = PropTypes.shape({
|
13
|
+
handler: PropTypes.func,
|
14
|
+
disabled: PropTypes.bool,
|
15
|
+
hotkey: PropTypes.string,
|
16
|
+
hotkeyScope: PropTypes.string,
|
17
|
+
hotkeyHandler: PropTypes.func,
|
18
|
+
tooltip: PropTypes.string,
|
19
|
+
}).isRequired;
|
20
|
+
|
21
|
+
export default class Pagination extends React.Component {
|
22
|
+
static propTypes = {
|
23
|
+
previous: paginationControlComponent,
|
24
|
+
next: paginationControlComponent,
|
25
|
+
};
|
26
|
+
|
27
|
+
renderComponent(name, control) {
|
28
|
+
const hotkeySettings = [
|
29
|
+
{
|
30
|
+
keys: control.hotkey,
|
31
|
+
scope: control.hotkeyScope,
|
32
|
+
handler: control.hotkeyHandler,
|
33
|
+
},
|
34
|
+
];
|
35
|
+
|
36
|
+
return (
|
37
|
+
<React.Fragment>
|
38
|
+
<Button
|
39
|
+
view="outlined"
|
40
|
+
onClick={control.handler}
|
41
|
+
disabled={control.disabled}
|
42
|
+
title={control.tooltip}
|
43
|
+
className={b('control')}
|
44
|
+
>
|
45
|
+
<Icon name={name} viewBox="0 0 6 11" width="6" height="11" />
|
46
|
+
</Button>
|
47
|
+
<Hotkey settings={hotkeySettings} />
|
48
|
+
</React.Fragment>
|
49
|
+
);
|
50
|
+
}
|
51
|
+
|
52
|
+
render() {
|
53
|
+
const {previous, next} = this.props;
|
54
|
+
|
55
|
+
return (
|
56
|
+
<div className={b()}>
|
57
|
+
{this.renderComponent('previous', previous)}
|
58
|
+
<div className={b('divider')} />
|
59
|
+
{this.renderComponent('next', next)}
|
60
|
+
</div>
|
61
|
+
);
|
62
|
+
}
|
63
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
.elements-pagination {
|
2
|
+
display: flex;
|
3
|
+
padding-left: 1px;
|
4
|
+
|
5
|
+
&__divider {
|
6
|
+
border-left: 1px solid var(--yc-color-line-generic);
|
7
|
+
}
|
8
|
+
|
9
|
+
&__control {
|
10
|
+
margin: 0 -1px;
|
11
|
+
display: flex;
|
12
|
+
align-items: center;
|
13
|
+
}
|
14
|
+
|
15
|
+
&__icon {
|
16
|
+
color: var(--yc-color-text-primary);
|
17
|
+
display: flex;
|
18
|
+
align-items: center;
|
19
|
+
justify-content: center;
|
20
|
+
}
|
21
|
+
|
22
|
+
&__control:hover {
|
23
|
+
z-index: 5;
|
24
|
+
}
|
25
|
+
}
|