ydb-embedded-ui 0.1.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (205) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/LICENSE +21 -0
  3. package/README.md +3 -3
  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 +175 -0
  136. package/dist/containers/Tenant/ObjectSummary/ObjectSummary.tsx +319 -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 +95 -0
  141. package/dist/containers/Tenant/QueryEditor/QueryEditor.js +319 -268
  142. package/dist/containers/Tenant/QueryEditor/QueryEditor.scss +47 -18
  143. package/dist/containers/Tenant/QueryEditor/QueryExplain/QueryExplain.js +190 -75
  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/executeQuery.js +36 -2
  175. package/dist/store/reducers/fullscreen.ts +31 -0
  176. package/dist/store/reducers/header.ts +23 -0
  177. package/dist/store/reducers/hotKeys.js +1 -1
  178. package/dist/store/reducers/index.js +6 -0
  179. package/dist/store/reducers/saveQuery.ts +33 -0
  180. package/dist/store/reducers/schema.js +14 -0
  181. package/dist/store/reducers/shardsWorkload.js +1 -1
  182. package/dist/store/state-url-mapping.js +1 -1
  183. package/dist/store/utils.js +2 -6
  184. package/dist/styles/mixins.scss +49 -34
  185. package/dist/utils/autofetcher.ts +51 -0
  186. package/dist/utils/constants.js +26 -7
  187. package/dist/utils/createToast.tsx +23 -0
  188. package/dist/utils/getNodesColumns.js +25 -28
  189. package/dist/utils/index.js +6 -2
  190. package/package.json +8 -4
  191. package/dist/components/SplitPane/SplitPane.js +0 -368
  192. package/dist/components/TenantOverview/TenantOverview.js +0 -148
  193. package/dist/containers/Cluster/Cluster.js +0 -168
  194. package/dist/containers/Header/Header.js +0 -88
  195. package/dist/containers/StorageV2/DiskStateProgressBar/DiskStateProgressBar.scss +0 -81
  196. package/dist/containers/Tenant/Compute/Compute.scss +0 -6
  197. package/dist/containers/Tenant/Healthcheck/Healthcheck.js +0 -116
  198. package/dist/containers/Tenant/Healthcheck/Healthcheck.scss +0 -64
  199. package/dist/containers/Tenant/Schema/Info/Info.js +0 -84
  200. package/dist/containers/Tenant/Schema/Info/Info.scss +0 -3
  201. package/dist/containers/Tenant/Schema/SchemaMain/SchemaMain.js +0 -439
  202. package/dist/containers/Tenant/Schema/SchemaMain/SchemaMain.scss +0 -90
  203. package/dist/containers/Tenant/Schema/SchemaPages.js +0 -56
  204. package/dist/containers/Tenant/Tenant.js +0 -199
  205. package/dist/containers/Tenant/TenantPages.js +0 -35
