ydb-embedded-ui 5.3.0 → 5.5.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/DiskPageTitle/DiskPageTitle.d.ts +11 -0
- package/dist/components/DiskPageTitle/DiskPageTitle.js +8 -0
- package/dist/components/DiskPageTitle/DiskPageTitle.scss +17 -0
- package/dist/{containers/Storage → components}/DiskStateProgressBar/DiskStateProgressBar.js +3 -3
- package/dist/components/ErrorBoundary/ErrorBoundary.d.ts +1 -1
- package/dist/components/GroupInfo/GroupInfo.d.ts +8 -0
- package/dist/components/GroupInfo/GroupInfo.js +28 -0
- package/dist/components/GroupInfo/i18n/en.json +6 -0
- package/dist/components/GroupInfo/i18n/index.d.ts +1 -0
- package/dist/components/GroupInfo/i18n/index.js +4 -0
- package/dist/components/MetricChart/MetricChart.js +12 -5
- package/dist/components/MetricChart/colors.d.ts +2 -0
- package/dist/components/MetricChart/colors.js +21 -0
- package/dist/components/MetricChart/getDefaultDataFormatter.js +9 -0
- package/dist/components/MetricChart/types.d.ts +11 -2
- package/dist/components/MonacoEditor/MonacoEditor.d.ts +2 -0
- package/dist/components/MonacoEditor/MonacoEditor.js +7 -0
- package/dist/{containers/Storage → components}/PDiskPopup/PDiskPopup.d.ts +3 -3
- package/dist/{containers/Storage → components}/PDiskPopup/PDiskPopup.js +6 -5
- package/dist/components/PageMeta/PageMeta.d.ts +2 -1
- package/dist/components/PageMeta/PageMeta.js +9 -2
- package/dist/components/PageMeta/PageMeta.scss +9 -0
- package/dist/components/Stack/Stack.scss +2 -0
- package/dist/{containers/Storage → components}/VDisk/VDisk.d.ts +2 -2
- package/dist/{containers/Storage → components}/VDisk/VDisk.js +8 -8
- package/dist/{containers/Storage → components}/VDisk/VDisk.scss +1 -1
- package/dist/components/VDisk/VDiskWithDonorsStack.d.ts +12 -0
- package/dist/components/VDisk/VDiskWithDonorsStack.js +14 -0
- package/dist/components/VDiskInfo/VDiskInfo.d.ts +10 -0
- package/dist/components/VDiskInfo/VDiskInfo.js +113 -0
- package/dist/components/VDiskInfo/VDiskInfo.scss +8 -0
- package/dist/components/VDiskInfo/i18n/en.json +23 -0
- package/dist/components/VDiskInfo/i18n/index.d.ts +1 -0
- package/dist/components/VDiskInfo/i18n/index.js +4 -0
- package/dist/{containers/Storage → components}/VDiskPopup/VDiskPopup.d.ts +3 -3
- package/dist/{containers/Storage → components}/VDiskPopup/VDiskPopup.js +8 -7
- package/dist/components/VirtualTable/TableHead.d.ts +2 -1
- package/dist/components/VirtualTable/TableHead.js +6 -6
- package/dist/components/VirtualTable/constants.d.ts +1 -0
- package/dist/components/VirtualTable/constants.js +1 -0
- package/dist/containers/App/App.js +0 -2
- package/dist/containers/App/App.scss +3 -0
- package/dist/containers/App/Content.js +19 -5
- package/dist/containers/App/appSlots.d.ts +9 -3
- package/dist/containers/App/appSlots.js +2 -1
- package/dist/containers/Header/breadcrumbs.js +12 -0
- package/dist/containers/Header/i18n/en.json +1 -0
- package/dist/containers/Header/i18n/index.d.ts +1 -1
- package/dist/containers/Heatmap/HeatmapCanvas/HeatmapCanvas.js +2 -2
- package/dist/containers/Node/NodeStructure/NodeStructure.js +1 -1
- package/dist/containers/Node/NodeStructure/Pdisk.js +2 -2
- package/dist/containers/Node/NodeStructure/Vdisk.d.ts +6 -2
- package/dist/containers/Node/NodeStructure/Vdisk.js +5 -78
- package/dist/containers/Nodes/getNodesColumns.js +0 -1
- package/dist/containers/PDiskPage/PDiskPage.d.ts +3 -0
- package/dist/containers/{PDisk/PDisk.js → PDiskPage/PDiskPage.js} +30 -14
- package/dist/containers/{PDisk/PDisk.scss → PDiskPage/PDiskPage.scss} +1 -14
- package/dist/containers/PDiskPage/i18n/en.json +8 -0
- package/dist/containers/PDiskPage/i18n/index.d.ts +1 -0
- package/dist/containers/Storage/PDisk/PDisk.js +4 -10
- package/dist/containers/Storage/PDisk/PDisk.scss +0 -2
- package/dist/containers/Storage/Storage.js +1 -2
- package/dist/containers/Storage/StorageGroups/StorageGroups.scss +1 -7
- package/dist/containers/Storage/StorageGroups/getStorageGroupsColumns.d.ts +1 -1
- package/dist/containers/Storage/StorageGroups/getStorageGroupsColumns.js +9 -17
- package/dist/containers/Storage/VirtualStorage.js +3 -7
- package/dist/containers/Tablet/TabletControls/TabletControls.js +2 -1
- package/dist/containers/TabletsFilters/TabletsFilters.d.ts +2 -2
- package/dist/containers/TabletsFilters/TabletsFilters.js +7 -6
- package/dist/containers/Tenant/Diagnostics/Consumers/Consumers.js +1 -1
- package/dist/containers/Tenant/Diagnostics/Network/Network.js +2 -2
- package/dist/containers/Tenant/Diagnostics/Partitions/Partitions.js +1 -2
- package/dist/containers/Tenant/Diagnostics/Partitions/PartitionsControls/PartitionsControls.js +1 -1
- package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantCpu/cpuDashboardConfig.js +14 -5
- package/dist/containers/Tenant/Diagnostics/TenantOverview/i18n/en.json +1 -1
- package/dist/containers/Tenant/Query/ExplainResult/ExplainResult.js +5 -3
- package/dist/containers/Tenant/Query/QueryEditor/QueryEditor.js +6 -4
- package/dist/containers/Tenant/Query/SaveQuery/SaveQuery.js +2 -2
- package/dist/containers/Tenant/Tenant.js +10 -5
- package/dist/containers/Tenants/Tenants.js +3 -2
- package/dist/containers/VDiskPage/VDiskPage.d.ts +3 -0
- package/dist/containers/VDiskPage/VDiskPage.js +109 -0
- package/dist/containers/VDiskPage/VDiskPage.scss +32 -0
- package/dist/containers/VDiskPage/i18n/en.json +9 -0
- package/dist/containers/VDiskPage/i18n/index.d.ts +1 -0
- package/dist/containers/VDiskPage/i18n/index.js +4 -0
- package/dist/containers/Versions/groupNodes.js +1 -1
- package/dist/routes.d.ts +3 -0
- package/dist/routes.js +5 -0
- package/dist/services/api.d.ts +12 -4
- package/dist/services/api.js +39 -4
- package/dist/store/configureStore.d.ts +4 -0
- package/dist/store/defaultStore.d.ts +2 -0
- package/dist/store/reducers/authentication/authentication.d.ts +3 -0
- package/dist/store/reducers/cluster/cluster.d.ts +1 -0
- package/dist/store/reducers/clusterNodes/clusterNodes.d.ts +1 -0
- package/dist/store/reducers/clusters/clusters.d.ts +1 -0
- package/dist/store/reducers/clusters/selectors.js +1 -1
- package/dist/store/reducers/describe.d.ts +2 -0
- package/dist/store/reducers/executeQuery.d.ts +1 -0
- package/dist/store/reducers/explainQuery.d.ts +2 -0
- package/dist/store/reducers/header/types.d.ts +4 -1
- package/dist/store/reducers/healthcheckInfo/healthcheckInfo.d.ts +1 -0
- package/dist/store/reducers/heatmap.d.ts +1 -0
- package/dist/store/reducers/host.d.ts +1 -0
- package/dist/store/reducers/index.d.ts +3 -0
- package/dist/store/reducers/index.js +2 -0
- package/dist/store/reducers/network/network.d.ts +1 -0
- package/dist/store/reducers/node/node.d.ts +2 -0
- package/dist/store/reducers/node/selectors.js +1 -1
- package/dist/store/reducers/nodes/nodes.d.ts +2 -0
- package/dist/store/reducers/nodesList.d.ts +1 -0
- package/dist/store/reducers/olapStats.d.ts +1 -0
- package/dist/store/reducers/overview/overview.d.ts +2 -0
- package/dist/store/reducers/partitions/partitions.d.ts +1 -0
- package/dist/store/reducers/pdisk/pdisk.d.ts +2 -0
- package/dist/store/reducers/pdisk/utils.js +1 -1
- package/dist/store/reducers/preview.d.ts +1 -0
- package/dist/store/reducers/schema/schema.d.ts +1 -0
- package/dist/store/reducers/schemaAcl/schemaAcl.d.ts +1 -0
- package/dist/store/reducers/shardsWorkload/shardsWorkload.d.ts +1 -0
- package/dist/store/reducers/storage/storage.d.ts +2 -0
- package/dist/store/reducers/storage/types.d.ts +3 -1
- package/dist/store/reducers/storage/utils.d.ts +1 -1
- package/dist/store/reducers/storage/utils.js +8 -9
- package/dist/store/reducers/tablet.d.ts +2 -0
- package/dist/store/reducers/tablets.d.ts +1 -0
- package/dist/store/reducers/tabletsFilters.d.ts +1 -0
- package/dist/store/reducers/tenant/tenant.d.ts +1 -0
- package/dist/store/reducers/tenantOverview/executeTopTables/executeTopTables.d.ts +1 -0
- package/dist/store/reducers/tenantOverview/topNodesByCpu/topNodesByCpu.d.ts +1 -0
- package/dist/store/reducers/tenantOverview/topNodesByLoad/topNodesByLoad.d.ts +1 -0
- package/dist/store/reducers/tenantOverview/topNodesByMemory/topNodesByMemory.d.ts +1 -0
- package/dist/store/reducers/tenantOverview/topQueries/tenantOverviewTopQueries.d.ts +1 -0
- package/dist/store/reducers/tenantOverview/topShards/tenantOverviewTopShards.d.ts +1 -0
- package/dist/store/reducers/tenantOverview/topStorageGroups/topStorageGroups.d.ts +1 -0
- package/dist/store/reducers/tenants/selectors.js +1 -1
- package/dist/store/reducers/tenants/tenants.d.ts +1 -0
- package/dist/store/reducers/topic.d.ts +1 -0
- package/dist/store/reducers/vdisk/types.d.ts +25 -0
- package/dist/store/reducers/vdisk/utils.d.ts +11 -0
- package/dist/store/reducers/vdisk/utils.js +33 -0
- package/dist/store/reducers/vdisk/vdisk.d.ts +100 -0
- package/dist/store/reducers/vdisk/vdisk.js +64 -0
- package/dist/store/state-url-mapping.js +6 -4
- package/dist/types/api/storage.d.ts +2 -0
- package/dist/utils/bytesParsers/__test__/formatBytes.test.js +7 -7
- package/dist/utils/clusterVersionColors.js +1 -1
- package/dist/utils/dataFormatters/dataFormatters.js +1 -0
- package/dist/utils/disks/constants.js +2 -2
- package/dist/utils/disks/types.d.ts +5 -1
- package/dist/utils/filters.js +1 -1
- package/dist/utils/hooks/useTableResize.d.ts +1 -1
- package/dist/utils/hooks/useTableResize.js +5 -3
- package/dist/utils/lazyComponent.d.ts +4 -0
- package/dist/utils/lazyComponent.js +25 -0
- package/dist/utils/monaco/index.d.ts +1 -0
- package/dist/utils/monaco/index.js +4 -0
- package/dist/utils/monaco/s-expression/constants.d.ts +1 -0
- package/dist/utils/monaco/s-expression/constants.js +1 -0
- package/dist/utils/monaco/s-expression/registerLanguage.d.ts +1 -0
- package/dist/utils/{monaco.js → monaco/s-expression/registerLanguage.js} +2 -19
- package/dist/utils/{yqlSuggestions → monaco/yqlSuggestions}/generateSuggestions.d.ts +2 -2
- package/dist/utils/{yqlSuggestions → monaco/yqlSuggestions}/generateSuggestions.js +40 -11
- package/dist/utils/monaco/yqlSuggestions/registerCompletionItemProvider.d.ts +1 -0
- package/dist/utils/monaco/yqlSuggestions/registerCompletionItemProvider.js +15 -0
- package/dist/utils/{yqlSuggestions → monaco/yqlSuggestions}/yqlSuggestions.js +1 -1
- package/dist/utils/numeral.js +7 -1
- package/dist/utils/storage.d.ts +1 -0
- package/dist/utils/storage.js +1 -0
- package/dist/utils/timeParsers/parsers.js +1 -1
- package/package.json +5 -2
- package/dist/containers/PDisk/PDisk.d.ts +0 -3
- package/dist/containers/PDisk/i18n/en.json +0 -6
- package/dist/containers/PDisk/i18n/index.d.ts +0 -1
- package/dist/containers/Storage/DiskStateProgressBar/index.d.ts +0 -1
- package/dist/containers/Storage/DiskStateProgressBar/index.js +0 -1
- package/dist/containers/Storage/PDiskPopup/index.d.ts +0 -1
- package/dist/containers/Storage/PDiskPopup/index.js +0 -1
- package/dist/containers/Storage/VDisk/index.d.ts +0 -1
- package/dist/containers/Storage/VDisk/index.js +0 -1
- package/dist/containers/Storage/VDiskPopup/index.d.ts +0 -1
- package/dist/containers/Storage/VDiskPopup/index.js +0 -1
- package/dist/containers/Storage/utils/types.d.ts +0 -5
- package/dist/utils/monaco.d.ts +0 -3
- /package/dist/{containers/Storage → components}/DiskStateProgressBar/DiskStateProgressBar.d.ts +0 -0
- /package/dist/{containers/Storage → components}/DiskStateProgressBar/DiskStateProgressBar.scss +0 -0
- /package/dist/{containers/Storage → components}/PDiskPopup/PDiskPopup.scss +0 -0
- /package/dist/{containers/Storage → components}/VDiskPopup/VDiskPopup.scss +0 -0
- /package/dist/containers/{PDisk → PDiskPage}/PDiskGroups.d.ts +0 -0
- /package/dist/containers/{PDisk → PDiskPage}/PDiskGroups.js +0 -0
- /package/dist/containers/{PDisk → PDiskPage}/i18n/index.js +0 -0
- /package/dist/containers/{PDisk → PDiskPage}/shared.d.ts +0 -0
- /package/dist/containers/{PDisk → PDiskPage}/shared.js +0 -0
- /package/dist/{containers/Storage/utils → store/reducers/vdisk}/types.js +0 -0
- /package/dist/utils/{yqlSuggestions → monaco/yqlSuggestions}/constants.d.ts +0 -0
- /package/dist/utils/{yqlSuggestions → monaco/yqlSuggestions}/constants.js +0 -0
- /package/dist/utils/{yqlSuggestions → monaco/yqlSuggestions}/yqlSuggestions.d.ts +0 -0
@@ -6,7 +6,7 @@ import { ResponseError } from '../../components/Errors/ResponseError';
|
|
6
6
|
import { setInitialState, setVisibleEntities, setStorageTextFilter, setUsageFilter, setStorageType, setNodesUptimeFilter, setDataWasNotLoaded, getStorageNodesInfo, getStorageGroupsInfo, setNodesSortParams, setGroupsSortParams, } from '../../store/reducers/storage/storage';
|
7
7
|
import { selectFilteredGroups, selectFilteredNodes, selectEntitiesCount, selectUsageFilterOptions, selectNodesSortParams, selectGroupsSortParams, } from '../../store/reducers/storage/selectors';
|
8
8
|
import { VISIBLE_ENTITIES, STORAGE_TYPES } from '../../store/reducers/storage/constants';
|
9
|
-
import {
|
9
|
+
import { selectNodesMap } from '../../store/reducers/nodesList';
|
10
10
|
import { useAutofetcher, useNodesRequestParams, useStorageRequestParams, useTableSort, useTypedSelector, useTypedDispatch, } from '../../utils/hooks';
|
11
11
|
import { NodesUptimeFilterValues } from '../../utils/nodes';
|
12
12
|
import { DEFAULT_TABLE_SETTINGS } from '../../utils/constants';
|
@@ -30,7 +30,6 @@ export const Storage = ({ additionalNodesProps, tenant, nodeId }) => {
|
|
30
30
|
const isNodePage = nodeId !== undefined;
|
31
31
|
const storageType = isNodePage ? STORAGE_TYPES.groups : type;
|
32
32
|
useEffect(() => {
|
33
|
-
dispatch(getNodesList());
|
34
33
|
return () => {
|
35
34
|
// Clean data on component unmount
|
36
35
|
dispatch(setInitialState());
|
@@ -6,6 +6,7 @@
|
|
6
6
|
&__vdisks-wrapper {
|
7
7
|
display: flex;
|
8
8
|
justify-content: center;
|
9
|
+
gap: 10px;
|
9
10
|
|
10
11
|
min-width: 500px;
|
11
12
|
}
|
@@ -13,15 +14,8 @@
|
|
13
14
|
flex-grow: 1;
|
14
15
|
|
15
16
|
max-width: 200px;
|
16
|
-
margin-right: 10px;
|
17
|
-
|
18
|
-
&:last-child {
|
19
|
-
margin-right: 0px;
|
20
|
-
}
|
21
17
|
|
22
18
|
.stack__layer {
|
23
|
-
background: var(--g-color-base-background);
|
24
|
-
|
25
19
|
.data-table__row:hover & {
|
26
20
|
background: var(--ydb-data-table-color-hover);
|
27
21
|
}
|
@@ -6,7 +6,7 @@ import './StorageGroups.scss';
|
|
6
6
|
type StorageGroupsColumn = VirtualTableColumn<PreparedStorageGroup> & DataTableColumn<PreparedStorageGroup>;
|
7
7
|
export declare const GROUPS_COLUMNS_IDS: {
|
8
8
|
readonly PoolName: "PoolName";
|
9
|
-
readonly
|
9
|
+
readonly MediaType: "MediaType";
|
10
10
|
readonly Erasure: "Erasure";
|
11
11
|
readonly GroupId: "GroupId";
|
12
12
|
readonly Used: "Used";
|
@@ -6,21 +6,19 @@ import { EFlag } from '../../../types/api/enums';
|
|
6
6
|
import shieldIcon from '../../../assets/icons/shield.svg';
|
7
7
|
import { VISIBLE_ENTITIES } from '../../../store/reducers/storage/constants';
|
8
8
|
import { isSortableStorageProperty } from '../../../utils/storage';
|
9
|
-
import { isFullVDiskData } from '../../../utils/disks/helpers';
|
10
9
|
import { bytesToGB, bytesToSpeed } from '../../../utils/utils';
|
11
10
|
import { stringifyVdiskId } from '../../../utils/dataFormatters/dataFormatters';
|
12
11
|
import { EntityStatus } from '../../../components/EntityStatus/EntityStatus';
|
13
|
-
import { Stack } from '../../../components/Stack/Stack';
|
14
12
|
import { CellWithPopover } from '../../../components/CellWithPopover/CellWithPopover';
|
15
13
|
import { UsageLabel } from '../../../components/UsageLabel/UsageLabel';
|
16
|
-
import {
|
14
|
+
import { VDiskWithDonorsStack } from '../../../components/VDisk/VDiskWithDonorsStack';
|
17
15
|
import { getDegradedSeverity, getUsageSeverityForStorageGroup } from '../utils';
|
18
16
|
import i18n from './i18n';
|
19
17
|
import './StorageGroups.scss';
|
20
18
|
const b = cn('global-storage-groups');
|
21
19
|
export const GROUPS_COLUMNS_IDS = {
|
22
20
|
PoolName: 'PoolName',
|
23
|
-
|
21
|
+
MediaType: 'MediaType',
|
24
22
|
Erasure: 'Erasure',
|
25
23
|
GroupId: 'GroupId',
|
26
24
|
Used: 'Used',
|
@@ -43,12 +41,12 @@ const poolNameColumn = {
|
|
43
41
|
},
|
44
42
|
align: DataTable.LEFT,
|
45
43
|
};
|
46
|
-
const
|
47
|
-
name: GROUPS_COLUMNS_IDS.
|
44
|
+
const typeColumn = {
|
45
|
+
name: GROUPS_COLUMNS_IDS.MediaType,
|
48
46
|
header: 'Type',
|
49
47
|
width: 100,
|
50
48
|
align: DataTable.LEFT,
|
51
|
-
render: ({ row }) => (_jsxs(_Fragment, { children: [_jsx(Label, { children: row.
|
49
|
+
render: ({ row }) => (_jsxs(_Fragment, { children: [_jsx(Label, { children: row.MediaType || '—' }), '\u00a0', row.Encryption && (_jsx(Popover, Object.assign({ content: i18n('encrypted'), placement: "right", behavior: PopoverBehavior.Immediate }, { children: _jsx(Label, { children: _jsx(Icon, { data: shieldIcon }) }) })))] })),
|
52
50
|
sortable: false,
|
53
51
|
};
|
54
52
|
const erasureColumn = {
|
@@ -157,25 +155,19 @@ const getVdiscksColumn = (nodes) => ({
|
|
157
155
|
render: ({ row }) => {
|
158
156
|
var _a;
|
159
157
|
return (_jsx("div", Object.assign({ className: b('vdisks-wrapper') }, { children: (_a = row.VDisks) === null || _a === void 0 ? void 0 : _a.map((vDisk) => {
|
160
|
-
|
161
|
-
return donors && donors.length > 0 ? (_jsxs(Stack, Object.assign({ className: b('vdisks-item') }, { children: [_jsx(VDisk, { data: vDisk, nodes: nodes }), donors.map((donor) => {
|
162
|
-
const isFullData = isFullVDiskData(donor);
|
163
|
-
return (_jsx(VDisk, { data: donor,
|
164
|
-
// donor and acceptor are always in the same group
|
165
|
-
nodes: nodes }, stringifyVdiskId(isFullData ? donor.VDiskId : donor)));
|
166
|
-
})] }), stringifyVdiskId(vDisk.VDiskId))) : (_jsx("div", Object.assign({ className: b('vdisks-item') }, { children: _jsx(VDisk, { data: vDisk, nodes: nodes }) }), stringifyVdiskId(vDisk.VDiskId)));
|
158
|
+
return (_jsx(VDiskWithDonorsStack, { data: vDisk, nodes: nodes, className: b('vdisks-item') }, stringifyVdiskId(vDisk.VDiskId)));
|
167
159
|
}) })));
|
168
160
|
},
|
169
161
|
align: DataTable.CENTER,
|
170
162
|
width: 900,
|
171
163
|
});
|
172
164
|
export const getStorageTopGroupsColumns = () => {
|
173
|
-
return [groupIdColumn,
|
165
|
+
return [groupIdColumn, typeColumn, erasureColumn, usageColumn, usedColumn, limitColumn];
|
174
166
|
};
|
175
167
|
export const getPDiskStorageColumns = (nodes) => {
|
176
168
|
return [
|
177
169
|
poolNameColumn,
|
178
|
-
|
170
|
+
typeColumn,
|
179
171
|
erasureColumn,
|
180
172
|
degradedColumn,
|
181
173
|
groupIdColumn,
|
@@ -187,7 +179,7 @@ export const getPDiskStorageColumns = (nodes) => {
|
|
187
179
|
const getStorageGroupsColumns = (nodes) => {
|
188
180
|
return [
|
189
181
|
poolNameColumn,
|
190
|
-
|
182
|
+
typeColumn,
|
191
183
|
erasureColumn,
|
192
184
|
degradedColumn,
|
193
185
|
usageColumn,
|
@@ -1,24 +1,20 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import {
|
2
|
+
import { useState } from 'react';
|
3
3
|
import { STORAGE_TYPES, VISIBLE_ENTITIES } from '../../store/reducers/storage/constants';
|
4
4
|
import { NodesUptimeFilterValues } from '../../utils/nodes';
|
5
5
|
import { AccessDenied } from '../../components/Errors/403/AccessDenied';
|
6
6
|
import { ResponseError } from '../../components/Errors/ResponseError/ResponseError';
|
7
|
-
import {
|
8
|
-
import { useTypedSelector
|
7
|
+
import { selectNodesMap } from '../../store/reducers/nodesList';
|
8
|
+
import { useTypedSelector } from '../../utils/hooks';
|
9
9
|
import { StorageControls } from './StorageControls/StorageControls';
|
10
10
|
import { VirtualStorageGroups } from './StorageGroups/VirtualStorageGroups';
|
11
11
|
import { VirtualStorageNodes } from './StorageNodes/VirtualStorageNodes';
|
12
12
|
export const VirtualStorage = ({ tenant, nodeId, parentContainer, additionalNodesProps, }) => {
|
13
|
-
const dispatch = useTypedDispatch();
|
14
13
|
const [searchValue, setSearchValue] = useState('');
|
15
14
|
const [storageType, setStorageType] = useState(STORAGE_TYPES.groups);
|
16
15
|
const [visibleEntities, setVisibleEntities] = useState(VISIBLE_ENTITIES.all);
|
17
16
|
const [nodesUptimeFilter, setNodesUptimeFilter] = useState(NodesUptimeFilterValues.All);
|
18
17
|
const nodesMap = useTypedSelector(selectNodesMap);
|
19
|
-
useEffect(() => {
|
20
|
-
dispatch(getNodesList());
|
21
|
-
}, [dispatch]);
|
22
18
|
const handleShowAllGroups = () => {
|
23
19
|
setVisibleEntities(VISIBLE_ENTITIES.all);
|
24
20
|
};
|
@@ -17,7 +17,8 @@ export const TabletControls = ({ tablet, fetchData }) => {
|
|
17
17
|
const hasHiveId = () => {
|
18
18
|
return HiveId && HiveId !== '0';
|
19
19
|
};
|
20
|
+
const isDisabledRestart = tablet.State === ETabletState.Stopped;
|
20
21
|
const isDisabledResume = tablet.State !== ETabletState.Stopped && tablet.State !== ETabletState.Dead;
|
21
22
|
const isDisabledStop = tablet.State === ETabletState.Stopped || tablet.State === ETabletState.Deleted;
|
22
|
-
return (_jsxs("div", Object.assign({ className: b('controls') }, { children: [_jsx(ButtonWithConfirmDialog, Object.assign({ dialogContent: i18n('dialog.kill'), onConfirmAction: _onKillClick, onConfirmActionSuccess: fetchData, buttonClassName: b('control') }, { children: i18n('controls.kill') })), hasHiveId() ? (_jsxs(_Fragment, { children: [_jsx(ButtonWithConfirmDialog, Object.assign({ dialogContent: i18n('dialog.stop'), onConfirmAction: _onStopClick, onConfirmActionSuccess: fetchData, buttonClassName: b('control'), buttonDisabled: isDisabledStop }, { children: i18n('controls.stop') })), _jsx(ButtonWithConfirmDialog, Object.assign({ dialogContent: i18n('dialog.resume'), onConfirmAction: _onResumeClick, onConfirmActionSuccess: fetchData, buttonClassName: b('control'), buttonDisabled: isDisabledResume }, { children: i18n('controls.resume') }))] })) : null] })));
|
23
|
+
return (_jsxs("div", Object.assign({ className: b('controls') }, { children: [_jsx(ButtonWithConfirmDialog, Object.assign({ dialogContent: i18n('dialog.kill'), onConfirmAction: _onKillClick, onConfirmActionSuccess: fetchData, buttonClassName: b('control'), buttonDisabled: isDisabledRestart }, { children: i18n('controls.kill') })), hasHiveId() ? (_jsxs(_Fragment, { children: [_jsx(ButtonWithConfirmDialog, Object.assign({ dialogContent: i18n('dialog.stop'), onConfirmAction: _onStopClick, onConfirmActionSuccess: fetchData, buttonClassName: b('control'), buttonDisabled: isDisabledStop }, { children: i18n('controls.stop') })), _jsx(ButtonWithConfirmDialog, Object.assign({ dialogContent: i18n('dialog.resume'), onConfirmAction: _onResumeClick, onConfirmActionSuccess: fetchData, buttonClassName: b('control'), buttonDisabled: isDisabledResume }, { children: i18n('controls.resume') }))] })) : null] })));
|
23
24
|
};
|
@@ -13,7 +13,7 @@ export class TabletsFilters extends React.Component<any, any, any> {
|
|
13
13
|
setTypeFilter: PropTypes.Requireable<(...args: any[]) => any>;
|
14
14
|
stateFilter: PropTypes.Requireable<any[]>;
|
15
15
|
typeFilter: PropTypes.Requireable<any[]>;
|
16
|
-
error: PropTypes.Requireable<PropTypes.Requireable<
|
16
|
+
error: PropTypes.Requireable<PropTypes.Requireable<object> | PropTypes.Requireable<string>>;
|
17
17
|
setHeader: PropTypes.Requireable<(...args: any[]) => any>;
|
18
18
|
};
|
19
19
|
static renderLoader(): JSX.Element;
|
@@ -56,7 +56,7 @@ declare const _default: import("react-redux").ConnectedComponent<typeof TabletsF
|
|
56
56
|
setTypeFilter: PropTypes.Requireable<(...args: any[]) => any>;
|
57
57
|
stateFilter: PropTypes.Requireable<any[]>;
|
58
58
|
typeFilter: PropTypes.Requireable<any[]>;
|
59
|
-
error: PropTypes.Requireable<PropTypes.Requireable<
|
59
|
+
error: PropTypes.Requireable<PropTypes.Requireable<object> | PropTypes.Requireable<string>>;
|
60
60
|
setHeader: PropTypes.Requireable<(...args: any[]) => any>;
|
61
61
|
}>, "nodes" | "tablets" | "loading" | "wasLoaded" | "error" | "stateFilter" | "typeFilter" | "setStateFilter" | "setTypeFilter" | "clearWasLoadingFlag" | "getTabletsInfo" | "filteredTablets" | "timeoutForRequest">>;
|
62
62
|
export default _default;
|
@@ -3,7 +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
|
6
|
+
import map from 'lodash/map';
|
7
|
+
import isEqual from 'lodash/isEqual';
|
7
8
|
import { Helmet } from 'react-helmet-async';
|
8
9
|
import { Loader, Select } from '@gravity-ui/uikit';
|
9
10
|
import ReactList from 'react-list';
|
@@ -60,11 +61,11 @@ export class TabletsFilters extends React.Component {
|
|
60
61
|
const { nodeFilter, tenantPath } = this.state;
|
61
62
|
const { tablets, filteredTablets, nodes, stateFilter, typeFilter, error } = this.props;
|
62
63
|
const states = tabletStates.map((item) => ({ value: item, content: item }));
|
63
|
-
const types = Array.from(new Set(...[
|
64
|
+
const types = Array.from(new Set(...[map(tablets, (tblt) => tblt.Type)])).map((item) => ({
|
64
65
|
value: item,
|
65
66
|
content: item,
|
66
67
|
}));
|
67
|
-
const nodesForSelect =
|
68
|
+
const nodesForSelect = map(nodes, (node) => ({
|
68
69
|
content: node.Id,
|
69
70
|
value: node.Id,
|
70
71
|
meta: node.Host,
|
@@ -171,9 +172,9 @@ Filters.propTypes = {
|
|
171
172
|
onChangeTypes: PropTypes.func,
|
172
173
|
};
|
173
174
|
const MemoizedFilters = React.memo(Filters, (prevProps, nextProps) => {
|
174
|
-
return (
|
175
|
-
|
176
|
-
|
175
|
+
return (isEqual(prevProps.nodeFilter, nextProps.nodeFilter) &&
|
176
|
+
isEqual(prevProps.stateFilter, nextProps.stateFilter) &&
|
177
|
+
isEqual(prevProps.typeFilter, nextProps.typeFilter));
|
177
178
|
});
|
178
179
|
const mapStateToProps = (state) => {
|
179
180
|
const { nodes, wasLoaded, loading, timeoutForRequest, stateFilter, typeFilter, error } = state.tabletsFilters;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import { useCallback, useMemo, useState } from 'react';
|
3
3
|
import block from 'bem-cn-lite';
|
4
|
-
import
|
4
|
+
import escapeRegExp from 'lodash/escapeRegExp';
|
5
5
|
import DataTable from '@gravity-ui/react-data-table';
|
6
6
|
import { Loader } from '../../../../components/Loader';
|
7
7
|
import { Search } from '../../../../components/Search';
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
3
3
|
import cn from 'bem-cn-lite';
|
4
4
|
import PropTypes from 'prop-types';
|
5
5
|
import { connect } from 'react-redux';
|
6
|
-
import
|
6
|
+
import reduce from 'lodash/reduce';
|
7
7
|
import { Link } from 'react-router-dom';
|
8
8
|
import { Loader, Checkbox } from '@gravity-ui/uikit';
|
9
9
|
import NodeNetwork from './NodeNetwork/NodeNetwork';
|
@@ -60,7 +60,7 @@ class Network extends React.Component {
|
|
60
60
|
};
|
61
61
|
};
|
62
62
|
this.groupNodesByField = (nodes, field) => {
|
63
|
-
return
|
63
|
+
return reduce(nodes, (acc, node) => {
|
64
64
|
if (!acc[node[field]]) {
|
65
65
|
acc[node[field]] = [node];
|
66
66
|
}
|
@@ -4,7 +4,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
4
4
|
import DataTable from '@gravity-ui/react-data-table';
|
5
5
|
import { useAutofetcher, useTypedSelector, useTypedDispatch, useSetting, } from '../../../../utils/hooks';
|
6
6
|
import { DEFAULT_TABLE_SETTINGS, PARTITIONS_HIDDEN_COLUMNS_KEY } from '../../../../utils/constants';
|
7
|
-
import {
|
7
|
+
import { selectNodesMap } from '../../../../store/reducers/nodesList';
|
8
8
|
import { cleanTopicData, getTopic, selectConsumersNames, setDataWasNotLoaded as setTopicDataWasNotLoaded, } from '../../../../store/reducers/topic';
|
9
9
|
import { getPartitions, setDataWasNotLoaded as setPartitionsDataWasNotLoaded, setSelectedConsumer, } from '../../../../store/reducers/partitions/partitions';
|
10
10
|
import { TableSkeleton } from '../../../../components/TableSkeleton/TableSkeleton';
|
@@ -32,7 +32,6 @@ export const Partitions = ({ path }) => {
|
|
32
32
|
useEffect(() => {
|
33
33
|
dispatch(cleanTopicData());
|
34
34
|
dispatch(setTopicDataWasNotLoaded());
|
35
|
-
dispatch(getNodesList());
|
36
35
|
dispatch(getTopic(path));
|
37
36
|
setComponentCurrentPath(path);
|
38
37
|
}, [dispatch, path]);
|
package/dist/containers/Tenant/Diagnostics/Partitions/PartitionsControls/PartitionsControls.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import { useEffect, useMemo, useState } from 'react';
|
3
|
-
import
|
3
|
+
import escapeRegExp from 'lodash/escapeRegExp';
|
4
4
|
import { Select, TableColumnSetup } from '@gravity-ui/uikit';
|
5
5
|
import { Search } from '../../../../../components/Search/Search';
|
6
6
|
import { PARTITIONS_COLUMNS_IDS, PARTITIONS_COLUMNS_TITILES } from '../utils/constants';
|
@@ -1,12 +1,21 @@
|
|
1
1
|
import i18n from '../i18n';
|
2
|
+
const pools = ['IC', 'IO', 'Batch', 'User', 'System'];
|
3
|
+
const getPoolMetricConfig = (poolName) => {
|
4
|
+
return {
|
5
|
+
target: `resources.cpu.${poolName}.usage`,
|
6
|
+
title: poolName,
|
7
|
+
};
|
8
|
+
};
|
2
9
|
export const cpuDashboardConfig = [
|
3
10
|
{
|
4
11
|
title: i18n('charts.cpu-usage'),
|
5
|
-
metrics:
|
6
|
-
|
7
|
-
|
8
|
-
|
12
|
+
metrics: pools.map(getPoolMetricConfig),
|
13
|
+
options: {
|
14
|
+
dataType: 'percent',
|
15
|
+
scaleRange: {
|
16
|
+
min: 0,
|
17
|
+
max: 1,
|
9
18
|
},
|
10
|
-
|
19
|
+
},
|
11
20
|
},
|
12
21
|
];
|
@@ -18,7 +18,7 @@
|
|
18
18
|
"by-size": "by size",
|
19
19
|
"charts.queries-per-second": "Queries per second",
|
20
20
|
"charts.transaction-latency": "Transactions latencies {{percentile}}",
|
21
|
-
"charts.cpu-usage": "CPU
|
21
|
+
"charts.cpu-usage": "CPU usage by pool",
|
22
22
|
"charts.storage-usage": "Tablet storage usage",
|
23
23
|
"charts.memory-usage": "Memory usage",
|
24
24
|
"storage.tablet-storage-title": "Tablet storage",
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import React, { useEffect, useRef, useState } from 'react';
|
3
3
|
import cn from 'bem-cn-lite';
|
4
|
-
import MonacoEditor from '
|
4
|
+
import { MonacoEditor } from '../../../../components/MonacoEditor/MonacoEditor';
|
5
5
|
import JSONTree from 'react-json-inspector';
|
6
6
|
import 'react-json-inspector/json-inspector.css';
|
7
7
|
import { TextOverflow, getYdbPlanNodeShape, getTopology } from '@gravity-ui/paranoid';
|
@@ -12,7 +12,7 @@ import Fullscreen from '../../../../components/Fullscreen/Fullscreen';
|
|
12
12
|
import { QueryExecutionStatus } from '../../../../components/QueryExecutionStatus';
|
13
13
|
import { explainVersions } from '../../../../store/reducers/explainQuery';
|
14
14
|
import { disableFullscreen } from '../../../../store/reducers/fullscreen';
|
15
|
-
import { LANGUAGE_S_EXPRESSION_ID } from '../../../../utils/monaco';
|
15
|
+
import { LANGUAGE_S_EXPRESSION_ID } from '../../../../utils/monaco/s-expression/constants';
|
16
16
|
import { useTypedDispatch, useTypedSelector } from '../../../../utils/hooks';
|
17
17
|
import { PaneVisibilityToggleButtons } from '../../utils/paneVisibilityToggleHelpers';
|
18
18
|
import { renderExplainNode } from './utils';
|
@@ -107,7 +107,9 @@ export function ExplainResult(props) {
|
|
107
107
|
return (_jsxs(React.Fragment, { children: [content, isFullscreen && _jsx(Fullscreen, { children: content })] }));
|
108
108
|
};
|
109
109
|
const renderAstExplain = () => {
|
110
|
-
const content = (_jsx("div", Object.assign({ className: b('ast') }, { children: _jsx(MonacoEditor, { language: LANGUAGE_S_EXPRESSION_ID, value: props.ast, options: EDITOR_OPTIONS, wrappingIndent: "indent"
|
110
|
+
const content = (_jsx("div", Object.assign({ className: b('ast') }, { children: _jsx(MonacoEditor, { language: LANGUAGE_S_EXPRESSION_ID, value: props.ast, options: EDITOR_OPTIONS, wrappingIndent: "indent",
|
111
|
+
// pass noop otherwise it will throw error
|
112
|
+
editorWillUnmount: () => { } }) })));
|
111
113
|
return (_jsxs(React.Fragment, { children: [content, isFullscreen && _jsx(Fullscreen, { children: content })] }));
|
112
114
|
};
|
113
115
|
const renderGraph = () => {
|
@@ -2,8 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useReducer, useRef, useState } from 'react';
|
3
3
|
import { connect } from 'react-redux';
|
4
4
|
import cn from 'bem-cn-lite';
|
5
|
-
import
|
6
|
-
import MonacoEditor from '
|
5
|
+
import throttle from 'lodash/throttle';
|
6
|
+
import { MonacoEditor } from '../../../../components/MonacoEditor/MonacoEditor';
|
7
7
|
import SplitPane from '../../../../components/SplitPane';
|
8
8
|
import { sendExecuteQuery, saveQueryToHistory, goToPreviousQuery, goToNextQuery, setTenantPath, } from '../../../../store/reducers/executeQuery';
|
9
9
|
import { getExplainQuery, getExplainQueryAst } from '../../../../store/reducers/explainQuery';
|
@@ -62,7 +62,7 @@ function QueryEditor(props) {
|
|
62
62
|
editorRef.current.layout();
|
63
63
|
}
|
64
64
|
};
|
65
|
-
const onChangeWindow =
|
65
|
+
const onChangeWindow = throttle(() => {
|
66
66
|
updateEditor();
|
67
67
|
}, 100);
|
68
68
|
updateEditor();
|
@@ -286,7 +286,9 @@ function QueryEditor(props) {
|
|
286
286
|
};
|
287
287
|
return (_jsx("div", Object.assign({ className: b() }, { children: _jsxs(SplitPane, Object.assign({ direction: "vertical", defaultSizePaneKey: DEFAULT_SIZE_RESULT_PANE_KEY, triggerCollapse: resultVisibilityState.triggerCollapse, triggerExpand: resultVisibilityState.triggerExpand, minSize: [0, 52], collapsedSizes: [100, 0], onSplitStartDragAdditional: onSplitStartDragAdditional }, { children: [_jsxs("div", Object.assign({ className: b('pane-wrapper', {
|
288
288
|
top: true,
|
289
|
-
}) }, { children: [_jsx("div", Object.assign({ className: b('monaco-wrapper') }, { children: _jsx("div", Object.assign({ className: b('monaco') }, { children: _jsx(MonacoEditor, { language: "sql", value: executeQuery.input, options: editorOptions, onChange: onChange, editorDidMount: editorDidMount,
|
289
|
+
}) }, { children: [_jsx("div", Object.assign({ className: b('monaco-wrapper') }, { children: _jsx("div", Object.assign({ className: b('monaco') }, { children: _jsx(MonacoEditor, { language: "sql", value: executeQuery.input, options: editorOptions, onChange: onChange, editorDidMount: editorDidMount,
|
290
|
+
// pass noop otherwise it will throw error
|
291
|
+
editorWillUnmount: () => { }, theme: `vs-${theme}` }) })) })), renderControls()] })), _jsx("div", Object.assign({ className: b('pane-wrapper') }, { children: _jsx(Result, { executeQuery: executeQuery, explainQuery: explainQuery, resultVisibilityState: resultVisibilityState, onExpandResultHandler: onExpandResultHandler, onCollapseResultHandler: onCollapseResultHandler, type: type, handleAstQuery: handleAstQuery, theme: theme, resultType: resultType, path: path, showPreview: showPreview }) }))] })) })));
|
290
292
|
}
|
291
293
|
const mapStateToProps = (state) => {
|
292
294
|
return {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import React, { useState } from 'react';
|
3
|
-
import
|
3
|
+
import some from 'lodash/some';
|
4
4
|
import cn from 'bem-cn-lite';
|
5
5
|
import { Dialog, DropdownMenu, TextInput, Button } from '@gravity-ui/uikit';
|
6
6
|
import { setQueryNameToEdit } from '../../../../store/reducers/saveQuery';
|
@@ -28,7 +28,7 @@ function SaveQuery({ savedQueries, onSaveQuery, saveButtonDisabled }) {
|
|
28
28
|
setValidationError(validateQueryName(value));
|
29
29
|
};
|
30
30
|
const validateQueryName = (value) => {
|
31
|
-
if (
|
31
|
+
if (some(savedQueries, (q) => q.name.toLowerCase() === value.trim().toLowerCase())) {
|
32
32
|
return 'This name already exists';
|
33
33
|
}
|
34
34
|
return null;
|
@@ -8,7 +8,6 @@ import { DEFAULT_IS_TENANT_SUMMARY_COLLAPSED, DEFAULT_SIZE_TENANT_KEY } from '..
|
|
8
8
|
import { useTypedSelector, useTypedDispatch } from '../../utils/hooks';
|
9
9
|
import { setHeaderBreadcrumbs } from '../../store/reducers/header/header';
|
10
10
|
import { disableAutorefresh, getSchema } from '../../store/reducers/schema/schema';
|
11
|
-
import { registerYQLCompletionItemProvider } from '../../utils/monaco';
|
12
11
|
import SplitPane from '../../components/SplitPane';
|
13
12
|
import { AccessDenied } from '../../components/Errors/403';
|
14
13
|
import { ObjectSummary } from './ObjectSummary/ObjectSummary';
|
@@ -45,10 +44,16 @@ function Tenant(props) {
|
|
45
44
|
});
|
46
45
|
const { name } = queryParams;
|
47
46
|
const tenantName = name;
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
47
|
+
useEffect(() => {
|
48
|
+
if (tenantName && typeof tenantName === 'string' && previousTenant.current !== tenantName) {
|
49
|
+
const register = async () => {
|
50
|
+
const { registerYQLCompletionItemProvider } = await import('../../utils/monaco/yqlSuggestions/registerCompletionItemProvider');
|
51
|
+
registerYQLCompletionItemProvider(tenantName);
|
52
|
+
};
|
53
|
+
register().catch(console.error);
|
54
|
+
previousTenant.current = tenantName;
|
55
|
+
}
|
56
|
+
}, [tenantName]);
|
52
57
|
useEffect(() => {
|
53
58
|
dispatch(getSchema({ path: tenantName }));
|
54
59
|
}, [tenantName, dispatch]);
|
@@ -7,6 +7,7 @@ import { PoolsGraph } from '../../components/PoolsGraph/PoolsGraph';
|
|
7
7
|
import { TabletsStatistic } from '../../components/TabletsStatistic';
|
8
8
|
import { ProblemFilter } from '../../components/ProblemFilter';
|
9
9
|
import { Illustration } from '../../components/Illustration';
|
10
|
+
import { EntitiesCount } from '../../components/EntitiesCount';
|
10
11
|
import { Search } from '../../components/Search';
|
11
12
|
import { TableWithControlsLayout } from '../../components/TableWithControlsLayout/TableWithControlsLayout';
|
12
13
|
import { ResponseError } from '../../components/Errors/ResponseError';
|
@@ -22,7 +23,7 @@ import './Tenants.scss';
|
|
22
23
|
const b = cn('tenants');
|
23
24
|
export const Tenants = ({ additionalTenantsProps }) => {
|
24
25
|
const dispatch = useTypedDispatch();
|
25
|
-
const { error, loading, wasLoaded } = useTypedSelector((state) => state.tenants);
|
26
|
+
const { error, loading, wasLoaded, tenants } = useTypedSelector((state) => state.tenants);
|
26
27
|
const searchValue = useTypedSelector(selectTenantsSearchValue);
|
27
28
|
const filteredTenants = useTypedSelector(selectFilteredTenants);
|
28
29
|
const problemFilter = useTypedSelector(selectProblemFilter);
|
@@ -36,7 +37,7 @@ export const Tenants = ({ additionalTenantsProps }) => {
|
|
36
37
|
dispatch(setSearchValue(value));
|
37
38
|
};
|
38
39
|
const renderControls = () => {
|
39
|
-
return (_jsxs(_Fragment, { children: [_jsx(Search, { value: searchValue, onChange: handleSearchChange, placeholder: "Database name", className: b('search') }), _jsx(ProblemFilter, { value: problemFilter, onChange: handleProblemFilterChange })] }));
|
40
|
+
return (_jsxs(_Fragment, { children: [_jsx(Search, { value: searchValue, onChange: handleSearchChange, placeholder: "Database name", className: b('search') }), _jsx(ProblemFilter, { value: problemFilter, onChange: handleProblemFilterChange }), _jsx(EntitiesCount, { total: tenants.length, current: (filteredTenants === null || filteredTenants === void 0 ? void 0 : filteredTenants.length) || 0, label: 'Databases', loading: loading && !wasLoaded })] }));
|
40
41
|
};
|
41
42
|
const renderTable = () => {
|
42
43
|
const getTenantBackend = (tenant) => {
|
@@ -0,0 +1,109 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
2
|
+
import { useCallback, useEffect } from 'react';
|
3
|
+
import { StringParam, useQueryParams } from 'use-query-params';
|
4
|
+
import { Helmet } from 'react-helmet-async';
|
5
|
+
import { Icon } from '@gravity-ui/uikit';
|
6
|
+
import ArrowsOppositeToDotsIcon from '@gravity-ui/icons/svgs/arrows-opposite-to-dots.svg';
|
7
|
+
import { cn } from '../../utils/cn';
|
8
|
+
import { getSeverityColor } from '../../utils/disks/helpers';
|
9
|
+
import { stringifyVdiskId } from '../../utils/dataFormatters/dataFormatters';
|
10
|
+
import { valueIsDefined } from '../../utils';
|
11
|
+
import { useAutofetcher, useTypedDispatch, useTypedSelector } from '../../utils/hooks';
|
12
|
+
import { setHeaderBreadcrumbs } from '../../store/reducers/header/header';
|
13
|
+
import { getVDiskData, setVDiskDataWasNotLoaded } from '../../store/reducers/vdisk/vdisk';
|
14
|
+
import { selectNodesMap } from '../../store/reducers/nodesList';
|
15
|
+
import { PageMeta } from '../../components/PageMeta/PageMeta';
|
16
|
+
import { DiskPageTitle } from '../../components/DiskPageTitle/DiskPageTitle';
|
17
|
+
import { GroupInfo } from '../../components/GroupInfo/GroupInfo';
|
18
|
+
import { ButtonWithConfirmDialog } from '../../components/ButtonWithConfirmDialog/ButtonWithConfirmDialog';
|
19
|
+
import { InfoViewerSkeleton } from '../../components/InfoViewerSkeleton/InfoViewerSkeleton';
|
20
|
+
import { VDiskInfo } from '../../components/VDiskInfo/VDiskInfo';
|
21
|
+
import { VDiskWithDonorsStack } from '../../components/VDisk/VDiskWithDonorsStack';
|
22
|
+
import { vDiskPageKeyset } from './i18n';
|
23
|
+
import './VDiskPage.scss';
|
24
|
+
const vDiskPageCn = cn('ydb-vdisk-page');
|
25
|
+
export function VDiskPage() {
|
26
|
+
const dispatch = useTypedDispatch();
|
27
|
+
const nodesMap = useTypedSelector(selectNodesMap);
|
28
|
+
const { vDiskData, groupData, loading, wasLoaded } = useTypedSelector((state) => state.vDisk);
|
29
|
+
const { NodeHost, NodeId, NodeType, NodeDC, PDiskId, PDiskType, Severity, VDiskId } = vDiskData;
|
30
|
+
const [{ nodeId, pDiskId, vDiskSlotId }] = useQueryParams({
|
31
|
+
nodeId: StringParam,
|
32
|
+
pDiskId: StringParam,
|
33
|
+
vDiskSlotId: StringParam,
|
34
|
+
});
|
35
|
+
useEffect(() => {
|
36
|
+
dispatch(setHeaderBreadcrumbs('vDisk', { nodeId, pDiskId, vDiskSlotId }));
|
37
|
+
}, [dispatch, nodeId, pDiskId, vDiskSlotId]);
|
38
|
+
const fetchData = useCallback(async (isBackground) => {
|
39
|
+
if (!isBackground) {
|
40
|
+
dispatch(setVDiskDataWasNotLoaded());
|
41
|
+
}
|
42
|
+
if (valueIsDefined(nodeId) && valueIsDefined(pDiskId) && valueIsDefined(vDiskSlotId)) {
|
43
|
+
return dispatch(getVDiskData({ nodeId, pDiskId, vDiskSlotId }));
|
44
|
+
}
|
45
|
+
return undefined;
|
46
|
+
}, [dispatch, nodeId, pDiskId, vDiskSlotId]);
|
47
|
+
useAutofetcher(fetchData, [fetchData], true);
|
48
|
+
const handleEvictVDisk = async () => {
|
49
|
+
const { GroupID, GroupGeneration, Ring, Domain, VDisk } = VDiskId || {};
|
50
|
+
if (valueIsDefined(GroupID) &&
|
51
|
+
valueIsDefined(GroupGeneration) &&
|
52
|
+
valueIsDefined(Ring) &&
|
53
|
+
valueIsDefined(Domain) &&
|
54
|
+
valueIsDefined(VDisk)) {
|
55
|
+
return window.api.evictVDisk({
|
56
|
+
groupId: GroupID,
|
57
|
+
groupGeneration: GroupGeneration,
|
58
|
+
failRealmIdx: Ring,
|
59
|
+
failDomainIdx: Domain,
|
60
|
+
vDiskIdx: VDisk,
|
61
|
+
});
|
62
|
+
}
|
63
|
+
return undefined;
|
64
|
+
};
|
65
|
+
const handleAfterEvictVDisk = async () => {
|
66
|
+
return fetchData(true);
|
67
|
+
};
|
68
|
+
const renderHelmet = () => {
|
69
|
+
const vDiskPagePart = vDiskSlotId
|
70
|
+
? `${vDiskPageKeyset('vdisk')} ${vDiskSlotId}`
|
71
|
+
: vDiskPageKeyset('vdisk');
|
72
|
+
const pDiskPagePart = pDiskId
|
73
|
+
? `${vDiskPageKeyset('pdisk')} ${pDiskId}`
|
74
|
+
: vDiskPageKeyset('pdisk');
|
75
|
+
const nodePagePart = NodeHost ? NodeHost : vDiskPageKeyset('node');
|
76
|
+
return (_jsx(Helmet, { titleTemplate: `%s - ${vDiskPagePart} - ${pDiskPagePart} — ${nodePagePart} — YDB Monitoring`, defaultTitle: `${vDiskPagePart} - ${pDiskPagePart} — ${nodePagePart} — YDB Monitoring` }));
|
77
|
+
};
|
78
|
+
const renderPageMeta = () => {
|
79
|
+
const hostItem = NodeHost ? `${vDiskPageKeyset('fqdn')}: ${NodeHost}` : undefined;
|
80
|
+
const nodeIdItem = NodeId ? `${vDiskPageKeyset('node')}: ${NodeId}` : undefined;
|
81
|
+
const pDiskIdItem = NodeId ? `${vDiskPageKeyset('pdisk')}: ${PDiskId}` : undefined;
|
82
|
+
return (_jsx(PageMeta, { loading: loading && !wasLoaded, items: [hostItem, nodeIdItem, NodeType, NodeDC, pDiskIdItem, PDiskType] }));
|
83
|
+
};
|
84
|
+
const renderPageTitle = () => {
|
85
|
+
return (_jsx(DiskPageTitle, { entityName: vDiskPageKeyset('vdisk'), status: getSeverityColor(Severity), id: stringifyVdiskId(vDiskData === null || vDiskData === void 0 ? void 0 : vDiskData.VDiskId) }));
|
86
|
+
};
|
87
|
+
const renderControls = () => {
|
88
|
+
return (_jsx("div", { children: _jsxs(ButtonWithConfirmDialog, Object.assign({ onConfirmAction: handleEvictVDisk, onConfirmActionSuccess: handleAfterEvictVDisk, buttonDisabled: !VDiskId, buttonView: "normal", dialogContent: vDiskPageKeyset('evict-vdisk-dialog') }, { children: [_jsx(Icon, { data: ArrowsOppositeToDotsIcon }), vDiskPageKeyset('evict-vdisk-button')] })) }));
|
89
|
+
};
|
90
|
+
const renderInfo = () => {
|
91
|
+
return _jsx(VDiskInfo, { data: vDiskData, isVDiskPage: true });
|
92
|
+
};
|
93
|
+
const renderGroupInfo = () => {
|
94
|
+
var _a;
|
95
|
+
if (groupData) {
|
96
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", Object.assign({ className: vDiskPageCn('group-title') }, { children: vDiskPageKeyset('group') })), _jsx(GroupInfo, { data: groupData }), _jsx("div", Object.assign({ className: vDiskPageCn('group-disks') }, { children: (_a = groupData.VDisks) === null || _a === void 0 ? void 0 : _a.map((vDisk) => {
|
97
|
+
return (_jsx(VDiskWithDonorsStack, { data: vDisk, nodes: nodesMap, className: vDiskPageCn('group-disk') }, stringifyVdiskId(vDisk.VDiskId)));
|
98
|
+
}) }))] }));
|
99
|
+
}
|
100
|
+
return null;
|
101
|
+
};
|
102
|
+
const renderContent = () => {
|
103
|
+
if (loading && !wasLoaded) {
|
104
|
+
return _jsx(InfoViewerSkeleton, { rows: 20 });
|
105
|
+
}
|
106
|
+
return (_jsxs(_Fragment, { children: [renderInfo(), renderGroupInfo()] }));
|
107
|
+
};
|
108
|
+
return (_jsxs("div", Object.assign({ className: vDiskPageCn(null) }, { children: [renderHelmet(), renderPageMeta(), renderPageTitle(), renderControls(), renderContent()] })));
|
109
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
@import '../../styles//mixins.scss';
|
2
|
+
|
3
|
+
.ydb-vdisk-page {
|
4
|
+
position: relative;
|
5
|
+
|
6
|
+
display: flex;
|
7
|
+
overflow: auto;
|
8
|
+
flex-direction: column;
|
9
|
+
|
10
|
+
height: 100%;
|
11
|
+
padding-top: 20px;
|
12
|
+
padding-left: 20px;
|
13
|
+
|
14
|
+
gap: 20px;
|
15
|
+
|
16
|
+
&__group-title {
|
17
|
+
@include header-1-typography();
|
18
|
+
}
|
19
|
+
|
20
|
+
&__group-disks {
|
21
|
+
display: flex;
|
22
|
+
flex-grow: 1;
|
23
|
+
flex-flow: row wrap;
|
24
|
+
|
25
|
+
margin-top: 20px;
|
26
|
+
gap: 10px;
|
27
|
+
}
|
28
|
+
|
29
|
+
&__group-disk {
|
30
|
+
width: 150px;
|
31
|
+
}
|
32
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const vDiskPageKeyset: (key: "node" | "pdisk" | "vdisk" | "group" | "fqdn" | "evict-vdisk-button" | "evict-vdisk-dialog", params?: import("@gravity-ui/i18n").Params | undefined) => string;
|