ydb-embedded-ui 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/README.md +2 -2
- package/dist/assets/icons/cluster.svg +1 -0
- package/dist/assets/icons/hide.svg +1 -0
- package/dist/assets/icons/show.svg +1 -0
- package/dist/assets/icons/user-check.svg +1 -1
- package/dist/assets/icons/user-secret.svg +1 -1
- package/dist/components/AsideNavigation/AsideHeader.scss +1 -2
- package/dist/components/AsideNavigation/AsideHeaderFooterItem/AsideHeaderFooterItem.scss +7 -7
- package/dist/components/AsideNavigation/AsideHeaderTooltip/AsideHeaderTooltip.scss +2 -2
- package/dist/components/AsideNavigation/CompositeBar/CompositeBar.scss +6 -6
- package/dist/components/AsideNavigation/Drawer/Drawer.scss +5 -5
- package/dist/components/AsideNavigation/Logo/Logo.scss +3 -4
- package/dist/components/AsideNavigation/Settings/Settings.scss +27 -12
- package/dist/components/AsideNavigation/Settings/SettingsMenu/SettingsMenu.scss +14 -6
- package/dist/components/Breadcrumbs/Breadcrumbs.scss +2 -1
- package/dist/components/ClusterInfo/ClusterInfo.scss +19 -12
- package/dist/components/ClusterInfo/ClusterInfo.tsx +110 -10
- package/dist/components/CopyToClipboard/CopyToClipboard.tsx +39 -0
- package/dist/components/CriticalActionDialog/CriticalActionDialog.scss +5 -4
- package/dist/components/Divider/Divider.scss +7 -0
- package/dist/components/Divider/Divider.tsx +11 -0
- package/dist/components/EmptyState/EmptyState.scss +14 -10
- package/dist/components/EnableFullscreenButton/EnableFullscreenButton.tsx +22 -0
- package/dist/components/EntityStatus/EntityStatus.js +5 -3
- package/dist/components/EntityStatus/EntityStatus.scss +35 -13
- package/dist/components/FullGroupViewer/FullGroupViewer.js +2 -4
- package/dist/components/FullGroupViewer/FullGroupViewer.scss +6 -3
- package/dist/components/FullNodeViewer/FullNodeViewer.scss +19 -11
- package/dist/components/Fullscreen/Fullscreen.scss +28 -0
- package/dist/components/Fullscreen/Fullscreen.tsx +81 -0
- package/dist/components/GroupTreeViewer/GroupTreeViewer.scss +1 -0
- package/dist/components/GroupViewer/GroupViewer.scss +8 -4
- package/dist/components/Icon/Icon.js +2 -0
- package/dist/components/InfoViewer/InfoViewer.scss +22 -16
- package/dist/components/NodesViewer/NodesViewer.js +25 -35
- package/dist/components/NodesViewer/NodesViewer.scss +15 -11
- package/dist/components/PDiskViewer/PDiskViewer.scss +10 -4
- package/dist/components/Pagination/Pagination.scss +6 -3
- package/dist/components/PoolBar/PoolBar.scss +14 -10
- package/dist/components/PoolUsage/PoolUsage.scss +17 -9
- package/dist/components/ProgressViewer/ProgressViewer.js +1 -1
- package/dist/components/ProgressViewer/ProgressViewer.scss +28 -18
- package/dist/components/QueryExecutionStatus/QueryExecutionStatus.scss +14 -0
- package/dist/components/QueryExecutionStatus/QueryExecutionStatus.tsx +29 -0
- package/dist/components/SplitPane/SplitPane.scss +33 -40
- package/dist/components/SplitPane/SplitPane.tsx +94 -0
- package/dist/components/Tablet/Tablet.scss +9 -6
- package/dist/components/TabletsOverall/TabletsOverall.scss +19 -0
- package/dist/components/TabletsOverall/TabletsOverall.tsx +105 -0
- package/dist/components/TabletsStatistic/TabletsStatistic.scss +24 -18
- package/dist/components/TabletsViewer/TabletsViewer.scss +12 -9
- package/dist/components/Tag/Tag.scss +6 -4
- package/dist/components/Tags/Tags.scss +1 -1
- package/dist/components/TreeView/TreeView.js +1 -1
- package/dist/components/TreeView/TreeView.scss +9 -0
- package/dist/components/TruncatedQuery/TruncatedQuery.scss +4 -3
- package/dist/containers/App/App.js +1 -0
- package/dist/containers/App/App.scss +50 -31
- package/dist/containers/App/Content.js +2 -2
- package/dist/containers/App/NodesTable.scss +25 -0
- package/dist/containers/App/TipPopup/TipPopup.scss +10 -6
- package/dist/containers/AppIcons/AppIcons.js +46 -22
- package/dist/containers/AsideNavigation/AsideNavigation.scss +1 -1
- package/dist/containers/AsideNavigation/AsideNavigation.tsx +12 -5
- package/dist/containers/Authentication/Authentication.scss +63 -14
- package/dist/containers/Authentication/Authentication.tsx +42 -9
- package/dist/containers/Cluster/Cluster.scss +5 -3
- package/dist/containers/Cluster/Cluster.tsx +49 -0
- package/dist/containers/Group/Group.scss +1 -1
- package/dist/containers/Header/Header.scss +15 -59
- package/dist/containers/Header/Header.tsx +75 -0
- package/dist/containers/Header/Host/Host.scss +10 -3
- package/dist/containers/Heatmap/Heatmap.js +1 -1
- package/dist/containers/Heatmap/Heatmap.scss +16 -7
- package/dist/containers/Heatmap/HeatmapCanvas/HeatmapCanvas.js +3 -3
- package/dist/containers/Heatmap/Histogram/Histogram.scss +21 -9
- package/dist/containers/Node/Node.js +1 -1
- package/dist/containers/Node/Node.scss +6 -4
- package/dist/containers/Nodes/Nodes.js +28 -27
- package/dist/containers/Nodes/Nodes.scss +5 -17
- package/dist/containers/Pdisk/Pdisk.scss +6 -4
- package/dist/containers/Pool/Pool.scss +7 -4
- package/dist/containers/ReduxTooltip/ReduxTooltip.scss +5 -1
- package/dist/containers/Storage/DiskStateProgressBar/DiskStateProgressBar.scss +77 -0
- package/dist/containers/{StorageV2 → Storage}/DiskStateProgressBar/DiskStateProgressBar.tsx +1 -1
- package/dist/containers/{StorageV2 → Storage}/Pdisk/Pdisk.scss +6 -4
- package/dist/containers/{StorageV2 → Storage}/Pdisk/Pdisk.tsx +1 -2
- package/dist/containers/{StorageV2 → Storage}/Storage.js +72 -34
- package/dist/containers/{StorageV2 → Storage}/Storage.scss +12 -14
- package/dist/containers/{StorageV2 → Storage}/StorageFilter/StorageFilter.js +1 -9
- package/dist/containers/{StorageV2 → Storage}/StorageGroups/StorageGroups.scss +2 -0
- package/dist/containers/{StorageV2 → Storage}/StorageGroups/StorageGroups.tsx +1 -1
- package/dist/containers/{StorageV2 → Storage}/StorageNodes/StorageNodes.scss +2 -0
- package/dist/containers/{StorageV2 → Storage}/StorageNodes/StorageNodes.tsx +1 -1
- package/dist/containers/{StorageV2 → Storage}/Vdisk/Vdisk.js +0 -0
- package/dist/containers/{StorageV2 → Storage}/Vdisk/Vdisk.scss +6 -4
- package/dist/containers/Tablet/Tablet.scss +13 -9
- package/dist/containers/Tablets/Tablets.js +21 -90
- package/dist/containers/Tablets/Tablets.scss +9 -35
- package/dist/containers/TabletsFilters/TabletsFilters.js +2 -75
- package/dist/containers/TabletsFilters/TabletsFilters.scss +15 -35
- package/dist/containers/Tenant/Acl/Acl.js +54 -47
- package/dist/containers/Tenant/Acl/Acl.scss +15 -4
- package/dist/containers/Tenant/{Compute → Diagnostics/Compute}/Compute.js +35 -12
- package/dist/containers/Tenant/Diagnostics/Compute/Compute.scss +14 -0
- package/dist/containers/Tenant/{Describe → Diagnostics/Describe}/Describe.js +50 -1
- package/dist/containers/Tenant/{Describe → Diagnostics/Describe}/Describe.scss +5 -3
- package/dist/containers/Tenant/Diagnostics/DetailedOverview/DetailedOverview.scss +27 -0
- package/dist/containers/Tenant/Diagnostics/DetailedOverview/DetailedOverview.tsx +88 -0
- package/dist/containers/Tenant/Diagnostics/Diagnostics.scss +50 -0
- package/dist/containers/Tenant/Diagnostics/Diagnostics.tsx +208 -0
- package/dist/containers/Tenant/Diagnostics/DiagnosticsPages.ts +75 -0
- package/dist/containers/Tenant/Diagnostics/Healthcheck/Healthcheck.js +191 -0
- package/dist/containers/Tenant/Diagnostics/Healthcheck/Healthcheck.scss +79 -0
- package/dist/containers/Tenant/{Healthcheck → Diagnostics/Healthcheck}/IssuesViewer/IssueViewer.scss +25 -13
- package/dist/containers/Tenant/{Healthcheck → Diagnostics/Healthcheck}/IssuesViewer/IssuesViewer.js +2 -2
- package/dist/containers/Tenant/{Schema → Diagnostics}/HotKeys/HotKeys.js +14 -8
- package/dist/containers/Tenant/{Schema → Diagnostics}/HotKeys/HotKeys.scss +7 -5
- package/dist/containers/Tenant/{Network → Diagnostics/Network}/Network.js +39 -9
- package/dist/containers/Tenant/{Network → Diagnostics/Network}/Network.scss +35 -36
- package/dist/containers/Tenant/{Network → Diagnostics/Network}/NodeNetwork/NodeNetwork.js +0 -0
- package/dist/containers/Tenant/{Network → Diagnostics/Network}/NodeNetwork/NodeNetwork.scss +11 -9
- package/dist/containers/Tenant/Diagnostics/Overview/Overview.scss +13 -0
- package/dist/containers/Tenant/Diagnostics/Overview/Overview.tsx +123 -0
- package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.js +200 -0
- package/dist/{components → containers/Tenant/Diagnostics}/TenantOverview/TenantOverview.scss +24 -17
- package/dist/containers/Tenant/{TopQueries → Diagnostics/TopQueries}/TopQueries.js +32 -30
- package/dist/containers/Tenant/{TopQueries → Diagnostics/TopQueries}/TopQueries.scss +10 -9
- package/dist/containers/Tenant/{TopShards → Diagnostics/TopShards}/TopShards.js +25 -29
- package/dist/containers/Tenant/{TopShards → Diagnostics/TopShards}/TopShards.scss +1 -13
- package/dist/containers/Tenant/ObjectGeneral/ObjectGeneral.scss +38 -0
- package/dist/containers/Tenant/ObjectGeneral/ObjectGeneral.tsx +104 -0
- package/dist/containers/Tenant/ObjectSummary/ObjectSummary.scss +165 -0
- package/dist/containers/Tenant/ObjectSummary/ObjectSummary.tsx +310 -0
- package/dist/containers/Tenant/Preview/Preview.js +50 -12
- package/dist/containers/Tenant/Preview/Preview.scss +45 -3
- package/dist/containers/Tenant/QueryEditor/QueriesHistory/QueriesHistory.scss +85 -0
- package/dist/containers/Tenant/QueryEditor/QueriesHistory/QueriesHistory.tsx +94 -0
- package/dist/containers/Tenant/QueryEditor/QueryEditor.js +291 -264
- package/dist/containers/Tenant/QueryEditor/QueryEditor.scss +47 -18
- package/dist/containers/Tenant/QueryEditor/QueryExplain/QueryExplain.js +132 -32
- package/dist/containers/Tenant/QueryEditor/QueryExplain/QueryExplain.scss +47 -11
- package/dist/containers/Tenant/QueryEditor/QueryResult/QueryResult.js +89 -20
- package/dist/containers/Tenant/QueryEditor/QueryResult/QueryResult.scss +60 -6
- package/dist/containers/Tenant/QueryEditor/SaveQuery/SaveQuery.js +10 -23
- package/dist/containers/Tenant/QueryEditor/SaveQuery/SaveQuery.scss +15 -7
- package/dist/containers/Tenant/QueryEditor/SavedQueries/SavedQueries.js +7 -3
- package/dist/containers/Tenant/QueryEditor/SavedQueries/SavedQueries.scss +28 -17
- package/dist/containers/Tenant/Schema/SchemaInfoViewer/SchemaInfoViewer.js +7 -7
- package/dist/containers/Tenant/Schema/SchemaInfoViewer/SchemaInfoViewer.scss +1 -11
- package/dist/containers/Tenant/Schema/SchemaNode/SchemaNode.js +37 -17
- package/dist/containers/Tenant/Schema/SchemaNode/SchemaNode.scss +33 -12
- package/dist/containers/Tenant/Schema/SchemaNodeActions/SchemaNodeActions.scss +17 -0
- package/dist/containers/Tenant/Schema/SchemaNodeActions/SchemaNodeActions.tsx +125 -0
- package/dist/containers/Tenant/Schema/SchemaTree/SchemaTree.js +5 -4
- package/dist/containers/Tenant/Schema/SchemaTree/SchemaTree.scss +6 -2
- package/dist/containers/Tenant/Schema/SchemaViewer/SchemaViewer.js +53 -34
- package/dist/containers/Tenant/Schema/SchemaViewer/SchemaViewer.scss +1 -22
- package/dist/containers/Tenant/Tenant.scss +3 -32
- package/dist/containers/Tenant/Tenant.tsx +161 -0
- package/dist/containers/Tenant/TenantPages.tsx +48 -0
- package/dist/containers/Tenant/utils/ToggleButton.scss +26 -0
- package/dist/containers/Tenant/utils/paneVisibilityToggleHelpers.tsx +126 -0
- package/dist/containers/Tenants/Tenants.js +41 -55
- package/dist/containers/Tenants/Tenants.scss +4 -17
- package/dist/containers/UserSettings/UserSettings.tsx +0 -2
- package/dist/containers/Vdisk/Vdisk.scss +6 -4
- package/dist/containers/VdiskPdiskNode/VdiskPdiskNode.js +1 -1
- package/dist/containers/VdiskPdiskNode/VdiskPdiskNode.scss +5 -5
- package/dist/{routes.js → routes.ts} +14 -4
- package/dist/store/reducers/clusterNodes.js +1 -1
- package/dist/store/reducers/fullscreen.ts +31 -0
- package/dist/store/reducers/header.ts +23 -0
- package/dist/store/reducers/hotKeys.js +1 -1
- package/dist/store/reducers/index.js +6 -0
- package/dist/store/reducers/saveQuery.ts +33 -0
- package/dist/store/reducers/schema.js +14 -0
- package/dist/store/reducers/shardsWorkload.js +1 -1
- package/dist/store/state-url-mapping.js +1 -1
- package/dist/store/utils.js +2 -6
- package/dist/styles/mixins.scss +49 -34
- package/dist/utils/autofetcher.ts +51 -0
- package/dist/utils/constants.js +25 -7
- package/dist/utils/createToast.tsx +23 -0
- package/dist/utils/getNodesColumns.js +25 -28
- package/dist/utils/index.js +6 -2
- package/package.json +8 -4
- package/dist/components/SplitPane/SplitPane.js +0 -368
- package/dist/components/TenantOverview/TenantOverview.js +0 -148
- package/dist/containers/Cluster/Cluster.js +0 -168
- package/dist/containers/Header/Header.js +0 -88
- package/dist/containers/StorageV2/DiskStateProgressBar/DiskStateProgressBar.scss +0 -81
- package/dist/containers/Tenant/Compute/Compute.scss +0 -6
- package/dist/containers/Tenant/Healthcheck/Healthcheck.js +0 -116
- package/dist/containers/Tenant/Healthcheck/Healthcheck.scss +0 -64
- package/dist/containers/Tenant/Schema/Info/Info.js +0 -84
- package/dist/containers/Tenant/Schema/Info/Info.scss +0 -3
- package/dist/containers/Tenant/Schema/SchemaMain/SchemaMain.js +0 -439
- package/dist/containers/Tenant/Schema/SchemaMain/SchemaMain.scss +0 -90
- package/dist/containers/Tenant/Schema/SchemaPages.js +0 -56
- package/dist/containers/Tenant/Tenant.js +0 -199
- package/dist/containers/Tenant/TenantPages.js +0 -35
@@ -1,368 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import cn from 'bem-cn-lite';
|
3
|
-
|
4
|
-
import {useMeasure} from 'react-use';
|
5
|
-
const block = cn('split');
|
6
|
-
|
7
|
-
import './SplitPane.scss';
|
8
|
-
|
9
|
-
const animationDuration = 200;
|
10
|
-
|
11
|
-
function Pane({className, children, size, split, style, hide, innerRef}) {
|
12
|
-
const [animate, setAnimate] = React.useState(hide === true);
|
13
|
-
const [hideInner, setHide] = React.useState(hide === true);
|
14
|
-
|
15
|
-
const secondary = size === undefined;
|
16
|
-
|
17
|
-
React.useLayoutEffect(() => {
|
18
|
-
setAnimate(true);
|
19
|
-
setHide(hide === true);
|
20
|
-
const timerId = window.setTimeout(() => setAnimate(false), animationDuration);
|
21
|
-
return () => {
|
22
|
-
clearTimeout(timerId);
|
23
|
-
};
|
24
|
-
}, [hide]);
|
25
|
-
|
26
|
-
const PaneStyle = {
|
27
|
-
...style,
|
28
|
-
...(secondary
|
29
|
-
? undefined
|
30
|
-
: {
|
31
|
-
[split === 'vertical' ? 'width' : 'height']: hideInner ? 0 : size,
|
32
|
-
opacity: hideInner ? 0 : 1,
|
33
|
-
}),
|
34
|
-
...(animate
|
35
|
-
? {
|
36
|
-
overflow: 'hidden',
|
37
|
-
transition: `${
|
38
|
-
split === 'vertical' ? 'width' : 'height'
|
39
|
-
} ${animationDuration}ms, opacity ${animationDuration}ms`,
|
40
|
-
}
|
41
|
-
: undefined),
|
42
|
-
};
|
43
|
-
return (
|
44
|
-
<div
|
45
|
-
ref={innerRef}
|
46
|
-
className={block(
|
47
|
-
'pane',
|
48
|
-
{secondary, hide: !secondary && hide},
|
49
|
-
classes(className, split),
|
50
|
-
)}
|
51
|
-
style={PaneStyle}
|
52
|
-
>
|
53
|
-
{children}
|
54
|
-
</div>
|
55
|
-
);
|
56
|
-
}
|
57
|
-
|
58
|
-
function Resizer({
|
59
|
-
className,
|
60
|
-
split,
|
61
|
-
style,
|
62
|
-
onClick,
|
63
|
-
onDoubleClick,
|
64
|
-
onMouseDown,
|
65
|
-
onTouchEnd,
|
66
|
-
onTouchStart,
|
67
|
-
allowResize,
|
68
|
-
active,
|
69
|
-
}) {
|
70
|
-
return (
|
71
|
-
<span
|
72
|
-
role="presentation"
|
73
|
-
className={block(
|
74
|
-
'resizer',
|
75
|
-
classes(className, split, allowResize ? '' : 'disabled', active ? 'active' : ''),
|
76
|
-
)}
|
77
|
-
style={style}
|
78
|
-
onMouseDown={(event) => onMouseDown(event)}
|
79
|
-
onTouchStart={(event) => {
|
80
|
-
event.preventDefault();
|
81
|
-
onTouchStart(event);
|
82
|
-
}}
|
83
|
-
onTouchEnd={(event) => {
|
84
|
-
event.preventDefault();
|
85
|
-
onTouchEnd(event);
|
86
|
-
}}
|
87
|
-
onClick={(event) => {
|
88
|
-
if (onClick) {
|
89
|
-
event.preventDefault();
|
90
|
-
onClick(event);
|
91
|
-
}
|
92
|
-
}}
|
93
|
-
onDoubleClick={(event) => {
|
94
|
-
if (onDoubleClick) {
|
95
|
-
event.preventDefault();
|
96
|
-
onDoubleClick(event);
|
97
|
-
}
|
98
|
-
}}
|
99
|
-
/>
|
100
|
-
);
|
101
|
-
}
|
102
|
-
|
103
|
-
export default function SplitPane({
|
104
|
-
className,
|
105
|
-
children,
|
106
|
-
split = 'vertical',
|
107
|
-
style,
|
108
|
-
size,
|
109
|
-
minSize = 50,
|
110
|
-
maxSize = -8,
|
111
|
-
defaultSize,
|
112
|
-
step,
|
113
|
-
primary = 'first',
|
114
|
-
allowResize = true,
|
115
|
-
hidePane,
|
116
|
-
onResizerClick,
|
117
|
-
onResizerDoubleClick,
|
118
|
-
onChange,
|
119
|
-
onDragStarted,
|
120
|
-
onDragFinished,
|
121
|
-
paneStyle,
|
122
|
-
pane1Style,
|
123
|
-
pane2Style,
|
124
|
-
paneClassName,
|
125
|
-
pane1ClassName,
|
126
|
-
pane2ClassName,
|
127
|
-
resizerClassName,
|
128
|
-
resizerStyle,
|
129
|
-
}) {
|
130
|
-
const [containerRef, {width, height}] = useMeasure();
|
131
|
-
const pane1Ref = React.useRef(null);
|
132
|
-
const pane2Ref = React.useRef(null);
|
133
|
-
const [paneSize, setPaneSize] = React.useState(() =>
|
134
|
-
size === undefined
|
135
|
-
? getDefaultSize(split, {width, height}, defaultSize, minSize, maxSize)
|
136
|
-
: size,
|
137
|
-
);
|
138
|
-
const [active, setActive] = React.useState(false);
|
139
|
-
const draggedSizeRef = React.useRef();
|
140
|
-
const defaultSizeRef = React.useRef();
|
141
|
-
const minSizeRef = React.useRef();
|
142
|
-
const maxSizeRef = React.useRef();
|
143
|
-
const positionRef = React.useRef(0);
|
144
|
-
const slackRef = React.useRef(0);
|
145
|
-
|
146
|
-
defaultSizeRef.current = defaultSize;
|
147
|
-
minSizeRef.current = minSize;
|
148
|
-
maxSizeRef.current = maxSize;
|
149
|
-
|
150
|
-
React.useLayoutEffect(() => {
|
151
|
-
if (!active) {
|
152
|
-
const newSize =
|
153
|
-
size === undefined
|
154
|
-
? getDefaultSize(
|
155
|
-
split,
|
156
|
-
{width, height},
|
157
|
-
defaultSizeRef.current,
|
158
|
-
minSizeRef.current,
|
159
|
-
maxSizeRef.current,
|
160
|
-
draggedSizeRef.current,
|
161
|
-
)
|
162
|
-
: size;
|
163
|
-
|
164
|
-
if (size !== undefined) {
|
165
|
-
draggedSizeRef.current = size;
|
166
|
-
}
|
167
|
-
|
168
|
-
setPaneSize(newSize);
|
169
|
-
}
|
170
|
-
}, [size, defaultSize, split, width, height, active]);
|
171
|
-
|
172
|
-
function onTouchStart(event) {
|
173
|
-
if (allowResize) {
|
174
|
-
unFocus(window);
|
175
|
-
positionRef.current =
|
176
|
-
split === 'vertical' ? event.touches[0].clientX : event.touches[0].clientY;
|
177
|
-
slackRef.current = 0;
|
178
|
-
|
179
|
-
if (typeof onDragStarted === 'function') {
|
180
|
-
onDragStarted();
|
181
|
-
}
|
182
|
-
setActive(true);
|
183
|
-
}
|
184
|
-
}
|
185
|
-
|
186
|
-
function onTouchMove(event) {
|
187
|
-
if (allowResize && active) {
|
188
|
-
unFocus(window);
|
189
|
-
const isPrimaryFirst = primary === 'first';
|
190
|
-
const node = isPrimaryFirst ? pane1Ref.current : pane2Ref.current;
|
191
|
-
const node2 = isPrimaryFirst ? pane2Ref.current : pane1Ref.current;
|
192
|
-
if (node && node2) {
|
193
|
-
if (node.getBoundingClientRect) {
|
194
|
-
const newPosition =
|
195
|
-
split === 'vertical' ? event.touches[0].clientX : event.touches[0].clientY;
|
196
|
-
let positionDelta = positionRef.current - newPosition;
|
197
|
-
if (step) {
|
198
|
-
if (Math.abs(positionDelta) < step) {
|
199
|
-
return;
|
200
|
-
}
|
201
|
-
positionDelta = Math.floor(positionDelta / step) * step;
|
202
|
-
}
|
203
|
-
let sizeDelta = isPrimaryFirst ? positionDelta : -positionDelta;
|
204
|
-
|
205
|
-
const pane1Order = parseInt(window.getComputedStyle(node).order, 10);
|
206
|
-
const pane2Order = parseInt(window.getComputedStyle(node2).order, 10);
|
207
|
-
if (pane1Order > pane2Order) {
|
208
|
-
sizeDelta = -sizeDelta;
|
209
|
-
}
|
210
|
-
|
211
|
-
const effectiveMaxSize = getEffectiveMaxSize(split, {width, height}, maxSize);
|
212
|
-
|
213
|
-
const {width: currentWidth, height: currentHeight} =
|
214
|
-
node.getBoundingClientRect();
|
215
|
-
const currentSize = split === 'vertical' ? currentWidth : currentHeight;
|
216
|
-
let newSize = slackRef.current + currentSize - sizeDelta;
|
217
|
-
positionRef.current = positionRef.current - positionDelta;
|
218
|
-
|
219
|
-
if (newSize < minSize) {
|
220
|
-
slackRef.current = newSize - minSize;
|
221
|
-
newSize = minSize;
|
222
|
-
} else if (effectiveMaxSize !== undefined && newSize > effectiveMaxSize) {
|
223
|
-
slackRef.current = newSize - effectiveMaxSize;
|
224
|
-
newSize = effectiveMaxSize;
|
225
|
-
} else {
|
226
|
-
slackRef.current = 0;
|
227
|
-
}
|
228
|
-
|
229
|
-
if (onChange) onChange(newSize);
|
230
|
-
|
231
|
-
draggedSizeRef.current = newSize;
|
232
|
-
setPaneSize(newSize);
|
233
|
-
}
|
234
|
-
}
|
235
|
-
}
|
236
|
-
}
|
237
|
-
const onTouchMoveRef = React.useRef(onTouchMove);
|
238
|
-
onTouchMoveRef.current = onTouchMove;
|
239
|
-
|
240
|
-
function onMouseMove(event) {
|
241
|
-
const eventWithTouches = Object.assign({}, event, {
|
242
|
-
touches: [{clientX: event.clientX, clientY: event.clientY}],
|
243
|
-
});
|
244
|
-
//@ts-ignore
|
245
|
-
onTouchMove(eventWithTouches);
|
246
|
-
}
|
247
|
-
const onMouseMoveRef = React.useRef(onMouseMove);
|
248
|
-
onMouseMoveRef.current = onMouseMove;
|
249
|
-
|
250
|
-
function onTouchEnd() {
|
251
|
-
if (allowResize && active) {
|
252
|
-
if (typeof onDragFinished === 'function') {
|
253
|
-
if (typeof paneSize === 'number') {
|
254
|
-
onDragFinished(paneSize);
|
255
|
-
}
|
256
|
-
}
|
257
|
-
setActive(false);
|
258
|
-
}
|
259
|
-
}
|
260
|
-
const onTouchEndRef = React.useRef(onTouchEnd);
|
261
|
-
onTouchEndRef.current = onTouchEnd;
|
262
|
-
|
263
|
-
function onMouseDown(event) {
|
264
|
-
const eventWithTouches = Object.assign({}, event, {
|
265
|
-
touches: [{clientX: event.clientX, clientY: event.clientY}],
|
266
|
-
});
|
267
|
-
//@ts-ignore
|
268
|
-
onTouchStart(eventWithTouches);
|
269
|
-
}
|
270
|
-
|
271
|
-
React.useEffect(() => {
|
272
|
-
function onTouchEndInner() {
|
273
|
-
// eslint-disable-next-line no-unused-expressions
|
274
|
-
onTouchEndRef.current?.();
|
275
|
-
}
|
276
|
-
function onMouseMoveInner(e) {
|
277
|
-
// eslint-disable-next-line no-unused-expressions
|
278
|
-
onMouseMoveRef.current?.(e);
|
279
|
-
}
|
280
|
-
function onTouchMoveInner(e) {
|
281
|
-
// eslint-disable-next-line no-unused-expressions
|
282
|
-
onTouchMoveRef.current?.(e);
|
283
|
-
}
|
284
|
-
document.addEventListener('mouseup', onTouchEndInner);
|
285
|
-
document.addEventListener('mousemove', onMouseMoveInner);
|
286
|
-
document.addEventListener('touchmove', onTouchMoveInner);
|
287
|
-
return () => {
|
288
|
-
document.removeEventListener('mouseup', onTouchEndInner);
|
289
|
-
document.removeEventListener('mousemove', onMouseMoveInner);
|
290
|
-
document.removeEventListener('touchmove', onTouchMoveInner);
|
291
|
-
};
|
292
|
-
}, []);
|
293
|
-
const notNullChildren = React.Children.toArray(children).filter(Boolean);
|
294
|
-
|
295
|
-
return (
|
296
|
-
<div
|
297
|
-
className={block(null, classes(className, split, allowResize ? '' : 'disabled'))}
|
298
|
-
ref={containerRef}
|
299
|
-
style={style}
|
300
|
-
>
|
301
|
-
<Pane
|
302
|
-
innerRef={pane1Ref}
|
303
|
-
className={classes(paneClassName, pane1ClassName)}
|
304
|
-
split={split}
|
305
|
-
style={{...paneStyle, ...pane1Style}}
|
306
|
-
size={primary === 'first' ? paneSize : undefined}
|
307
|
-
hide={hidePane}
|
308
|
-
>
|
309
|
-
{notNullChildren[0]}
|
310
|
-
</Pane>
|
311
|
-
<Resizer
|
312
|
-
className={resizerClassName}
|
313
|
-
style={resizerStyle}
|
314
|
-
onClick={onResizerClick}
|
315
|
-
onDoubleClick={onResizerDoubleClick}
|
316
|
-
onMouseDown={onMouseDown}
|
317
|
-
onTouchEnd={onTouchEnd}
|
318
|
-
onTouchStart={onTouchStart}
|
319
|
-
split={split}
|
320
|
-
allowResize={allowResize && !hidePane}
|
321
|
-
active={active}
|
322
|
-
/>
|
323
|
-
<Pane
|
324
|
-
innerRef={pane2Ref}
|
325
|
-
className={classes(paneClassName, pane2ClassName)}
|
326
|
-
split={split}
|
327
|
-
style={{...paneStyle, ...pane2Style}}
|
328
|
-
size={primary === 'second' ? paneSize : undefined}
|
329
|
-
hide={hidePane}
|
330
|
-
>
|
331
|
-
{notNullChildren[1]}
|
332
|
-
</Pane>
|
333
|
-
</div>
|
334
|
-
);
|
335
|
-
}
|
336
|
-
|
337
|
-
function classes(...classList) {
|
338
|
-
return classList.filter(Boolean).join(' ');
|
339
|
-
}
|
340
|
-
|
341
|
-
function unFocus(window) {
|
342
|
-
// eslint-disable-next-line no-unused-expressions
|
343
|
-
window.getSelection()?.removeAllRanges();
|
344
|
-
}
|
345
|
-
|
346
|
-
function getDefaultSize(split, bound, defaultSize, minSize = 50, maxSize, draggedSize) {
|
347
|
-
const min = minSize;
|
348
|
-
const max = getEffectiveMaxSize(split, bound, maxSize);
|
349
|
-
if (typeof draggedSize === 'number') {
|
350
|
-
return Math.max(min, Math.min(max, draggedSize));
|
351
|
-
}
|
352
|
-
if (defaultSize !== undefined) {
|
353
|
-
if (typeof defaultSize === 'number') {
|
354
|
-
return Math.max(min, Math.min(max, defaultSize));
|
355
|
-
}
|
356
|
-
return defaultSize;
|
357
|
-
}
|
358
|
-
return min;
|
359
|
-
}
|
360
|
-
|
361
|
-
function getEffectiveMaxSize(split, bound, maxSize) {
|
362
|
-
const boundSize = split === 'vertical' ? bound.width : bound.height;
|
363
|
-
let effectiveMaxSize = boundSize;
|
364
|
-
if (typeof maxSize === 'number') {
|
365
|
-
effectiveMaxSize = maxSize >= 0 ? maxSize : boundSize + maxSize;
|
366
|
-
}
|
367
|
-
return Math.min(effectiveMaxSize, boundSize);
|
368
|
-
}
|
@@ -1,148 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import cn from 'bem-cn-lite';
|
3
|
-
import PropTypes from 'prop-types';
|
4
|
-
|
5
|
-
import {Collapse} from '../Collapse/Collapse';
|
6
|
-
import EntityStatus from '../EntityStatus/EntityStatus';
|
7
|
-
import InfoViewer from '../InfoViewer/InfoViewer';
|
8
|
-
import PoolUsage from '../PoolUsage/PoolUsage';
|
9
|
-
import Tablet from '../Tablet/Tablet';
|
10
|
-
import InternalLink from '../InternalLink/InternalLink';
|
11
|
-
|
12
|
-
import {TABLET_STATES} from '../../utils/constants';
|
13
|
-
import {formatCPU} from '../../utils';
|
14
|
-
import {bytesToGB} from '../../utils/utils';
|
15
|
-
import routes, {createHref} from '../../routes';
|
16
|
-
import {HEALTHCHECK} from '../../containers/Tenant/TenantPages';
|
17
|
-
|
18
|
-
import './TenantOverview.scss';
|
19
|
-
|
20
|
-
const b = cn('tenant-overview');
|
21
|
-
|
22
|
-
const renderName = (tenant) => {
|
23
|
-
if (tenant) {
|
24
|
-
const {Name} = tenant;
|
25
|
-
return (
|
26
|
-
<React.Fragment>
|
27
|
-
<InternalLink to={createHref(routes.tenant, {page: HEALTHCHECK}, {name: Name})}>
|
28
|
-
<EntityStatus status={tenant.State} />
|
29
|
-
</InternalLink>
|
30
|
-
<span>{Name}</span>
|
31
|
-
</React.Fragment>
|
32
|
-
);
|
33
|
-
}
|
34
|
-
|
35
|
-
return <div>no tenant data</div>;
|
36
|
-
};
|
37
|
-
|
38
|
-
class TenantOverview extends React.Component {
|
39
|
-
static propTypes = {
|
40
|
-
tenant: PropTypes.object,
|
41
|
-
hideTooltip: PropTypes.func,
|
42
|
-
showTooltip: PropTypes.func,
|
43
|
-
systemTablets: PropTypes.array,
|
44
|
-
additionalTenantInfo: PropTypes.func,
|
45
|
-
};
|
46
|
-
|
47
|
-
onChangeCollapseState = () => {
|
48
|
-
window.dispatchEvent(new Event('resize'));
|
49
|
-
};
|
50
|
-
|
51
|
-
render() {
|
52
|
-
const {tenant, systemTablets, hideTooltip, showTooltip} = this.props;
|
53
|
-
const {
|
54
|
-
Metrics = {},
|
55
|
-
PoolStats,
|
56
|
-
StateStats = [],
|
57
|
-
MemoryUsed,
|
58
|
-
CoresUsed,
|
59
|
-
StorageGroups,
|
60
|
-
StorageAllocatedSize,
|
61
|
-
Type,
|
62
|
-
} = tenant;
|
63
|
-
|
64
|
-
const memoryRaw = MemoryUsed ?? Metrics.Memory;
|
65
|
-
|
66
|
-
const memory = (memoryRaw && bytesToGB(memoryRaw)) || 'no data';
|
67
|
-
const storage = (Metrics.Storage && bytesToGB(Metrics.Storage)) || 'no data';
|
68
|
-
const storageGroups = StorageGroups ?? 'no data';
|
69
|
-
const blobStorage = (StorageAllocatedSize && bytesToGB(StorageAllocatedSize)) || 'no data';
|
70
|
-
const storageEfficiency =
|
71
|
-
Metrics.Storage && StorageAllocatedSize
|
72
|
-
? `${((Metrics.Storage * 100) / StorageAllocatedSize).toFixed(2)}%`
|
73
|
-
: 'no data';
|
74
|
-
|
75
|
-
const cpuRaw = CoresUsed !== undefined ? Number(CoresUsed) * 1_000_000 : Metrics.CPU;
|
76
|
-
|
77
|
-
const cpu = formatCPU(cpuRaw);
|
78
|
-
|
79
|
-
const metricsInfo = [
|
80
|
-
{label: 'Type', value: Type},
|
81
|
-
{label: 'Memory', value: memory},
|
82
|
-
{label: 'CPU', value: cpu},
|
83
|
-
{label: 'Tablet storage', value: storage},
|
84
|
-
{label: 'Storage groups', value: storageGroups},
|
85
|
-
{label: 'Blob storage', value: blobStorage},
|
86
|
-
{label: 'Storage efficiency', value: storageEfficiency},
|
87
|
-
];
|
88
|
-
|
89
|
-
const tabletsInfo = StateStats.map((info) => ({
|
90
|
-
label: TABLET_STATES[info.VolatileState],
|
91
|
-
value: info.Count,
|
92
|
-
}));
|
93
|
-
|
94
|
-
const collapseTitle = <span className={b('collapse-title')}>Database info</span>;
|
95
|
-
|
96
|
-
return (
|
97
|
-
<div className={b()}>
|
98
|
-
<div className={b('top')}>
|
99
|
-
<span className={b('top-label')}>database</span>
|
100
|
-
{renderName(tenant)}
|
101
|
-
{this.props.additionalTenantInfo &&
|
102
|
-
this.props.additionalTenantInfo(
|
103
|
-
this.props.tenant.Name,
|
104
|
-
this.props.tenant.Type,
|
105
|
-
)}
|
106
|
-
<div className={b('system-tablets')}>
|
107
|
-
{systemTablets &&
|
108
|
-
systemTablets.map((tablet, tabletIndex) => (
|
109
|
-
<Tablet
|
110
|
-
onMouseEnter={showTooltip}
|
111
|
-
onMouseLeave={hideTooltip}
|
112
|
-
key={tabletIndex}
|
113
|
-
tablet={tablet}
|
114
|
-
/>
|
115
|
-
))}
|
116
|
-
</div>
|
117
|
-
</div>
|
118
|
-
<Collapse title={collapseTitle} onChange={this.onChangeCollapseState} titleSize="m">
|
119
|
-
<div className={b('common-info')}>
|
120
|
-
{PoolStats ? (
|
121
|
-
<div>
|
122
|
-
<div className={b('section-title')}>Pools</div>
|
123
|
-
<div className={b('section', {pools: true})}>
|
124
|
-
{PoolStats.map((pool, poolIndex) => (
|
125
|
-
<PoolUsage key={poolIndex} data={pool} />
|
126
|
-
))}
|
127
|
-
</div>
|
128
|
-
</div>
|
129
|
-
) : (
|
130
|
-
<div className="error">no pools data</div>
|
131
|
-
)}
|
132
|
-
<InfoViewer
|
133
|
-
title="Metrics"
|
134
|
-
className={b('section', {metrics: true})}
|
135
|
-
info={metricsInfo}
|
136
|
-
/>
|
137
|
-
|
138
|
-
<div className={b('section')}>
|
139
|
-
<InfoViewer info={tabletsInfo} title="Tablets" />
|
140
|
-
</div>
|
141
|
-
</div>
|
142
|
-
</Collapse>
|
143
|
-
</div>
|
144
|
-
);
|
145
|
-
}
|
146
|
-
}
|
147
|
-
|
148
|
-
export default TenantOverview;
|
@@ -1,168 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import PropTypes from 'prop-types';
|
3
|
-
import {connect} from 'react-redux';
|
4
|
-
import cn from 'bem-cn-lite';
|
5
|
-
|
6
|
-
import {getClusterInfo} from '../../store/reducers/cluster';
|
7
|
-
import {clusterName} from '../../store';
|
8
|
-
import {hideTooltip, showTooltip} from '../../store/reducers/tooltip';
|
9
|
-
|
10
|
-
import {Loader} from '@yandex-cloud/uikit';
|
11
|
-
import ClusterInfo from '../../components/ClusterInfo/ClusterInfo';
|
12
|
-
import Tenants from '../Tenants/Tenants';
|
13
|
-
import Nodes from '../Nodes/Nodes';
|
14
|
-
import Storage from '../StorageV2/Storage';
|
15
|
-
|
16
|
-
import './Cluster.scss';
|
17
|
-
|
18
|
-
const b = cn('cluster');
|
19
|
-
|
20
|
-
export const CLUSTER_PAGES = {
|
21
|
-
tenants: {id: 'tenants', name: 'Databases'},
|
22
|
-
nodes: {id: 'nodes', name: 'Nodes'},
|
23
|
-
storage: {id: 'storage', name: 'Storage'},
|
24
|
-
};
|
25
|
-
|
26
|
-
export class AutoFetcher {
|
27
|
-
constructor() {
|
28
|
-
this.timeout = AutoFetcher.DEFAULT_TIMEOUT;
|
29
|
-
this.active = true;
|
30
|
-
this.timer = undefined;
|
31
|
-
}
|
32
|
-
static DEFAULT_TIMEOUT = 30000;
|
33
|
-
static MIN_TIMEOUT = 30000;
|
34
|
-
wait(ms) {
|
35
|
-
return new Promise((resolve) => {
|
36
|
-
this.timer = setTimeout(resolve, ms);
|
37
|
-
return;
|
38
|
-
});
|
39
|
-
}
|
40
|
-
async fetch(request) {
|
41
|
-
if (!this.active) {
|
42
|
-
return;
|
43
|
-
}
|
44
|
-
|
45
|
-
await this.wait(this.timeout);
|
46
|
-
|
47
|
-
if (this.active) {
|
48
|
-
const startTs = Date.now();
|
49
|
-
await request();
|
50
|
-
const finishTs = Date.now();
|
51
|
-
|
52
|
-
const responseTime = finishTs - startTs;
|
53
|
-
const nextTimeout =
|
54
|
-
responseTime > AutoFetcher.MIN_TIMEOUT ? responseTime : AutoFetcher.MIN_TIMEOUT;
|
55
|
-
this.timeout = nextTimeout;
|
56
|
-
|
57
|
-
this.fetch(request);
|
58
|
-
} else {
|
59
|
-
return;
|
60
|
-
}
|
61
|
-
}
|
62
|
-
stop() {
|
63
|
-
clearTimeout(this.timer);
|
64
|
-
this.active = false;
|
65
|
-
}
|
66
|
-
start() {
|
67
|
-
this.active = true;
|
68
|
-
}
|
69
|
-
}
|
70
|
-
|
71
|
-
class Cluster extends React.Component {
|
72
|
-
static propTypes = {
|
73
|
-
activeTab: PropTypes.string,
|
74
|
-
getClusterInfo: PropTypes.func,
|
75
|
-
cluster: PropTypes.object,
|
76
|
-
error: PropTypes.object,
|
77
|
-
loading: PropTypes.bool,
|
78
|
-
wasLoaded: PropTypes.bool,
|
79
|
-
showTooltip: PropTypes.func,
|
80
|
-
hideTooltip: PropTypes.func,
|
81
|
-
additionalClusterInfo: PropTypes.array,
|
82
|
-
additionalTenantsInfo: PropTypes.object,
|
83
|
-
additionalNodesInfo: PropTypes.object,
|
84
|
-
};
|
85
|
-
componentDidMount() {
|
86
|
-
this.props.getClusterInfo(clusterName);
|
87
|
-
this.autofetcher = new AutoFetcher();
|
88
|
-
this.autofetcher.fetch(() => this.props.getClusterInfo(clusterName));
|
89
|
-
}
|
90
|
-
componentDidCatch(error, info) {
|
91
|
-
console.log(error);
|
92
|
-
console.log(info);
|
93
|
-
}
|
94
|
-
componentWillUnmount() {
|
95
|
-
this.autofetcher.stop();
|
96
|
-
}
|
97
|
-
renderLoader() {
|
98
|
-
return (
|
99
|
-
<div className="loader">
|
100
|
-
<Loader size="l" />
|
101
|
-
</div>
|
102
|
-
);
|
103
|
-
}
|
104
|
-
renderTabContent() {
|
105
|
-
const {activeTab} = this.props;
|
106
|
-
switch (activeTab) {
|
107
|
-
case CLUSTER_PAGES.tenants.id: {
|
108
|
-
return <Tenants {...this.props} />;
|
109
|
-
}
|
110
|
-
case CLUSTER_PAGES.nodes.id: {
|
111
|
-
return <Nodes {...this.props} />;
|
112
|
-
}
|
113
|
-
case CLUSTER_PAGES.storage.id: {
|
114
|
-
return <Storage {...this.props} />;
|
115
|
-
}
|
116
|
-
default: {
|
117
|
-
return null;
|
118
|
-
}
|
119
|
-
}
|
120
|
-
}
|
121
|
-
renderContent = () => {
|
122
|
-
const {cluster} = this.props;
|
123
|
-
|
124
|
-
return (
|
125
|
-
<div className={b()}>
|
126
|
-
<ClusterInfo
|
127
|
-
cluster={cluster}
|
128
|
-
showTooltip={this.props.showTooltip}
|
129
|
-
hideTooltip={this.props.hideTooltip}
|
130
|
-
additionalInfo={this.props.additionalClusterInfo}
|
131
|
-
/>
|
132
|
-
{this.renderTabContent()}
|
133
|
-
</div>
|
134
|
-
);
|
135
|
-
};
|
136
|
-
|
137
|
-
render() {
|
138
|
-
const {error, loading, wasLoaded} = this.props;
|
139
|
-
|
140
|
-
if (loading && !wasLoaded) {
|
141
|
-
return this.renderLoader();
|
142
|
-
} else if (error) {
|
143
|
-
return <div>{error.statusText}</div>;
|
144
|
-
}
|
145
|
-
return this.renderContent();
|
146
|
-
}
|
147
|
-
}
|
148
|
-
|
149
|
-
const mapStateToProps = (state, ownProps) => {
|
150
|
-
const {data: cluster, loading, error, wasLoaded} = state.cluster;
|
151
|
-
const {activeTab = CLUSTER_PAGES.tenants.id} = ownProps.match.params;
|
152
|
-
|
153
|
-
return {
|
154
|
-
activeTab,
|
155
|
-
cluster,
|
156
|
-
loading,
|
157
|
-
wasLoaded,
|
158
|
-
error,
|
159
|
-
};
|
160
|
-
};
|
161
|
-
|
162
|
-
const mapDispatchToProps = {
|
163
|
-
getClusterInfo,
|
164
|
-
hideTooltip,
|
165
|
-
showTooltip,
|
166
|
-
};
|
167
|
-
|
168
|
-
export default connect(mapStateToProps, mapDispatchToProps)(Cluster);
|