@@ -0,0 +1,200 @@
1
+ import React from 'react';
2
+ import {connect} from 'react-redux';
3
+ import cn from 'bem-cn-lite';
4
+ import PropTypes from 'prop-types';
5
+
6
+ import EntityStatus from '../../../../components/EntityStatus/EntityStatus';
7
+ import InfoViewer from '../../../../components/InfoViewer/InfoViewer';
8
+ import PoolUsage from '../../../../components/PoolUsage/PoolUsage';
9
+ import Tablet from '../../../../components/Tablet/Tablet';
10
+
11
+ import {hideTooltip, showTooltip} from '../../../../store/reducers/tooltip';
12
+ import {getTenantInfo} from '../../../../store/reducers/tenant';
13
+
14
+ import {formatCPU} from '../../../../utils';
15
+ import {bytesToGB} from '../../../../utils/utils';
16
+ import {TABLET_STATES} from '../../../../utils/constants';
17
+
18
+ import './TenantOverview.scss';
19
+ import {AutoFetcher} from '../../../../utils/autofetcher';
20
+ import {Loader} from '@yandex-cloud/uikit';
21
+
22
+ const b = cn('tenant-overview');
23
+
24
+ const renderName = (tenant) => {
25
+ if (tenant) {
26
+ const {Name} = tenant;
27
+ return (
28
+ <div className={b('tenant-name')}>
29
+ <EntityStatus status={tenant.State} />
30
+ <span>{Name}</span>
31
+ </div>
32
+ );
33
+ }
34
+
35
+ return <div>no tenant data</div>;
36
+ };
37
+
38
+ class TenantOverview extends React.Component {
39
+ static propTypes = {
40
+ loading: PropTypes.bool,
41
+ autorefresh: PropTypes.bool,
42
+ tenant: PropTypes.object,
43
+ hideTooltip: PropTypes.func,
44
+ showTooltip: PropTypes.func,
45
+ systemTablets: PropTypes.array,
46
+ additionalTenantInfo: PropTypes.func,
47
+ tenantName: PropTypes.string,
48
+ };
49
+
50
+ autofetcher;
51
+
52
+ componentDidMount() {
53
+ const {tenantName, autorefresh, getTenantInfo} = this.props;
54
+ this.autofetcher = new AutoFetcher();
55
+ if (autorefresh) {
56
+ this.autofetcher.start();
57
+ this.autofetcher.fetch(() => getTenantInfo({path: tenantName}));
58
+ }
59
+ }
60
+
61
+ componentDidUpdate(prevProps) {
62
+ const {autorefresh, tenantName, getTenantInfo} = this.props;
63
+ if (autorefresh && !prevProps.autorefresh) {
64
+ getTenantInfo({path: tenantName});
65
+ this.autofetcher.stop();
66
+ this.autofetcher.start();
67
+ this.autofetcher.fetch(() => getTenantInfo({path: tenantName}));
68
+ }
69
+ if (!autorefresh && prevProps.autorefresh) {
70
+ this.autofetcher.stop();
71
+ }
72
+ }
73
+
74
+ componentWillUnmount() {
75
+ this.autofetcher.stop();
76
+ }
77
+
78
+ renderLoader = () => {
79
+ return (
80
+ <div className={b('loader')}>
81
+ <Loader size="m" />
82
+ </div>
83
+ );
84
+ };
85
+
86
+ render() {
87
+ const {tenant, hideTooltip, showTooltip, loading} = this.props;
88
+ const {
89
+ Metrics = {},
90
+ PoolStats,
91
+ StateStats = [],
92
+ MemoryUsed,
93
+ CoresUsed,
94
+ StorageGroups,
95
+ StorageAllocatedSize,
96
+ Type,
97
+ SystemTablets,
98
+ } = tenant;
99
+
100
+ const memoryRaw = MemoryUsed ?? Metrics.Memory;
101
+
102
+ const memory = (memoryRaw && bytesToGB(memoryRaw)) || 'no data';
103
+ const storage = (Metrics.Storage && bytesToGB(Metrics.Storage)) || 'no data';
104
+ const storageGroups = StorageGroups ?? 'no data';
105
+ const blobStorage = (StorageAllocatedSize && bytesToGB(StorageAllocatedSize)) || 'no data';
106
+ const storageEfficiency =
107
+ Metrics.Storage && StorageAllocatedSize
108
+ ? `${((Metrics.Storage * 100) / StorageAllocatedSize).toFixed(2)}%`
109
+ : 'no data';
110
+
111
+ const cpuRaw = CoresUsed !== undefined ? Number(CoresUsed) * 1_000_000 : Metrics.CPU;
112
+
113
+ const cpu = formatCPU(cpuRaw);
114
+
115
+ const metricsInfo = [
116
+ {label: 'Type', value: Type},
117
+ {label: 'Memory', value: memory},
118
+ {label: 'CPU', value: cpu},
119
+ {label: 'Tablet storage', value: storage},
120
+ {label: 'Storage groups', value: storageGroups},
121
+ {label: 'Blob storage', value: blobStorage},
122
+ {label: 'Storage efficiency', value: storageEfficiency},
123
+ ];
124
+
125
+ const tabletsInfo = StateStats.map((info) => ({
126
+ label: TABLET_STATES[info.VolatileState],
127
+ value: info.Count,
128
+ }));
129
+
130
+ return loading ? (
131
+ this.renderLoader()
132
+ ) : (
133
+ <div className={b()}>
134
+ <div className={b('top-label')}>Database</div>
135
+ <div className={b('top')}>
136
+ {renderName(tenant)}
137
+ {this.props.additionalTenantInfo &&
138
+ this.props.additionalTenantInfo(
139
+ this.props.tenant.Name,
140
+ this.props.tenant.Type,
141
+ )}
142
+ <div className={b('system-tablets')}>
143
+ {SystemTablets &&
144
+ SystemTablets.map((tablet, tabletIndex) => (
145
+ <Tablet
146
+ onMouseEnter={showTooltip}
147
+ onMouseLeave={hideTooltip}
148
+ key={tabletIndex}
149
+ tablet={tablet}
150
+ />
151
+ ))}
152
+ </div>
153
+ </div>
154
+ <div className={b('common-info')}>
155
+ {PoolStats ? (
156
+ <div>
157
+ <div className={b('section-title')}>Pools</div>
158
+ <div className={b('section', {pools: true})}>
159
+ {PoolStats.map((pool, poolIndex) => (
160
+ <PoolUsage key={poolIndex} data={pool} />
161
+ ))}
162
+ </div>
163
+ </div>
164
+ ) : (
165
+ <div className="error">no pools data</div>
166
+ )}
167
+ <InfoViewer
168
+ title="Metrics"
169
+ className={b('section', {metrics: true})}
170
+ info={metricsInfo}
171
+ />
172
+
173
+ <div className={b('section')}>
174
+ <InfoViewer info={tabletsInfo} title="Tablets" />
175
+ </div>
176
+ </div>
177
+ </div>
178
+ );
179
+ }
180
+ }
181
+
182
+ function mapStateToProps(state) {
183
+ const {tenant = {}, loading, data: {status} = {}} = state.tenant;
184
+ const {autorefresh} = state.schema;
185
+
186
+ return {
187
+ tenant,
188
+ loading,
189
+ status,
190
+ autorefresh,
191
+ };
192
+ }
193
+
194
+ const mapDispatchToProps = {
195
+ hideTooltip,
196
+ showTooltip,
197
+ getTenantInfo,
198
+ };
199
+
200
+ export default connect(mapStateToProps, mapDispatchToProps)(TenantOverview);
@@ -1,35 +1,46 @@
1
1
  .tenant-overview {
2
- padding: 15px;
2
+ padding-bottom: 20px;
3
+ &__loader {
4
+ display: flex;
5
+ justify-content: center;
6
+ }
7
+ &__tenant-name {
8
+ display: flex;
9
+ align-items: center;
10
+
11
+ & .yc-link {
12
+ display: flex;
13
+ }
14
+ }
3
15
 
4
16
  &__top {
5
17
  display: flex;
6
18
  align-items: center;
7
19
 
8
- margin-bottom: 10px;
20
+ margin-bottom: 20px;
9
21
  }
10
22
 
11
23
  &__top-label {
12
- margin-right: 16px;
24
+ gap: 10px;
13
25
 
14
- text-transform: uppercase;
26
+ margin-bottom: 20px;
15
27
 
16
- font-size: var(--yc-text-body2-font-size);
17
- font-weight: 500;
18
- line-height: var(--yc-text-body2-line-height);
28
+ font-weight: 600;
19
29
  }
20
30
 
21
31
  &__common-info {
22
32
  display: flex;
23
- align-items: stretch;
24
- justify-content: flex-start;
33
+ gap: 20px;
25
34
 
26
- padding-left: 12px;
35
+ flex-direction: column;
36
+ justify-content: flex-start;
37
+ align-items: stretch;
27
38
  }
28
39
 
29
40
  &__system-tablets {
30
41
  display: flex;
31
- align-items: center;
32
42
  flex-wrap: wrap;
43
+ align-items: center;
33
44
 
34
45
  margin-left: 15px;
35
46
  }
@@ -42,9 +53,6 @@
42
53
  }
