ydb-embedded-ui 5.0.0 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/BasicNodeViewer/BasicNodeViewer.d.ts +2 -2
- package/dist/components/BasicNodeViewer/BasicNodeViewer.js +1 -1
- package/dist/components/EntityStatus/EntityStatus.scss +1 -1
- package/dist/components/FullNodeViewer/FullNodeViewer.d.ts +2 -2
- package/dist/components/FullNodeViewer/FullNodeViewer.js +1 -1
- package/dist/components/LagImages/LagImages.js +2 -2
- package/dist/components/ProgressViewer/ProgressViewer.js +6 -5
- package/dist/components/ProgressViewer/ProgressViewer.scss +33 -17
- package/dist/components/TabletsOverall/TabletsOverall.js +6 -6
- package/dist/containers/App/App.js +2 -1
- package/dist/containers/App/Content.js +6 -12
- package/dist/containers/App/Providers.js +2 -1
- package/dist/containers/App/appSlots.d.ts +7 -7
- package/dist/containers/AppIcons/AppIcons.js +1 -1
- package/dist/containers/Cluster/Cluster.js +45 -27
- package/dist/containers/Cluster/Cluster.scss +15 -0
- package/dist/containers/Cluster/ClusterInfo/ClusterInfo.js +4 -18
- package/dist/containers/Cluster/ClusterInfo/ClusterInfo.scss +0 -40
- package/dist/containers/Cluster/utils.d.ts +6 -1
- package/dist/containers/Cluster/utils.js +11 -3
- package/dist/containers/Clusters/Clusters.js +4 -3
- package/dist/containers/Clusters/columns.js +1 -1
- package/dist/containers/Clusters/constants.d.ts +1 -1
- package/dist/containers/Clusters/i18n/en.json +2 -1
- package/dist/containers/Clusters/i18n/index.d.ts +1 -1
- package/dist/containers/Clusters/i18n/index.js +2 -4
- package/dist/containers/Clusters/i18n/ru.json +2 -1
- package/dist/containers/Node/Node.js +11 -13
- package/dist/containers/Node/NodePages.js +4 -1
- package/dist/containers/Node/i18n/index.d.ts +1 -1
- package/dist/containers/Node/i18n/index.js +2 -4
- package/dist/containers/Nodes/getNodesColumns.js +2 -1
- package/dist/containers/Storage/StorageGroups/getStorageGroupsColumns.d.ts +1 -1
- package/dist/containers/Storage/StorageNodes/getStorageNodesColumns.d.ts +1 -1
- package/dist/containers/Storage/StorageNodes/getStorageNodesColumns.js +2 -1
- package/dist/containers/Tablet/Tablet.js +24 -20
- package/dist/containers/Tablet/i18n/index.d.ts +1 -1
- package/dist/containers/Tablet/i18n/index.js +2 -4
- package/dist/containers/TabletsFilters/TabletsFilters.d.ts +2 -0
- package/dist/containers/TabletsFilters/TabletsFilters.js +25 -19
- package/dist/containers/TabletsFilters/i18n/en.json +3 -0
- package/dist/containers/TabletsFilters/i18n/index.d.ts +2 -0
- package/dist/containers/TabletsFilters/i18n/index.js +5 -0
- package/dist/containers/TabletsFilters/i18n/ru.json +3 -0
- package/dist/containers/Tenant/Diagnostics/Diagnostics.js +12 -11
- package/dist/containers/Tenant/Diagnostics/DiagnosticsPages.d.ts +19 -0
- package/dist/containers/Tenant/Diagnostics/DiagnosticsPages.js +2 -1
- package/dist/containers/Tenant/Diagnostics/HotKeys/HotKeys.d.ts +7 -25
- package/dist/containers/Tenant/Diagnostics/HotKeys/HotKeys.js +88 -92
- package/dist/containers/Tenant/Diagnostics/HotKeys/HotKeys.scss +1 -33
- package/dist/containers/Tenant/Diagnostics/HotKeys/i18n/en.json +4 -0
- package/dist/containers/Tenant/Diagnostics/HotKeys/i18n/index.d.ts +2 -0
- package/dist/containers/Tenant/Diagnostics/HotKeys/i18n/index.js +5 -0
- package/dist/containers/Tenant/Diagnostics/TenantOverview/MetricsCards/MetricCard/MetricCard.js +4 -1
- package/dist/containers/Tenant/Diagnostics/TenantOverview/MetricsCards/MetricsCards.js +3 -4
- package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.js +12 -5
- package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantStorage/TenantStorage.d.ts +2 -2
- package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantStorage/TenantStorage.js +7 -10
- package/dist/containers/Tenant/Diagnostics/TenantOverview/i18n/en.json +7 -5
- package/dist/containers/Tenant/Diagnostics/TenantOverview/i18n/index.js +0 -2
- package/dist/containers/Tenant/Diagnostics/TopQueries/getTopQueriesColumns.js +10 -0
- package/dist/containers/Tenant/ObjectGeneral/ObjectGeneral.d.ts +1 -1
- package/dist/containers/Tenant/Query/Query.d.ts +2 -2
- package/dist/containers/Tenant/Query/Query.js +5 -2
- package/dist/containers/Tenant/Query/QueryEditor/QueryEditor.d.ts +29 -31
- package/dist/containers/Tenant/Query/QueryEditor/QueryEditor.js +150 -167
- package/dist/containers/Tenant/Query/QueryEditorControls/QueryEditorControls.d.ts +2 -2
- package/dist/containers/Tenant/Query/QueryEditorControls/QueryEditorControls.js +3 -3
- package/dist/containers/Tenant/Query/QueryTabs/QueryTabs.d.ts +10 -0
- package/dist/containers/Tenant/Query/QueryTabs/QueryTabs.js +1 -1
- package/dist/containers/Tenant/Query/utils/getPreparedResult.d.ts +1 -1
- package/dist/containers/Tenant/Query/utils/getPreparedResult.js +18 -16
- package/dist/containers/Tenant/Tenant.js +4 -1
- package/dist/containers/Tenant/i18n/en.json +1 -0
- package/dist/containers/Tenant/i18n/index.d.ts +1 -1
- package/dist/containers/Tenant/i18n/index.js +2 -4
- package/dist/containers/Tenant/i18n/ru.json +1 -0
- package/dist/containers/Versions/NodesTreeTitle/NodesTreeTitle.scss +1 -1
- package/dist/routes.d.ts +5 -0
- package/dist/routes.js +4 -0
- package/dist/services/api.d.ts +2 -1
- package/dist/services/api.js +2 -2
- package/dist/services/settings.d.ts +0 -1
- package/dist/services/settings.js +1 -14
- package/dist/store/index.d.ts +1 -1
- package/dist/store/reducers/cluster/cluster.d.ts +8 -2
- package/dist/store/reducers/cluster/cluster.js +29 -1
- package/dist/store/reducers/cluster/types.d.ts +4 -2
- package/dist/store/reducers/executeQuery.d.ts +1 -10
- package/dist/store/reducers/executeQuery.js +26 -29
- package/dist/store/reducers/executeTopQueries/executeTopQueries.js +2 -1
- package/dist/store/reducers/executeTopQueries/utils.js +7 -4
- package/dist/store/reducers/hotKeys/hotKeys.d.ts +25 -0
- package/dist/store/reducers/hotKeys/hotKeys.js +49 -0
- package/dist/store/reducers/hotKeys/types.d.ts +10 -0
- package/dist/store/reducers/hotKeys/types.js +1 -0
- package/dist/store/reducers/index.d.ts +2 -6
- package/dist/store/reducers/index.js +1 -1
- package/dist/store/reducers/node/node.d.ts +1 -1
- package/dist/store/reducers/node/node.js +2 -0
- package/dist/store/reducers/node/selectors.js +1 -1
- package/dist/store/reducers/node/types.d.ts +7 -3
- package/dist/store/reducers/node/utils.d.ts +3 -0
- package/dist/store/reducers/node/utils.js +8 -0
- package/dist/store/reducers/nodes/types.d.ts +1 -1
- package/dist/store/reducers/nodes/utils.js +3 -3
- package/dist/store/reducers/storage/types.d.ts +2 -0
- package/dist/store/reducers/storage/utils.js +3 -3
- package/dist/store/reducers/tenants/utils.d.ts +4 -3
- package/dist/store/reducers/tenants/utils.js +17 -12
- package/dist/store/reducers/tooltip.d.ts +1 -1
- package/dist/types/api/hotkeys.d.ts +7 -0
- package/dist/types/api/hotkeys.js +1 -0
- package/dist/types/api/nodes.d.ts +2 -1
- package/dist/types/store/executeQuery.d.ts +3 -6
- package/dist/types/store/explainQuery.d.ts +1 -0
- package/dist/utils/constants.d.ts +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/diagnostics.d.ts +1 -0
- package/dist/utils/diagnostics.js +1 -0
- package/dist/utils/i18n/i18n.d.ts +2 -1
- package/dist/utils/i18n/i18n.js +15 -2
- package/dist/utils/monitoring.js +1 -3
- package/dist/utils/versions/getVersionsColors.js +1 -1
- package/package.json +9 -8
- package/dist/containers/Tenant/Diagnostics/TenantOverview/i18n/ru.json +0 -26
- package/dist/store/reducers/hotKeys.d.ts +0 -11
- package/dist/store/reducers/hotKeys.js +0 -34
@@ -1,7 +1,5 @@
|
|
1
|
-
import {
|
1
|
+
import { registerKeysets } from '../../../utils/i18n';
|
2
2
|
import en from './en.json';
|
3
3
|
import ru from './ru.json';
|
4
4
|
const COMPONENT = 'ydb-tablet-page';
|
5
|
-
|
6
|
-
i18n.registerKeyset(Lang.Ru, COMPONENT, ru);
|
7
|
-
export default i18n.keyset(COMPONENT);
|
5
|
+
export default registerKeysets(COMPONENT, { en, ru });
|
@@ -26,6 +26,7 @@ export class TabletsFilters extends React.Component<any, any, any> {
|
|
26
26
|
state: {
|
27
27
|
nodeFilter: never[];
|
28
28
|
tenantPath: string;
|
29
|
+
clusterName: string;
|
29
30
|
};
|
30
31
|
reloadDescriptor: number;
|
31
32
|
componentDidMount(): void;
|
@@ -38,6 +39,7 @@ export class TabletsFilters extends React.Component<any, any, any> {
|
|
38
39
|
handleTypeFilterChange: (typeFilter: any) => void;
|
39
40
|
renderTablet: (index: any, key: any) => JSX.Element;
|
40
41
|
renderContent: () => JSX.Element;
|
42
|
+
renderView: () => JSX.Element;
|
41
43
|
render(): JSX.Element;
|
42
44
|
}
|
43
45
|
declare var _default: import("react-redux").ConnectedComponent<typeof TabletsFilters, import("react-redux").Omit<PropTypes.InferProps<{
|
@@ -3,8 +3,8 @@ import React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
4
4
|
import { connect } from 'react-redux';
|
5
5
|
import cn from 'bem-cn-lite';
|
6
|
-
import qs from 'qs';
|
7
6
|
import _ from 'lodash';
|
7
|
+
import { Helmet } from 'react-helmet-async';
|
8
8
|
import { Loader, Select } from '@gravity-ui/uikit';
|
9
9
|
import ReactList from 'react-list';
|
10
10
|
import { Tablet } from '../../components/Tablet';
|
@@ -12,6 +12,9 @@ import { AccessDenied } from '../../components/Errors/403';
|
|
12
12
|
import { setHeaderBreadcrumbs } from '../../store/reducers/header/header';
|
13
13
|
import { tabletColorToTabletState, tabletStates } from '../../utils/tablet';
|
14
14
|
import { getTabletsInfo, clearWasLoadingFlag, setStateFilter, setTypeFilter, getFilteredTablets, getTablets, } from '../../store/reducers/tabletsFilters';
|
15
|
+
import { parseQuery } from '../../routes';
|
16
|
+
import { CLUSTER_DEFAULT_TITLE } from '../../utils/constants';
|
17
|
+
import i18n from './i18n';
|
15
18
|
import './TabletsFilters.scss';
|
16
19
|
const b = cn('tablets-filters');
|
17
20
|
export class TabletsFilters extends React.Component {
|
@@ -20,6 +23,7 @@ export class TabletsFilters extends React.Component {
|
|
20
23
|
this.state = {
|
21
24
|
nodeFilter: [],
|
22
25
|
tenantPath: '',
|
26
|
+
clusterName: '',
|
23
27
|
};
|
24
28
|
this.reloadDescriptor = -1;
|
25
29
|
this.makeRequest = () => {
|
@@ -67,16 +71,29 @@ export class TabletsFilters extends React.Component {
|
|
67
71
|
}));
|
68
72
|
return (_jsxs("div", Object.assign({ className: b() }, { children: [tenantPath ? (_jsx("div", Object.assign({ className: b('tenant') }, { children: _jsxs(_Fragment, { children: [_jsx("span", Object.assign({ className: b('label') }, { children: "Database: " })), " ", tenantPath] }) }))) : null, _jsx(MemoizedFilters, { nodesForSelect: nodesForSelect, nodeFilter: nodeFilter, onChangeNodes: this.handleNodeFilterChange, states: states, stateFilter: stateFilter, onChangeStates: this.handleStateFilterChange, types: types, typeFilter: typeFilter, onChangeTypes: this.handleTypeFilterChange }), error && _jsx("div", Object.assign({ className: "error" }, { children: error })), filteredTablets.length > 0 ? (_jsx("div", Object.assign({ className: b('items') }, { children: _jsx(ReactList, { itemRenderer: this.renderTablet, length: filteredTablets.length, type: "uniform" }) }))) : (!error && _jsx("div", Object.assign({ className: b('empty-message') }, { children: "no tablets" })))] })));
|
69
73
|
};
|
74
|
+
this.renderView = () => {
|
75
|
+
const { loading, wasLoaded, error } = this.props;
|
76
|
+
if (loading && !wasLoaded) {
|
77
|
+
return TabletsFilters.renderLoader();
|
78
|
+
}
|
79
|
+
else if (error && typeof error === 'object') {
|
80
|
+
if (error.status === 403) {
|
81
|
+
return _jsx(AccessDenied, {});
|
82
|
+
}
|
83
|
+
return _jsx("div", { children: error.statusText });
|
84
|
+
}
|
85
|
+
else {
|
86
|
+
return this.renderContent();
|
87
|
+
}
|
88
|
+
};
|
70
89
|
}
|
71
90
|
static renderLoader() {
|
72
91
|
return (_jsx("div", Object.assign({ className: 'loader' }, { children: _jsx(Loader, { size: "l" }) })));
|
73
92
|
}
|
74
93
|
componentDidMount() {
|
75
94
|
const { setStateFilter, setTypeFilter, setHeaderBreadcrumbs } = this.props;
|
76
|
-
const queryParams =
|
77
|
-
|
78
|
-
});
|
79
|
-
const { nodeIds, type, path, state } = queryParams;
|
95
|
+
const queryParams = parseQuery(this.props.location);
|
96
|
+
const { nodeIds, type, path, state, clusterName } = queryParams;
|
80
97
|
const nodes = TabletsFilters.parseNodes(nodeIds);
|
81
98
|
if (state) {
|
82
99
|
const stateFilter = TabletsFilters.getStateFiltersFromColor(state);
|
@@ -85,7 +102,7 @@ export class TabletsFilters extends React.Component {
|
|
85
102
|
if (type) {
|
86
103
|
setTypeFilter([type]);
|
87
104
|
}
|
88
|
-
this.setState({ nodeFilter: nodes, tenantPath: path }, () => {
|
105
|
+
this.setState({ nodeFilter: nodes, tenantPath: path, clusterName }, () => {
|
89
106
|
this.makeRequest();
|
90
107
|
});
|
91
108
|
setHeaderBreadcrumbs('tablets', {
|
@@ -106,19 +123,8 @@ export class TabletsFilters extends React.Component {
|
|
106
123
|
clearInterval(this.reloadDescriptor);
|
107
124
|
}
|
108
125
|
render() {
|
109
|
-
const {
|
110
|
-
|
111
|
-
return TabletsFilters.renderLoader();
|
112
|
-
}
|
113
|
-
else if (error && typeof error === 'object') {
|
114
|
-
if (error.status === 403) {
|
115
|
-
return _jsx(AccessDenied, {});
|
116
|
-
}
|
117
|
-
return _jsx("div", { children: error.statusText });
|
118
|
-
}
|
119
|
-
else {
|
120
|
-
return this.renderContent();
|
121
|
-
}
|
126
|
+
const { tenantPath, clusterName } = this.state;
|
127
|
+
return (_jsxs(_Fragment, { children: [_jsx(Helmet, { children: _jsx("title", { children: `${i18n('page.title')} — ${tenantPath || clusterName || CLUSTER_DEFAULT_TITLE}` }) }), this.renderView()] }));
|
122
128
|
}
|
123
129
|
}
|
124
130
|
TabletsFilters.propTypes = {
|
@@ -5,6 +5,7 @@ import cn from 'bem-cn-lite';
|
|
5
5
|
import { Link } from 'react-router-dom';
|
6
6
|
import { useDispatch, useSelector } from 'react-redux';
|
7
7
|
import { useLocation } from 'react-router';
|
8
|
+
import { Helmet } from 'react-helmet-async';
|
8
9
|
import { Switch, Tabs } from '@gravity-ui/uikit';
|
9
10
|
import { useTypedSelector } from '../../../utils/hooks';
|
10
11
|
import routes, { createHref } from '../../../routes';
|
@@ -17,7 +18,7 @@ import { NodesWrapper } from '../../Nodes/NodesWrapper';
|
|
17
18
|
import { StorageWrapper } from '../../Storage/StorageWrapper';
|
18
19
|
import { Tablets } from '../../Tablets';
|
19
20
|
import Describe from './Describe/Describe';
|
20
|
-
import HotKeys from './HotKeys/HotKeys';
|
21
|
+
import { HotKeys } from './HotKeys/HotKeys';
|
21
22
|
import Network from './Network/Network';
|
22
23
|
import { Partitions } from './Partitions/Partitions';
|
23
24
|
import { Consumers } from './Consumers';
|
@@ -52,14 +53,14 @@ function Diagnostics(props) {
|
|
52
53
|
};
|
53
54
|
const activeTab = useMemo(() => {
|
54
55
|
if (wasLoaded) {
|
55
|
-
|
56
|
-
|
56
|
+
let page = pages.find((el) => el.id === diagnosticsTab);
|
57
|
+
if (!page) {
|
58
|
+
page = pages[0];
|
57
59
|
}
|
58
|
-
|
59
|
-
|
60
|
-
forwardToDiagnosticTab(newPage);
|
61
|
-
return newPage;
|
60
|
+
if (page && page.id !== diagnosticsTab) {
|
61
|
+
forwardToDiagnosticTab(page.id);
|
62
62
|
}
|
63
|
+
return page;
|
63
64
|
}
|
64
65
|
return undefined;
|
65
66
|
}, [pages, diagnosticsTab, wasLoaded]);
|
@@ -74,7 +75,7 @@ function Diagnostics(props) {
|
|
74
75
|
const renderTabContent = () => {
|
75
76
|
const { type } = props;
|
76
77
|
const tenantNameString = tenantName;
|
77
|
-
switch (
|
78
|
+
switch (activeTab === null || activeTab === void 0 ? void 0 : activeTab.id) {
|
78
79
|
case TENANT_DIAGNOSTICS_TABS_IDS.overview: {
|
79
80
|
return (_jsx(DetailedOverview, { type: type, tenantName: tenantNameString, additionalTenantProps: props.additionalTenantProps, additionalNodesProps: props.additionalNodesProps }));
|
80
81
|
}
|
@@ -100,7 +101,7 @@ function Diagnostics(props) {
|
|
100
101
|
return _jsx(Describe, { tenant: tenantNameString, type: type });
|
101
102
|
}
|
102
103
|
case TENANT_DIAGNOSTICS_TABS_IDS.hotKeys: {
|
103
|
-
return _jsx(HotKeys, {
|
104
|
+
return _jsx(HotKeys, { path: currentSchemaPath });
|
104
105
|
}
|
105
106
|
case TENANT_DIAGNOSTICS_TABS_IDS.graph: {
|
106
107
|
return _jsx(Heatmap, { path: currentSchemaPath });
|
@@ -117,7 +118,7 @@ function Diagnostics(props) {
|
|
117
118
|
}
|
118
119
|
};
|
119
120
|
const renderTabs = () => {
|
120
|
-
return (_jsx("div", Object.assign({ className: b('header-wrapper') }, { children: _jsxs("div", Object.assign({ className: b('tabs') }, { children: [_jsx(Tabs, { size: "l", items: pages, activeTab: activeTab, wrapTo: ({ id }, node) => {
|
121
|
+
return (_jsx("div", Object.assign({ className: b('header-wrapper') }, { children: _jsxs("div", Object.assign({ className: b('tabs') }, { children: [_jsx(Tabs, { size: "l", items: pages, activeTab: activeTab === null || activeTab === void 0 ? void 0 : activeTab.id, wrapTo: ({ id }, node) => {
|
121
122
|
const path = createHref(routes.tenant, undefined, Object.assign(Object.assign({}, queryParams), { [TenantTabsGroups.diagnosticsTab]: id }));
|
122
123
|
return (_jsx(Link, Object.assign({ to: path, className: b('tab') }, { children: node }), id));
|
123
124
|
}, allowNotSelected: true }), _jsx(Switch, { checked: autorefresh, onUpdate: onAutorefreshToggle, content: "Autorefresh" })] })) })));
|
@@ -128,6 +129,6 @@ function Diagnostics(props) {
|
|
128
129
|
if (!wasLoaded) {
|
129
130
|
return _jsx(Loader, { size: "l" });
|
130
131
|
}
|
131
|
-
return (_jsxs("div", Object.assign({ className: b(), ref: container }, { children: [renderTabs(), _jsx("div", Object.assign({ className: b('page-wrapper') }, { children: renderTabContent() }))] })));
|
132
|
+
return (_jsxs("div", Object.assign({ className: b(), ref: container }, { children: [activeTab ? (_jsx(Helmet, { children: _jsx("title", { children: activeTab.title }) })) : null, renderTabs(), _jsx("div", Object.assign({ className: b('page-wrapper') }, { children: renderTabContent() }))] })));
|
132
133
|
}
|
133
134
|
export default Diagnostics;
|
@@ -51,6 +51,25 @@ export declare const TABLE_PAGES: ({
|
|
51
51
|
id: "graph";
|
52
52
|
title: string;
|
53
53
|
})[];
|
54
|
+
export declare const COLUMN_TABLE_PAGES: ({
|
55
|
+
id: "overview";
|
56
|
+
title: string;
|
57
|
+
} | {
|
58
|
+
id: "topShards";
|
59
|
+
title: string;
|
60
|
+
} | {
|
61
|
+
id: "nodes";
|
62
|
+
title: string;
|
63
|
+
} | {
|
64
|
+
id: "tablets";
|
65
|
+
title: string;
|
66
|
+
} | {
|
67
|
+
id: "describe";
|
68
|
+
title: string;
|
69
|
+
} | {
|
70
|
+
id: "graph";
|
71
|
+
title: string;
|
72
|
+
})[];
|
54
73
|
export declare const DIR_PAGES: ({
|
55
74
|
id: "overview";
|
56
75
|
title: string;
|
@@ -59,6 +59,7 @@ export const DATABASE_PAGES = [
|
|
59
59
|
describe,
|
60
60
|
];
|
61
61
|
export const TABLE_PAGES = [overview, topShards, nodes, graph, tablets, hotKeys, describe];
|
62
|
+
export const COLUMN_TABLE_PAGES = [overview, topShards, nodes, graph, tablets, describe];
|
62
63
|
export const DIR_PAGES = [overview, topShards, nodes, describe];
|
63
64
|
export const CDC_STREAM_PAGES = [overview, consumers, partitions, nodes, describe];
|
64
65
|
export const TOPIC_PAGES = [overview, consumers, partitions, nodes, describe];
|
@@ -72,7 +73,7 @@ const pathTypeToPages = {
|
|
72
73
|
[EPathType.EPathTypeExtSubDomain]: DATABASE_PAGES,
|
73
74
|
[EPathType.EPathTypeColumnStore]: DATABASE_PAGES,
|
74
75
|
[EPathType.EPathTypeTable]: TABLE_PAGES,
|
75
|
-
[EPathType.EPathTypeColumnTable]:
|
76
|
+
[EPathType.EPathTypeColumnTable]: COLUMN_TABLE_PAGES,
|
76
77
|
[EPathType.EPathTypeDir]: DIR_PAGES,
|
77
78
|
[EPathType.EPathTypeTableIndex]: DIR_PAGES,
|
78
79
|
[EPathType.EPathTypeCdcStream]: CDC_STREAM_PAGES,
|
@@ -1,25 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
autorefresh: any;
|
9
|
-
setHotKeysOptions: any;
|
10
|
-
currentSchema: any;
|
11
|
-
type: any;
|
12
|
-
}, "data" | "error" | "loading" | "wasLoaded" | "currentSchemaPath" | "autorefresh" | "currentSchema" | "getHotKeys" | "setHotKeysOptions">>;
|
13
|
-
export default _default;
|
14
|
-
declare function HotKeys({ getHotKeys, currentSchemaPath, loading, wasLoaded, error, data, autorefresh, setHotKeysOptions, currentSchema, type, }: {
|
15
|
-
getHotKeys: any;
|
16
|
-
currentSchemaPath: any;
|
17
|
-
loading: any;
|
18
|
-
wasLoaded: any;
|
19
|
-
error: any;
|
20
|
-
data: any;
|
21
|
-
autorefresh: any;
|
22
|
-
setHotKeysOptions: any;
|
23
|
-
currentSchema: any;
|
24
|
-
type: any;
|
25
|
-
}): JSX.Element;
|
1
|
+
/// <reference types="react" />
|
2
|
+
import './HotKeys.scss';
|
3
|
+
interface HotKeysProps {
|
4
|
+
path: string;
|
5
|
+
}
|
6
|
+
export declare function HotKeys({ path }: HotKeysProps): JSX.Element;
|
7
|
+
export {};
|
@@ -1,105 +1,101 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import { useEffect, useMemo } from 'react';
|
3
|
-
import
|
4
|
-
import { connect } from 'react-redux';
|
5
|
-
import { Loader } from '@gravity-ui/uikit';
|
2
|
+
import { useEffect, useMemo, useRef } from 'react';
|
3
|
+
import { useDispatch } from 'react-redux';
|
6
4
|
import DataTable from '@gravity-ui/react-data-table';
|
7
5
|
import { Icon } from '../../../../components/Icon';
|
8
6
|
import { ResponseError } from '../../../../components/Errors/ResponseError';
|
9
|
-
import {
|
10
|
-
import {
|
11
|
-
import {
|
7
|
+
import { useTypedSelector } from '../../../../utils/hooks';
|
8
|
+
import { cn } from '../../../../utils/cn';
|
9
|
+
import { DEFAULT_TABLE_SETTINGS } from '../../../../utils/constants';
|
10
|
+
import { setHotKeysData, setHotKeysDataWasNotLoaded, setHotKeysError, setHotKeysLoading, } from '../../../../store/reducers/hotKeys/hotKeys';
|
12
11
|
import './HotKeys.scss';
|
13
|
-
|
14
|
-
const
|
15
|
-
displayIndices: false,
|
16
|
-
syncHeadOnResize: true,
|
17
|
-
stickyHead: DataTable.MOVING,
|
18
|
-
stickyTop: 0,
|
19
|
-
};
|
12
|
+
import i18n from './i18n';
|
13
|
+
const b = cn('ydb-hot-keys');
|
20
14
|
const tableColumnsIds = {
|
21
15
|
accessSample: 'accessSample',
|
22
16
|
keyValues: 'keyValues',
|
23
17
|
};
|
24
|
-
const
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
18
|
+
const getHotKeysColumns = (keyColumnsIds = []) => {
|
19
|
+
const keysColumns = keyColumnsIds.map((col, index) => ({
|
20
|
+
name: col,
|
21
|
+
header: (_jsxs("div", Object.assign({ className: b('primary-key-column') }, { children: [_jsx(Icon, { name: "key", viewBox: "0 0 12 7", width: 12, height: 7 }), col] }))),
|
22
|
+
render: ({ row }) => row.keyValues[index],
|
23
|
+
align: DataTable.RIGHT,
|
24
|
+
sortable: false,
|
25
|
+
}));
|
26
|
+
return [
|
27
|
+
{
|
28
|
+
name: tableColumnsIds.accessSample,
|
29
|
+
header: 'Samples',
|
30
|
+
render: ({ row }) => row.accessSample,
|
31
|
+
align: DataTable.RIGHT,
|
32
|
+
sortable: false,
|
33
|
+
},
|
34
|
+
...keysColumns,
|
35
|
+
];
|
36
|
+
};
|
37
|
+
export function HotKeys({ path }) {
|
38
|
+
var _a, _b, _c;
|
39
|
+
const dispatch = useDispatch();
|
40
|
+
const collectSamplesTimerRef = useRef();
|
41
|
+
const { loading, wasLoaded, data, error } = useTypedSelector((state) => state.hotKeys);
|
42
|
+
const { loading: schemaLoading, data: schemaData } = useTypedSelector((state) => state.schema);
|
43
|
+
const keyColumnsIds = (_c = (_b = (_a = schemaData[path]) === null || _a === void 0 ? void 0 : _a.PathDescription) === null || _b === void 0 ? void 0 : _b.Table) === null || _c === void 0 ? void 0 : _c.KeyColumnNames;
|
44
|
+
const tableColumns = useMemo(() => {
|
45
|
+
return getHotKeysColumns(keyColumnsIds);
|
46
|
+
}, [keyColumnsIds]);
|
31
47
|
useEffect(() => {
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
48
|
+
const fetchHotkeys = async (enableSampling) => {
|
49
|
+
// Set hotkeys error, but not data, since data is set conditionally
|
50
|
+
try {
|
51
|
+
const response = await window.api.getHotKeys(path, enableSampling);
|
52
|
+
return response;
|
53
|
+
}
|
54
|
+
catch (err) {
|
55
|
+
dispatch(setHotKeysError(err));
|
56
|
+
return undefined;
|
57
|
+
}
|
58
|
+
};
|
59
|
+
const fetchData = async () => {
|
60
|
+
// If there is previous pending request for samples, cancel it
|
61
|
+
if (collectSamplesTimerRef.current !== undefined) {
|
62
|
+
window.clearInterval(collectSamplesTimerRef.current);
|
63
|
+
}
|
64
|
+
dispatch(setHotKeysDataWasNotLoaded());
|
65
|
+
dispatch(setHotKeysLoading());
|
66
|
+
// Send request that will trigger hot keys sampling (enable_sampling = true)
|
67
|
+
const initialResponse = await fetchHotkeys(true);
|
68
|
+
// If there are hotkeys in the initial request (hotkeys was collected before)
|
69
|
+
// we could just use colleted samples (collected hotkeys are stored only for 30 seconds)
|
70
|
+
if (initialResponse && initialResponse.hotkeys) {
|
71
|
+
dispatch(setHotKeysData(initialResponse));
|
72
|
+
}
|
73
|
+
else if (initialResponse) {
|
74
|
+
// Else wait for 5 seconds, while hot keys are being collected
|
75
|
+
// And request these samples (enable_sampling = false)
|
76
|
+
const timer = setTimeout(async () => {
|
77
|
+
const responseWithSamples = await fetchHotkeys(false);
|
78
|
+
if (responseWithSamples) {
|
79
|
+
dispatch(setHotKeysData(responseWithSamples));
|
80
|
+
}
|
81
|
+
}, 5000);
|
82
|
+
collectSamplesTimerRef.current = timer;
|
83
|
+
}
|
42
84
|
};
|
43
|
-
}, [autorefresh]);
|
44
|
-
useEffect(() => {
|
45
85
|
fetchData();
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
});
|
50
|
-
}
|
51
|
-
|
52
|
-
return
|
53
|
-
}
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
sortable: false,
|
62
|
-
align: DataTable.RIGHT,
|
63
|
-
},
|
64
|
-
...keyColumnsIds.map((col, index) => ({
|
65
|
-
name: col,
|
66
|
-
header: (_jsxs("div", Object.assign({ className: b('primary-key-column') }, { children: [_jsx(Icon, { name: "key", viewBox: "0 0 12 7", width: 12, height: 7 }), col] }))),
|
67
|
-
render: ({ row }) => row[tableColumnsIds.keyValues][index],
|
68
|
-
align: DataTable.RIGHT,
|
69
|
-
sortable: false,
|
70
|
-
})),
|
71
|
-
];
|
72
|
-
}, [currentSchema]);
|
73
|
-
const renderStub = () => {
|
74
|
-
return _jsx("div", Object.assign({ className: b('stub') }, { children: "Cluster version does not support hot keys viewing" }));
|
75
|
-
};
|
76
|
-
const renderContent = () => {
|
77
|
-
if (error) {
|
78
|
-
return _jsx(ResponseError, { error: error });
|
79
|
-
}
|
80
|
-
return data !== null ? (_jsx("div", Object.assign({ className: b('table-content') }, { children: _jsx(DataTable, { columns: tableColumns, data: data, settings: TABLE_SETTINGS, theme: "yandex-cloud", initialSortOrder: {
|
81
|
-
columnId: tableColumnsIds.accessSample,
|
82
|
-
order: DataTable.DESCENDING,
|
83
|
-
} }) }))) : (_jsx("div", Object.assign({ className: b('stub') }, { children: "No information about hot keys" })));
|
84
|
-
};
|
85
|
-
return !loading && data === undefined ? (renderStub()) : (_jsx("div", Object.assign({ className: b() }, { children: loading && !wasLoaded ? renderLoader() : renderContent() })));
|
86
|
+
}, [dispatch, path]);
|
87
|
+
// It takes a while to collect hot keys. Display explicit status message, while collecting
|
88
|
+
if ((loading && !wasLoaded) || schemaLoading) {
|
89
|
+
return _jsx("div", { children: i18n('hot-keys-collecting') });
|
90
|
+
}
|
91
|
+
if (error) {
|
92
|
+
return _jsx(ResponseError, { error: error });
|
93
|
+
}
|
94
|
+
if (!data) {
|
95
|
+
return _jsx("div", { children: i18n('no-data') });
|
96
|
+
}
|
97
|
+
return (_jsx("div", Object.assign({ className: b('table-content') }, { children: _jsx(DataTable, { columns: tableColumns, data: data, settings: DEFAULT_TABLE_SETTINGS, theme: "yandex-cloud", initialSortOrder: {
|
98
|
+
columnId: tableColumnsIds.accessSample,
|
99
|
+
order: DataTable.DESCENDING,
|
100
|
+
} }) })));
|
86
101
|
}
|
87
|
-
const mapStateToProps = (state) => {
|
88
|
-
const { loading, data, error, wasLoaded } = state.hotKeys;
|
89
|
-
const { currentSchema = {}, autorefresh } = state.schema;
|
90
|
-
const { Path } = currentSchema;
|
91
|
-
return {
|
92
|
-
loading,
|
93
|
-
data,
|
94
|
-
error,
|
95
|
-
currentSchemaPath: Path,
|
96
|
-
autorefresh,
|
97
|
-
wasLoaded,
|
98
|
-
currentSchema,
|
99
|
-
};
|
100
|
-
};
|
101
|
-
const mapDispatchToProps = {
|
102
|
-
getHotKeys,
|
103
|
-
setHotKeysOptions,
|
104
|
-
};
|
105
|
-
export default connect(mapStateToProps, mapDispatchToProps)(HotKeys);
|
@@ -1,16 +1,6 @@
|
|
1
1
|
@import '../../../../styles/mixins.scss';
|
2
2
|
|
3
|
-
.hot-keys {
|
4
|
-
display: flex;
|
5
|
-
overflow: auto;
|
6
|
-
flex-grow: 1;
|
7
|
-
flex-direction: column;
|
8
|
-
align-items: flex-start;
|
9
|
-
|
10
|
-
max-height: 100%;
|
11
|
-
|
12
|
-
background-color: var(--g-color-base-background);
|
13
|
-
|
3
|
+
.ydb-hot-keys {
|
14
4
|
&__table-content {
|
15
5
|
overflow: auto;
|
16
6
|
|
@@ -19,28 +9,6 @@
|
|
19
9
|
@include freeze-nth-column(1);
|
20
10
|
}
|
21
11
|
|
22
|
-
&__header {
|
23
|
-
position: sticky;
|
24
|
-
z-index: 2;
|
25
|
-
top: 0px;
|
26
|
-
left: 0;
|
27
|
-
|
28
|
-
width: 100%;
|
29
|
-
padding: 10px 0;
|
30
|
-
|
31
|
-
background-color: var(--g-color-base-background);
|
32
|
-
}
|
33
|
-
&__loader {
|
34
|
-
display: flex;
|
35
|
-
justify-content: center;
|
36
|
-
align-items: center;
|
37
|
-
|
38
|
-
width: 100%;
|
39
|
-
height: 100%;
|
40
|
-
}
|
41
|
-
&__stub {
|
42
|
-
margin: 10px;
|
43
|
-
}
|
44
12
|
&__primary-key-column {
|
45
13
|
display: flex;
|
46
14
|
gap: 5px;
|
package/dist/containers/Tenant/Diagnostics/TenantOverview/MetricsCards/MetricCard/MetricCard.js
CHANGED
@@ -8,7 +8,10 @@ import './MetricCard.scss';
|
|
8
8
|
const b = cn('ydb-metrics-card');
|
9
9
|
export function MetricCard({ active, progress, label, status, resourcesUsed }) {
|
10
10
|
const renderContent = () => {
|
11
|
-
|
11
|
+
if (progress === undefined && resourcesUsed === undefined) {
|
12
|
+
return _jsx("div", Object.assign({ className: b('content') }, { children: i18n('no-data') }));
|
13
|
+
}
|
14
|
+
return (_jsxs("div", Object.assign({ className: b('content') }, { children: [progress && _jsx("div", Object.assign({ className: b('progress') }, { children: formatUsage(progress) })), resourcesUsed && _jsx("div", Object.assign({ className: b('resources') }, { children: resourcesUsed }))] })));
|
12
15
|
};
|
13
16
|
return (_jsxs(DiagnosticCard, Object.assign({ className: b({ active }), active: active }, { children: [_jsx("div", Object.assign({ className: b('header') }, { children: label && _jsx("div", Object.assign({ className: b('label') }, { children: label })) })), _jsx(CircularProgressBar, { size: 172, strokeWidth: 11, progress: progress || 0, content: renderContent(), status: status, circleBgClassName: b('progress-bar-circle-bg') })] })));
|
14
17
|
}
|
@@ -12,15 +12,14 @@ import './MetricsCards.scss';
|
|
12
12
|
const b = cn('metrics-cards');
|
13
13
|
export function MetricsCards({ metrics, issuesStatistics, selfCheckResult, fetchHealthcheck, healthcheckLoading, healthCheckWasLoaded, healthcheckError, }) {
|
14
14
|
const location = useLocation();
|
15
|
-
const { memoryUsed, memoryLimit,
|
15
|
+
const { memoryUsed, memoryLimit, cpuUsage, storageUsed, storageLimit } = metrics || {};
|
16
16
|
const { metricsTab } = useTypedSelector((state) => state.tenant);
|
17
17
|
const storageUsage = calculateUsage(storageUsed, storageLimit);
|
18
18
|
const memoryUsage = calculateUsage(memoryUsed, memoryLimit);
|
19
19
|
const cpuStatus = cpuUsageToStatus(cpuUsage);
|
20
20
|
const storageStatus = storageUsageToStatus(storageUsage);
|
21
21
|
const memoryStatus = memoryUsageToStatus(memoryUsage);
|
22
|
-
const {
|
23
|
-
cpu: cpuUsed,
|
22
|
+
const { storage, memory } = formatTenantMetrics({
|
24
23
|
storage: storageUsed,
|
25
24
|
memory: memoryUsed,
|
26
25
|
});
|
@@ -38,5 +37,5 @@ export function MetricsCards({ metrics, issuesStatistics, selfCheckResult, fetch
|
|
38
37
|
[TENANT_METRICS_TABS_IDS.memory]: getTenantPath(Object.assign(Object.assign({}, queryParams), { [TenantTabsGroups.metricsTab]: getTabIfNotActive(TENANT_METRICS_TABS_IDS.memory) })),
|
39
38
|
[TENANT_METRICS_TABS_IDS.healthcheck]: getTenantPath(Object.assign(Object.assign({}, queryParams), { [TenantTabsGroups.metricsTab]: getTabIfNotActive(TENANT_METRICS_TABS_IDS.healthcheck) })),
|
40
39
|
};
|
41
|
-
return (_jsxs("div", Object.assign({ className: b() }, { children: [_jsx(Link, Object.assign({ to: tabLinks.cpu, className: b('tab') }, { children: _jsx(MetricCard, { label: "CPU", progress: cpuUsage, status: cpuStatus,
|
40
|
+
return (_jsxs("div", Object.assign({ className: b() }, { children: [_jsx(Link, Object.assign({ to: tabLinks.cpu, className: b('tab') }, { children: _jsx(MetricCard, { label: "CPU", progress: cpuUsage, status: cpuStatus, active: metricsTab === TENANT_METRICS_TABS_IDS.cpu }) })), _jsx(Link, Object.assign({ to: tabLinks.storage, className: b('tab') }, { children: _jsx(MetricCard, { label: "Storage", progress: storageUsage, status: storageStatus, resourcesUsed: storage, active: metricsTab === TENANT_METRICS_TABS_IDS.storage }) })), _jsx(Link, Object.assign({ to: tabLinks.memory, className: b('tab') }, { children: _jsx(MetricCard, { label: "Memory", progress: memoryUsage, status: memoryStatus, resourcesUsed: memory, active: metricsTab === TENANT_METRICS_TABS_IDS.memory }) })), _jsx(Link, Object.assign({ to: tabLinks.healthcheck, className: b('tab') }, { children: _jsx(HealthcheckPreview, { selfCheckResult: selfCheckResult, issuesStatistics: issuesStatistics, onUpdate: fetchHealthcheck, loading: healthcheckLoading, wasLoaded: healthCheckWasLoaded, error: healthcheckError, active: metricsTab === TENANT_METRICS_TABS_IDS.healthcheck }) }))] })));
|
42
41
|
}
|
@@ -36,20 +36,27 @@ export function TenantOverview({ tenantName, additionalTenantProps, additionalNo
|
|
36
36
|
}, [fetchTenant, fetchHealthcheck], autorefresh);
|
37
37
|
const { Name, State, Type } = tenant || {};
|
38
38
|
const tenantType = mapDatabaseTypeToDBName(Type);
|
39
|
-
const { cpu, blobStorage,
|
39
|
+
const { cpu, blobStorage, tabletStorage, memory, cpuUsage, blobStorageLimit, tabletStorageLimit, memoryLimit, } = calculateTenantMetrics(tenant);
|
40
|
+
// If there is table storage limit (data_size_hard_quota),
|
41
|
+
// use it for metric card instead of blob storage limit
|
42
|
+
// When datasize exceeds or equals to quota
|
43
|
+
// all write operations to the database are finished with error
|
44
|
+
const isTabletStorageLimitSet = tabletStorageLimit && tabletStorageLimit > 0;
|
45
|
+
const storageUsed = isTabletStorageLimitSet ? tabletStorage : blobStorage;
|
46
|
+
const storageLimit = isTabletStorageLimitSet ? tabletStorageLimit : blobStorageLimit;
|
40
47
|
const calculatedMetrics = {
|
41
48
|
memoryUsed: memory,
|
42
49
|
memoryLimit,
|
43
50
|
cpuUsed: cpu,
|
44
51
|
cpuUsage,
|
45
|
-
storageUsed
|
46
|
-
storageLimit
|
52
|
+
storageUsed,
|
53
|
+
storageLimit,
|
47
54
|
};
|
48
55
|
const storageMetrics = {
|
49
56
|
blobStorageUsed: blobStorage,
|
50
57
|
blobStorageLimit,
|
51
|
-
|
52
|
-
|
58
|
+
tabletStorageUsed: tabletStorage,
|
59
|
+
tabletStorageLimit,
|
53
60
|
};
|
54
61
|
const renderName = () => {
|
55
62
|
return (_jsx("div", Object.assign({ className: b('tenant-name-wrapper') }, { children: _jsx(EntityStatus, { status: State, name: Name || TENANT_DEFAULT_TITLE, withLeftTrim: true, hasClipboardButton: Boolean(tenant), clipboardButtonAlwaysVisible: true }) })));
|
@@ -3,8 +3,8 @@ import '../TenantOverview.scss';
|
|
3
3
|
export interface TenantStorageMetrics {
|
4
4
|
blobStorageUsed?: number;
|
5
5
|
blobStorageLimit?: number;
|
6
|
-
|
7
|
-
|
6
|
+
tabletStorageUsed?: number;
|
7
|
+
tabletStorageLimit?: number;
|
8
8
|
}
|
9
9
|
interface TenantStorageProps {
|
10
10
|
tenantName: string;
|