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,108 @@
|
|
1
|
+
import React, {useEffect} from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import {connect} from 'react-redux';
|
4
|
+
import {Popup, useVirtualElementRef} from '@yandex-cloud/uikit';
|
5
|
+
|
6
|
+
import {hideTooltip} from '../../store/reducers/tooltip';
|
7
|
+
|
8
|
+
import './ReduxTooltip.scss';
|
9
|
+
|
10
|
+
const propTypes = {
|
11
|
+
className: PropTypes.string,
|
12
|
+
toolTipVisible: PropTypes.bool,
|
13
|
+
currentHoveredRef: PropTypes.object,
|
14
|
+
data: PropTypes.object,
|
15
|
+
template: PropTypes.func,
|
16
|
+
hideTooltip: PropTypes.func,
|
17
|
+
};
|
18
|
+
|
19
|
+
function ReduxTooltip(props) {
|
20
|
+
const fakeAnchor = useVirtualElementRef({
|
21
|
+
rect: {top: props.positions?.top, left: props.positions?.left},
|
22
|
+
});
|
23
|
+
|
24
|
+
useEffect(() => {
|
25
|
+
window.addEventListener('scroll', handleScroll, true);
|
26
|
+
return () => {
|
27
|
+
window.removeEventListener('scroll', handleScroll);
|
28
|
+
};
|
29
|
+
}, []);
|
30
|
+
|
31
|
+
const handleScroll = () => {
|
32
|
+
const {hideTooltip, toolTipVisible} = props;
|
33
|
+
if (toolTipVisible) {
|
34
|
+
setTimeout(() => hideTooltip(), 500);
|
35
|
+
}
|
36
|
+
};
|
37
|
+
|
38
|
+
const renderPositionPopup = (visible, positions, data, additionalData) => {
|
39
|
+
const {template, popupClassName, hideTooltip} = props;
|
40
|
+
|
41
|
+
return (
|
42
|
+
<React.Fragment>
|
43
|
+
<Popup
|
44
|
+
open={visible}
|
45
|
+
placement={['top', 'bottom', 'left', 'right']}
|
46
|
+
className={popupClassName}
|
47
|
+
anchorRef={fakeAnchor}
|
48
|
+
onOutsideClick={hideTooltip}
|
49
|
+
>
|
50
|
+
{data && template(data, additionalData)}
|
51
|
+
</Popup>
|
52
|
+
</React.Fragment>
|
53
|
+
);
|
54
|
+
};
|
55
|
+
const renderAnchorPopup = (visible, anchor, data, additionalData) => {
|
56
|
+
const {template, popupClassName, hideTooltip} = props;
|
57
|
+
return (
|
58
|
+
<Popup
|
59
|
+
open={visible}
|
60
|
+
anchorRef={{current: anchor}}
|
61
|
+
hasArrow
|
62
|
+
placement={['top', 'bottom', 'left', 'right']}
|
63
|
+
className={popupClassName}
|
64
|
+
onOutsideClick={hideTooltip}
|
65
|
+
>
|
66
|
+
{data && template(data, additionalData)}
|
67
|
+
</Popup>
|
68
|
+
);
|
69
|
+
};
|
70
|
+
|
71
|
+
const {
|
72
|
+
className = '',
|
73
|
+
toolTipVisible,
|
74
|
+
currentHoveredRef,
|
75
|
+
data,
|
76
|
+
additionalData,
|
77
|
+
positions,
|
78
|
+
} = props;
|
79
|
+
|
80
|
+
return (
|
81
|
+
<div className={`redux-tooltip ${className}`}>
|
82
|
+
{positions
|
83
|
+
? renderPositionPopup(toolTipVisible, positions, data, additionalData)
|
84
|
+
: renderAnchorPopup(toolTipVisible, currentHoveredRef, data, additionalData)}
|
85
|
+
</div>
|
86
|
+
);
|
87
|
+
}
|
88
|
+
|
89
|
+
const mapStateToProps = (state) => {
|
90
|
+
const {toolTipVisible, currentHoveredRef, data, template, additionalData, positions} =
|
91
|
+
state.tooltip;
|
92
|
+
|
93
|
+
const {popupClassName} = additionalData || {};
|
94
|
+
|
95
|
+
return {
|
96
|
+
toolTipVisible,
|
97
|
+
currentHoveredRef,
|
98
|
+
data,
|
99
|
+
template,
|
100
|
+
additionalData,
|
101
|
+
positions,
|
102
|
+
popupClassName,
|
103
|
+
};
|
104
|
+
};
|
105
|
+
|
106
|
+
export default connect(mapStateToProps, {hideTooltip})(ReduxTooltip);
|
107
|
+
|
108
|
+
ReduxTooltip.propTypes = propTypes;
|
@@ -0,0 +1,67 @@
|
|
1
|
+
@import '../../styles/mixins.scss';
|
2
|
+
|
3
|
+
.popup2 {
|
4
|
+
animation: none !important;
|
5
|
+
max-width: 300px;
|
6
|
+
}
|
7
|
+
|
8
|
+
.pool-tooltip,
|
9
|
+
.tablet-tooltip,
|
10
|
+
.node-tootltip,
|
11
|
+
.tabletsOverall-tooltip,
|
12
|
+
.histogram-tooltip {
|
13
|
+
padding: 10px;
|
14
|
+
|
15
|
+
&__label {
|
16
|
+
padding-right: 15px;
|
17
|
+
color: var(--yc-color-text-secondary);
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
.json-tooltip {
|
22
|
+
padding: 20px 20px 20px 0;
|
23
|
+
|
24
|
+
&__inspector {
|
25
|
+
@include json-tree-styles();
|
26
|
+
|
27
|
+
:not(.json-inspector__leaf_expanded).json-inspector__leaf_composite:before {
|
28
|
+
content: '';
|
29
|
+
}
|
30
|
+
.json-inspector__leaf_expanded.json-inspector__leaf_composite:before {
|
31
|
+
content: '';
|
32
|
+
}
|
33
|
+
|
34
|
+
& .json-inspector {
|
35
|
+
&__line:hover:after {
|
36
|
+
background: transparent;
|
37
|
+
}
|
38
|
+
&__show-original:hover:after,
|
39
|
+
&__show-original:hover:before {
|
40
|
+
color: transparent;
|
41
|
+
}
|
42
|
+
|
43
|
+
&__value_helper {
|
44
|
+
display: none;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
.cell-tooltip {
|
51
|
+
padding: 10px;
|
52
|
+
word-break: break-word;
|
53
|
+
}
|
54
|
+
|
55
|
+
.tablet-tooltip {
|
56
|
+
padding: 10px;
|
57
|
+
&__label {
|
58
|
+
padding-right: 15px;
|
59
|
+
color: var(--yc-color-text-secondary);
|
60
|
+
}
|
61
|
+
|
62
|
+
&__value {
|
63
|
+
&_blue {
|
64
|
+
color: var(--yc-color-base-special);
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
@@ -0,0 +1,81 @@
|
|
1
|
+
.storage-disk-progress-bar {
|
2
|
+
$block: &;
|
3
|
+
position: relative;
|
4
|
+
|
5
|
+
display: inline-block;
|
6
|
+
|
7
|
+
width: 100%;
|
8
|
+
height: var(--yc-text-body2-line-height);
|
9
|
+
|
10
|
+
border: 1px solid var(--yc-color-infographics-misc-heavy);
|
11
|
+
border-radius: 5px;
|
12
|
+
background-color: var(--yc-color-infographics-misc-medium);
|
13
|
+
|
14
|
+
#{$block}__filled {
|
15
|
+
filter: brightness(0.3) saturate(3);
|
16
|
+
}
|
17
|
+
|
18
|
+
&_green {
|
19
|
+
border-color: var(--yc-color-text-positive);
|
20
|
+
background-color: var(--yc-color-text-positive);
|
21
|
+
filter: opacity(0.8);
|
22
|
+
}
|
23
|
+
|
24
|
+
&_blue {
|
25
|
+
border-color: var(--yc-color-infographics-info-heavy);
|
26
|
+
background-color: var(--yc-color-infographics-info-medium);
|
27
|
+
#{$block}__filled {
|
28
|
+
filter: brightness(0.2) saturate(3);
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
&_yellow {
|
33
|
+
border-color: var(--yc-color-base-warning-heavy-hover);
|
34
|
+
background-color: var(--yc-color-base-warning-heavy);
|
35
|
+
filter: opacity(0.8);
|
36
|
+
}
|
37
|
+
|
38
|
+
&_orange {
|
39
|
+
border-color: var(--yc-color-infographics-danger-medium);
|
40
|
+
background-color: var(--yc-color-infographics-warning-medium);
|
41
|
+
filter: opacity(0.8);
|
42
|
+
#{$block}__filled {
|
43
|
+
filter: brightness(0.7) saturate(3);
|
44
|
+
}
|
45
|
+
}
|
46
|
+
&_red {
|
47
|
+
border-color: var(--yc-color-base-danger-heavy-hover);
|
48
|
+
background-color: var(--yc-color-base-danger-heavy);
|
49
|
+
filter: opacity(0.8);
|
50
|
+
#{$block}__filled {
|
51
|
+
filter: brightness(0.3) saturate(4);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
&__filled {
|
56
|
+
position: absolute;
|
57
|
+
top: 0;
|
58
|
+
left: 0;
|
59
|
+
|
60
|
+
height: 100%;
|
61
|
+
|
62
|
+
border-radius: 5px 0 0 5px;
|
63
|
+
background-color: inherit;
|
64
|
+
filter: brightness(0.6) saturate(2);
|
65
|
+
}
|
66
|
+
&__filled-title {
|
67
|
+
position: absolute;
|
68
|
+
top: 0;
|
69
|
+
left: 5px;
|
70
|
+
|
71
|
+
color: inherit;
|
72
|
+
|
73
|
+
font-size: var(--yc-text-body-font-size);
|
74
|
+
line-height: inherit;
|
75
|
+
&_light {
|
76
|
+
z-index: 100;
|
77
|
+
|
78
|
+
color: var(--yc-color-text-light-primary);
|
79
|
+
}
|
80
|
+
}
|
81
|
+
}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
import React, {useContext} from 'react';
|
2
|
+
import HistoryContext from '../../../contexts/HistoryContext';
|
3
|
+
import cn from 'bem-cn-lite';
|
4
|
+
|
5
|
+
import './DiskStateProgressBar.scss';
|
6
|
+
|
7
|
+
const b = cn('storage-disk-progress-bar');
|
8
|
+
|
9
|
+
export const diskProgressColors = {
|
10
|
+
0: 'Grey',
|
11
|
+
1: 'Green',
|
12
|
+
2: 'Blue',
|
13
|
+
3: 'Yellow',
|
14
|
+
4: 'Orange',
|
15
|
+
5: 'Red',
|
16
|
+
};
|
17
|
+
|
18
|
+
interface DiskStateProgressBarProps {
|
19
|
+
diskAllocatedPercent?: number;
|
20
|
+
severity?: keyof typeof diskProgressColors;
|
21
|
+
href?: string;
|
22
|
+
}
|
23
|
+
|
24
|
+
function DiskStateProgressBar({
|
25
|
+
diskAllocatedPercent = -1,
|
26
|
+
severity,
|
27
|
+
href,
|
28
|
+
}: DiskStateProgressBarProps) {
|
29
|
+
const history = useContext(HistoryContext);
|
30
|
+
const onDiskClick = () => {
|
31
|
+
if (href) {
|
32
|
+
history.push(href);
|
33
|
+
}
|
34
|
+
};
|
35
|
+
return (
|
36
|
+
<div
|
37
|
+
className={
|
38
|
+
severity !== undefined
|
39
|
+
? b({[diskProgressColors[severity].toLowerCase()]: true})
|
40
|
+
: undefined
|
41
|
+
}
|
42
|
+
onClick={onDiskClick}
|
43
|
+
>
|
44
|
+
{diskAllocatedPercent >= 0 && (
|
45
|
+
<React.Fragment>
|
46
|
+
<div className={b('filled')} style={{width: `${diskAllocatedPercent}%`}} />
|
47
|
+
<div className={b('filled-title', {light: diskAllocatedPercent > 7})}>
|
48
|
+
{`${Math.round(diskAllocatedPercent)}%`}
|
49
|
+
</div>
|
50
|
+
</React.Fragment>
|
51
|
+
)}
|
52
|
+
</div>
|
53
|
+
);
|
54
|
+
}
|
55
|
+
|
56
|
+
export default DiskStateProgressBar;
|
@@ -0,0 +1,32 @@
|
|
1
|
+
.pdisk-storage {
|
2
|
+
flex-grow: 1;
|
3
|
+
|
4
|
+
margin-right: 10px;
|
5
|
+
|
6
|
+
cursor: pointer;
|
7
|
+
|
8
|
+
&:last-child {
|
9
|
+
margin-right: 0px;
|
10
|
+
}
|
11
|
+
&__popup-wrapper {
|
12
|
+
padding: 5px 10px;
|
13
|
+
}
|
14
|
+
&__popup-content {
|
15
|
+
display: grid;
|
16
|
+
column-gap: 5px;
|
17
|
+
justify-items: stretch;
|
18
|
+
}
|
19
|
+
&__popup-section-name {
|
20
|
+
margin: 5px 0;
|
21
|
+
|
22
|
+
text-align: center;
|
23
|
+
|
24
|
+
border-bottom: 1px solid var(--yc-color-line-generic);
|
25
|
+
|
26
|
+
font-weight: 500;
|
27
|
+
grid-column: 1 / 3;
|
28
|
+
}
|
29
|
+
&__property {
|
30
|
+
text-align: right;
|
31
|
+
}
|
32
|
+
}
|
@@ -0,0 +1,167 @@
|
|
1
|
+
import React, {useEffect, useState, useRef, useMemo} from 'react';
|
2
|
+
import cn from 'bem-cn-lite';
|
3
|
+
import _ from 'lodash';
|
4
|
+
import {Popup} from '@yandex-cloud/uikit';
|
5
|
+
//@ts-ignore
|
6
|
+
import {bytesToGB} from '../../../utils/utils';
|
7
|
+
//@ts-ignore
|
8
|
+
import routes, {createHref} from '../../../routes';
|
9
|
+
//@ts-ignore
|
10
|
+
import {getPDiskId} from '../../../utils';
|
11
|
+
import DiskStateProgressBar, {
|
12
|
+
diskProgressColors,
|
13
|
+
} from '../DiskStateProgressBar/DiskStateProgressBar';
|
14
|
+
|
15
|
+
import './Pdisk.scss';
|
16
|
+
|
17
|
+
const b = cn('pdisk-storage');
|
18
|
+
|
19
|
+
const stateSeverity = {
|
20
|
+
Initial: 0,
|
21
|
+
Normal: 1,
|
22
|
+
InitialFormatRead: 3,
|
23
|
+
InitialSysLogRead: 3,
|
24
|
+
InitialCommonLogRead: 3,
|
25
|
+
InitialFormatReadError: 5,
|
26
|
+
InitialSysLogReadError: 5,
|
27
|
+
InitialSysLogParseError: 5,
|
28
|
+
InitialCommonLogReadError: 5,
|
29
|
+
InitialCommonLogParseError: 5,
|
30
|
+
CommonLoggerInitError: 5,
|
31
|
+
OpenFileError: 5,
|
32
|
+
ChunkQuotaError: 5,
|
33
|
+
DeviceIoError: 5,
|
34
|
+
};
|
35
|
+
|
36
|
+
const colorSeverity = {
|
37
|
+
Grey: 0,
|
38
|
+
Green: 1,
|
39
|
+
Blue: 2,
|
40
|
+
Yellow: 3,
|
41
|
+
Orange: 4,
|
42
|
+
Red: 5,
|
43
|
+
};
|
44
|
+
type PDiskState = keyof typeof stateSeverity;
|
45
|
+
|
46
|
+
interface PDiskProps {
|
47
|
+
NodeId: number;
|
48
|
+
Host?: string;
|
49
|
+
Path?: string;
|
50
|
+
Realtime?: string;
|
51
|
+
Device?: string;
|
52
|
+
AvailableSize?: string;
|
53
|
+
TotalSize?: string;
|
54
|
+
State?: PDiskState;
|
55
|
+
PDiskId: number;
|
56
|
+
}
|
57
|
+
|
58
|
+
const getStateSeverity = (pDiskState?: PDiskState) => {
|
59
|
+
return pDiskState ? stateSeverity[pDiskState] : colorSeverity.Grey;
|
60
|
+
};
|
61
|
+
|
62
|
+
function Pdisk(props: PDiskProps) {
|
63
|
+
const [severity, setSeverity] = useState(getStateSeverity(props.State));
|
64
|
+
const [isPopupVisible, setIsPopupVisible] = useState(false);
|
65
|
+
|
66
|
+
const anchor = useRef(null);
|
67
|
+
|
68
|
+
useEffect(() => {
|
69
|
+
const newSeverity = getStateSeverity(props.State);
|
70
|
+
if (severity !== newSeverity) {
|
71
|
+
setSeverity(newSeverity);
|
72
|
+
}
|
73
|
+
}, [props.State]);
|
74
|
+
|
75
|
+
const showPopup = () => {
|
76
|
+
setIsPopupVisible(true);
|
77
|
+
};
|
78
|
+
|
79
|
+
const hidePopup = () => {
|
80
|
+
setIsPopupVisible(false);
|
81
|
+
};
|
82
|
+
/* eslint-disable */
|
83
|
+
const preparePdiskData = () => {
|
84
|
+
const {AvailableSize, TotalSize, State, PDiskId, NodeId, Host, Path, Realtime, Device} =
|
85
|
+
props;
|
86
|
+
const errorColors = [
|
87
|
+
diskProgressColors[colorSeverity.Orange as keyof typeof diskProgressColors],
|
88
|
+
diskProgressColors[colorSeverity.Red as keyof typeof diskProgressColors],
|
89
|
+
diskProgressColors[colorSeverity.Yellow as keyof typeof diskProgressColors],
|
90
|
+
];
|
91
|
+
|
92
|
+
const pdiskData: {property: string; value: string | number}[] = [
|
93
|
+
{property: 'PDisk', value: getPDiskId({NodeId, PDiskId})},
|
94
|
+
];
|
95
|
+
|
96
|
+
pdiskData.push({property: 'State', value: State || 'not available'});
|
97
|
+
NodeId && pdiskData.push({property: 'Node Id', value: NodeId});
|
98
|
+
|
99
|
+
Host && pdiskData.push({property: 'Host', value: Host});
|
100
|
+
Path && pdiskData.push({property: 'Path', value: Path});
|
101
|
+
pdiskData.push({
|
102
|
+
property: 'Available',
|
103
|
+
value: `${bytesToGB(AvailableSize)} of ${bytesToGB(TotalSize)}`,
|
104
|
+
});
|
105
|
+
Realtime &&
|
106
|
+
errorColors.includes(Realtime) &&
|
107
|
+
pdiskData.push({property: 'Realtime', value: Realtime});
|
108
|
+
Device &&
|
109
|
+
errorColors.includes(Device) &&
|
110
|
+
pdiskData.push({property: 'Device', value: Device});
|
111
|
+
return pdiskData;
|
112
|
+
};
|
113
|
+
/* eslint-enable */
|
114
|
+
|
115
|
+
const renderPopup = () => {
|
116
|
+
const pdiskData = preparePdiskData();
|
117
|
+
return (
|
118
|
+
<Popup
|
119
|
+
className={b('popup-wrapper')}
|
120
|
+
anchorRef={anchor}
|
121
|
+
open={isPopupVisible}
|
122
|
+
placement={['top']}
|
123
|
+
hasArrow
|
124
|
+
>
|
125
|
+
<div className={b('popup-content')}>
|
126
|
+
<div className={b('popup-section-name')}>PDisk</div>
|
127
|
+
{_.map(pdiskData, (row) => (
|
128
|
+
<React.Fragment key={row.property}>
|
129
|
+
<div className={b('property')}>{row.property}</div>
|
130
|
+
<div className={b('value')}>{row.value}</div>
|
131
|
+
</React.Fragment>
|
132
|
+
))}
|
133
|
+
</div>
|
134
|
+
</Popup>
|
135
|
+
);
|
136
|
+
};
|
137
|
+
|
138
|
+
const pdiskAllocatedPercent = useMemo(() => {
|
139
|
+
const {AvailableSize, TotalSize} = props;
|
140
|
+
|
141
|
+
if (!AvailableSize || !TotalSize) {
|
142
|
+
return;
|
143
|
+
}
|
144
|
+
return !isNaN(Number(AvailableSize)) && !isNaN(Number(TotalSize))
|
145
|
+
? Math.round(((Number(TotalSize) - Number(AvailableSize)) * 100) / Number(TotalSize))
|
146
|
+
: undefined;
|
147
|
+
}, [props.AvailableSize, props.TotalSize]);
|
148
|
+
|
149
|
+
return (
|
150
|
+
<React.Fragment>
|
151
|
+
{renderPopup()}
|
152
|
+
<div className={b()} ref={anchor} onMouseEnter={showPopup} onMouseLeave={hidePopup}>
|
153
|
+
<DiskStateProgressBar
|
154
|
+
diskAllocatedPercent={pdiskAllocatedPercent}
|
155
|
+
severity={severity as keyof typeof diskProgressColors}
|
156
|
+
// href={createHref(routes.pdisk, {id: props.PDiskId}, {node_id: props.NodeId})}
|
157
|
+
href={createHref(routes.vdisk, null, {
|
158
|
+
pdiskId: props.PDiskId,
|
159
|
+
nodeId: props.NodeId,
|
160
|
+
})}
|
161
|
+
/>
|
162
|
+
</div>
|
163
|
+
</React.Fragment>
|
164
|
+
);
|
165
|
+
}
|
166
|
+
|
167
|
+
export default Pdisk;
|