ydb-embedded-ui 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (204) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +21 -0
  3. package/README.md +2 -2
  4. package/dist/assets/icons/cluster.svg +1 -0
  5. package/dist/assets/icons/hide.svg +1 -0
  6. package/dist/assets/icons/show.svg +1 -0
  7. package/dist/assets/icons/user-check.svg +1 -1
  8. package/dist/assets/icons/user-secret.svg +1 -1
  9. package/dist/components/AsideNavigation/AsideHeader.scss +1 -2
  10. package/dist/components/AsideNavigation/AsideHeaderFooterItem/AsideHeaderFooterItem.scss +7 -7
  11. package/dist/components/AsideNavigation/AsideHeaderTooltip/AsideHeaderTooltip.scss +2 -2
  12. package/dist/components/AsideNavigation/CompositeBar/CompositeBar.scss +6 -6
  13. package/dist/components/AsideNavigation/Drawer/Drawer.scss +5 -5
  14. package/dist/components/AsideNavigation/Logo/Logo.scss +3 -4
  15. package/dist/components/AsideNavigation/Settings/Settings.scss +27 -12
  16. package/dist/components/AsideNavigation/Settings/SettingsMenu/SettingsMenu.scss +14 -6
  17. package/dist/components/Breadcrumbs/Breadcrumbs.scss +2 -1
  18. package/dist/components/ClusterInfo/ClusterInfo.scss +19 -12
  19. package/dist/components/ClusterInfo/ClusterInfo.tsx +110 -10
  20. package/dist/components/CopyToClipboard/CopyToClipboard.tsx +39 -0
  21. package/dist/components/CriticalActionDialog/CriticalActionDialog.scss +5 -4
  22. package/dist/components/Divider/Divider.scss +7 -0
  23. package/dist/components/Divider/Divider.tsx +11 -0
  24. package/dist/components/EmptyState/EmptyState.scss +14 -10
  25. package/dist/components/EnableFullscreenButton/EnableFullscreenButton.tsx +22 -0
  26. package/dist/components/EntityStatus/EntityStatus.js +5 -3
  27. package/dist/components/EntityStatus/EntityStatus.scss +35 -13
  28. package/dist/components/FullGroupViewer/FullGroupViewer.js +2 -4
  29. package/dist/components/FullGroupViewer/FullGroupViewer.scss +6 -3
  30. package/dist/components/FullNodeViewer/FullNodeViewer.scss +19 -11
  31. package/dist/components/Fullscreen/Fullscreen.scss +28 -0
  32. package/dist/components/Fullscreen/Fullscreen.tsx +81 -0
  33. package/dist/components/GroupTreeViewer/GroupTreeViewer.scss +1 -0
  34. package/dist/components/GroupViewer/GroupViewer.scss +8 -4
  35. package/dist/components/Icon/Icon.js +2 -0
  36. package/dist/components/InfoViewer/InfoViewer.scss +22 -16
  37. package/dist/components/NodesViewer/NodesViewer.js +25 -35
  38. package/dist/components/NodesViewer/NodesViewer.scss +15 -11
  39. package/dist/components/PDiskViewer/PDiskViewer.scss +10 -4
  40. package/dist/components/Pagination/Pagination.scss +6 -3
  41. package/dist/components/PoolBar/PoolBar.scss +14 -10
  42. package/dist/components/PoolUsage/PoolUsage.scss +17 -9
  43. package/dist/components/ProgressViewer/ProgressViewer.js +1 -1
  44. package/dist/components/ProgressViewer/ProgressViewer.scss +28 -18
  45. package/dist/components/QueryExecutionStatus/QueryExecutionStatus.scss +14 -0
  46. package/dist/components/QueryExecutionStatus/QueryExecutionStatus.tsx +29 -0
  47. package/dist/components/SplitPane/SplitPane.scss +33 -40
  48. package/dist/components/SplitPane/SplitPane.tsx +94 -0
  49. package/dist/components/Tablet/Tablet.scss +9 -6
  50. package/dist/components/TabletsOverall/TabletsOverall.scss +19 -0
  51. package/dist/components/TabletsOverall/TabletsOverall.tsx +105 -0
  52. package/dist/components/TabletsStatistic/TabletsStatistic.scss +24 -18
  53. package/dist/components/TabletsViewer/TabletsViewer.scss +12 -9
  54. package/dist/components/Tag/Tag.scss +6 -4
  55. package/dist/components/Tags/Tags.scss +1 -1
  56. package/dist/components/TreeView/TreeView.js +1 -1
  57. package/dist/components/TreeView/TreeView.scss +9 -0
  58. package/dist/components/TruncatedQuery/TruncatedQuery.scss +4 -3
  59. package/dist/containers/App/App.js +1 -0
  60. package/dist/containers/App/App.scss +50 -31
  61. package/dist/containers/App/Content.js +2 -2
  62. package/dist/containers/App/NodesTable.scss +25 -0
  63. package/dist/containers/App/TipPopup/TipPopup.scss +10 -6
  64. package/dist/containers/AppIcons/AppIcons.js +46 -22
  65. package/dist/containers/AsideNavigation/AsideNavigation.scss +1 -1
  66. package/dist/containers/AsideNavigation/AsideNavigation.tsx +12 -5
  67. package/dist/containers/Authentication/Authentication.scss +63 -14
  68. package/dist/containers/Authentication/Authentication.tsx +42 -9
  69. package/dist/containers/Cluster/Cluster.scss +5 -3
  70. package/dist/containers/Cluster/Cluster.tsx +49 -0
  71. package/dist/containers/Group/Group.scss +1 -1
  72. package/dist/containers/Header/Header.scss +15 -59
  73. package/dist/containers/Header/Header.tsx +75 -0
  74. package/dist/containers/Header/Host/Host.scss +10 -3
  75. package/dist/containers/Heatmap/Heatmap.js +1 -1
  76. package/dist/containers/Heatmap/Heatmap.scss +16 -7
  77. package/dist/containers/Heatmap/HeatmapCanvas/HeatmapCanvas.js +3 -3
  78. package/dist/containers/Heatmap/Histogram/Histogram.scss +21 -9
  79. package/dist/containers/Node/Node.js +1 -1
  80. package/dist/containers/Node/Node.scss +6 -4
  81. package/dist/containers/Nodes/Nodes.js +28 -27
  82. package/dist/containers/Nodes/Nodes.scss +5 -17
  83. package/dist/containers/Pdisk/Pdisk.scss +6 -4
  84. package/dist/containers/Pool/Pool.scss +7 -4
  85. package/dist/containers/ReduxTooltip/ReduxTooltip.scss +5 -1
  86. package/dist/containers/Storage/DiskStateProgressBar/DiskStateProgressBar.scss +77 -0
  87. package/dist/containers/{StorageV2 → Storage}/DiskStateProgressBar/DiskStateProgressBar.tsx +1 -1
  88. package/dist/containers/{StorageV2 → Storage}/Pdisk/Pdisk.scss +6 -4
  89. package/dist/containers/{StorageV2 → Storage}/Pdisk/Pdisk.tsx +1 -2
  90. package/dist/containers/{StorageV2 → Storage}/Storage.js +72 -34
  91. package/dist/containers/{StorageV2 → Storage}/Storage.scss +12 -14
  92. package/dist/containers/{StorageV2 → Storage}/StorageFilter/StorageFilter.js +1 -9
  93. package/dist/containers/{StorageV2 → Storage}/StorageGroups/StorageGroups.scss +2 -0
  94. package/dist/containers/{StorageV2 → Storage}/StorageGroups/StorageGroups.tsx +1 -1
  95. package/dist/containers/{StorageV2 → Storage}/StorageNodes/StorageNodes.scss +2 -0
  96. package/dist/containers/{StorageV2 → Storage}/StorageNodes/StorageNodes.tsx +1 -1
  97. package/dist/containers/{StorageV2 → Storage}/Vdisk/Vdisk.js +0 -0
  98. package/dist/containers/{StorageV2 → Storage}/Vdisk/Vdisk.scss +6 -4
  99. package/dist/containers/Tablet/Tablet.scss +13 -9
  100. package/dist/containers/Tablets/Tablets.js +21 -90
  101. package/dist/containers/Tablets/Tablets.scss +9 -35
  102. package/dist/containers/TabletsFilters/TabletsFilters.js +2 -75
  103. package/dist/containers/TabletsFilters/TabletsFilters.scss +15 -35
  104. package/dist/containers/Tenant/Acl/Acl.js +54 -47
  105. package/dist/containers/Tenant/Acl/Acl.scss +15 -4
  106. package/dist/containers/Tenant/{Compute → Diagnostics/Compute}/Compute.js +35 -12
  107. package/dist/containers/Tenant/Diagnostics/Compute/Compute.scss +14 -0
  108. package/dist/containers/Tenant/{Describe → Diagnostics/Describe}/Describe.js +50 -1
  109. package/dist/containers/Tenant/{Describe → Diagnostics/Describe}/Describe.scss +5 -3
  110. package/dist/containers/Tenant/Diagnostics/DetailedOverview/DetailedOverview.scss +27 -0
  111. package/dist/containers/Tenant/Diagnostics/DetailedOverview/DetailedOverview.tsx +88 -0
  112. package/dist/containers/Tenant/Diagnostics/Diagnostics.scss +50 -0
  113. package/dist/containers/Tenant/Diagnostics/Diagnostics.tsx +208 -0
  114. package/dist/containers/Tenant/Diagnostics/DiagnosticsPages.ts +75 -0
  115. package/dist/containers/Tenant/Diagnostics/Healthcheck/Healthcheck.js +191 -0
  116. package/dist/containers/Tenant/Diagnostics/Healthcheck/Healthcheck.scss +79 -0
  117. package/dist/containers/Tenant/{Healthcheck → Diagnostics/Healthcheck}/IssuesViewer/IssueViewer.scss +25 -13
  118. package/dist/containers/Tenant/{Healthcheck → Diagnostics/Healthcheck}/IssuesViewer/IssuesViewer.js +2 -2
  119. package/dist/containers/Tenant/{Schema → Diagnostics}/HotKeys/HotKeys.js +14 -8
  120. package/dist/containers/Tenant/{Schema → Diagnostics}/HotKeys/HotKeys.scss +7 -5
  121. package/dist/containers/Tenant/{Network → Diagnostics/Network}/Network.js +39 -9
  122. package/dist/containers/Tenant/{Network → Diagnostics/Network}/Network.scss +35 -36
  123. package/dist/containers/Tenant/{Network → Diagnostics/Network}/NodeNetwork/NodeNetwork.js +0 -0
  124. package/dist/containers/Tenant/{Network → Diagnostics/Network}/NodeNetwork/NodeNetwork.scss +11 -9
  125. package/dist/containers/Tenant/Diagnostics/Overview/Overview.scss +13 -0
  126. package/dist/containers/Tenant/Diagnostics/Overview/Overview.tsx +123 -0
  127. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.js +200 -0
  128. package/dist/{components → containers/Tenant/Diagnostics}/TenantOverview/TenantOverview.scss +24 -17
  129. package/dist/containers/Tenant/{TopQueries → Diagnostics/TopQueries}/TopQueries.js +32 -30
  130. package/dist/containers/Tenant/{TopQueries → Diagnostics/TopQueries}/TopQueries.scss +10 -9
  131. package/dist/containers/Tenant/{TopShards → Diagnostics/TopShards}/TopShards.js +25 -29
  132. package/dist/containers/Tenant/{TopShards → Diagnostics/TopShards}/TopShards.scss +1 -13
  133. package/dist/containers/Tenant/ObjectGeneral/ObjectGeneral.scss +38 -0
  134. package/dist/containers/Tenant/ObjectGeneral/ObjectGeneral.tsx +104 -0
  135. package/dist/containers/Tenant/ObjectSummary/ObjectSummary.scss +165 -0
  136. package/dist/containers/Tenant/ObjectSummary/ObjectSummary.tsx +310 -0
  137. package/dist/containers/Tenant/Preview/Preview.js +50 -12
  138. package/dist/containers/Tenant/Preview/Preview.scss +45 -3
  139. package/dist/containers/Tenant/QueryEditor/QueriesHistory/QueriesHistory.scss +85 -0
  140. package/dist/containers/Tenant/QueryEditor/QueriesHistory/QueriesHistory.tsx +94 -0
  141. package/dist/containers/Tenant/QueryEditor/QueryEditor.js +291 -264
  142. package/dist/containers/Tenant/QueryEditor/QueryEditor.scss +47 -18
  143. package/dist/containers/Tenant/QueryEditor/QueryExplain/QueryExplain.js +132 -32
  144. package/dist/containers/Tenant/QueryEditor/QueryExplain/QueryExplain.scss +47 -11
  145. package/dist/containers/Tenant/QueryEditor/QueryResult/QueryResult.js +89 -20
  146. package/dist/containers/Tenant/QueryEditor/QueryResult/QueryResult.scss +60 -6
  147. package/dist/containers/Tenant/QueryEditor/SaveQuery/SaveQuery.js +10 -23
  148. package/dist/containers/Tenant/QueryEditor/SaveQuery/SaveQuery.scss +15 -7
  149. package/dist/containers/Tenant/QueryEditor/SavedQueries/SavedQueries.js +7 -3
  150. package/dist/containers/Tenant/QueryEditor/SavedQueries/SavedQueries.scss +28 -17
  151. package/dist/containers/Tenant/Schema/SchemaInfoViewer/SchemaInfoViewer.js +7 -7
  152. package/dist/containers/Tenant/Schema/SchemaInfoViewer/SchemaInfoViewer.scss +1 -11
  153. package/dist/containers/Tenant/Schema/SchemaNode/SchemaNode.js +37 -17
  154. package/dist/containers/Tenant/Schema/SchemaNode/SchemaNode.scss +33 -12
  155. package/dist/containers/Tenant/Schema/SchemaNodeActions/SchemaNodeActions.scss +17 -0
  156. package/dist/containers/Tenant/Schema/SchemaNodeActions/SchemaNodeActions.tsx +125 -0
  157. package/dist/containers/Tenant/Schema/SchemaTree/SchemaTree.js +5 -4
  158. package/dist/containers/Tenant/Schema/SchemaTree/SchemaTree.scss +6 -2
  159. package/dist/containers/Tenant/Schema/SchemaViewer/SchemaViewer.js +53 -34
  160. package/dist/containers/Tenant/Schema/SchemaViewer/SchemaViewer.scss +1 -22
  161. package/dist/containers/Tenant/Tenant.scss +3 -32
  162. package/dist/containers/Tenant/Tenant.tsx +161 -0
  163. package/dist/containers/Tenant/TenantPages.tsx +48 -0
  164. package/dist/containers/Tenant/utils/ToggleButton.scss +26 -0
  165. package/dist/containers/Tenant/utils/paneVisibilityToggleHelpers.tsx +126 -0
  166. package/dist/containers/Tenants/Tenants.js +41 -55
  167. package/dist/containers/Tenants/Tenants.scss +4 -17
  168. package/dist/containers/UserSettings/UserSettings.tsx +0 -2
  169. package/dist/containers/Vdisk/Vdisk.scss +6 -4
  170. package/dist/containers/VdiskPdiskNode/VdiskPdiskNode.js +1 -1
  171. package/dist/containers/VdiskPdiskNode/VdiskPdiskNode.scss +5 -5
  172. package/dist/{routes.js → routes.ts} +14 -4
  173. package/dist/store/reducers/clusterNodes.js +1 -1
  174. package/dist/store/reducers/fullscreen.ts +31 -0
  175. package/dist/store/reducers/header.ts +23 -0
  176. package/dist/store/reducers/hotKeys.js +1 -1
  177. package/dist/store/reducers/index.js +6 -0
  178. package/dist/store/reducers/saveQuery.ts +33 -0
  179. package/dist/store/reducers/schema.js +14 -0
  180. package/dist/store/reducers/shardsWorkload.js +1 -1
  181. package/dist/store/state-url-mapping.js +1 -1
  182. package/dist/store/utils.js +2 -6
  183. package/dist/styles/mixins.scss +49 -34
  184. package/dist/utils/autofetcher.ts +51 -0
  185. package/dist/utils/constants.js +25 -7
  186. package/dist/utils/createToast.tsx +23 -0
  187. package/dist/utils/getNodesColumns.js +25 -28
  188. package/dist/utils/index.js +6 -2
  189. package/package.json +8 -4
  190. package/dist/components/SplitPane/SplitPane.js +0 -368
  191. package/dist/components/TenantOverview/TenantOverview.js +0 -148
  192. package/dist/containers/Cluster/Cluster.js +0 -168
  193. package/dist/containers/Header/Header.js +0 -88
  194. package/dist/containers/StorageV2/DiskStateProgressBar/DiskStateProgressBar.scss +0 -81
  195. package/dist/containers/Tenant/Compute/Compute.scss +0 -6
  196. package/dist/containers/Tenant/Healthcheck/Healthcheck.js +0 -116
  197. package/dist/containers/Tenant/Healthcheck/Healthcheck.scss +0 -64
  198. package/dist/containers/Tenant/Schema/Info/Info.js +0 -84
  199. package/dist/containers/Tenant/Schema/Info/Info.scss +0 -3
  200. package/dist/containers/Tenant/Schema/SchemaMain/SchemaMain.js +0 -439
  201. package/dist/containers/Tenant/Schema/SchemaMain/SchemaMain.scss +0 -90
  202. package/dist/containers/Tenant/Schema/SchemaPages.js +0 -56
  203. package/dist/containers/Tenant/Tenant.js +0 -199
  204. package/dist/containers/Tenant/TenantPages.js +0 -35
