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,453 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import {connect} from 'react-redux';
|
4
|
+
import {Link} from 'react-router-dom';
|
5
|
+
import cn from 'bem-cn-lite';
|
6
|
+
import _ from 'lodash';
|
7
|
+
|
8
|
+
import {calcUptime} from '../../utils';
|
9
|
+
import {backend} from '../../store';
|
10
|
+
import {getTablet, getTabletDescribe} from '../../store/reducers/tablet';
|
11
|
+
import '../../services/api';
|
12
|
+
|
13
|
+
import InfoViewer from '../../components/InfoViewer/InfoViewer';
|
14
|
+
import EntityStatus from '../../components/EntityStatus/EntityStatus';
|
15
|
+
import {Tag} from '../../components/Tag/Tag';
|
16
|
+
import Icon from '../../components/Icon/Icon';
|
17
|
+
import EmptyState from '../../components/EmptyState/EmptyState';
|
18
|
+
import {Link as ExternalLink, Button, Loader} from '@yandex-cloud/uikit';
|
19
|
+
import DataTable from '@yandex-cloud/react-data-table';
|
20
|
+
import CriticalActionDialog from '../../components/CriticalActionDialog/CriticalActionDialog';
|
21
|
+
import routes, {createHref} from '../../routes';
|
22
|
+
|
23
|
+
import './Tablet.scss';
|
24
|
+
|
25
|
+
const b = cn('tablet-page');
|
26
|
+
|
27
|
+
const TABLE_SETTINGS = {
|
28
|
+
displayIndices: false,
|
29
|
+
};
|
30
|
+
|
31
|
+
const CLUSTERS_COLUMNS = [
|
32
|
+
{
|
33
|
+
name: 'generation',
|
34
|
+
header: 'Generation',
|
35
|
+
align: DataTable.RIGHT,
|
36
|
+
},
|
37
|
+
{
|
38
|
+
name: 'nodeId',
|
39
|
+
header: 'Node ID',
|
40
|
+
align: DataTable.RIGHT,
|
41
|
+
sortable: false,
|
42
|
+
},
|
43
|
+
{
|
44
|
+
name: 'changeTime',
|
45
|
+
header: 'Change time',
|
46
|
+
align: DataTable.RIGHT,
|
47
|
+
sortable: false,
|
48
|
+
render: ({value}) => calcUptime(value),
|
49
|
+
},
|
50
|
+
{
|
51
|
+
name: 'state',
|
52
|
+
header: 'State',
|
53
|
+
sortable: false,
|
54
|
+
},
|
55
|
+
{
|
56
|
+
name: 'follower_id',
|
57
|
+
header: 'Follower ID',
|
58
|
+
sortable: false,
|
59
|
+
render: ({row}) => {
|
60
|
+
return row.leader ? 'leader' : row.followerId;
|
61
|
+
},
|
62
|
+
},
|
63
|
+
];
|
64
|
+
|
65
|
+
class Tablet extends React.Component {
|
66
|
+
static propTypes = {
|
67
|
+
id: PropTypes.string,
|
68
|
+
tablet: PropTypes.object,
|
69
|
+
loading: PropTypes.bool,
|
70
|
+
getTablet: PropTypes.func,
|
71
|
+
getTabletDescribe: PropTypes.func,
|
72
|
+
tenantPath: PropTypes.string,
|
73
|
+
tabletId: PropTypes.string,
|
74
|
+
};
|
75
|
+
|
76
|
+
componentDidMount() {
|
77
|
+
this.fetchTabletInfo();
|
78
|
+
}
|
79
|
+
|
80
|
+
componentDidUpdate(prevProps) {
|
81
|
+
const {version} = this.props;
|
82
|
+
|
83
|
+
if (version && !prevProps.version) {
|
84
|
+
this.fetchTabletInfo();
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
componentWillUnmount() {
|
89
|
+
if (this.fetcher) {
|
90
|
+
clearInterval(this.fetcher);
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
state = {
|
95
|
+
typeVisibleDialog: null,
|
96
|
+
dialogVisible: false,
|
97
|
+
isFirstFetchData: true,
|
98
|
+
tenantPath: '-',
|
99
|
+
disableTabletActions: false,
|
100
|
+
};
|
101
|
+
|
102
|
+
makeShowDialog = (type) => () => this.setState({dialogVisible: true, typeVisibleDialog: type});
|
103
|
+
showKillDialog = this.makeShowDialog('kill');
|
104
|
+
showStopDialog = this.makeShowDialog('stop');
|
105
|
+
showResumeDialog = this.makeShowDialog('resume');
|
106
|
+
hideDialog = () => this.setState({dialogVisible: false, typeVisibleDialog: null});
|
107
|
+
|
108
|
+
fetchTabletInfo = () => {
|
109
|
+
const {version, id} = this.props;
|
110
|
+
const {isFirstFetchData} = this.state;
|
111
|
+
|
112
|
+
if (version && this.isValidVersion()) {
|
113
|
+
this.props.getTablet(id).then(({tablet}) => {
|
114
|
+
if (isFirstFetchData && tablet.TenantId) {
|
115
|
+
this.props.getTabletDescribe(tablet.TenantId);
|
116
|
+
}
|
117
|
+
|
118
|
+
this.setState({isFirstFetchData: false});
|
119
|
+
});
|
120
|
+
|
121
|
+
if (this.fetcher) {
|
122
|
+
clearInterval(this.fetcher);
|
123
|
+
this.fetcher = null;
|
124
|
+
}
|
125
|
+
|
126
|
+
this.fetcher = setInterval(() => {
|
127
|
+
this.props.getTablet(id).then(() => {
|
128
|
+
this.setState({disableTabletActions: false});
|
129
|
+
});
|
130
|
+
}, 10000);
|
131
|
+
}
|
132
|
+
};
|
133
|
+
|
134
|
+
isValidVersion = () => {
|
135
|
+
const {version} = this.props;
|
136
|
+
|
137
|
+
if (/\d+.stable-19-6$/.exec(version)) {
|
138
|
+
return false;
|
139
|
+
} else if (/\d+.stable-29/.exec(version)) {
|
140
|
+
return false;
|
141
|
+
}
|
142
|
+
|
143
|
+
return true;
|
144
|
+
};
|
145
|
+
renderLoader() {
|
146
|
+
return (
|
147
|
+
<div className={'loader'}>
|
148
|
+
<Loader size="l" />
|
149
|
+
</div>
|
150
|
+
);
|
151
|
+
}
|
152
|
+
renderPlaceholder() {
|
153
|
+
return (
|
154
|
+
<div className={b('placeholder')}>
|
155
|
+
<EmptyState title="The tablet was not found" />
|
156
|
+
</div>
|
157
|
+
);
|
158
|
+
}
|
159
|
+
renderExternalLinks = (link, index) => {
|
160
|
+
return (
|
161
|
+
<li key={index} className={b('link', {external: true})}>
|
162
|
+
<ExternalLink href={`${backend}${link.path}`} target="_blank">
|
163
|
+
{link.name}
|
164
|
+
</ExternalLink>
|
165
|
+
</li>
|
166
|
+
);
|
167
|
+
};
|
168
|
+
_onKillClick = () => {
|
169
|
+
const {TabletId: id} = this.props.tablet;
|
170
|
+
|
171
|
+
this.setState({disableTabletActions: true});
|
172
|
+
|
173
|
+
return window.api.killTablet(id);
|
174
|
+
};
|
175
|
+
_onStopClick = () => {
|
176
|
+
const {TabletId: id, HiveId: hiveId} = this.props.tablet;
|
177
|
+
|
178
|
+
this.setState({disableTabletActions: true});
|
179
|
+
|
180
|
+
return window.api.stopTablet(id, hiveId);
|
181
|
+
};
|
182
|
+
_onResumeClick = () => {
|
183
|
+
const {TabletId: id, HiveId: hiveId} = this.props.tablet;
|
184
|
+
|
185
|
+
this.setState({disableTabletActions: true});
|
186
|
+
|
187
|
+
return window.api.resumeTablet(id, hiveId);
|
188
|
+
};
|
189
|
+
renderDialog = () => {
|
190
|
+
const {dialogVisible, typeVisibleDialog} = this.state;
|
191
|
+
|
192
|
+
if (!dialogVisible) {
|
193
|
+
return null;
|
194
|
+
}
|
195
|
+
|
196
|
+
switch (typeVisibleDialog) {
|
197
|
+
case 'kill': {
|
198
|
+
return (
|
199
|
+
<CriticalActionDialog
|
200
|
+
visible={dialogVisible}
|
201
|
+
text="The tablet will be killed. Do you want to proceed?"
|
202
|
+
onClose={this.hideDialog}
|
203
|
+
onConfirm={this._onKillClick}
|
204
|
+
/>
|
205
|
+
);
|
206
|
+
}
|
207
|
+
case 'stop': {
|
208
|
+
return (
|
209
|
+
<CriticalActionDialog
|
210
|
+
visible={dialogVisible}
|
211
|
+
text="The tablet will be stopped. Do you want to proceed?"
|
212
|
+
onClose={this.hideDialog}
|
213
|
+
onConfirm={this._onStopClick}
|
214
|
+
/>
|
215
|
+
);
|
216
|
+
}
|
217
|
+
case 'resume': {
|
218
|
+
return (
|
219
|
+
<CriticalActionDialog
|
220
|
+
visible={dialogVisible}
|
221
|
+
text="The tablet will be resumed. Do you want to proceed?"
|
222
|
+
onClose={this.hideDialog}
|
223
|
+
onConfirm={this._onResumeClick}
|
224
|
+
/>
|
225
|
+
);
|
226
|
+
}
|
227
|
+
default:
|
228
|
+
return null;
|
229
|
+
}
|
230
|
+
};
|
231
|
+
|
232
|
+
hasUptime = () => {
|
233
|
+
const {tablet} = this.props;
|
234
|
+
|
235
|
+
return tablet.State === 'Active';
|
236
|
+
};
|
237
|
+
|
238
|
+
hasHiveId = () => {
|
239
|
+
const {tablet} = this.props;
|
240
|
+
const {HiveId} = tablet;
|
241
|
+
|
242
|
+
return HiveId && HiveId !== '0';
|
243
|
+
};
|
244
|
+
|
245
|
+
getSchemeShard = () => {
|
246
|
+
const {tablet} = this.props;
|
247
|
+
|
248
|
+
return _.get(tablet, 'TenantId.SchemeShard');
|
249
|
+
};
|
250
|
+
|
251
|
+
isDisabledResume = () => {
|
252
|
+
const {tablet} = this.props;
|
253
|
+
const {disableTabletActions} = this.state;
|
254
|
+
|
255
|
+
if (disableTabletActions) {
|
256
|
+
return true;
|
257
|
+
}
|
258
|
+
|
259
|
+
return tablet.State !== 'Stopped' && tablet.State !== 'Dead';
|
260
|
+
};
|
261
|
+
|
262
|
+
isDisabledKill = () => {
|
263
|
+
const {disableTabletActions} = this.state;
|
264
|
+
|
265
|
+
return disableTabletActions;
|
266
|
+
};
|
267
|
+
|
268
|
+
isDisabledStop = () => {
|
269
|
+
const {tablet} = this.props;
|
270
|
+
const {disableTabletActions} = this.state;
|
271
|
+
|
272
|
+
if (disableTabletActions) {
|
273
|
+
return true;
|
274
|
+
}
|
275
|
+
|
276
|
+
return tablet.State === 'Stopped' || tablet.State === 'Deleted';
|
277
|
+
};
|
278
|
+
|
279
|
+
renderTablet = () => {
|
280
|
+
const {tablet, tenantPath} = this.props;
|
281
|
+
const {TabletId: id} = tablet;
|
282
|
+
const schemeShard = this.getSchemeShard();
|
283
|
+
|
284
|
+
const tabletInfo = [
|
285
|
+
{label: 'Database', value: tenantPath},
|
286
|
+
this.hasHiveId()
|
287
|
+
? {
|
288
|
+
label: 'HiveId',
|
289
|
+
value: (
|
290
|
+
<ExternalLink
|
291
|
+
href={createHref(routes.tablet, {id: tablet.HiveId})}
|
292
|
+
target="_blank"
|
293
|
+
>
|
294
|
+
{tablet.HiveId}
|
295
|
+
</ExternalLink>
|
296
|
+
),
|
297
|
+
}
|
298
|
+
: null,
|
299
|
+
schemeShard
|
300
|
+
? {
|
301
|
+
label: 'SchemeShard',
|
302
|
+
value: (
|
303
|
+
<ExternalLink
|
304
|
+
href={createHref(routes.tablet, {id: schemeShard})}
|
305
|
+
target="_blank"
|
306
|
+
>
|
307
|
+
{schemeShard}
|
308
|
+
</ExternalLink>
|
309
|
+
),
|
310
|
+
}
|
311
|
+
: null,
|
312
|
+
{label: 'Type', value: tablet.Type},
|
313
|
+
{label: 'State', value: tablet.State},
|
314
|
+
this.hasUptime() ? {label: 'Uptime', value: calcUptime(tablet.ChangeTime)} : null,
|
315
|
+
{label: 'Generation', value: tablet.Generation},
|
316
|
+
{
|
317
|
+
label: 'Node',
|
318
|
+
value: (
|
319
|
+
<Link
|
320
|
+
className={b('link')}
|
321
|
+
to={createHref(routes.node, {
|
322
|
+
id: String(tablet.NodeId),
|
323
|
+
activeTab: 'storage',
|
324
|
+
})}
|
325
|
+
>
|
326
|
+
{tablet.NodeId}
|
327
|
+
</Link>
|
328
|
+
),
|
329
|
+
},
|
330
|
+
].filter(Boolean);
|
331
|
+
|
332
|
+
if (tablet.SlaveId || tablet.FollowerId) {
|
333
|
+
tabletInfo.push({label: 'Follower', value: tablet.SlaveId || tablet.FollowerId});
|
334
|
+
}
|
335
|
+
|
336
|
+
const externalLinks = [
|
337
|
+
{
|
338
|
+
name: 'Internal viewer - tablet',
|
339
|
+
path: `/tablets?TabletID=${id}`,
|
340
|
+
},
|
341
|
+
];
|
342
|
+
|
343
|
+
return (
|
344
|
+
<div className={b()}>
|
345
|
+
<div className={b('pane-wrapper')}>
|
346
|
+
<div className={b('left-pane')}>
|
347
|
+
<ul className={b('links')}>
|
348
|
+
{externalLinks.map(this.renderExternalLinks)}
|
349
|
+
</ul>
|
350
|
+
<div className={b('row', {header: true})}>
|
351
|
+
<span className={b('title')}>Tablet</span>
|
352
|
+
<EntityStatus status={tablet.Overall} name={tablet.TabletId} />
|
353
|
+
<a
|
354
|
+
rel="noopener noreferrer"
|
355
|
+
className={b('link', {external: true})}
|
356
|
+
href={`${backend}/tablets?TabletID=${tablet.TabletId}`}
|
357
|
+
target="_blank"
|
358
|
+
>
|
359
|
+
<Icon name="external" />
|
360
|
+
</a>
|
361
|
+
{(tablet.Master || tablet.Leader) && <Tag text="Leader" type="blue" />}
|
362
|
+
</div>
|
363
|
+
<InfoViewer info={tabletInfo} />
|
364
|
+
<div className={b('controls')}>
|
365
|
+
<Button
|
366
|
+
onClick={this.showKillDialog}
|
367
|
+
view="action"
|
368
|
+
disabled={this.isDisabledKill()}
|
369
|
+
className={b('control')}
|
370
|
+
>
|
371
|
+
Kill
|
372
|
+
</Button>
|
373
|
+
{this.hasHiveId() ? (
|
374
|
+
<React.Fragment>
|
375
|
+
<Button
|
376
|
+
onClick={this.showStopDialog}
|
377
|
+
view="action"
|
378
|
+
disabled={this.isDisabledStop()}
|
379
|
+
className={b('control')}
|
380
|
+
>
|
381
|
+
Stop
|
382
|
+
</Button>
|
383
|
+
<Button
|
384
|
+
onClick={this.showResumeDialog}
|
385
|
+
view="action"
|
386
|
+
disabled={this.isDisabledResume()}
|
387
|
+
className={b('control')}
|
388
|
+
>
|
389
|
+
Resume
|
390
|
+
</Button>
|
391
|
+
</React.Fragment>
|
392
|
+
) : null}
|
393
|
+
</div>
|
394
|
+
</div>
|
395
|
+
<div className={b('rigth-pane')}>
|
396
|
+
<DataTable
|
397
|
+
data={this.props.history}
|
398
|
+
columns={CLUSTERS_COLUMNS}
|
399
|
+
settings={TABLE_SETTINGS}
|
400
|
+
initialSortOrder={{
|
401
|
+
columnId: 'generation',
|
402
|
+
order: DataTable.DESCENDING,
|
403
|
+
}}
|
404
|
+
/>
|
405
|
+
</div>
|
406
|
+
</div>
|
407
|
+
{this.renderDialog()}
|
408
|
+
</div>
|
409
|
+
);
|
410
|
+
};
|
411
|
+
|
412
|
+
renderContent = () => {
|
413
|
+
const {tablet} = this.props;
|
414
|
+
return tablet && Object.keys(tablet).length
|
415
|
+
? this.renderTablet()
|
416
|
+
: this.renderPlaceholder();
|
417
|
+
};
|
418
|
+
render() {
|
419
|
+
const {loading, tabletId, id} = this.props;
|
420
|
+
const {isFirstFetchData} = this.state;
|
421
|
+
|
422
|
+
if (this.isValidVersion()) {
|
423
|
+
return loading && id !== tabletId && isFirstFetchData
|
424
|
+
? this.renderLoader()
|
425
|
+
: this.renderContent();
|
426
|
+
}
|
427
|
+
|
428
|
+
return null;
|
429
|
+
}
|
430
|
+
}
|
431
|
+
|
432
|
+
const mapStateToProps = (state, ownProps) => {
|
433
|
+
const {data: tablet = {}, loading, id: tabletId, history = [], tenantPath} = state.tablet;
|
434
|
+
const {id} = ownProps.match.params;
|
435
|
+
const {data: host} = state.host;
|
436
|
+
|
437
|
+
return {
|
438
|
+
tablet,
|
439
|
+
loading,
|
440
|
+
id,
|
441
|
+
tabletId,
|
442
|
+
history,
|
443
|
+
version: host.Version,
|
444
|
+
tenantPath,
|
445
|
+
};
|
446
|
+
};
|
447
|
+
|
448
|
+
const mapDispatchToProps = {
|
449
|
+
getTablet,
|
450
|
+
getTabletDescribe,
|
451
|
+
};
|
452
|
+
|
453
|
+
export default connect(mapStateToProps, mapDispatchToProps)(Tablet);
|
@@ -0,0 +1,88 @@
|
|
1
|
+
@import '../../styles/mixins.scss';
|
2
|
+
|
3
|
+
.tablet-page {
|
4
|
+
display: flex;
|
5
|
+
flex-direction: column;
|
6
|
+
padding: 20px;
|
7
|
+
|
8
|
+
$_: &;
|
9
|
+
|
10
|
+
&__tenant {
|
11
|
+
margin-bottom: 20px;
|
12
|
+
}
|
13
|
+
|
14
|
+
&__pane-wrapper {
|
15
|
+
display: flex;
|
16
|
+
}
|
17
|
+
|
18
|
+
&__left-pane {
|
19
|
+
margin-right: 70px;
|
20
|
+
}
|
21
|
+
&__history-title {
|
22
|
+
@include body2-typography();
|
23
|
+
margin-bottom: 15px;
|
24
|
+
}
|
25
|
+
|
26
|
+
&__placeholder {
|
27
|
+
display: flex;
|
28
|
+
flex: 1 1 auto;
|
29
|
+
align-items: center;
|
30
|
+
justify-content: center;
|
31
|
+
}
|
32
|
+
|
33
|
+
&__row {
|
34
|
+
display: flex;
|
35
|
+
align-items: center;
|
36
|
+
|
37
|
+
&_header {
|
38
|
+
margin-bottom: 20px;
|
39
|
+
|
40
|
+
& #{$_}__link {
|
41
|
+
margin: 0 10px 0 5px;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
&__title {
|
47
|
+
font-size: var(--yc-text-body2-font-size);
|
48
|
+
line-height: var(--yc-text-body2-line-height);
|
49
|
+
font-weight: 500;
|
50
|
+
text-transform: uppercase;
|
51
|
+
margin-right: 16px;
|
52
|
+
}
|
53
|
+
|
54
|
+
.info-viewer__items {
|
55
|
+
grid-template-columns: auto;
|
56
|
+
}
|
57
|
+
|
58
|
+
&__link {
|
59
|
+
@extend .link;
|
60
|
+
}
|
61
|
+
|
62
|
+
&__controls {
|
63
|
+
margin: 20px 0 15px;
|
64
|
+
}
|
65
|
+
|
66
|
+
&__control {
|
67
|
+
margin-right: 15px;
|
68
|
+
}
|
69
|
+
|
70
|
+
&__links {
|
71
|
+
display: flex;
|
72
|
+
margin: 5px 0 10px 0;
|
73
|
+
padding: 0;
|
74
|
+
list-style-type: none;
|
75
|
+
|
76
|
+
& > * {
|
77
|
+
margin: 0 10px 0 0;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
&__top-label {
|
82
|
+
font-size: var(--yc-text-body2-font-size);
|
83
|
+
line-height: var(--yc-text-body2-line-height);
|
84
|
+
font-weight: 500;
|
85
|
+
text-transform: uppercase;
|
86
|
+
margin-right: 16px;
|
87
|
+
}
|
88
|
+
}
|