ydb-embedded-ui 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +8 -0
- package/README.md +28 -0
- package/dist/HOCS/WithSearch/WithSearch.js +26 -0
- package/dist/HOCS/index.js +1 -0
- package/dist/assets/icons/bug.svg +1 -0
- package/dist/assets/icons/close.svg +1 -0
- package/dist/assets/icons/control-menu-button.svg +1 -0
- package/dist/assets/icons/databases.svg +3 -0
- package/dist/assets/icons/dots.svg +1 -0
- package/dist/assets/icons/server.svg +1 -0
- package/dist/assets/icons/settings-with-dot.svg +1 -0
- package/dist/assets/icons/settings.svg +1 -0
- package/dist/assets/icons/signIn.svg +1 -0
- package/dist/assets/icons/signOut.svg +1 -0
- package/dist/assets/icons/star.svg +1 -0
- package/dist/assets/icons/storage.svg +1 -0
- package/dist/assets/icons/support.svg +1 -0
- package/dist/assets/icons/user-check.svg +1 -0
- package/dist/assets/icons/user-secret.svg +1 -0
- package/dist/assets/icons/ydb.svg +4 -0
- package/dist/components/AsideNavigation/AsideHeader.scss +148 -0
- package/dist/components/AsideNavigation/AsideHeader.tsx +388 -0
- package/dist/components/AsideNavigation/AsideHeaderFooterItem/AsideHeaderFooterItem.scss +82 -0
- package/dist/components/AsideNavigation/AsideHeaderFooterItem/AsideHeaderFooterItem.tsx +138 -0
- package/dist/components/AsideNavigation/AsideHeaderFooterSlot/AsideHeaderFooterSlot.tsx +33 -0
- package/dist/components/AsideNavigation/AsideHeaderFooterSlot/SlotsContext.tsx +49 -0
- package/dist/components/AsideNavigation/AsideHeaderTooltip/AsideHeaderTooltip.scss +16 -0
- package/dist/components/AsideNavigation/AsideHeaderTooltip/AsideHeaderTooltip.tsx +37 -0
- package/dist/components/AsideNavigation/CompositeBar/CompositeBar.scss +108 -0
- package/dist/components/AsideNavigation/CompositeBar/CompositeBar.tsx +282 -0
- package/dist/components/AsideNavigation/Content/Content.tsx +35 -0
- package/dist/components/AsideNavigation/Drawer/Drawer.scss +76 -0
- package/dist/components/AsideNavigation/Drawer/Drawer.tsx +134 -0
- package/dist/components/AsideNavigation/Drawer/index.ts +1 -0
- package/dist/components/AsideNavigation/Logo/Logo.scss +44 -0
- package/dist/components/AsideNavigation/Logo/Logo.tsx +82 -0
- package/dist/components/AsideNavigation/Settings/README.md +92 -0
- package/dist/components/AsideNavigation/Settings/Settings.scss +113 -0
- package/dist/components/AsideNavigation/Settings/Settings.tsx +270 -0
- package/dist/components/AsideNavigation/Settings/SettingsMenu/SettingsMenu.scss +70 -0
- package/dist/components/AsideNavigation/Settings/SettingsMenu/SettingsMenu.tsx +141 -0
- package/dist/components/AsideNavigation/Settings/SettingsSearch/SettingsSearch.tsx +57 -0
- package/dist/components/AsideNavigation/Settings/collect-settings.ts +156 -0
- package/dist/components/AsideNavigation/Settings/filter-settings.ts +38 -0
- package/dist/components/AsideNavigation/Settings/helpers.ts +39 -0
- package/dist/components/AsideNavigation/Settings/i18n/en.json +5 -0
- package/dist/components/AsideNavigation/Settings/i18n/index.ts +11 -0
- package/dist/components/AsideNavigation/Settings/i18n/ru.json +5 -0
- package/dist/components/AsideNavigation/Settings/index.ts +1 -0
- package/dist/components/AsideNavigation/constants.ts +28 -0
- package/dist/components/AsideNavigation/helpers.ts +34 -0
- package/dist/components/AsideNavigation/i18n/en.json +4 -0
- package/dist/components/AsideNavigation/i18n/index.ts +11 -0
- package/dist/components/AsideNavigation/i18n/ru.json +4 -0
- package/dist/components/AsideNavigation/icons.ts +32 -0
- package/dist/components/AsideNavigation/types.ts +23 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js +25 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.scss +4 -0
- package/dist/components/ClusterInfo/ClusterInfo.scss +65 -0
- package/dist/components/ClusterInfo/ClusterInfo.tsx +157 -0
- package/dist/components/Collapse/Collapse.js +84 -0
- package/dist/components/Collapse/Collapse.scss +70 -0
- package/dist/components/CriticalActionDialog/CriticalActionDialog.js +53 -0
- package/dist/components/CriticalActionDialog/CriticalActionDialog.scss +31 -0
- package/dist/components/EmptyState/EmptyState.js +48 -0
- package/dist/components/EmptyState/EmptyState.scss +70 -0
- package/dist/components/EntityStatus/EntityStatus.js +96 -0
- package/dist/components/EntityStatus/EntityStatus.scss +81 -0
- package/dist/components/FullGroupViewer/FullGroupViewer.js +149 -0
- package/dist/components/FullGroupViewer/FullGroupViewer.scss +32 -0
- package/dist/components/FullNodeViewer/FullNodeViewer.js +108 -0
- package/dist/components/FullNodeViewer/FullNodeViewer.scss +78 -0
- package/dist/components/GroupTreeViewer/GroupTreeViewer.js +86 -0
- package/dist/components/GroupTreeViewer/GroupTreeViewer.scss +17 -0
- package/dist/components/GroupViewer/GroupViewer.js +100 -0
- package/dist/components/GroupViewer/GroupViewer.scss +41 -0
- package/dist/components/Hotkey/Hotkey.js +102 -0
- package/dist/components/Icon/Icon.js +26 -0
- package/dist/components/InfoViewer/InfoViewer.js +47 -0
- package/dist/components/InfoViewer/InfoViewer.scss +48 -0
- package/dist/components/InternalLink/InternalLink.js +15 -0
- package/dist/components/NodesViewer/NodesViewer.js +183 -0
- package/dist/components/NodesViewer/NodesViewer.scss +66 -0
- package/dist/components/PDiskViewer/PDiskViewer.js +80 -0
- package/dist/components/PDiskViewer/PDiskViewer.scss +40 -0
- package/dist/components/Pagination/Pagination.js +63 -0
- package/dist/components/Pagination/Pagination.scss +25 -0
- package/dist/components/PoolBar/PoolBar.js +52 -0
- package/dist/components/PoolBar/PoolBar.scss +40 -0
- package/dist/components/PoolUsage/PoolUsage.js +54 -0
- package/dist/components/PoolUsage/PoolUsage.scss +65 -0
- package/dist/components/PoolsGraph/PoolsGraph.js +33 -0
- package/dist/components/PoolsGraph/PoolsGraph.scss +3 -0
- package/dist/components/ProblemFilter/ProblemFilter.js +24 -0
- package/dist/components/ProgressViewer/ProgressViewer.js +92 -0
- package/dist/components/ProgressViewer/ProgressViewer.scss +84 -0
- package/dist/components/SplitPane/SplitPane.js +368 -0
- package/dist/components/SplitPane/SplitPane.scss +107 -0
- package/dist/components/SplitPane/index.js +3 -0
- package/dist/components/Tablet/Tablet.js +61 -0
- package/dist/components/Tablet/Tablet.scss +49 -0
- package/dist/components/TabletsStatistic/TabletsStatistic.js +58 -0
- package/dist/components/TabletsStatistic/TabletsStatistic.scss +41 -0
- package/dist/components/TabletsViewer/TabletsViewer.js +44 -0
- package/dist/components/TabletsViewer/TabletsViewer.scss +37 -0
- package/dist/components/Tag/Tag.js +14 -0
- package/dist/components/Tag/Tag.scss +17 -0
- package/dist/components/Tags/Tags.js +36 -0
- package/dist/components/Tags/Tags.scss +5 -0
- package/dist/components/TenantOverview/TenantOverview.js +148 -0
- package/dist/components/TenantOverview/TenantOverview.scss +75 -0
- package/dist/components/TreeView/TreeView.js +60 -0
- package/dist/components/TreeView/TreeView.scss +30 -0
- package/dist/components/TruncatedQuery/TruncatedQuery.js +26 -0
- package/dist/components/TruncatedQuery/TruncatedQuery.scss +12 -0
- package/dist/containers/App/App.js +67 -0
- package/dist/containers/App/App.scss +154 -0
- package/dist/containers/App/Content.js +109 -0
- package/dist/containers/App/TipPopup/TipPopup.js +66 -0
- package/dist/containers/App/TipPopup/TipPopup.scss +42 -0
- package/dist/containers/AppIcons/AppIcons.js +477 -0
- package/dist/containers/AsideNavigation/AsideNavigation.scss +43 -0
- package/dist/containers/AsideNavigation/AsideNavigation.tsx +228 -0
- package/dist/containers/Authentication/Authentication.scss +37 -0
- package/dist/containers/Authentication/Authentication.tsx +89 -0
- package/dist/containers/Cluster/Cluster.js +168 -0
- package/dist/containers/Cluster/Cluster.scss +52 -0
- package/dist/containers/Group/Group.js +97 -0
- package/dist/containers/Group/Group.scss +6 -0
- package/dist/containers/Header/Header.js +88 -0
- package/dist/containers/Header/Header.scss +72 -0
- package/dist/containers/Header/Host/Host.js +66 -0
- package/dist/containers/Header/Host/Host.scss +43 -0
- package/dist/containers/Heatmap/Heatmap.js +246 -0
- package/dist/containers/Heatmap/Heatmap.scss +94 -0
- package/dist/containers/Heatmap/HeatmapCanvas/HeatmapCanvas.js +167 -0
- package/dist/containers/Heatmap/Histogram/Histogram.js +108 -0
- package/dist/containers/Heatmap/Histogram/Histogram.scss +49 -0
- package/dist/containers/Heatmap/util.js +110 -0
- package/dist/containers/Node/Node.js +184 -0
- package/dist/containers/Node/Node.scss +34 -0
- package/dist/containers/Node/NodePages.js +13 -0
- package/dist/containers/Nodes/Nodes.js +193 -0
- package/dist/containers/Nodes/Nodes.scss +50 -0
- package/dist/containers/Pdisk/Pdisk.js +159 -0
- package/dist/containers/Pdisk/Pdisk.scss +40 -0
- package/dist/containers/Pool/Pool.js +169 -0
- package/dist/containers/Pool/Pool.scss +32 -0
- package/dist/containers/ReduxTooltip/ReduxTooltip.js +108 -0
- package/dist/containers/ReduxTooltip/ReduxTooltip.scss +67 -0
- package/dist/containers/StorageV2/DiskStateProgressBar/DiskStateProgressBar.scss +81 -0
- package/dist/containers/StorageV2/DiskStateProgressBar/DiskStateProgressBar.tsx +56 -0
- package/dist/containers/StorageV2/Pdisk/Pdisk.scss +32 -0
- package/dist/containers/StorageV2/Pdisk/Pdisk.tsx +167 -0
- package/dist/containers/StorageV2/Storage.js +249 -0
- package/dist/containers/StorageV2/Storage.scss +57 -0
- package/dist/containers/StorageV2/StorageFilter/StorageFilter.js +39 -0
- package/dist/containers/StorageV2/StorageGroups/StorageGroups.scss +26 -0
- package/dist/containers/StorageV2/StorageGroups/StorageGroups.tsx +234 -0
- package/dist/containers/StorageV2/StorageNodes/StorageNodes.scss +30 -0
- package/dist/containers/StorageV2/StorageNodes/StorageNodes.tsx +135 -0
- package/dist/containers/StorageV2/Vdisk/Vdisk.js +250 -0
- package/dist/containers/StorageV2/Vdisk/Vdisk.scss +32 -0
- package/dist/containers/Tablet/Tablet.js +453 -0
- package/dist/containers/Tablet/Tablet.scss +88 -0
- package/dist/containers/Tablets/Tablets.js +306 -0
- package/dist/containers/Tablets/Tablets.scss +77 -0
- package/dist/containers/TabletsFilters/TabletsFilters.js +412 -0
- package/dist/containers/TabletsFilters/TabletsFilters.scss +104 -0
- package/dist/containers/Tenant/Acl/Acl.js +149 -0
- package/dist/containers/Tenant/Acl/Acl.scss +34 -0
- package/dist/containers/Tenant/Compute/Compute.js +110 -0
- package/dist/containers/Tenant/Compute/Compute.scss +6 -0
- package/dist/containers/Tenant/Describe/Describe.js +81 -0
- package/dist/containers/Tenant/Describe/Describe.scss +25 -0
- package/dist/containers/Tenant/Healthcheck/Healthcheck.js +116 -0
- package/dist/containers/Tenant/Healthcheck/Healthcheck.scss +64 -0
- package/dist/containers/Tenant/Healthcheck/IssuesViewer/IssueViewer.scss +164 -0
- package/dist/containers/Tenant/Healthcheck/IssuesViewer/IssuesViewer.js +185 -0
- package/dist/containers/Tenant/Network/Network.js +341 -0
- package/dist/containers/Tenant/Network/Network.scss +145 -0
- package/dist/containers/Tenant/Network/NodeNetwork/NodeNetwork.js +71 -0
- package/dist/containers/Tenant/Network/NodeNetwork/NodeNetwork.scss +52 -0
- package/dist/containers/Tenant/Preview/Preview.js +169 -0
- package/dist/containers/Tenant/Preview/Preview.scss +20 -0
- package/dist/containers/Tenant/QueryEditor/QueryEditor.js +649 -0
- package/dist/containers/Tenant/QueryEditor/QueryEditor.scss +71 -0
- package/dist/containers/Tenant/QueryEditor/QueryExplain/QueryExplain.js +168 -0
- package/dist/containers/Tenant/QueryEditor/QueryExplain/QueryExplain.scss +42 -0
- package/dist/containers/Tenant/QueryEditor/QueryResult/QueryResult.js +58 -0
- package/dist/containers/Tenant/QueryEditor/QueryResult/QueryResult.scss +24 -0
- package/dist/containers/Tenant/QueryEditor/SaveQuery/SaveQuery.js +171 -0
- package/dist/containers/Tenant/QueryEditor/SaveQuery/SaveQuery.scss +51 -0
- package/dist/containers/Tenant/QueryEditor/SavedQueries/SavedQueries.js +156 -0
- package/dist/containers/Tenant/QueryEditor/SavedQueries/SavedQueries.scss +82 -0
- package/dist/containers/Tenant/Schema/HotKeys/HotKeys.js +149 -0
- package/dist/containers/Tenant/Schema/HotKeys/HotKeys.scss +48 -0
- package/dist/containers/Tenant/Schema/Info/Info.js +84 -0
- package/dist/containers/Tenant/Schema/Info/Info.scss +3 -0
- package/dist/containers/Tenant/Schema/SchemaInfoViewer/SchemaInfoViewer.js +67 -0
- package/dist/containers/Tenant/Schema/SchemaInfoViewer/SchemaInfoViewer.scss +21 -0
- package/dist/containers/Tenant/Schema/SchemaMain/SchemaMain.js +439 -0
- package/dist/containers/Tenant/Schema/SchemaMain/SchemaMain.scss +90 -0
- package/dist/containers/Tenant/Schema/SchemaNode/SchemaNode.js +150 -0
- package/dist/containers/Tenant/Schema/SchemaNode/SchemaNode.scss +41 -0
- package/dist/containers/Tenant/Schema/SchemaPages.js +56 -0
- package/dist/containers/Tenant/Schema/SchemaTree/SchemaTree.js +115 -0
- package/dist/containers/Tenant/Schema/SchemaTree/SchemaTree.scss +13 -0
- package/dist/containers/Tenant/Schema/SchemaViewer/SchemaViewer.js +63 -0
- package/dist/containers/Tenant/Schema/SchemaViewer/SchemaViewer.scss +28 -0
- package/dist/containers/Tenant/Tenant.js +199 -0
- package/dist/containers/Tenant/Tenant.scss +94 -0
- package/dist/containers/Tenant/TenantPages.js +35 -0
- package/dist/containers/Tenant/TopQueries/TopQueries.js +184 -0
- package/dist/containers/Tenant/TopQueries/TopQueries.scss +53 -0
- package/dist/containers/Tenant/TopShards/TopShards.js +171 -0
- package/dist/containers/Tenant/TopShards/TopShards.scss +23 -0
- package/dist/containers/Tenants/Tenants.js +375 -0
- package/dist/containers/Tenants/Tenants.scss +73 -0
- package/dist/containers/UserSettings/UserSettings.tsx +57 -0
- package/dist/containers/Vdisk/Vdisk.js +160 -0
- package/dist/containers/Vdisk/Vdisk.scss +40 -0
- package/dist/containers/VdiskPdiskNode/VdiskPdiskNode.js +528 -0
- package/dist/containers/VdiskPdiskNode/VdiskPdiskNode.scss +60 -0
- package/dist/contexts/HistoryContext.ts +6 -0
- package/dist/index.css +11 -0
- package/dist/index.js +28 -0
- package/dist/index.test.js +5 -0
- package/dist/react-app-env.d.ts +1 -0
- package/dist/reportWebVitals.js +13 -0
- package/dist/routes.js +40 -0
- package/dist/services/api.js +224 -0
- package/dist/setupTests.js +5 -0
- package/dist/store/index.js +61 -0
- package/dist/store/reducers/authentication.js +77 -0
- package/dist/store/reducers/cluster.js +52 -0
- package/dist/store/reducers/clusterInfo.js +48 -0
- package/dist/store/reducers/clusterNodes.js +70 -0
- package/dist/store/reducers/describe.js +45 -0
- package/dist/store/reducers/executeQuery.js +158 -0
- package/dist/store/reducers/executeTopQueries.js +69 -0
- package/dist/store/reducers/explainQuery.js +174 -0
- package/dist/store/reducers/group.js +49 -0
- package/dist/store/reducers/healthcheckInfo.js +45 -0
- package/dist/store/reducers/heatmap.js +105 -0
- package/dist/store/reducers/host.js +44 -0
- package/dist/store/reducers/hotKeys.js +57 -0
- package/dist/store/reducers/index.js +78 -0
- package/dist/store/reducers/network.js +45 -0
- package/dist/store/reducers/node.js +42 -0
- package/dist/store/reducers/nodes.js +58 -0
- package/dist/store/reducers/olapStats.js +74 -0
- package/dist/store/reducers/pdisk.js +51 -0
- package/dist/store/reducers/pool.js +42 -0
- package/dist/store/reducers/preview.js +73 -0
- package/dist/store/reducers/schema.js +95 -0
- package/dist/store/reducers/schemaAcl.js +44 -0
- package/dist/store/reducers/settings.js +76 -0
- package/dist/store/reducers/shardsWorkload.js +75 -0
- package/dist/store/reducers/storage.js +280 -0
- package/dist/store/reducers/tablet.js +94 -0
- package/dist/store/reducers/tablets.js +90 -0
- package/dist/store/reducers/tabletsFilters.js +126 -0
- package/dist/store/reducers/tenant.js +76 -0
- package/dist/store/reducers/tenants.js +61 -0
- package/dist/store/reducers/tooltip.js +64 -0
- package/dist/store/reducers/vdisk.js +49 -0
- package/dist/store/state-url-mapping.js +133 -0
- package/dist/store/utils.js +55 -0
- package/dist/styles/mixins.scss +254 -0
- package/dist/styles/react-treeview.scss +45 -0
- package/dist/types/assets.d.ts +12 -0
- package/dist/types/react-list.d.ts +4 -0
- package/dist/types/window.d.ts +33 -0
- package/dist/utils/actionsConstants.js +4 -0
- package/dist/utils/constants.js +126 -0
- package/dist/utils/getNodesColumns.js +156 -0
- package/dist/utils/i18n/i18n.ts +7 -0
- package/dist/utils/i18n/index.ts +1 -0
- package/dist/utils/index.js +136 -0
- package/dist/utils/monaco.js +69 -0
- package/dist/utils/prepareQueryExplain.ts +101 -0
- package/dist/utils/tooltip.js +197 -0
- package/dist/utils/utils.js +75 -0
- package/package.json +89 -0
@@ -0,0 +1,75 @@
|
|
1
|
+
import {createRequestActionTypes, createApiRequest} from '../utils';
|
2
|
+
import '../../services/api';
|
3
|
+
|
4
|
+
const SEND_SHARD_QUERY = createRequestActionTypes('query', 'SEND_SHARD_QUERY');
|
5
|
+
const SET_SHARD_QUERY_OPTIONS = createRequestActionTypes('query', 'SET_SHARD_QUERY_OPTIONS');
|
6
|
+
|
7
|
+
const initialState = {
|
8
|
+
loading: false,
|
9
|
+
wasLoaded: false,
|
10
|
+
};
|
11
|
+
|
12
|
+
function createShardQuery(path) {
|
13
|
+
return `SELECT Path, TabletId, CPUCores FROM \`.sys/partition_stats\` WHERE Path='${path}' OR Path LIKE '${path}/%' ORDER BY CPUCores DESC LIMIT 20`;
|
14
|
+
}
|
15
|
+
|
16
|
+
const queryAction = 'execute-scan';
|
17
|
+
|
18
|
+
const shardsWorkload = (state = initialState, action) => {
|
19
|
+
switch (action.type) {
|
20
|
+
case SEND_SHARD_QUERY.REQUEST: {
|
21
|
+
return {
|
22
|
+
...state,
|
23
|
+
loading: true,
|
24
|
+
error: undefined,
|
25
|
+
};
|
26
|
+
}
|
27
|
+
case SEND_SHARD_QUERY.SUCCESS: {
|
28
|
+
return {
|
29
|
+
...state,
|
30
|
+
data: action.data,
|
31
|
+
loading: false,
|
32
|
+
error: undefined,
|
33
|
+
wasLoaded: true,
|
34
|
+
};
|
35
|
+
}
|
36
|
+
// 401 Unauthorized error is handled by GenericAPI
|
37
|
+
case SEND_SHARD_QUERY.FAILURE: {
|
38
|
+
return {
|
39
|
+
...state,
|
40
|
+
error: action.error || 'Unauthorized',
|
41
|
+
loading: false,
|
42
|
+
};
|
43
|
+
}
|
44
|
+
case SET_SHARD_QUERY_OPTIONS:
|
45
|
+
return {
|
46
|
+
...state,
|
47
|
+
...action.data,
|
48
|
+
};
|
49
|
+
default:
|
50
|
+
return state;
|
51
|
+
}
|
52
|
+
};
|
53
|
+
|
54
|
+
export const sendShardQuery = ({database, path = ''}) => {
|
55
|
+
return createApiRequest({
|
56
|
+
request: window.api.sendQuery(createShardQuery(path), database, queryAction),
|
57
|
+
actions: SEND_SHARD_QUERY,
|
58
|
+
dataHandler: (result) => {
|
59
|
+
if (result && typeof result === 'string') {
|
60
|
+
throw 'Unexpected token in JSON.';
|
61
|
+
}
|
62
|
+
|
63
|
+
return result;
|
64
|
+
},
|
65
|
+
});
|
66
|
+
};
|
67
|
+
|
68
|
+
export function setShardQueryOptions(options) {
|
69
|
+
return {
|
70
|
+
type: SET_SHARD_QUERY_OPTIONS,
|
71
|
+
data: options,
|
72
|
+
};
|
73
|
+
}
|
74
|
+
|
75
|
+
export default shardsWorkload;
|
@@ -0,0 +1,280 @@
|
|
1
|
+
import {createRequestActionTypes, createApiRequest} from '../utils';
|
2
|
+
import '../../services/api';
|
3
|
+
import _ from 'lodash';
|
4
|
+
import {createSelector} from 'reselect';
|
5
|
+
import {calcUptime} from '../../utils';
|
6
|
+
|
7
|
+
export const VisibleEntities = {
|
8
|
+
All: 'All',
|
9
|
+
Missing: 'Missing',
|
10
|
+
Space: 'Space',
|
11
|
+
};
|
12
|
+
|
13
|
+
export const StorageTypes = {
|
14
|
+
groups: 'Groups',
|
15
|
+
nodes: 'Nodes',
|
16
|
+
};
|
17
|
+
|
18
|
+
const FETCH_STORAGE = createRequestActionTypes('storage', 'FETCH_STORAGE');
|
19
|
+
const SET_INITIAL = 'storage/SET_INITIAL';
|
20
|
+
const SET_FILTER = 'storage/SET_FILTER';
|
21
|
+
const SET_VISIBLE_GROUPS = 'storage/SET_VISIBLE_GROUPS';
|
22
|
+
const SET_STORAGE_TYPE = 'storage/SET_STORAGE_TYPE';
|
23
|
+
|
24
|
+
const initialState = {
|
25
|
+
loading: true,
|
26
|
+
wasLoaded: false,
|
27
|
+
filter: '',
|
28
|
+
visible: VisibleEntities.Missing,
|
29
|
+
type: StorageTypes.groups,
|
30
|
+
};
|
31
|
+
|
32
|
+
const storage = function z(state = initialState, action) {
|
33
|
+
switch (action.type) {
|
34
|
+
case FETCH_STORAGE.REQUEST: {
|
35
|
+
return {
|
36
|
+
...state,
|
37
|
+
loading: true,
|
38
|
+
};
|
39
|
+
}
|
40
|
+
case FETCH_STORAGE.SUCCESS: {
|
41
|
+
return {
|
42
|
+
...state,
|
43
|
+
data: action.data,
|
44
|
+
loading: false,
|
45
|
+
wasLoaded: true,
|
46
|
+
error: undefined,
|
47
|
+
};
|
48
|
+
}
|
49
|
+
case FETCH_STORAGE.FAILURE: {
|
50
|
+
return {
|
51
|
+
...state,
|
52
|
+
error: action.error,
|
53
|
+
loading: false,
|
54
|
+
};
|
55
|
+
}
|
56
|
+
case SET_INITIAL: {
|
57
|
+
return {
|
58
|
+
...initialState,
|
59
|
+
};
|
60
|
+
}
|
61
|
+
case SET_FILTER: {
|
62
|
+
return {
|
63
|
+
...state,
|
64
|
+
filter: action.data,
|
65
|
+
};
|
66
|
+
}
|
67
|
+
case SET_VISIBLE_GROUPS: {
|
68
|
+
return {
|
69
|
+
...state,
|
70
|
+
visible: action.data,
|
71
|
+
};
|
72
|
+
}
|
73
|
+
case SET_STORAGE_TYPE: {
|
74
|
+
return {
|
75
|
+
...state,
|
76
|
+
type: action.data,
|
77
|
+
wasLoaded: false,
|
78
|
+
};
|
79
|
+
}
|
80
|
+
default:
|
81
|
+
return state;
|
82
|
+
}
|
83
|
+
};
|
84
|
+
|
85
|
+
export function setInitialState() {
|
86
|
+
return {
|
87
|
+
type: SET_INITIAL,
|
88
|
+
};
|
89
|
+
}
|
90
|
+
|
91
|
+
export function getStorageInfo({tenant, filter, nodeId, type}) {
|
92
|
+
return createApiRequest({
|
93
|
+
request: window.api.getStorageInfo({tenant, filter, nodeId, type}),
|
94
|
+
actions: FETCH_STORAGE,
|
95
|
+
});
|
96
|
+
}
|
97
|
+
|
98
|
+
export function setStorageType(value) {
|
99
|
+
return {
|
100
|
+
type: SET_STORAGE_TYPE,
|
101
|
+
data: value,
|
102
|
+
};
|
103
|
+
}
|
104
|
+
|
105
|
+
export function setStorageFilter(value) {
|
106
|
+
return {
|
107
|
+
type: SET_FILTER,
|
108
|
+
data: value,
|
109
|
+
};
|
110
|
+
}
|
111
|
+
export function setVisibleEntities(value) {
|
112
|
+
return {
|
113
|
+
type: SET_VISIBLE_GROUPS,
|
114
|
+
data: value,
|
115
|
+
};
|
116
|
+
}
|
117
|
+
|
118
|
+
export const getStoragePools = (state) => state.storage.data?.StoragePools;
|
119
|
+
export const getStorageNodes = (state) => state.storage.data?.Nodes;
|
120
|
+
export const getStorageFilter = (state) => state.storage.filter;
|
121
|
+
export const getVisibleEntities = (state) => state.storage.visible;
|
122
|
+
export const getStorageType = (state) => state.storage.type;
|
123
|
+
export const getNodesObject = (state) =>
|
124
|
+
_.reduce(
|
125
|
+
state.nodesList?.data,
|
126
|
+
(acc, el) => {
|
127
|
+
acc[el.NodeId] = el.Host;
|
128
|
+
return acc;
|
129
|
+
},
|
130
|
+
{},
|
131
|
+
);
|
132
|
+
|
133
|
+
const FLAGS_POINTS = {
|
134
|
+
Green: 1,
|
135
|
+
Yellow: 100,
|
136
|
+
Orange: 10_000,
|
137
|
+
Red: 1_000_000,
|
138
|
+
};
|
139
|
+
export const getFlatListStorageGroups = createSelector([getStoragePools], (storagePools) => {
|
140
|
+
return _.reduce(
|
141
|
+
storagePools,
|
142
|
+
(acc, pool) => {
|
143
|
+
const groups = _.reduce(
|
144
|
+
pool.Groups,
|
145
|
+
(acc, group) => {
|
146
|
+
const missing = _.filter(group.VDisks, (v) => {
|
147
|
+
return !v.Replicated || v.PDisk.State !== 'Normal' || v.VDiskState !== 'OK';
|
148
|
+
}).length;
|
149
|
+
|
150
|
+
const UsedSpaceFlag = _.reduce(
|
151
|
+
group.VDisks,
|
152
|
+
(acc, v) => {
|
153
|
+
if (v.DiskSpace) {
|
154
|
+
acc += FLAGS_POINTS[v.DiskSpace];
|
155
|
+
}
|
156
|
+
return acc;
|
157
|
+
},
|
158
|
+
0,
|
159
|
+
);
|
160
|
+
|
161
|
+
const usedSpaceBytes = _.reduce(
|
162
|
+
group.VDisks,
|
163
|
+
(acc, vDisk) => {
|
164
|
+
return acc + (Number(vDisk.AllocatedSize) || 0);
|
165
|
+
},
|
166
|
+
0,
|
167
|
+
);
|
168
|
+
const limitSizeBytes = _.reduce(
|
169
|
+
group.VDisks,
|
170
|
+
(acc, vDisk) => {
|
171
|
+
return (
|
172
|
+
acc +
|
173
|
+
(Number(vDisk.AvailableSize) ||
|
174
|
+
Number(vDisk.PDisk?.AvailableSize) ||
|
175
|
+
0) +
|
176
|
+
(Number(vDisk.AllocatedSize) || 0)
|
177
|
+
);
|
178
|
+
},
|
179
|
+
0,
|
180
|
+
);
|
181
|
+
const readSpeedBytesPerSec = _.reduce(
|
182
|
+
group.VDisks,
|
183
|
+
(acc, vDisk) => {
|
184
|
+
return acc + (Number(vDisk.ReadThroughput) || 0);
|
185
|
+
},
|
186
|
+
0,
|
187
|
+
);
|
188
|
+
const writeSpeedBytesPerSec = _.reduce(
|
189
|
+
group.VDisks,
|
190
|
+
(acc, vDisk) => {
|
191
|
+
return acc + (Number(vDisk.WriteThroughput) || 0);
|
192
|
+
},
|
193
|
+
0,
|
194
|
+
);
|
195
|
+
return [
|
196
|
+
...acc,
|
197
|
+
{
|
198
|
+
...group,
|
199
|
+
Read: readSpeedBytesPerSec,
|
200
|
+
Write: writeSpeedBytesPerSec,
|
201
|
+
PoolName: pool.Name,
|
202
|
+
Used: usedSpaceBytes,
|
203
|
+
Limit: limitSizeBytes,
|
204
|
+
Missing: missing,
|
205
|
+
UsedSpaceFlag,
|
206
|
+
},
|
207
|
+
];
|
208
|
+
},
|
209
|
+
[],
|
210
|
+
);
|
211
|
+
return [...acc, ...groups];
|
212
|
+
},
|
213
|
+
[],
|
214
|
+
);
|
215
|
+
});
|
216
|
+
|
217
|
+
export const getFlatListStorageNodes = createSelector([getStorageNodes], (storageNodes) => {
|
218
|
+
return _.map(storageNodes, (node) => {
|
219
|
+
const systemState = node.SystemState ?? {};
|
220
|
+
const missing = _.filter(node.PDisks, (p) => {
|
221
|
+
return p.State !== 'Normal';
|
222
|
+
}).length;
|
223
|
+
return {
|
224
|
+
NodeId: node.NodeId,
|
225
|
+
FQDN: systemState.Host,
|
226
|
+
uptime: calcUptime(systemState.StartTime),
|
227
|
+
StartTime: systemState.StartTime,
|
228
|
+
PDisks: node.PDisks,
|
229
|
+
Missing: missing,
|
230
|
+
};
|
231
|
+
});
|
232
|
+
});
|
233
|
+
|
234
|
+
export const getFlatListStorage = createSelector(
|
235
|
+
[getStorageType, getFlatListStorageGroups, getFlatListStorageNodes],
|
236
|
+
(storageType, groupsList, nodesList) => {
|
237
|
+
if (storageType === StorageTypes.groups) {
|
238
|
+
return groupsList;
|
239
|
+
}
|
240
|
+
return nodesList;
|
241
|
+
},
|
242
|
+
);
|
243
|
+
|
244
|
+
export const getVisibleEntitiesList = createSelector(
|
245
|
+
[getVisibleEntities, getFlatListStorage],
|
246
|
+
(visibleGroups, storageList) => {
|
247
|
+
if (visibleGroups === VisibleEntities.All) {
|
248
|
+
return storageList;
|
249
|
+
} else if (visibleGroups === VisibleEntities.Missing) {
|
250
|
+
return _.filter(storageList, (g) => g.Missing > 0);
|
251
|
+
} else {
|
252
|
+
return _.filter(storageList, (g) => g.UsedSpaceFlag > 100);
|
253
|
+
}
|
254
|
+
},
|
255
|
+
);
|
256
|
+
|
257
|
+
export const getFilteredEntities = createSelector(
|
258
|
+
[getStorageFilter, getStorageType, getVisibleEntitiesList],
|
259
|
+
(filter, type, entities) => {
|
260
|
+
const cleanedFilter = filter.trim().toLowerCase();
|
261
|
+
if (!cleanedFilter) {
|
262
|
+
return entities;
|
263
|
+
} else {
|
264
|
+
return _.filter(entities, (e) => {
|
265
|
+
if (type === StorageTypes.groups) {
|
266
|
+
return (
|
267
|
+
e.PoolName.toLowerCase().includes(cleanedFilter) ||
|
268
|
+
e.GroupID?.toString().includes(cleanedFilter)
|
269
|
+
);
|
270
|
+
}
|
271
|
+
return (
|
272
|
+
e.NodeId.toString().includes(cleanedFilter) ||
|
273
|
+
e.FQDN.toLowerCase().includes(cleanedFilter)
|
274
|
+
);
|
275
|
+
});
|
276
|
+
}
|
277
|
+
},
|
278
|
+
);
|
279
|
+
|
280
|
+
export default storage;
|
@@ -0,0 +1,94 @@
|
|
1
|
+
import {createRequestActionTypes, createApiRequest} from '../utils';
|
2
|
+
import '../../services/api';
|
3
|
+
import _ from 'lodash';
|
4
|
+
|
5
|
+
const FETCH_TABLET = createRequestActionTypes('TABLET', 'FETCH_TABLET');
|
6
|
+
const FETCH_TABLET_DESCRIBE = createRequestActionTypes('TABLET', 'FETCH_TABLET_DESCRIBE');
|
7
|
+
|
8
|
+
const tablet = (state = {loading: false, tenantPath: '-'}, action) => {
|
9
|
+
switch (action.type) {
|
10
|
+
case FETCH_TABLET.REQUEST: {
|
11
|
+
return {
|
12
|
+
...state,
|
13
|
+
loading: true,
|
14
|
+
};
|
15
|
+
}
|
16
|
+
case FETCH_TABLET.SUCCESS: {
|
17
|
+
const {tablet, history} = action.data;
|
18
|
+
const {TabletId: id} = tablet;
|
19
|
+
return {
|
20
|
+
...state,
|
21
|
+
id,
|
22
|
+
data: tablet,
|
23
|
+
history,
|
24
|
+
loading: false,
|
25
|
+
error: undefined,
|
26
|
+
};
|
27
|
+
}
|
28
|
+
case FETCH_TABLET.FAILURE: {
|
29
|
+
return {
|
30
|
+
...state,
|
31
|
+
error: action.error,
|
32
|
+
loading: false,
|
33
|
+
};
|
34
|
+
}
|
35
|
+
case FETCH_TABLET_DESCRIBE.SUCCESS: {
|
36
|
+
const {tenantPath} = action.data;
|
37
|
+
|
38
|
+
return {
|
39
|
+
...state,
|
40
|
+
tenantPath,
|
41
|
+
error: undefined,
|
42
|
+
};
|
43
|
+
}
|
44
|
+
default:
|
45
|
+
return state;
|
46
|
+
}
|
47
|
+
};
|
48
|
+
|
49
|
+
export const getTablet = (id) => {
|
50
|
+
return createApiRequest({
|
51
|
+
request: Promise.all([window.api.getTablet({id}), window.api.getTabletHistory({id})]),
|
52
|
+
actions: FETCH_TABLET,
|
53
|
+
dataHandler: ([tabletData, history]) => {
|
54
|
+
const historyData = Object.keys(history).reduce((list, nodeId) => {
|
55
|
+
const tabletInfo = history[nodeId]?.TabletStateInfo;
|
56
|
+
if (tabletInfo && tabletInfo.length) {
|
57
|
+
const leaderTablet =
|
58
|
+
_.find(tabletInfo, (t) => t.Master || t.Leader) || tabletInfo[0];
|
59
|
+
const {ChangeTime, Generation, State, Master, SlaveId, Leader, FollowerId} =
|
60
|
+
leaderTablet;
|
61
|
+
list.push({
|
62
|
+
nodeId,
|
63
|
+
generation: Generation,
|
64
|
+
changeTime: ChangeTime,
|
65
|
+
state: State,
|
66
|
+
leader: Master || Leader,
|
67
|
+
followerId: SlaveId || FollowerId,
|
68
|
+
});
|
69
|
+
}
|
70
|
+
return list;
|
71
|
+
}, []);
|
72
|
+
|
73
|
+
const {TabletStateInfo = []} = tabletData;
|
74
|
+
const [tablet = {}] = TabletStateInfo;
|
75
|
+
|
76
|
+
return {tablet, history: historyData};
|
77
|
+
},
|
78
|
+
});
|
79
|
+
};
|
80
|
+
|
81
|
+
export const getTabletDescribe = (TenantId) => {
|
82
|
+
return createApiRequest({
|
83
|
+
request: window.api.getTabletDescribe(TenantId),
|
84
|
+
actions: FETCH_TABLET_DESCRIBE,
|
85
|
+
dataHandler: (tabletDescribe) => {
|
86
|
+
const {SchemeShard, PathId} = TenantId;
|
87
|
+
const tenantPath = tabletDescribe.Path || `${SchemeShard}:${PathId}`;
|
88
|
+
|
89
|
+
return {tenantPath};
|
90
|
+
},
|
91
|
+
});
|
92
|
+
};
|
93
|
+
|
94
|
+
export default tablet;
|
@@ -0,0 +1,90 @@
|
|
1
|
+
import {createRequestActionTypes, createApiRequest} from '../utils';
|
2
|
+
import '../../services/api';
|
3
|
+
import {AUTO_RELOAD_INTERVAL} from '../../utils/constants';
|
4
|
+
|
5
|
+
const FETCH_TABLETS = createRequestActionTypes('tablets', 'FETCH_TABLETS');
|
6
|
+
|
7
|
+
const initialState = {
|
8
|
+
loading: true,
|
9
|
+
wasLoaded: false,
|
10
|
+
stateFilter: [],
|
11
|
+
typeFilter: [],
|
12
|
+
};
|
13
|
+
|
14
|
+
const tablets = function z(state = initialState, action) {
|
15
|
+
switch (action.type) {
|
16
|
+
case FETCH_TABLETS.REQUEST: {
|
17
|
+
return {
|
18
|
+
...state,
|
19
|
+
loading: true,
|
20
|
+
requestTime: new Date().getTime(),
|
21
|
+
};
|
22
|
+
}
|
23
|
+
case FETCH_TABLETS.SUCCESS: {
|
24
|
+
const timeout = new Date().getTime() - state.requestTime;
|
25
|
+
return {
|
26
|
+
...state,
|
27
|
+
data: action.data,
|
28
|
+
loading: false,
|
29
|
+
timeoutForRequest: timeout > AUTO_RELOAD_INTERVAL ? timeout : AUTO_RELOAD_INTERVAL,
|
30
|
+
error: undefined,
|
31
|
+
wasLoaded: true,
|
32
|
+
};
|
33
|
+
}
|
34
|
+
case FETCH_TABLETS.FAILURE: {
|
35
|
+
return {
|
36
|
+
...state,
|
37
|
+
error: action.error,
|
38
|
+
loading: false,
|
39
|
+
};
|
40
|
+
}
|
41
|
+
case 'CLEAR_WAS_LOADING_TABLETS': {
|
42
|
+
return {
|
43
|
+
...state,
|
44
|
+
wasLoaded: false,
|
45
|
+
loading: true,
|
46
|
+
};
|
47
|
+
}
|
48
|
+
case 'SET_STATE_FILTER': {
|
49
|
+
return {
|
50
|
+
...state,
|
51
|
+
stateFilter: action.data,
|
52
|
+
};
|
53
|
+
}
|
54
|
+
case 'SET_TYPE_FILTER': {
|
55
|
+
return {
|
56
|
+
...state,
|
57
|
+
typeFilter: action.data,
|
58
|
+
};
|
59
|
+
}
|
60
|
+
default:
|
61
|
+
return state;
|
62
|
+
}
|
63
|
+
};
|
64
|
+
|
65
|
+
export const setStateFilter = (stateFilter) => {
|
66
|
+
return {
|
67
|
+
type: 'SET_STATE_FILTER',
|
68
|
+
data: stateFilter,
|
69
|
+
};
|
70
|
+
};
|
71
|
+
|
72
|
+
export const setTypeFilter = (typeFilter) => {
|
73
|
+
return {
|
74
|
+
type: 'SET_TYPE_FILTER',
|
75
|
+
data: typeFilter,
|
76
|
+
};
|
77
|
+
};
|
78
|
+
|
79
|
+
export const clearWasLoadingFlag = () => ({
|
80
|
+
type: 'CLEAR_WAS_LOADING_TABLETS',
|
81
|
+
});
|
82
|
+
|
83
|
+
export function getTabletsInfo(data) {
|
84
|
+
return createApiRequest({
|
85
|
+
request: window.api.getTabletsInfo(data),
|
86
|
+
actions: FETCH_TABLETS,
|
87
|
+
});
|
88
|
+
}
|
89
|
+
|
90
|
+
export default tablets;
|
@@ -0,0 +1,126 @@
|
|
1
|
+
import {createSelector} from 'reselect';
|
2
|
+
import {createRequestActionTypes, createApiRequest} from '../utils';
|
3
|
+
import '../../services/api';
|
4
|
+
import {AUTO_RELOAD_INTERVAL} from '../../utils/constants';
|
5
|
+
|
6
|
+
const FETCH_TABLETS_FILTERS = createRequestActionTypes('tabletsFilters', 'FETCH_TABLETS_FILTERS');
|
7
|
+
|
8
|
+
const initialState = {
|
9
|
+
data: undefined,
|
10
|
+
loading: true,
|
11
|
+
wasLoaded: false,
|
12
|
+
stateFilter: [],
|
13
|
+
typeFilter: [],
|
14
|
+
};
|
15
|
+
|
16
|
+
const tabletsFilters = function (state = initialState, action) {
|
17
|
+
switch (action.type) {
|
18
|
+
case FETCH_TABLETS_FILTERS.REQUEST: {
|
19
|
+
return {
|
20
|
+
...state,
|
21
|
+
loading: true,
|
22
|
+
requestTime: new Date().getTime(),
|
23
|
+
};
|
24
|
+
}
|
25
|
+
case FETCH_TABLETS_FILTERS.SUCCESS: {
|
26
|
+
const timeout = new Date().getTime() - state.requestTime;
|
27
|
+
const [tabletsData, nodes] = action.data;
|
28
|
+
return {
|
29
|
+
...state,
|
30
|
+
tabletsData,
|
31
|
+
nodes,
|
32
|
+
loading: false,
|
33
|
+
wasLoaded: true,
|
34
|
+
timeoutForRequest: timeout > AUTO_RELOAD_INTERVAL ? timeout : AUTO_RELOAD_INTERVAL,
|
35
|
+
error: undefined,
|
36
|
+
};
|
37
|
+
}
|
38
|
+
|
39
|
+
// The error with large uri is handled by GenericAPI
|
40
|
+
case FETCH_TABLETS_FILTERS.FAILURE: {
|
41
|
+
return {
|
42
|
+
...state,
|
43
|
+
error: action.error || 'Request-URI Too Large. Please reload the page',
|
44
|
+
loading: false,
|
45
|
+
};
|
46
|
+
}
|
47
|
+
case 'CLEAR_WAS_LOADING_TABLETS': {
|
48
|
+
const {stateFilter, typeFilter} = state;
|
49
|
+
return {
|
50
|
+
...initialState,
|
51
|
+
stateFilter,
|
52
|
+
typeFilter,
|
53
|
+
};
|
54
|
+
}
|
55
|
+
case 'SET_STATE_FILTER': {
|
56
|
+
return {
|
57
|
+
...state,
|
58
|
+
stateFilter: action.data,
|
59
|
+
};
|
60
|
+
}
|
61
|
+
case 'SET_TYPE_FILTER': {
|
62
|
+
return {
|
63
|
+
...state,
|
64
|
+
typeFilter: action.data,
|
65
|
+
};
|
66
|
+
}
|
67
|
+
default:
|
68
|
+
return state;
|
69
|
+
}
|
70
|
+
};
|
71
|
+
|
72
|
+
export const clearWasLoadingFlag = () => ({
|
73
|
+
type: 'CLEAR_WAS_LOADING_TABLETS',
|
74
|
+
});
|
75
|
+
|
76
|
+
export const setStateFilter = (stateFilter) => {
|
77
|
+
return {
|
78
|
+
type: 'SET_STATE_FILTER',
|
79
|
+
data: stateFilter,
|
80
|
+
};
|
81
|
+
};
|
82
|
+
|
83
|
+
export const setTypeFilter = (typeFilter) => {
|
84
|
+
return {
|
85
|
+
type: 'SET_TYPE_FILTER',
|
86
|
+
data: typeFilter,
|
87
|
+
};
|
88
|
+
};
|
89
|
+
|
90
|
+
export function getTabletsInfo(data) {
|
91
|
+
return createApiRequest({
|
92
|
+
request: Promise.all([window.api.getTabletsInfo(data), window.api.getNodesList()]),
|
93
|
+
actions: FETCH_TABLETS_FILTERS,
|
94
|
+
});
|
95
|
+
}
|
96
|
+
|
97
|
+
export const getTablets = (state) => {
|
98
|
+
const {tabletsData} = state.tabletsFilters;
|
99
|
+
return tabletsData?.TabletStateInfo || [];
|
100
|
+
};
|
101
|
+
|
102
|
+
export const getFilteredTablets = createSelector(
|
103
|
+
[
|
104
|
+
getTablets,
|
105
|
+
(state) => state.tabletsFilters.stateFilter,
|
106
|
+
(state) => state.tabletsFilters.typeFilter,
|
107
|
+
],
|
108
|
+
(tablets, stateFilter, typeFilter) => {
|
109
|
+
let filteredTablets = tablets;
|
110
|
+
|
111
|
+
if (typeFilter.length > 0) {
|
112
|
+
filteredTablets = filteredTablets.filter((tblt) =>
|
113
|
+
typeFilter.some((filter) => tblt.Type === filter),
|
114
|
+
);
|
115
|
+
}
|
116
|
+
if (stateFilter.length > 0) {
|
117
|
+
filteredTablets = filteredTablets.filter((tblt) =>
|
118
|
+
stateFilter.some((filter) => tblt.State === filter),
|
119
|
+
);
|
120
|
+
}
|
121
|
+
|
122
|
+
return filteredTablets;
|
123
|
+
},
|
124
|
+
);
|
125
|
+
|
126
|
+
export default tabletsFilters;
|