@@ -0,0 +1,208 @@
1
+ import {useMemo} from 'react';
2
+ import qs from 'qs';
3
+ import cn from 'bem-cn-lite';
4
+ import {Link} from 'react-router-dom';
5
+ import {useDispatch, useSelector} from 'react-redux';
6
+ import {useHistory, useLocation} from 'react-router';
7
+
8
+ import {Switch, Tabs} from '@yandex-cloud/uikit';
9
+
10
+ //@ts-ignore
11
+ import TopQueries from './TopQueries/TopQueries';
12
+ //@ts-ignore
13
+ import DetailedOverview from './DetailedOverview/DetailedOverview';
14
+ //@ts-ignore
15
+ import TopShards from './TopShards/TopShards';
16
+ //@ts-ignore
17
+ import Storage from '../../Storage/Storage';
18
+ //@ts-ignore
19
+ import Network from './Network/Network';
20
+ //@ts-ignore
21
+ import Describe from './Describe/Describe';
22
+ //@ts-ignore
23
+ import HotKeys from './HotKeys/HotKeys';
24
+ //@ts-ignore
25
+ import Heatmap from '../../Heatmap/Heatmap';
26
+ //@ts-ignore
27
+ import Compute from './Compute/Compute';
28
+ //@ts-ignore
29
+ import Tablets from '../../Tablets/Tablets';
30
+
31
+ import routes, {createHref} from '../../../routes';
32
+ import {OLAP_TABLE_TYPE, TABLE_TYPE} from '../Tenant';
33
+ import {TenantGeneralTabsIds, TenantTabsGroups} from '../TenantPages';
34
+ import {GeneralPagesIds, DATABASE_PAGES, TABLE_PAGES, DIR_PAGES} from './DiagnosticsPages';
35
+ //@ts-ignore
36
+ import {enableAutorefresh, disableAutorefresh} from '../../../store/reducers/schema';
37
+
38
+ import './Diagnostics.scss';
39
+ interface DiagnosticsProps {
40
+ type: string;
41
+ additionalTenantInfo?: any;
42
+ additionalNodesInfo?: any;
43
+ }
44
+
45
+ const b = cn('kv-tenant-diagnostics');
46
+
47
+ function Diagnostics(props: DiagnosticsProps) {
48
+ const dispatch = useDispatch();
49
+ const {
50
+ currentSchemaPath,
51
+ currentSchema: currentItem = {},
52
+ autorefresh,
53
+ } = useSelector((state: any) => state.schema);
54
+
55
+ const location = useLocation();
56
+
57
+ const history = useHistory();
58
+
59
+ const queryParams = qs.parse(location.search, {
60
+ ignoreQueryPrefix: true,
61
+ });
62
+
63
+ const {name: tenantName, generalTab = GeneralPagesIds.overview} = queryParams;
64
+
65
+ const isDatabase = currentSchemaPath === tenantName;
66
+
67
+ const pages = useMemo(() => {
68
+ const {type} = props;
69
+ const isTable = type === TABLE_TYPE || type === OLAP_TABLE_TYPE;
70
+
71
+ let pages = DIR_PAGES;
72
+
73
+ if (isDatabase) {
74
+ pages = DATABASE_PAGES;
75
+ } else if (isTable) {
76
+ pages = TABLE_PAGES;
77
+ }
78
+ return pages;
79
+ }, [props.type]);
80
+
81
+ const forwardToDiagnosticTab = (tab: GeneralPagesIds) => {
82
+ history.push(
83
+ createHref(routes.tenant, undefined, {
84
+ ...queryParams,
85
+ [TenantTabsGroups.generalTab]: tab,
86
+ }),
87
+ );
88
+ };
89
+ const activeTab = useMemo(() => {
90
+ if (pages.find((el) => el.id === generalTab)) {
91
+ return generalTab;
92
+ } else {
93
+ const newPage = pages[0].id;
94
+ forwardToDiagnosticTab(newPage);
95
+ return newPage;
96
+ }
97
+ }, [pages, generalTab]);
98
+
99
+ const onAutorefreshToggle = (value: boolean) => {
100
+ if (value) {
101
+ dispatch(enableAutorefresh());
102
+ } else {
103
+ dispatch(disableAutorefresh());
104
+ }
105
+ };
106
+
107
+ const forwardToGeneralTab = (tab: TenantGeneralTabsIds) => {
108
+ history.push(
109
+ createHref(routes.tenant, undefined, {
110
+ ...queryParams,
111
+ [TenantTabsGroups.general]: tab,
112
+ }),
113
+ );
114
+ };
115
+
116
+ const renderTabContent = () => {
117
+ const {type} = props;
118
+
119
+ const tenantNameString = tenantName as string;
120
+
121
+ switch (generalTab) {
122
+ case GeneralPagesIds.overview: {
123
+ return (
124
+ <DetailedOverview
125
+ type={type}
126
+ tenantName={tenantNameString}
127
+ additionalTenantInfo={props.additionalTenantInfo}
128
+ />
129
+ );
130
+ }
131
+ case GeneralPagesIds.topQueries: {
132
+ return (
133
+ <TopQueries
134
+ path={tenantNameString}
135
+ changeSchemaTab={forwardToGeneralTab}
136
+ type={type}
137
+ />
138
+ );
139
+ }
140
+ case GeneralPagesIds.topShards: {
141
+ return <TopShards path={tenantNameString} type={type} />;
142
+ }
143
+ case GeneralPagesIds.nodes: {
144
+ return <Compute additionalNodesInfo={props.additionalNodesInfo} />;
145
+ }
146
+ case GeneralPagesIds.tablets: {
147
+ return <Tablets path={currentItem.Path} />;
148
+ }
149
+ case GeneralPagesIds.storage: {
150
+ return <Storage tenant={tenantNameString} database={true} />;
151
+ }
152
+ case GeneralPagesIds.network: {
153
+ return <Network path={tenantNameString} />;
154
+ }
155
+ case GeneralPagesIds.describe: {
156
+ return <Describe tenant={tenantNameString} />;
157
+ }
158
+ case GeneralPagesIds.hotKeys: {
159
+ return <HotKeys type={type} />;
160
+ }
161
+ case GeneralPagesIds.graph: {
162
+ return <Heatmap path={currentItem.Path} />;
163
+ }
164
+ default: {
165
+ return <div>No data...</div>;
166
+ }
167
+ }
168
+ };
169
+ const renderTabs = () => {
170
+ return (
171
+ <div className={b('header-wrapper')}>
172
+ <div className={b('tabs')}>
173
+ <Tabs
174
+ items={pages}
175
+ activeTab={activeTab as string}
176
+ wrapTo={({id}, node) => {
177
+ const path = createHref(routes.tenant, undefined, {
178
+ ...queryParams,
179
+ [TenantTabsGroups.generalTab]: id,
180
+ });
181
+
182
+ return (
183
+ <Link to={path} key={id} className={b('tab')}>
184
+ {node}
185
+ </Link>
186
+ );
187
+ }}
188
+ allowNotSelected={true}
189
+ />
190
+ <Switch
191
+ checked={autorefresh}
192
+ onUpdate={onAutorefreshToggle}
193
+ content="Autorefresh"
194
+ />
195
+ </div>
196
+ </div>
197
+ );
198
+ };
199
+
200
+ return (
201
+ <div className={b()}>
202
+ {renderTabs()}
203
+ <div className={b('page-wrapper')}>{renderTabContent()}</div>
204
+ </div>
205
+ );
206
+ }
207
+
208
+ export default Diagnostics;
@@ -0,0 +1,75 @@
1
+ export enum GeneralPagesIds {
2
+ 'overview' = 'Overview',
3
+ 'topQueries' = 'topQueries',
4
+ 'topShards' = 'topShards',
5
+ 'nodes' = 'Nodes',
6
+ 'tablets' = 'Tablets',
7
+ 'storage' = 'Storage',
8
+ 'network' = 'Network',
9
+ 'describe' = 'Describe',
10
+ 'hotKeys' = 'hotKeys',
11
+ 'graph' = 'graph',
12
+ }
13
+
14
+ const overview = {
15
+ id: GeneralPagesIds.overview,
16
+ title: 'Overview',
17
+ };
18
+
19
+ const topQueries = {
20
+ id: GeneralPagesIds.topQueries,
21
+ title: 'Top queries',
22
+ };
23
+
24
+ const topShards = {
25
+ id: GeneralPagesIds.topShards,
26
+ title: 'Top shards',
27
+ };
28
+
29
+ const nodes = {
30
+ id: GeneralPagesIds.nodes,
31
+ title: 'Nodes',
32
+ };
33
+
34
+ const tablets = {
35
+ id: GeneralPagesIds.tablets,
36
+ title: 'Tablets',
37
+ };
38
+ const storage = {
39
+ id: GeneralPagesIds.storage,
40
+ title: 'Storage',
41
+ };
42
+ const network = {
43
+ id: GeneralPagesIds.network,
44
+ title: 'Network',
45
+ };
46
+
47
+ const describe = {
48
+ id: GeneralPagesIds.describe,
49
+ title: 'Describe',
50
+ };
51
+
52
+ const hotKeys = {
53
+ id: GeneralPagesIds.hotKeys,
54
+ title: 'Hot keys',
55
+ };
56
+
57
+ const graph = {
58
+ id: GeneralPagesIds.graph,
59
+ title: 'Graph',
60
+ };
61
+
62
+ export const DATABASE_PAGES = [
63
+ overview,
64
+ topQueries,
65
+ topShards,
66
+ nodes,
67
+ tablets,
68
+ storage,
69
+ network,
70
+ describe,
71
+ ];
72
+
73
+ export const TABLE_PAGES = [overview, topShards, graph, tablets, hotKeys, describe];
74
+
75
+ export const DIR_PAGES = [overview, topShards, describe];
@@ -0,0 +1,191 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import {connect} from 'react-redux';
4
+ import cn from 'bem-cn-lite';
5
+
6
+ import {Loader, Button} from '@yandex-cloud/uikit';
7
+
8
+ import IssuesViewer from './IssuesViewer/IssuesViewer';
9
+
10
+ import {getHealthcheckInfo} from '../../../../store/reducers/healthcheckInfo';
11
+ import {hideTooltip, showTooltip} from '../../../../store/reducers/tooltip';
12
+ import {AutoFetcher} from '../../../../utils/autofetcher';
13
+
14
+ import './Healthcheck.scss';
15
+
16
+ const b = cn('healthcheck');
17
+
18
+ class Healthcheck extends React.Component {
19
+ static propTypes = {
20
+ data: PropTypes.object,
21
+ loading: PropTypes.bool,
22
+ wasLoaded: PropTypes.bool,
23
+ error: PropTypes.object,
24
+ getHealthcheckInfo: PropTypes.func,
25
+ tenant: PropTypes.string,
26
+ preview: PropTypes.bool,
27
+ showMoreHandler: PropTypes.func,
28
+ };
29
+
30
+ autofetcher;
31
+
32
+ componentDidMount() {
33
+ this.autofetcher = new AutoFetcher();
34
+ this.fetchHealthcheck();
35
+ if (this.props.autorefresh) {
36
+ this.autofetcher.start();
37
+ this.autofetcher.fetch(() => this.fetchHealthcheck());
38
+ }
39
+ }
40
+
41
+ componentDidUpdate(prevProps) {
42
+ const {autorefresh} = this.props;
43
+
44
+ if (autorefresh && !prevProps.autorefresh) {
45
+ this.fetchHealthcheck();
46
+ this.autofetcher.stop();
47
+ this.autofetcher.start();
48
+ this.autofetcher.fetch(() => this.fetchHealthcheck());
49
+ }
50
+ if (!autorefresh && prevProps.autorefresh) {
51
+ this.autofetcher.stop();
52
+ }
53
+ }
54
+
55
+ componentWillUnmount() {
56
+ this.autofetcher.stop();
57
+ }
58
+
59
+ fetchHealthcheck = () => {
60
+ const {tenant, getHealthcheckInfo} = this.props;
61
+ getHealthcheckInfo(tenant);
62
+ };
63
+
64
+ renderLoader() {
65
+ return (
66
+ <div className={b('loader')}>
67
+ <Loader size="m" />
68
+ </div>
69
+ );
70
+ }
71
+
72
+ renderUpdateButton() {
73
+ const {loading} = this.props;
74
+ return (
75
+ <Button size="s" onClick={this.fetchHealthcheck} loading={loading}>
76
+ Update
77
+ </Button>
78
+ );
79
+ }
80
+
81
+ renderPreview = () => {
82
+ const {data, showMoreHandler} = this.props;
83
+ const {self_check_result: selfCheckResult} = data;
84
+ const modifier = selfCheckResult.toLowerCase();
85
+
86
+ const statusOk = selfCheckResult === 'GOOD';
87
+ const text = statusOk
88
+ ? 'No issues have been found on this database.'
89
+ : 'Several issues have been found on this database.';
90
+
91
+ return (
92
+ <div>
93
+ <div className={b('status-wrapper')}>
94
+ <div className={b('preview-title')}>Healthcheck</div>
95
+ <div className={b('self-check-status-indicator', {[modifier]: true})}>
96
+ {statusOk ? 'Ok' : 'Error'}
97
+ </div>
98
+ {this.renderUpdateButton()}
99
+ </div>
100
+ <div>
101
+ {text}
102
+ {!statusOk && (
103
+ <Button view="flat-info" onClick={showMoreHandler}>
104
+ Show details
105
+ </Button>
106
+ )}
107
+ </div>
108
+ </div>
109
+ );
110
+ };
111
+
112
+ renderOverviewStatus = () => {
113
+ const {data} = this.props;
114
+ const {self_check_result: selfCheckResult} = data;
115
+ const modifier = selfCheckResult.toLowerCase();
116
+
117
+ return (
118
+ <div className={b('self-check-status')}>
119
+ <h3 className={b('self-check-status-label')}>Self check status</h3>
120
+ <div className={b('self-check-status-indicator', {[modifier]: true})} />
121
+ {selfCheckResult}
122
+ <div className={b('self-check-update')}>{this.renderUpdateButton()}</div>
123
+ </div>
124
+ );
125
+ };
126
+
127
+ renderHealthcheckIssues() {
128
+ const {data, showTooltip, hideTooltip} = this.props;
129
+ const {issue_log: issueLog} = data;
130
+
131
+ if (!issueLog) {
132
+ return null;
133
+ }
134
+
135
+ return (
136
+ <div className={b('issues')}>
137
+ <h3>Issues</h3>
138
+ <IssuesViewer
139
+ issues={issueLog}
140
+ showTooltip={showTooltip}
141
+ hideTooltip={hideTooltip}
142
+ />
143
+ </div>
144
+ );
145
+ }
146
+
147
+ renderContent = () => {
148
+ const {preview} = this.props;
149
+ return preview ? (
150
+ this.renderPreview()
151
+ ) : (
152
+ <div className={b()}>
153
+ {this.renderOverviewStatus()}
154
+ {this.renderHealthcheckIssues()}
155
+ </div>
156
+ );
157
+ };
158
+
159
+ render() {
160
+ const {error, data, loading, wasLoaded} = this.props;
161
+
162
+ if (error) {
163
+ return <div>{error.statusText}</div>;
164
+ } else if (data && data['self_check_result']) {
165
+ return this.renderContent();
166
+ } else if (loading && !wasLoaded) {
167
+ return this.renderLoader();
168
+ } else return <div className="error">no healthcheck data</div>;
169
+ }
170
+ }
171
+
172
+ function mapStateToProps(state) {
173
+ const {data, loading, wasLoaded, error} = state.healthcheckInfo;
174
+ const {autorefresh} = state.schema;
175
+
176
+ return {
177
+ data,
178
+ loading,
179
+ wasLoaded,
180
+ error,
181
+ autorefresh,
182
+ };
183
+ }
184
+
185
+ const mapDispatchToProps = {
186
+ getHealthcheckInfo,
187
+ hideTooltip,
188
+ showTooltip,
189
+ };
190
+
191
+ export default connect(mapStateToProps, mapDispatchToProps)(Healthcheck);
@@ -0,0 +1,79 @@
1
+ @import '../../../../styles/mixins.scss';
2
+
3
+ .healthcheck {
4
+ padding: 25px 20px 20px;
5
+
6
+ &__loader {
7
+ display: flex;
8
+ justify-content: center;
9
+ }
10
+
11
+ &__message-container {
12
+ padding: 15px 0;
13
+ }
14
+
15
+ &__self-check-status {
16
+ display: flex;
17
+ align-items: center;
18
+
19
+ margin-bottom: 20px;
20
+ }
21
+
22
+ &__self-check-status-label {
23
+ margin: 0 10px 0 0;
24
+ }
25
+
26
+ &__self-check-update {
27
+ margin-left: 20px;
28
+ }
29
+
30
+ &__status-wrapper {
31
+ display: flex;
32
+ gap: 8px;
33
+
34
+ margin-bottom: 15px;
35
+ }
36
+
37
+ &__preview-title {
38
+ font-weight: 600;
39
+ }
40
+
41
+ &__self-check-status-indicator {
42
+ padding: 0 8px;
43
+
44
+ border-radius: 4px;
45
+
46
+ &_good,
47
+ &_green {
48
+ color: var(--yc-color-text-positive);
49
+ background-color: var(--yc-color-base-positive);
50
+ }
51
+ &_degraded,
52
+ &_yellow {
53
+ color: var(--yc-color-text-warning-medium);
54
+ background-color: var(--yc-color-base-warning);
55
+ }
56
+
57
+ &_blue {
58
+ color: var(--yc-color-text-info);
59
+ background-color: var(--yc-color-base-info);
60
+ }
61
+
62
+ &_emergency,
63
+ &_red {
64
+ color: var(--yc-color-text-danger);
65
+ background-color: var(--yc-color-base-danger);
66
+ }
67
+ &_unspecified,
68
+ &_gray,
69
+ &_grey {
70
+ color: var(--yc-color-text-misc);
71
+ background-color: var(--yc-color-base-misc);
72
+ }
73
+ &_maintenance_required,
74
+ &_orange {
75
+ color: var(--yc-color-text-warning-heavy);
76
+ background-color: var(--yc-color-infographics-warning-light);
77
+ }
78
+ }
79
+ }
@@ -1,19 +1,20 @@
1
- @import '../../../../styles/mixins.scss';
1
+ @import '../../../../../styles/mixins.scss';
2
2
 
