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
@@ -4,6 +4,8 @@
4
4
  overflow-x: auto;
5
5
  overflow-y: hidden;
6
6
  justify-content: center;
7
+
8
+ min-width: 500px;
7
9
  }
8
10
  &__pool-name-wrapper {
9
11
  display: flex;
@@ -122,7 +122,7 @@ function StorageNodes({data, tableSettings, visibleEntities}: StorageGroupsProps
122
122
  return data ? (
123
123
  <DataTable
124
124
  key={visibleEntities as string}
125
- theme="internal"
125
+ theme="yandex-cloud"
126
126
  data={data}
127
127
  columns={columns}
128
128
  settings={tableSettings}
@@ -1,5 +1,7 @@
1
1
  .vdisk-storage {
2
+ display: flex;
2
3
  flex-grow: 1;
4
+ align-items: center;
3
5
 
4
6
  margin-right: 10px;
5
7
 
@@ -13,18 +15,18 @@
13
15
  }
14
16
  &__popup-content {
15
17
  display: grid;
16
- column-gap: 5px;
17
18
  justify-items: stretch;
19
+ column-gap: 5px;
18
20
  }
19
21
  &__popup-section-name {
22
+ grid-column: 1 / 3;
23
+
20
24
  margin: 5px 0;
21
25
 
26
+ font-weight: 500;
22
27
  text-align: center;
23
28
 
24
29
  border-bottom: 1px solid var(--yc-color-line-generic);
25
-
26
- font-weight: 500;
27
- grid-column: 1 / 3;
28
30
  }
29
31
  &__property {
30
32
  text-align: right;
@@ -1,11 +1,11 @@
1
1
  @import '../../styles/mixins.scss';
2
2
 
3
3
  .tablet-page {
4
+ $_: &;
4
5
  display: flex;
5
6
  flex-direction: column;
6
- padding: 20px;
7
7
 
8
- $_: &;
8
+ padding: 20px;
9
9
 
10
10
  &__tenant {
11
11
  margin-bottom: 20px;
@@ -19,15 +19,15 @@
19
19
  margin-right: 70px;
20
20
  }
21
21
  &__history-title {
22
- @include body2-typography();
23
22
  margin-bottom: 15px;
23
+ @include body2-typography();
24
24
  }
25
25
 
26
26
  &__placeholder {
27
27
  display: flex;
28
28
  flex: 1 1 auto;
29
- align-items: center;
30
29
  justify-content: center;
30
+ align-items: center;
31
31
  }
32
32
 
33
33
  &__row {
@@ -44,11 +44,12 @@
44
44
  }
45
45
 
46
46
  &__title {
47
+ margin-right: 16px;
48
+
47
49
  font-size: var(--yc-text-body2-font-size);
48
- line-height: var(--yc-text-body2-line-height);
49
50
  font-weight: 500;
51
+ line-height: var(--yc-text-body2-line-height);
50
52
  text-transform: uppercase;
51
- margin-right: 16px;
52
53
  }
53
54
 
54
55
  .info-viewer__items {
@@ -69,8 +70,10 @@
69
70
 
70
71
  &__links {
71
72
  display: flex;
72
- margin: 5px 0 10px 0;
73
+
74
+ margin: 5px 0 10px;
73
75
  padding: 0;
76
+
74
77
  list-style-type: none;
75
78
 
76
79
  & > * {
@@ -79,10 +82,11 @@
79
82
  }
80
83
 
81
84
  &__top-label {
85
+ margin-right: 16px;
86
+
82
87
  font-size: var(--yc-text-body2-font-size);
83
- line-height: var(--yc-text-body2-line-height);
84
88
  font-weight: 500;
89
+ line-height: var(--yc-text-body2-line-height);
85
90
  text-transform: uppercase;
86
- margin-right: 16px;
87
91
  }
88
92
  }
@@ -12,16 +12,13 @@ import {
12
12
  import {showTooltip, hideTooltip} from '../../store/reducers/tooltip';
13
13
 
14
14
  import Tablet from '../../components/Tablet/Tablet';
15
- import {Loader, Progress} from '@yandex-cloud/uikit';
15
+ import {Loader} from '@yandex-cloud/uikit';
16
16
  import {Select} from '@yandex-cloud/uikit/build/esm/components/unstable/Select';
17
17
  import ReactList from 'react-list';
18
- import {COLORS_PRIORITY} from '../../utils/constants';
19
- import {AutoFetcher} from '../Cluster/Cluster';
18
+ import {AutoFetcher} from '../../utils/autofetcher';
20
19
 
21
20
  import './Tablets.scss';
22
-
23
- // чтобы при очень маленьком проценте все равно были видны проблемные места, установим минимальный процент в 3
24
- const minOverallPercentValue = 3;
21
+ import TabletsOverall from '../../components/TabletsOverall/TabletsOverall';
25
22
 
26
23
  const b = cn('tablets');
27
24
 
@@ -42,14 +39,6 @@ class Tablets extends React.Component {
42
39
 
43
40
  autofetcher;
44
41
 
45
- static renderLoader() {
46
- return (
47
- <div className={b('loader-wrapper')}>
48
- <Loader size="m" />
49
- </div>
50
- );
51
- }
52
-
53
42
  state = {
54
43
  filteredTablets: [],
55
44
  };
@@ -65,6 +54,11 @@ class Tablets extends React.Component {
65
54
 
66
55
  componentDidUpdate(prevProps) {
67
56
  const {autorefresh} = this.props;
57
+
58
+ if (!prevProps.path && this.props.path) {
59
+ this.makeRequestIfPathOrNodeExist();
60
+ }
61
+
68
62
  if (prevProps.path && this.props.path && prevProps.path !== this.props.path) {
69
63
  this.props.clearWasLoadingFlag();
70
64
  this.makeRequestIfPathOrNodeExist();
@@ -85,6 +79,14 @@ class Tablets extends React.Component {
85
79
  this.autofetcher.stop();
86
80
  }
87
81
 
82
+ renderLoader = () => {
83
+ return (
84
+ <div className={b('loader-wrapper')}>
85
+ <Loader size="m" />
86
+ </div>
87
+ );
88
+ };
89
+
88
90
  makeRequestIfPathOrNodeExist = () => {
89
91
  const {nodeId, path} = this.props;
90
92
  if (typeof nodeId !== 'undefined') {
@@ -136,76 +138,6 @@ class Tablets extends React.Component {
136
138
  this.setState({filteredTablets});
137
139
  };
138
140
 
139
- renderOverall = (tablets) => {
140
- const {hideTooltip, showTooltip} = this.props;
141
- const tabletsCount = tablets.length;
142
-
143
- const substractPercentsFromMaxPercents = (statesForOverallProgress, substractValue) => {
144
- Object.keys(statesForOverallProgress).some((key) => {
145
- if (statesForOverallProgress[key] > 10) {
146
- statesForOverallProgress[key] -= minOverallPercentValue - substractValue;
147
- return true;
148
- }
149
- return false;
150
- });
151
- };
152
-
153
- // определим, сколько таблеток какого цвета имеется в tablets
154
- const statesForOverallProgress = tablets.reduce((acc, tablet) => {
155
- const color = tablet.Overall.toLowerCase();
156
- if (!acc[color]) {
157
- acc[color] = 1;
158
- } else {
159
- acc[color]++;
160
- }
161
-
162
- return acc;
163
- }, {});
164
-
165
- const tooltipData = [];
166
-
167
- // подсчитаем, сколько процентов составляет каждый цвет в statesForOverallProgress и заодно сгенерируем информацию для тултипа
168
- Object.keys(statesForOverallProgress).forEach((key) => {
169
- const percents = (statesForOverallProgress[key] / tabletsCount) * 100;
170
- const value = statesForOverallProgress[key];
171
- statesForOverallProgress[key] = percents;
172
- tooltipData.push({color: key, percents, value, total: tablets.length});
173
- });
174
-
175
- // заменим все проценты, значения которых меньше 3 на тройку
176
- Object.keys(statesForOverallProgress).forEach((key) => {
177
- if (statesForOverallProgress[key] < minOverallPercentValue) {
178
- substractPercentsFromMaxPercents(
179
- statesForOverallProgress,
180
- statesForOverallProgress[key],
181
- );
182
- statesForOverallProgress[key] = minOverallPercentValue;
183
- }
184
- });
185
-
186
- const memoryProgress = 100;
187
- const stack = Object.keys(statesForOverallProgress).map((key) => ({
188
- color: `var(--color-status-${key}-solid-70)`,
189
- colorKey: key,
190
- value: statesForOverallProgress[key],
191
- }));
192
-
193
- // сортируем наш stack, чтобы цвета были в порядке "зеленый, оранжевый, желтый, красный, черный"
194
- stack.sort((a, b) => COLORS_PRIORITY[b.colorKey] - COLORS_PRIORITY[a.colorKey]);
195
-
196
- return (
197
- <div className={b('row', {overall: true})}>
198
- <span className={b('label', {overall: true})}>Overall</span>
199
- <div
200
- onMouseLeave={hideTooltip}
201
- onMouseEnter={(e) => showTooltip(e.target, tooltipData, 'tabletsOverall')}
202
- >
203
- <Progress value={memoryProgress} stack={stack} />
204
- </div>
205
- </div>
206
- );
207
- };
208
-
209
141
  renderContent = (tablets) => {
210
142
  const states = Array.from(new Set(...[tablets.map((tblt) => tblt.State)])).map((item) => ({
211
143
  value: item,
@@ -220,13 +152,11 @@ class Tablets extends React.Component {
220
152
 
221
153
  return (
222
154
  <div className={b()}>
223
- {this.renderOverall(tablets)}
224
-
225
- <div className={b('filters')}>
155
+ <div className={b('header')}>
226
156
  <Select
227
157
  className={b('filter-control')}
228
158
  multiple
229
- placeholder="All"
159
+ placeholder="All items"
230
160
  label="States:"
231
161
  options={states}
232
162
  value={stateFilter}
@@ -236,13 +166,14 @@ class Tablets extends React.Component {
236
166
  <Select
237
167
  className={b('filter-control')}
238
168
  multiple
239
- placeholder="All"
169
+ placeholder="All items"
240
170
  label="Types:"
241
171
  options={types}
242
172
  value={typeFilter}
243
173
  onUpdate={this.handleTypeFilterChange}
244
174
  width="100%"
245
175
  />
176
+ <TabletsOverall tablets={tablets} />
246
177
  </div>
247
178
 
248
179
  <div className={b('items')}>
@@ -259,7 +190,7 @@ class Tablets extends React.Component {
259
190
  render() {
260
191
  const {loading, wasLoaded, error, tablets} = this.props;
261
192
  if (loading && !wasLoaded) {
262
- return Tablets.renderLoader();
193
+ return this.renderLoader();
263
194
  } else if (error) {
264
195
  return <div>{error.statusText}</div>;
265
196
  } else {
@@ -3,37 +3,19 @@
3
3
  .tablets {
4
4
  @include flex-container();
5
5
 
6
- &__row {
6
+ &__header {
7
7
  display: flex;
8
- align-items: center;
9
-
10
- &_overall {
11
- margin: 15px 20px;
12
-
13
- .yc-progress {
14
- width: 300px;
15
- margin: 0;
16
- }
17
- }
18
- }
8
+ gap: 12px;
19
9
 
20
- &__label {
21
- font-size: var(--yc-text-body2-font-size);
22
- line-height: var(--yc-text-body2-line-height);
23
- font-weight: 500;
24
- text-transform: uppercase;
25
- margin-right: 16px;
10
+ align-items: center;
26
11
 
27
- &_overall {
28
- margin-right: 15px;
29
- }
12
+ margin-bottom: 16px;
30
13
  }
31
14
 
32
15
  &__items {
33
16
  display: flex;
34
- flex-wrap: wrap;
35
17
  flex: 1 1 auto;
36
- padding: 0 20px;
18
+ flex-wrap: wrap;
37
19
  }
38
20
 
39
21
  &__items-wrapper {
@@ -43,19 +25,12 @@
43
25
  &__filters {
44
26
  display: flex;
45
27
  align-items: center;
46
- margin: 10px 0;
47
- padding: 0 20px;
48
28
  }
49
29
 
50
30
  &__filter-control {
51
- margin-right: 10px;
31
+ width: 180px;
52
32
  min-width: 100px;
53
- width: 200px;
54
- max-width: 200px;
55
-
56
- &:last-child {
57
- margin-right: 0;
58
- }
33
+ max-width: 180px;
59
34
  }
60
35
 
61
36
  &__tablet {
@@ -64,14 +39,13 @@
64
39
 
65
40
  .tablet {
66
41
  display: inline-block;
67
- text-align: center;
42
+
68
43
  line-height: 18px;
44
+ text-align: center;
69
45
  }
70
46
 
71
47
  &__loader-wrapper {
72
48
  display: flex;
73
49
  justify-content: center;
74
- align-items: center;
75
- height: 100%;
76
50
  }
77
51
  }
@@ -5,13 +5,13 @@ import cn from 'bem-cn-lite';
5
5
  import qs from 'qs';
6
6
  import _ from 'lodash';
7
7
 
8
- import {Loader, Progress} from '@yandex-cloud/uikit';
8
+ import {Loader} from '@yandex-cloud/uikit';
9
9
  import {Select} from '@yandex-cloud/uikit/build/esm/components/unstable/Select';
10
10
  import ReactList from 'react-list';
11
11
 
12
12
  import Tablet from '../../components/Tablet/Tablet';
13
13
 
14
- import {COLORS_PRIORITY, TABLET_COLOR_TO_STATES, TABLETS_STATES} from '../../utils/constants';
14
+ import {TABLET_COLOR_TO_STATES, TABLETS_STATES} from '../../utils/constants';
15
15
  import {showTooltip, hideTooltip} from '../../store/reducers/tooltip';
16
16
  import {
17
17
  getTabletsInfo,
@@ -24,9 +24,6 @@ import {
24
24
 
25
25
  import './TabletsFilters.scss';
26
26
 
27
- // чтобы при очень маленьком проценте все равно были видны проблемные места, установим минимальный процент в 3
28
- const minOverallPercentValue = 3;
29
-
30
27
  const b = cn('tablets-filters');
31
28
 
32
29
  class TabletsFilters extends React.Component {
@@ -158,76 +155,6 @@ class TabletsFilters extends React.Component {
158
155
  );
159
156
  };
160
157
 
161
- renderOverall = (tablets) => {
162
- const {hideTooltip, showTooltip} = this.props;
163
- const tabletsCount = tablets.length;
164
-
165
- const substractPercentsFromMaxPercents = (statesForOverallProgress, substractValue) => {
166
- Object.keys(statesForOverallProgress).some((key) => {
167
- if (statesForOverallProgress[key] > 10) {
168
- statesForOverallProgress[key] -= minOverallPercentValue - substractValue;
169
- return true;
170
- }
171
- return false;
172
- });
173
- };
174
-
175
- // определим, сколько таблеток какого цвета имеется в tablets
176
- const statesForOverallProgress = tablets.reduce((acc, tablet) => {
177
- const color = tablet.Overall.toLowerCase();
178
- if (!acc[color]) {
179
- acc[color] = 1;
180
- } else {
181
- acc[color]++;
182
- }
183
-
184
- return acc;
185
- }, {});
186
-
187
- const tooltipData = [];
188
-
189
- // подсчитаем, сколько процентов составляет каждый цвет в statesForOverallProgress и заодно сгенерируем информацию для тултипа
190
- Object.keys(statesForOverallProgress).forEach((key) => {
191
- const percents = (statesForOverallProgress[key] / tabletsCount) * 100;
192
- const value = statesForOverallProgress[key];
193
- statesForOverallProgress[key] = percents;
194
- tooltipData.push({color: key, percents, value, total: tablets.length});
195
- });
196
-
197
- // заменим все проценты, значения которых меньше 3 на тройку
198
- Object.keys(statesForOverallProgress).forEach((key) => {
199
- if (statesForOverallProgress[key] < minOverallPercentValue) {
200
- substractPercentsFromMaxPercents(
201
- statesForOverallProgress,
202
- statesForOverallProgress[key],
203
- );
204
- statesForOverallProgress[key] = minOverallPercentValue;
205
- }
206
- });
207
-
208
- const memoryProgress = 100;
209
- const stack = Object.keys(statesForOverallProgress).map((key) => ({
210
- color: `var(--color-status-${key}-solid-70)`,
211
- colorKey: key,
212
- value: statesForOverallProgress[key],
213
- }));
214
-
215
- // сортируем наш stack, чтобы цвета были в порядке "зеленый, оранжевый, желтый, красный, черный"
216
- stack.sort((a, b) => COLORS_PRIORITY[b.colorKey] - COLORS_PRIORITY[a.colorKey]);
217
-
218
- return (
219
- <div className={b('row', {overall: true})}>
220
- <span className={b('label', {overall: true})}>Overall</span>
221
- <div
222
- onMouseLeave={hideTooltip}
223
- onMouseEnter={(e) => showTooltip(e.target, tooltipData, 'tabletsOverall')}
224
- >
225
- <Progress value={memoryProgress} stack={stack} />
226
- </div>
227
- </div>
228
- );
229
- };
230
-
231
158
  renderContent = () => {
232
159
  const {nodeFilter, tenantPath} = this.state;
233
160
  const {tablets, filteredTablets, nodes, stateFilter, typeFilter, error} = this.props;
@@ -1,53 +1,29 @@
1
1
  @import '../../styles/mixins';
2
2
 
3
3
  .tablets-filters {
4
- @include flex-container();
5
4
  overflow: auto;
5
+
6
6
  max-height: 400px;
7
- // max-width: 400px;
7
+ @include flex-container();
8
8
 
9
9
  &__node {
10
- font-size: var(--yc-text-body-font-size);
11
- line-height: var(--yc-text-body-line-height);
12
10
  display: flex;
13
11
  flex-direction: column;
12
+
13
+ font-size: var(--yc-text-body-font-size);
14
+ line-height: var(--yc-text-body-line-height);
14
15
  }
15
16
 
16
17
  &__node-meta {
17
18
  color: var(--yc-color-text-secondary);
18
19
  }
19
20
 
20
- &__row {
21
- display: flex;
22
- align-items: center;
23
-
24
- &_overall {
25
- margin: 15px 20px;
26
-
27
- .yc-progress {
28
- width: 300px;
29
- margin: 0;
30
- }
31
- }
32
- }
33
-
34
- &__label {
35
- font-size: var(--yc-text-body2-font-size);
36
- line-height: var(--yc-text-body2-line-height);
37
- font-weight: 500;
38
- text-transform: uppercase;
39
- margin-right: 16px;
40
-
41
- &_overall {
42
- margin-right: 15px;
43
- }
44
- }
45
-
46
21
  &__items {
47
22
  display: flex;
48
- flex-wrap: wrap;
49
- flex: 1 1 auto;
50
23
  overflow: auto;
24
+ flex: 1 1 auto;
25
+ flex-wrap: wrap;
26
+
51
27
  padding: 5px 20px;
52
28
  }
53
29
 
@@ -58,25 +34,28 @@
58
34
  &__filters {
59
35
  display: flex;
60
36
  align-items: center;
37
+
61
38
  margin: 10px 0;
62
39
  padding: 0 20px;
63
40
  }
64
41
 
65
42
  &__filter-label {
66
43
  margin-right: 15px;
44
+
67
45
  white-space: nowrap;
68
46
  }
69
47
 
70
48
  &__filter-wrapper {
71
49
  display: flex;
72
50
  align-items: center;
51
+
73
52
  margin-right: 15px;
74
53
  }
75
54
 
76
55
  &__filter-control {
77
- margin-right: 10px;
78
56
  min-width: 100px;
79
57
  max-width: 200px;
58
+ margin-right: 10px;
80
59
 
81
60
  &:last-child {
82
61
  margin-right: 0;
@@ -93,12 +72,13 @@
93
72
  }
94
73
 
95
74
  &__tenant {
96
- padding: 20px 20px 10px 20px;
75
+ padding: 20px 20px 10px;
97
76
  }
98
77
 
99
78
  .tablet {
100
79
  display: inline-block;
101
- text-align: center;
80
+
102
81
  line-height: 18px;
82
+ text-align: center;
103
83
  }
104
84
  }