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
@@ -6,10 +6,11 @@ import DataTable from '@yandex-cloud/react-data-table';
6
6
 
7
7
  import Icon from '../../../../components/Icon/Icon';
8
8
 
9
- import {AutoFetcher} from '../../../Cluster/Cluster';
9
+ import {AutoFetcher} from '../../../../utils/autofetcher';
10
10
  import {getHotKeys, setHotKeysOptions} from '../../../../store/reducers/hotKeys';
11
11
 
12
12
  import './HotKeys.scss';
13
+ import {TABLE_TYPE} from '../../Tenant';
13
14
 
14
15
  const b = cn('hot-keys');
15
16
 
@@ -37,12 +38,18 @@ function HotKeys({
37
38
  autorefresh,
38
39
  setHotKeysOptions,
39
40
  currentSchema,
41
+ type,
40
42
  }) {
43
+ const fetchData = () => {
44
+ if (type === TABLE_TYPE) {
45
+ getHotKeys(currentSchemaPath);
46
+ }
47
+ };
41
48
  useEffect(() => {
42
- getHotKeys(currentSchemaPath);
43
49
  if (autorefresh) {
50
+ fetchData();
44
51
  autofetcher.start();
45
- autofetcher.fetch(() => getHotKeys(currentSchemaPath));
52
+ autofetcher.fetch(() => fetchData());
46
53
  } else {
47
54
  autofetcher.stop();
48
55
  }
@@ -52,7 +59,7 @@ function HotKeys({
52
59
  }, [autorefresh]);
53
60
 
54
61
  useEffect(() => {
55
- getHotKeys(currentSchemaPath);
62
+ fetchData();
56
63
  setHotKeysOptions({
57
64
  wasLoaded: false,
58
65
  data: undefined,
@@ -68,7 +75,7 @@ function HotKeys({
68
75
  };
69
76
 
70
77
  const tableColumns = useMemo(() => {
71
- const keyColumnsIds = currentSchema?.PathDescription?.Table?.KeyColumnNames;
78
+ const keyColumnsIds = currentSchema?.PathDescription?.Table?.KeyColumnNames ?? [];
72
79
 
73
80
  return [
74
81
  {
@@ -106,7 +113,7 @@ function HotKeys({
106
113
  columns={tableColumns}
107
114
  data={data}
108
115
  settings={TABLE_SETTINGS}
109
- theme="internal"
116
+ theme="yandex-cloud"
110
117
  initialSortOrder={{
111
118
  columnId: tableColumnsIds.accessSample,
112
119
  order: DataTable.DESCENDING,
@@ -127,9 +134,8 @@ function HotKeys({
127
134
 
128
135
  const mapStateToProps = (state) => {
129
136
  const {loading, data, error, wasLoaded} = state.hotKeys;
130
- const {currentSchema = {}} = state.schema;
137
+ const {currentSchema = {}, autorefresh} = state.schema;
131
138
  const {Path} = currentSchema;
132
- const {autorefresh} = state.schema;
133
139
  return {
134
140
  loading,
135
141
  data,
@@ -3,9 +3,9 @@
3
3
  .hot-keys {
4
4
  display: flex;
5
5
  overflow: auto;
6
- align-items: flex-start;
7
- flex-direction: column;
8
6
  flex-grow: 1;
7
+ flex-direction: column;
8
+ align-items: flex-start;
9
9
 
10
10
  max-height: 100%;
11
11
 
@@ -13,8 +13,9 @@
13
13
 
14
14
  &__table-content {
15
15
  overflow: auto;
16
- height: 100%;
16
+
17
17
  width: 100%;
18
+ height: 100%;
18
19
  @include freeze-nth-column(1);
19
20
  }
20
21
 
@@ -31,8 +32,8 @@
31
32
  }
32
33
  &__loader {
33
34
  display: flex;
34
- align-items: center;
35
35
  justify-content: center;
36
+ align-items: center;
36
37
 
37
38
  width: 100%;
38
39
  height: 100%;
@@ -42,7 +43,8 @@
42
43
  }
43
44
  &__primary-key-column {
44
45
  display: flex;
45
- align-items: center;
46
46
  gap: 5px;
47
+
48
+ align-items: center;
47
49
  }
48
50
  }
@@ -8,16 +8,17 @@ import {Link} from 'react-router-dom';
8
8
  import {Loader, Checkbox} from '@yandex-cloud/uikit';
9
9
 
10
10
  import NodeNetwork from './NodeNetwork/NodeNetwork';
11
- import Icon from '../../../components/Icon/Icon';
12
- import ProblemFilter, {problemFilterType} from '../../../components/ProblemFilter/ProblemFilter';
11
+ import Icon from '../../../../components/Icon/Icon';
12
+ import ProblemFilter, {problemFilterType} from '../../../../components/ProblemFilter/ProblemFilter';
13
13
 
14
- import {getNetworkInfo} from '../../../store/reducers/network';
15
- import {hideTooltip, showTooltip} from '../../../store/reducers/tooltip';
16
- import {ALL, PROBLEMS} from '../../../utils/constants';
17
- import routes, {createHref} from '../../../routes';
18
- import {changeFilter} from '../../../store/reducers/settings';
14
+ import {getNetworkInfo} from '../../../../store/reducers/network';
15
+ import {hideTooltip, showTooltip} from '../../../../store/reducers/tooltip';
16
+ import {ALL, PROBLEMS} from '../../../../utils/constants';
17
+ import routes, {createHref} from '../../../../routes';
18
+ import {changeFilter} from '../../../../store/reducers/settings';
19
19
 
20
20
  import './Network.scss';
21
+ import {AutoFetcher} from '../../../../utils/autofetcher';
21
22
 
22
23
  const b = cn('network');
23
24
 
@@ -30,6 +31,7 @@ class Network extends React.Component {
30
31
  error: PropTypes.object,
31
32
  wasLoaded: PropTypes.bool,
32
33
  loading: PropTypes.bool,
34
+ autorefresh: PropTypes.bool,
33
35
  path: PropTypes.string,
34
36
  filter: problemFilterType,
35
37
  changeFilter: PropTypes.func,
@@ -57,9 +59,35 @@ class Network extends React.Component {
57
59
  showRacks: false,
58
60
  };
59
61
 
62
+ autofetcher;
63
+
60
64
  componentDidMount() {
61
- const {path} = this.props;
62
- this.props.getNetworkInfo(path);
65
+ const {path, autorefresh, getNetworkInfo} = this.props;
66
+ this.autofetcher = new AutoFetcher();
67
+
68
+ if (autorefresh) {
69
+ this.autofetcher.start();
70
+ this.autofetcher.fetch(() => getNetworkInfo(path));
71
+ }
72
+
73
+ getNetworkInfo(path);
74
+ }
75
+
76
+ componentDidUpdate(prevProps) {
77
+ const {autorefresh, path} = this.props;
78
+
79
+ if (autorefresh && !prevProps.autorefresh) {
80
+ getNetworkInfo(path);
81
+ this.autofetcher.start();
82
+ this.autofetcher.fetch(() => getNetworkInfo(path));
83
+ }
84
+ if (!autorefresh && prevProps.autorefresh) {
85
+ this.autofetcher.stop();
86
+ }
87
+ }
88
+
89
+ componentWillUnmount() {
90
+ this.autofetcher.stop();
63
91
  }
64
92
 
65
93
  onChange = (field, num) => {
@@ -323,11 +351,13 @@ class Network extends React.Component {
323
351
 
324
352
  const mapStateToProps = (state) => {
325
353
  const {wasLoaded, loading, data: netWorkInfo} = state.network;
354
+ const {autorefresh} = state.schema;
326
355
  return {
327
356
  netWorkInfo,
328
357
  wasLoaded,
329
358
  loading,
330
359
  filter: state.settings.problemFilter,
360
+ autorefresh,
331
361
  };
332
362
  };
333
363
 
@@ -1,52 +1,52 @@
1
- @import '../../../styles/mixins.scss';
1
+ @import '../../../../styles/mixins.scss';
2
2
 
3
3
  .network {
4
- @include container-fluid();
5
- font-size: var(--yc-text-body2-font-size);
6
- line-height: var(--yc-text-body2-line-height);
7
- max-width: 1305px;
8
4
  display: flex;
9
- @include flex-container();
10
5
  overflow: auto;
6
+ flex-grow: 1;
11
7
  justify-content: space-between;
12
8
 
13
- &__problem-filter {
14
- margin-right: 15px;
15
- }
9
+ max-width: 1305px;
10
+ height: 100%;
11
+
12
+ font-size: var(--yc-text-body2-font-size);
13
+ line-height: var(--yc-text-body2-line-height);
16
14
 
17
15
  &__nodes-row {
18
16
  display: flex;
19
- @include flex-container();
20
17
  overflow: auto;
18
+ flex-grow: 1;
21
19
  flex-direction: row;
22
- height: 100%;
23
20
  align-items: flex-start;
21
+
22
+ height: 100%;
24
23
  }
25
24
 
26
25
  &__inner {
27
- @include flex-container();
28
26
  overflow: auto;
27
+ @include flex-container();
29
28
  }
30
29
 
31
30
  &__right {
32
31
  width: 100%;
33
32
  height: 100%;
34
- padding-left: 55px;
33
+ padding-left: 20px;
35
34
  }
36
35
 
37
36
  &__left {
38
- padding-right: 55px;
39
- border-right: 1px solid var(--yc-color-base-generic-accent);
40
37
  height: 100%;
38
+
39
+ border-right: 1px solid var(--yc-color-base-generic-accent);
41
40
  }
42
41
 
43
42
  &__placeholder {
44
43
  display: flex;
44
+ flex-grow: 1;
45
45
  flex-direction: column;
46
- align-items: center;
47
46
  justify-content: center;
47
+ align-items: center;
48
+
48
49
  width: 100%;
49
- flex-grow: 1;
50
50
  height: 100%;
51
51
  }
52
52
 
@@ -72,55 +72,52 @@
72
72
  }
73
73
 
74
74
  &__nodes-title {
75
- color: var(--yc-color-text-secondary);
75
+ margin: 0 0 15px;
76
+
76
77
  font-size: var(--yc-text-body2-font-size);
77
78
  line-height: var(--yc-text-body2-line-height);
79
+
80
+ color: var(--yc-color-text-secondary);
78
81
  border-bottom: 1px solid var(--yc-color-base-generic-accent);
79
- margin: 0 0 15px 0;
80
82
  }
81
83
 
82
84
  &__link {
83
- color: var(--yc-color-base-special);
84
85
  text-decoration: none;
86
+
87
+ color: var(--yc-color-base-special);
85
88
  }
86
89
 
87
90
  &__title {
91
+ margin: 20px 0;
92
+
88
93
  font-size: var(--yc-text-body-font-size);
89
94
  font-weight: 500;
90
95
  line-height: var(--yc-text-body-line-height);
91
- margin: 20px 0;
92
96
  }
93
97
 
94
98
  &__checkbox-wrapper {
95
99
  display: flex;
96
100
  align-items: center;
97
- margin-right: 10px;
98
101
  label {
99
102
  white-space: nowrap;
100
103
  }
101
104
  }
102
105
 
103
106
  &__label {
104
- margin: 25px 0 16px 0;
107
+ margin-bottom: 16px;
105
108
  }
106
109
 
107
110
  &__controls {
108
111
  display: flex;
109
- align-items: center;
110
- margin-bottom: 13px;
111
- margin-top: 15px;
112
- margin-right: 144px;
112
+ gap: 12px;
113
113
 
114
- & .radiobox {
115
- margin-right: 15px;
116
- }
114
+ margin-bottom: 16px;
117
115
  }
118
116
 
119
117
  &__controls-wrapper {
120
118
  display: flex;
121
- align-items: center;
122
- @include flex-container();
123
119
  flex-direction: row;
120
+ @include flex-container();
124
121
  }
125
122
 
126
123
  &__select {
@@ -129,14 +126,16 @@
129
126
  }
130
127
 
131
128
  &__rack-column {
132
- border-radius: 4px;
133
- background-color: rgba(0, 0, 0, 0.07);
134
129
  display: flex;
135
- align-items: center;
136
130
  flex-direction: column;
137
- padding: 2px;
131
+ align-items: center;
132
+
138
133
  margin-right: 5px;
139
134
  margin-bottom: 5px;
135
+ padding: 2px;
136
+
137
+ border-radius: 4px;
138
+ background-color: rgba(0, 0, 0, 0.07);
140
139
 
141
140
  .node-network {
142
141
  margin-right: 0;
@@ -1,20 +1,22 @@
1
1
  .node-network {
2
+ display: inline-block;
3
+
2
4
  box-sizing: border-box;
3
5
  width: 14px;
4
6
  height: 14px;
5
- border-radius: 3px;
7
+ margin-right: 5px;
8
+ margin-bottom: 5px;
6
9
  padding: 0 5px;
7
- display: inline-block;
8
- border-radius: 4px;
9
- text-align: center;
10
- color: var(--yc-color-text-complementary);
11
- text-transform: uppercase;
10
+
12
11
  font-size: 12px;
13
12
  line-height: 14px;
14
13
  cursor: pointer;
15
- margin-right: 5px;
16
- margin-bottom: 5px;
14
+ text-align: center;
15
+ text-transform: uppercase;
16
+
17
+ color: var(--yc-color-text-complementary);
17
18
  border: 1px solid transparent;
19
+ border-radius: 4px;
18
20
 
19
21
  &_id {
20
22
  width: 42px;
@@ -30,8 +32,8 @@
30
32
  }
31
33
 
32
34
  &_black {
33
- background-color: var(--yc-color-text-primary);
34
35
  color: var(--yc-color-text-light-primary);
36
+ background-color: var(--yc-color-text-primary);
35
37
  }
36
38
 
37
39
  &_green {
@@ -0,0 +1,13 @@
1
+ .kv-tenant-overview {
2
+ &__title {
3
+ margin: 0;
4
+ margin-bottom: 15px;
5
+
6
+ font-weight: 600;
7
+ }
8
+ &__loader {
9
+ display: flex;
10
+ flex-grow: 1;
11
+ justify-content: center;
12
+ }
13
+ }
@@ -0,0 +1,123 @@
1
+ import {useEffect, useMemo} from 'react';
2
+ import {useDispatch, useSelector} from 'react-redux';
3
+ import cn from 'bem-cn-lite';
4
+
5
+ import {Loader} from '@yandex-cloud/uikit';
6
+
7
+ //@ts-ignore
8
+ import SchemaInfoViewer from '../../Schema/SchemaInfoViewer/SchemaInfoViewer';
9
+
10
+ import {OLAP_TABLE_TYPE} from '../../Tenant';
11
+ import {AutoFetcher} from '../../../../utils/autofetcher';
12
+ //@ts-ignore
13
+ import {getSchema} from '../../../../store/reducers/schema';
14
+ //@ts-ignore
15
+ import {getOlapStats} from '../../../../store/reducers/olapStats';
16
+
17
+ import './Overview.scss';
18
+
19
+ function prepareOlapTableGeneral(tableData: any, olapStats: any[]) {
20
+ const {ColumnShardCount} = tableData;
21
+ const Bytes = olapStats?.reduce((acc, el) => {
22
+ acc += parseInt(el.Bytes) ?? 0;
23
+ return acc;
24
+ }, 0);
25
+ const Rows = olapStats?.reduce((acc, el) => {
26
+ acc += parseInt(el.Rows) ?? 0;
27
+ return acc;
28
+ }, 0);
29
+ const tabletIds = olapStats?.reduce((acc, el) => {
30
+ acc.add(el.TabletId);
31
+ return acc;
32
+ }, new Set());
33
+
34
+ return {
35
+ PathDescription: {
36
+ TableStats: {
37
+ ColumnShardCount,
38
+ Bytes: Bytes?.toLocaleString('ru-RU', {useGrouping: true}) ?? 0,
39
+ Rows: Rows?.toLocaleString('ru-RU', {useGrouping: true}) ?? 0,
40
+ Parts: tabletIds?.size ?? 0,
41
+ },
42
+ },
43
+ };
44
+ }
45
+
46
+ interface OverviewProps {
47
+ type: string;
48
+ className?: string;
49
+ tenantName?: string;
50
+ }
51
+
52
+ const b = cn('kv-tenant-overview');
53
+
54
+ const autofetcher = new AutoFetcher();
55
+
56
+ function Overview(props: OverviewProps) {
57
+ const dispatch = useDispatch();
58
+ const {
59
+ currentSchema: currentItem = {},
60
+ loading,
61
+ wasLoaded,
62
+ autorefresh,
63
+ currentSchemaPath,
64
+ } = useSelector((state: any) => state.schema);
65
+
66
+ const {data: olapStats} = useSelector((state: any) => state.olapStats);
67
+
68
+ const fetchOverviewData = () => {
69
+ const {tenantName, type} = props;
70
+ const schemaPath = currentSchemaPath || tenantName;
71
+ dispatch(getSchema({path: schemaPath}));
72
+
73
+ if (type === OLAP_TABLE_TYPE) {
74
+ dispatch(getOlapStats({path: schemaPath}));
75
+ }
76
+ };
77
+
78
+ useEffect(() => {
79
+ fetchOverviewData();
80
+ return () => {
81
+ autofetcher.stop();
82
+ };
83
+ }, []);
84
+
85
+ useEffect(() => {
86
+ if (autorefresh) {
87
+ fetchOverviewData();
88
+ autofetcher.stop();
89
+ autofetcher.start();
90
+ autofetcher.fetch(() => fetchOverviewData());
91
+ }
92
+ if (autorefresh === false) {
93
+ autofetcher.stop();
94
+ }
95
+ }, [autorefresh]);
96
+
97
+ const tableSchema =
98
+ currentItem?.PathDescription?.Table || currentItem?.PathDescription?.OlapTableDescription;
99
+
100
+ const schemaData = useMemo(() => {
101
+ return props.type === OLAP_TABLE_TYPE
102
+ ? prepareOlapTableGeneral(tableSchema, olapStats)
103
+ : currentItem;
104
+ }, [props.type, tableSchema, olapStats, currentItem]);
105
+
106
+ const renderLoader = () => {
107
+ return (
108
+ <div className={b('loader')}>
109
+ <Loader size="m" />
110
+ </div>
111
+ );
112
+ };
113
+
114
+ return loading && !wasLoaded ? (
115
+ renderLoader()
116
+ ) : (
117
+ <div className={props.className}>
118
+ <SchemaInfoViewer fullPath={currentItem.Path} data={schemaData} />
119
+ </div>
120
+ );
121
+ }
122
+
123
+ export default Overview;