3
3
  .issue {
4
4
  display: flex;
5
5
  align-items: center;
6
- height: 40px;
7
- cursor: pointer;
8
6
 
7
+ height: 40px;
9
8
  margin-left: 36px;
9
+
10
+ cursor: pointer;
10
11
  .km-tree-view__arrow-icon + & {
11
12
  margin-left: 0;
12
13
  }
13
14
 
14
15
  &_active {
15
- background: var(--yc-color-base-info);
16
16
  border-radius: 4px;
17
+ background: var(--yc-color-base-info);
17
18
  }
18
19
 
19
20
  &__wpapper {
@@ -23,9 +24,10 @@
23
24
  & .km-tree-view__arrow-icon {
24
25
  display: flex;
25
26
  align-items: center;
26
- margin: 0;
27
+
27
28
  width: 36px;
28
29
  height: 36px;
30
+ margin: 0;
29
31
  }
30
32
  }
31
33
 
@@ -39,24 +41,30 @@
39
41
 
40
42
  &_status {
41
43
  display: flex;
42
- white-space: nowrap;
44
+
43
45
  min-width: 470px;
46
+
47
+ white-space: nowrap;
44
48
  }
45
49
  &_type {
46
50
  min-width: 160px;
47
51
  }
48
52
  &_additional {
49
- color: var(--yc-color-text-link);
50
53
  width: max-content;
54
+
51
55
  cursor: pointer;
52
56
 
57
+ color: var(--yc-color-text-link);
58
+
53
59
  &:hover {
54
60
  color: var(--yc-color-text-link-hover);
55
61
  }
56
62
  }
57
63
  &_message {
58
- width: 300px;
59
64
  overflow: hidden;
65
+
66
+ width: 300px;
67
+
60
68
  white-space: normal;
61
69
  }
62
70
  }