43
54
 
44
55
  &__section {
45
- margin-right: 20px;
46
- padding: 0 15px 0 0;
47
-
48
56
  border-radius: 10px;
49
57
 
50
58
  &_metrics {
@@ -58,15 +66,14 @@
58
66
 
59
67
  &_pools {
60
68
  display: grid;
69
+ grid-gap: 7px 20px;
61
70
 
62
- padding: 15px 15px 0 0;
63
71
  grid-template-columns: 110px 110px;
64
- grid-gap: 7px 20px;
65
72
  }
66
73
  }
67
74
 
68
75
  &__section-title {
69
- margin: 0;
76
+ margin-bottom: 20px;
70
77
 
71
78
  font-size: var(--yc-text-body2-font-size);
72
79
  font-weight: 500;
@@ -2,26 +2,22 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import cn from 'bem-cn-lite';
4
4
  import {connect} from 'react-redux';
5
- import {Loader} from '@yandex-cloud/uikit';
6
5
  import DataTable from '@yandex-cloud/react-data-table';
7
6
 
8
- import {changeUserInput} from '../../../store/reducers/executeQuery';
9
- import {sendQuery, setQueryOptions} from '../../../store/reducers/executeTopQueries';
10
- import {QUERY} from '../Schema/SchemaPages';
11
- import TruncatedQuery from '../../../components/TruncatedQuery/TruncatedQuery';
12
- import {AutoFetcher} from '../../Cluster/Cluster';
13
- import {OLAP_STORE_TYPE, OLAP_TABLE_TYPE} from '../Schema/SchemaMain/SchemaMain';
7
+ import {changeUserInput} from '../../../../store/reducers/executeQuery';
8
+ import {sendQuery, setQueryOptions} from '../../../../store/reducers/executeTopQueries';
9
+ import TruncatedQuery from '../../../../components/TruncatedQuery/TruncatedQuery';
10
+ import {AutoFetcher} from '../../../../utils/autofetcher';
11
+ import { OLAP_STORE_TYPE, OLAP_TABLE_TYPE } from '../../Tenant';
14
12
 
15
13
  import './TopQueries.scss';
14
+ import {DEFAULT_TABLE_SETTINGS} from '../../../../utils/constants';
15
+ import {TenantGeneralTabsIds} from '../../TenantPages';
16
+ import {Loader} from '@yandex-cloud/uikit';
17
+
16
18
 
17
19
  const b = cn('kv-top-queries');
18
20
 
19
- const TABLE_SETTINGS = {
20
- displayIndices: false,
21
- syncHeadOnResize: true,
22
- stickyHead: DataTable.MOVING,
23
- highlightRows: true,
24
- };
25
21
  const MAX_QUERY_HEIGHT = 10;
26
22
  const COLUMNS = [
27
23
  {
@@ -58,8 +54,11 @@ class TopQueries extends React.Component {
58
54
  path: PropTypes.string,
59
55
  data: PropTypes.array,
60
56
  loading: PropTypes.bool,
57
+ wasLoaded: PropTypes.bool,
61
58
  changeSchemaTab: PropTypes.func,
62
59
  currentSchema: PropTypes.object,
60
+ type: PropTypes.string,
61
+ className: PropTypes.string,
63
62
  };
64
63
 
65
64
  autofetcher;
@@ -67,6 +66,10 @@ class TopQueries extends React.Component {
67
66
  componentDidMount() {
68
67
  this.autofetcher = new AutoFetcher();
69
68
  this.getTopQueries();
69
+ if (this.props.autorefresh) {
70
+ this.autofetcher.start();
71
+ this.autofetcher.fetch(() => this.getTopQueries());
72
+ }
70
73
  }
71
74
 
72
75
  componentDidUpdate(prevProps) {
@@ -93,6 +96,14 @@ class TopQueries extends React.Component {
93
96
  this.autofetcher.stop();
94
97
  }
95
98
 
99
+ renderLoader = () => {
100
+ return (
101
+ <div className={b('loader')}>
102
+ <Loader size="m" />
103
+ </div>
104
+ );
105
+ };
106
+
96
107
  getTopQueries() {
97
108
  const {path} = this.props;
98
109
  const query = getQueryText(path);
@@ -104,7 +115,7 @@ class TopQueries extends React.Component {
104
115
  const {changeUserInput, changeSchemaTab} = this.props;
105
116
 
106
117
  changeUserInput({input});
107
- changeSchemaTab(QUERY);
118
+ changeSchemaTab(TenantGeneralTabsIds.query);
108
119
  };
109
120
 
110
121
  renderTable = () => {
@@ -118,7 +129,7 @@ class TopQueries extends React.Component {
118
129
  <DataTable
119
130
  columns={COLUMNS}
120
131
  data={data}
121
- settings={TABLE_SETTINGS}
132
+ settings={DEFAULT_TABLE_SETTINGS}
122
133
  onRowClick={this.onRowClick}
123
134
  />
124
135
  );
@@ -133,17 +144,10 @@ class TopQueries extends React.Component {
133
144
  };
134
145
 
135
146
  render() {
136
- const {error, loading, data, wasLoaded, type} = this.props;
137
-
138
- if (loading && !wasLoaded) {
139
- return (
140
- <div className={b('loader-container')}>
141
- <Loader size="m" />
142
- </div>
143
- );
144
- }
147
+ const {error, loading, data, type, className, wasLoaded} = this.props;
145
148
 
146
149
  let message;
150
+
147
151
  if (type === OLAP_STORE_TYPE || type === OLAP_TABLE_TYPE) {
148
152
  message = 'No data';
149
153
  } else if (error && !error.isCancelled) {
@@ -152,13 +156,11 @@ class TopQueries extends React.Component {
152
156
  message = 'No data';
153
157
  }
154
158
 
155
- if (message) {
156
- return <div className={b('message-container')}>{message}</div>;
157
- }
158
-
159
- return (
159
+ return loading && !wasLoaded ? (
160
+ this.renderLoader()
161
+ ) : (
160
162
  <div className={b()}>
161
- <div className={b('result')}>{this.renderResult()}</div>
163
+ <div className={b('result', className)}>{message || this.renderResult()}</div>
162
164
  </div>
163
165
  );
164
166
  }
@@ -1,19 +1,18 @@
1
- @import '../../../styles/mixins.scss';
1
+ @import '../../../../styles/mixins.scss';
2
2
 
3
3
  .kv-top-queries {
4
+ height: 100%;
5
+
6
+ @include query-data-table;
4
7
  &__message-container {
5
8
  padding: 15px 0;
6
9
  }
7
10
 
8
- &__loader-container {
11
+ &__loader {
9
12
  display: flex;
10
13
  justify-content: center;
11
- align-items: center;
12
- height: 100%;
13
14
  }
14
15
 
15
- @include query-data-table;
16
-
17
16
  &__owner-container {
18
17
  margin: 10px;
19
18
 
@@ -25,6 +24,7 @@
25
24
  &__text {
26
25
  font-size: var(--yc-text-body-font-size);
27
26
  line-height: var(--yc-text-body-line-height);
27
+
28
28
  color: var(--yc-color-text-primary);
29
29
 
30
30
  &::first-letter {
@@ -39,14 +39,15 @@
39
39
  width: 100%;
40
40
  }
41
41
  &__td {
42
- word-break: break-word;
43
- white-space: pre;
44
42
  vertical-align: top;
43
+ white-space: pre;
44
+ word-break: break-word;
45
45
  }
46
46
 
47
47
  &__row {
48
- cursor: pointer;
49
48
  max-height: 80px;
49
+
50
+ cursor: pointer;
50
51
  }
51
52
  }
52
53
  }
@@ -1,28 +1,24 @@
1
1
  import {useContext, useEffect, useMemo} from 'react';
2
2
  import cn from 'bem-cn-lite';
3
3
  import {connect} from 'react-redux';
4
- import InternalLink from '../../../components/InternalLink/InternalLink';
5
- import {Loader} from '@yandex-cloud/uikit';
4
+ import InternalLink from '../../../../components/InternalLink/InternalLink';
6
5
  import DataTable from '@yandex-cloud/react-data-table';
7
- import routes, {createHref} from '../../../routes';
6
+ import routes, {createHref} from '../../../../routes';
7
+
8
+ import {sendShardQuery, setShardQueryOptions} from '../../../../store/reducers/shardsWorkload';
9
+ import {setCurrentSchemaPath, getSchema} from '../../../../store/reducers/schema';
10
+ import {AutoFetcher} from '../../../../utils/autofetcher';
8
11
 
9
- import {sendShardQuery, setShardQueryOptions} from '../../../store/reducers/shardsWorkload';
10
- import {setCurrentSchemaPath, getSchema} from '../../../store/reducers/schema';
11
- import {AutoFetcher} from '../../Cluster/Cluster';
12
+ import HistoryContext from '../../../../contexts/HistoryContext';
12
13
 
13
14
  import './TopShards.scss';
14
- import {OLAP_STORE_TYPE, OLAP_TABLE_TYPE} from '../Schema/SchemaMain/SchemaMain';
15
- import HistoryContext from '../../../contexts/HistoryContext';
15
+ import {DEFAULT_TABLE_SETTINGS} from '../../../../utils/constants';
16
+ import {Loader} from '@yandex-cloud/uikit';
17
+ import { OLAP_STORE_TYPE, OLAP_TABLE_TYPE } from '../../Tenant';
16
18
 
17
19
  const b = cn('top-shards');
18
20
  const bLink = cn('yc-link');
19
21
 
20
- const TABLE_SETTINGS = {
21
- displayIndices: false,
22
- syncHeadOnResize: true,
23
- stickyHead: DataTable.MOVING,
24
- };
25
-
26
22
  const tableColumnsNames = {
27
23
  TabletId: 'TabletId',
28
24
  CPUCores: 'CPUCores',
@@ -69,14 +65,6 @@ function TopShards({
69
65
  });
70
66
  }, [currentSchemaPath]);
71
67
 
72
- const renderLoader = () => {
73
- return (
74
- <div className={b('loader')}>
75
- <Loader size="l" />
76
- </div>
77
- );
78
- };
79
-
80
68
  const history = useContext(HistoryContext);
81
69
 
82
70
  const onSchemaClick = (schemaPath) => {
@@ -122,21 +110,30 @@ function TopShards({
122
110
  ];
123
111
  }, []);
124
112
 
113
+ const renderLoader = () => {
114
+ return (
115
+ <div className={b('loader')}>
116
+ <Loader size="m" />
117
+ </div>
118
+ );
119
+ };
120
+
125
121
  const renderContent = () => {
126
122
  if (type === OLAP_STORE_TYPE || type === OLAP_TABLE_TYPE) {
127
- return <div className={b('no-data')}>No data</div>;
123
+ return 'No data';
128
124
  }
129
125
  if (error) {
130
- return error.data;
126
+ return error.data || error;
131
127
  }
128
+
132
129
  return data && data.length > 0 ? (
133
130
  <div className={b('table')}>
134
131
  <DataTable
135
132
  columns={tableColumns}
136
133
  data={data}
137
- settings={TABLE_SETTINGS}
134
+ settings={DEFAULT_TABLE_SETTINGS}
138
135
  className={b('table')}
139
- theme="internal"
136
+ theme="yandex-cloud"
140
137
  />
141
138
  </div>
142
139
  ) : (
@@ -144,18 +141,17 @@ function TopShards({
144
141
  );
145
142
  };
146
143
 
147
- return <div className={b()}>{loading && !wasLoaded ? renderLoader() : renderContent()}</div>;
144
+ return loading && !wasLoaded ? renderLoader() : <div className={b()}>{renderContent()}</div>;
148
145
  }
149
146
 
150
147
  const mapStateToProps = (state) => {
151
148
  const {loading, data, error, wasLoaded} = state.shardsWorkload;
152
- const {Path} = state.schema.currentSchema;
153
149
  const {autorefresh} = state.schema;
154
150
  return {
155
151
  loading,
156
152
  data,
157
153
  error,
158
- currentSchemaPath: Path,
154
+ currentSchemaPath: state.schema?.currentSchema?.Path,
159
155
  autorefresh,
160
156
  wasLoaded,
161
157
  };
@@ -1,23 +1,11 @@
1
1
  .top-shards {
2
- height: 100%;
3
- padding-top: 10px;
4
-
5
2
  background-color: var(--yc-color-base-background);
6
3
  &__loader {
7
4
  display: flex;
8
- align-items: center;
9
5
  justify-content: center;
10
-
11
- height: 100%;
12
6
  }
13
7
 
14
8
  &__table {
15
- overflow: auto;
16
-
17
- margin-top: 5px;
18
- }
19
-
20
- &__no-data {
21
- margin-top: 5px;
9
+ height: 100%;
22
10
  }
23
11
  }
@@ -0,0 +1,38 @@
1
+ @import '../../../styles/mixins.scss';
2
+
3
+ .object-general {
4
+ display: flex;
5
+ flex-grow: 1;
6
+ flex-direction: column;
7
+
8
+ width: 100%;
9
+ height: 100%;
10
+ max-height: 100%;
11
+
12
+ &__tabs {
13
+ display: flex;
14
+ gap: 20px;
15
+
16
+ padding: 13px 20px 0;
17
+
18
+ box-shadow: inset 0 -1px 0 0 var(--yc-color-line-generic);
19
+ @include body3-typography();
20
+ .yc-tabs {
21
+ box-shadow: unset;
22
+ }
23
+ }
24
+ &__tab {
25
+ text-decoration: none;
26
+ }
27
+
28
+ &__loader {
29
+ display: flex;
30
+ }
31
+
32
+ &__tab-label {
33
+ display: flex;
34
+ gap: 5px;
35
+
36
+ align-items: center;
37
+ }
38
+ }