@@ -76,9 +84,10 @@
76
84
  .indicator {
77
85
  width: 12px;
78
86
  height: 12px;
79
- border-radius: 4px;
80
87
  margin-right: 4px;
81
88
 
89
+ border-radius: 4px;
90
+
82
91
  &_good,
83
92
  &_green {
84
93
  background-color: var(--yc-color-base-positive-heavy);
@@ -115,17 +124,19 @@
115
124
  }
116
125
 
117
126
  &__checkbox {
118
- margin: 5px 0 10px 0;
127
+ margin: 5px 0 10px;
119
128
  }
120
129
 
121
130
  &__info-panel {
122
131
  position: sticky;
123
132
  top: 20px;
124
- padding: 5px 20px 20px;
125
- height: 100%;
133
+
126
134
  width: 500px;
127
- background: var(--yc-color-base-generic);
135
+ height: 100%;
136
+ padding: 5px 20px 20px;
137
+
128
138
  border-radius: 4px;
139
+ background: var(--yc-color-base-generic);
129
140
  }
130
141
 
131
142
  &__inspector {
@@ -153,6 +164,7 @@
153
164
 
154
165
  &__value {
155
166
  overflow: hidden;
167
+
156
168
  word-break: break-all;
157
169
 
158
170
  & > span {
@@ -7,8 +7,8 @@ import _filter from 'lodash/fp/filter';
7
7
  import _sortBy from 'lodash/fp/sortBy';
8
8
  import _uniqBy from 'lodash/fp/uniqBy';
9
9
 
10
- import TreeView from '../../../../components/TreeView/TreeView';
11
- import EntityStatus from '../../../../components/EntityStatus/EntityStatus';
10
+ import TreeView from '../../../../../components/TreeView/TreeView';
11
+ import EntityStatus from '../../../../../components/EntityStatus/EntityStatus';
12
12
 
13
13
  import './IssueViewer.scss';
14
14