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
@@ -32,6 +32,9 @@ import shardsWorkload from './shardsWorkload';
32
32
  import hotKeys from './hotKeys';
33
33
  import olapStats from './olapStats';
34
34
  import authentication from './authentication';
35
+ import header from './header';
36
+ import saveQuery from './saveQuery';
37
+ import fullscreen from './fullscreen';
35
38
 
36
39
  function singleClusterMode(state = true) {
37
40
  return state;
@@ -71,6 +74,9 @@ export const rootReducer = {
71
74
  shardsWorkload,
72
75
  hotKeys,
73
76
  authentication,
77
+ header,
78
+ saveQuery,
79
+ fullscreen,
74
80
  };
75
81
 
76
82
  export default combineReducers({
@@ -0,0 +1,33 @@
1
+ const SET_QUERY_NAME_TO_EDIT = 'SET_QUERY_NAME_TO_EDIT';
2
+ const CLEAR_QUERY_NAME_TO_EDIT = 'CLEAR_QUERY_NAME_TO_EDIT';
3
+
4
+ const initialState = null;
5
+
6
+ const saveQuery = function (
7
+ state = initialState,
8
+ action: ReturnType<typeof setQueryNameToEdit> | ReturnType<typeof clearQueryNameToEdit>,
9
+ ) {
10
+ switch (action.type) {
11
+ case SET_QUERY_NAME_TO_EDIT:
12
+ return action.data;
13
+ case CLEAR_QUERY_NAME_TO_EDIT:
14
+ return null;
15
+
16
+ default:
17
+ return state;
18
+ }
19
+ };
20
+
21
+ export function setQueryNameToEdit(name: string) {
22
+ return {
23
+ type: SET_QUERY_NAME_TO_EDIT,
24
+ data: name,
25
+ } as const;
26
+ }
27
+ export function clearQueryNameToEdit() {
28
+ return {
29
+ type: CLEAR_QUERY_NAME_TO_EDIT,
30
+ } as const;
31
+ }
32
+
33
+ export default saveQuery;
@@ -3,6 +3,7 @@ import '../../services/api';
3
3
 
4
4
  const FETCH_SCHEMA = createRequestActionTypes('schema', 'FETCH_SCHEMA');
5
5
  const SET_SCHEMA = 'schema/SET_SCHEMA';
6
+ const SET_SHOW_PREVIEW = 'schema/SET_SHOW_PREVIEW';
6
7
  const ENABLE_AUTOREFRESH = 'schema/ENABLE_AUTOREFRESH';
7
8
  const DISABLE_AUTOREFRESH = 'schema/DISABLE_AUTOREFRESH';
8
9
 
@@ -12,6 +13,7 @@ export const initialState = {
12
13
  data: {},
13
14
  currentSchemaPath: undefined,
14
15
  autorefresh: false,
16
+ showPreview: false,
15
17
  };
16
18
 
17
19
  const schema = function z(state = initialState, action) {
@@ -64,6 +66,12 @@ const schema = function z(state = initialState, action) {
64
66
  autorefresh: false,
65
67
  };
66
68
  }
69
+ case SET_SHOW_PREVIEW: {
70
+ return {
71
+ ...state,
72
+ showPreview: action.data,
73
+ };
74
+ }
67
75
  default:
68
76
  return state;
69
77
  }
@@ -92,4 +100,10 @@ export function disableAutorefresh() {
92
100
  type: DISABLE_AUTOREFRESH,
93
101
  };
94
102
  }
103
+ export function setShowPreview(value) {
104
+ return {
105
+ type: SET_SHOW_PREVIEW,
106
+ data: value,
107
+ };
108
+ }
95
109
  export default schema;
@@ -2,7 +2,7 @@ import {createRequestActionTypes, createApiRequest} from '../utils';
2
2
  import '../../services/api';
3
3
 
4
4
  const SEND_SHARD_QUERY = createRequestActionTypes('query', 'SEND_SHARD_QUERY');
5
- const SET_SHARD_QUERY_OPTIONS = createRequestActionTypes('query', 'SET_SHARD_QUERY_OPTIONS');
5
+ const SET_SHARD_QUERY_OPTIONS = 'query/SET_SHARD_QUERY_OPTIONS';
6
6
 
7
7
  const initialState = {
8
8
  loading: false,
@@ -16,7 +16,7 @@ const paramSetup = {
16
16
  initialState: initialSettingsState.problemFilter,
17
17
  },
18
18
  },
19
- '/tenant/schema': {
19
+ '/tenant': {
20
20
  sort: {
21
21
  stateKey: 'heatmap.sort',
22
22
  initialState: initialHeatmapState.sort,
@@ -1,10 +1,8 @@
1
- import {Toaster} from '@yandex-cloud/uikit';
1
+ import createToast from '../utils/createToast';
2
2
  import {SET_UNAUTHENTICATED} from './reducers/authentication';
3
3
 
4
4
  export const nop = (result) => result;
5
5
 
6
- const toaster = new Toaster();
7
-
8
6
  export function createRequestActionTypes(prefix, type) {
9
7
  return {
10
8
  REQUEST: `${prefix}/${type}_REQUEST`,
@@ -35,13 +33,11 @@ export function createApiRequest({actions, request, dataHandler = nop}) {
35
33
  type: SET_UNAUTHENTICATED.SUCCESS,
36
34
  });
37
35
  } else if (error && error.status && error.statusText) {
38
- toaster.createToast({
36
+ createToast({
39
37
  name: 'Request failure',
40
38
  title: 'Request failure',
41
39
  type: 'error',
42
40
  content: `${error.status} ${error.statusText}`,
43
- isClosable: true,
44
- allowAutoHiding: false,
45
41
  });
46
42
  }
47
43
  dispatch({
@@ -23,11 +23,28 @@
23
23
  font-size: var(--yc-text-body2-font-size);
24
24
  line-height: var(--yc-text-body2-line-height);
25
25
  }
26
+ @mixin body3-typography() {
27
+ font-size: var(--yc-text-body3-font-size);
28
+ line-height: var(--yc-text-body3-line-height);
29
+ }
26
30
  @mixin lead-typography() {
27
31
  font-size: var(--yc-text-lead-font-size);
28
32
  line-height: var(--yc-text-lead-line-height);
29
33
  }
30
34
 
35
+ @mixin title-typography() {
36
+ font-size: var(--yc-text-title-font-size);
37
+ line-height: var(--yc-text-title-line-height);
38
+ }
39
+
40
+ @mixin sticky-top {
41
+ position: sticky;
42
+ top: 0;
43
+ left: 0;
44
+
45
+ background-color: var(--yc-color-base-background);
46
+ }
47
+
31
48
  @mixin loader() {
32
49
  position: fixed;
33
50
  z-index: 99999999;
@@ -35,8 +52,8 @@
35
52
  left: 50%;
36
53
 
37
54
  display: flex;
38
- align-items: center;
39
55
  justify-content: center;
56
+ align-items: center;
40
57
  }
41
58
 
42
59
  @mixin cell-container() {
@@ -50,21 +67,30 @@
50
67
  text-overflow: ellipsis;
51
68
  }
52
69
 
70
+ @mixin controls() {
71
+ display: flex;
72
+ align-items: center;
73
+ gap: 12px;
74
+
75
+ padding: 16px 0 18px;
76
+ }
77
+
78
+ @mixin search() {
79
+ width: 238px;
80
+ }
81
+
53
82
  @mixin query-data-table() {
54
83
  & .data-table {
55
84
  $_: &;
56
85
 
57
86
  &__table {
58
87
  border-spacing: 0;
59
-
60
88
  border-collapse: separate;
61
89
  }
62
90
 
63
91
  &__th,
64
92
  &__td {
65
93
  vertical-align: middle;
66
-
67
- border: none;
68
94
  }
69
95
 
70
96
  &__box {
@@ -102,6 +128,17 @@
102
128
  $border-width: 1px;
103
129
  $clearance-width: 1px; /* Delete clearance and cancel column shadow for previous columns */
104
130
 
131
+ @for $i from 0 through $nth {
132
+ & .data-table__td:nth-child(#{$i}),
133
+ & .data-table__head-row:first-child .data-table__th:nth-child(#{$i}) {
134
+ box-shadow: unset;
135
+
136
+ @if $i < $nth {
137
+ border-right: unset;
138
+ }
139
+ }
140
+ }
141
+
105
142
  /* Freeze td */
106
143
  & .data-table__td:nth-child(#{$nth}),
107
144
  & .data-table__head-row:first-child .data-table__th:nth-child(#{$nth}) {
@@ -112,35 +149,19 @@
112
149
  border-right: $border-width solid var(--yc-color-line-generic);
113
150
  background-color: var(--yc-color-base-background);
114
151
  }
115
-
116
- @for $i from 0 through $nth {
117
- & .data-table__td:nth-child(#{$i}),
118
- & .data-table__head-row:first-child .data-table__th:nth-child(#{$i}) {
119
- box-shadow: -$clearance-width 0 0 var(--yc-color-base-background);
120
-
121
- @if $i < $nth {
122
- border-right: $border-width solid var(--yc-color-base-background);
123
- }
124
- }
152
+ .data-table__row:hover .data-table__td:nth-child(#{$nth}) {
153
+ background-color: var(--yc-color-base-float-hover) !important;
125
154
  }
126
155
  }
127
156
 
128
157
  @mixin table-styles {
129
158
  & .data-table {
130
- width: 100%;
131
-
132
159
  &__table {
133
160
  width: 100%;
134
-
135
- border-spacing: 0;
136
-
137
- border-collapse: separate;
138
-
139
- font-size: var(--yc-text-body2-font-size);
140
- line-height: 18px;
141
161
  }
142
162
 
143
- &__th {
163
+ &__row,
164
+ &__sticky th {
144
165
  height: 40px;
145
166
  }
146
167
 
@@ -175,9 +196,9 @@
175
196
  position: absolute;
176
197
  left: 20px;
177
198
 
178
- color: var(--yc-color-text-secondary);
179
-
180
199
  font-size: 9px;
200
+
201
+ color: var(--yc-color-text-secondary);
181
202
  }
182
203
  .json-inspector__leaf_composite.json-inspector__leaf_root:before {
183
204
  left: 0;
@@ -206,7 +227,6 @@
206
227
  }
207
228
  &__toolbar {
208
229
  width: 300px;
209
-
210
230
  margin-bottom: 10px;
211
231
 
212
232
  border: 1px solid var(--yc-color-line-generic);
@@ -214,26 +234,21 @@
214
234
  }
215
235
  &__search {
216
236
  box-sizing: border-box;
217
-
218
237
  width: 300px;
219
238
  height: 28px;
220
-
221
239
  margin: 0;
222
-
223
240
  padding: 0;
224
241
 
242
+ font-family: var(--yc-font-family);
243
+ font-size: 13px;
225
244
  vertical-align: top;
226
245
 
227
246
  color: var(--yc-color-text-primary);
228
-
229
247
  border: 0 solid transparent;
230
248
  border-width: 0 8px;
231
249
  border-right-width: 22px;
232
250
  outline: 0;
233
251
  background: none;
234
-
235
- font-family: var(--yc-font-family);
236
- font-size: 13px;
237
252
  }
238
253
  &__value {
239
254
  &_helper {
@@ -0,0 +1,51 @@
1
+ export class AutoFetcher {
2
+ constructor() {
3
+ this.timeout = AutoFetcher.DEFAULT_TIMEOUT;
4
+ this.active = true;
5
+ this.timer = undefined;
6
+ }
7
+
8
+ wait(ms: number) {
9
+ return new Promise((resolve) => {
10
+ this.timer = setTimeout(resolve, ms);
11
+ return;
12
+ });
13
+ }
14
+ async fetch(request: Function) {
15
+ if (!this.active) {
16
+ return;
17
+ }
18
+
19
+ await this.wait(this.timeout);
20
+
21
+ if (this.active) {
22
+ const startTs = Date.now();
23
+ await request();
24
+ const finishTs = Date.now();
25
+
26
+ const responseTime = finishTs - startTs;
27
+ const nextTimeout =
28
+ responseTime > AutoFetcher.MIN_TIMEOUT ? responseTime : AutoFetcher.MIN_TIMEOUT;
29
+ this.timeout = nextTimeout;
30
+
31
+ this.fetch(request);
32
+ } else {
33
+ return;
34
+ }
35
+ }
36
+ stop() {
37
+ if (this.timer) {
38
+ clearTimeout(this.timer);
39
+ }
40
+ this.active = false;
41
+ }
42
+ start() {
43
+ this.active = true;
44
+ }
45
+
46
+ static DEFAULT_TIMEOUT = 30000;
47
+ static MIN_TIMEOUT = 30000;
48
+ timeout: number;
49
+ active: boolean;
50
+ timer: undefined | ReturnType<typeof setTimeout>;
51
+ }
@@ -1,3 +1,5 @@
1
+ import DataTable from '@yandex-cloud/react-data-table';
2
+
1
3
  const SECOND = 1000;
2
4
 
3
5
  export const CLUSTER_AUTO_RELOAD_INTERVAL = 10 * SECOND;
@@ -10,8 +12,9 @@ export const PDISK_AUTO_RELOAD_INTERVAL = 10 * SECOND;
10
12
  export const VDISK_AUTO_RELOAD_INTERVAL = 10 * SECOND;
11
13
  export const AUTO_RELOAD_INTERVAL = 10 * SECOND;
12
14
  export const HEALTHCHECK_RELOAD_INTERVAL = 10 * SECOND;
13
- export const MEGABYTE = 1000000;
14
- export const TERABYTE = 1000000000000;
15
+ export const MEGABYTE = 1_000_000;
16
+ export const GIGABYTE = 1_000_000_000;
17
+ export const TERABYTE = 1_000_000_000_000;
15
18
  export const GROUP = 'group';
16
19
 
17
20
  export const DAY_IN_SECONDS = 24 * 60 * 60;
@@ -108,19 +111,35 @@ export const COLORS_PRIORITY = {
108
111
  yellow: 4,
109
112
  orange: 3,
110
113
  red: 2,
111
- black: 1,
112
- gray: 1,
114
+ blue: 1,
115
+ grey: 1,
113
116
  };
114
117
 
115
118
  export const ALL = 'All';
116
- export const PROBLEMS = 'Problems';
119
+ export const PROBLEMS = 'With problems';
117
120
 
118
121
  export const THEME_KEY = 'theme';
119
122
  export const SAVED_QUERIES_KEY = 'saved_queries';
123
+ export const QUERIES_HISTORY_KEY = 'queries_history';
120
124
  export const DATA_QA_TUNE_COLUMNS_POPUP = 'tune-columns-popup';
121
- export const SELECTED_COLUMNS_KEY = 'selectedColumns';
125
+
122
126
  export const defaultUserSettings = {
123
127
  [THEME_KEY]: 'light',
124
128
  };
125
129
  export const DEFAULT_SIZE_RESULT_PANE_KEY = 'default-size-result-pane';
126
- export const DEFAULT_SIZE_SHEMA_TREE_PANE_KEY = 'default-size-schema-tree-pane';
130
+ export const DEFAULT_SIZE_TENANT_SUMMARY_KEY = 'default-size-tenant-summary-pane';
131
+ export const DEFAULT_SIZE_TENANT_KEY = 'default-size-tenant-pane';
132
+
133
+ export const DEFAULT_IS_TENANT_SUMMARY_COLLAPSED = 'default-is-tenant-summary-collapsed';
134
+
135
+ export const DEFAULT_IS_TENANT_COMMON_INFO_COLLAPSED = 'default-is-tenant-common-info-collapsed';
136
+
137
+ export const DEFAULT_IS_QUERY_RESULT_COLLAPSED = 'default-is-query-result-collapsed';
138
+
139
+ export const DEFAULT_TABLE_SETTINGS = {
140
+ displayIndices: false,
141
+ stickyHead: DataTable.MOVING,
142
+ syncHeadOnResize: true,
143
+ dynamicRender: true,
144
+ highlightRows: true,
145
+ };
@@ -0,0 +1,23 @@
1
+ import {Toaster} from '@yandex-cloud/uikit';
2
+
3
+ const toaster = new Toaster();
4
+
5
+ interface CreateToastProps {
6
+ name?: string;
7
+ title?: string;
8
+ content?: string;
9
+ type: 'error' | 'success';
10
+ }
11
+
12
+ function createToast({name, title, type, content}: CreateToastProps) {
13
+ return toaster.createToast({
14
+ name: name ?? 'Request succeeded',
15
+ title: title ?? 'Request succeeded',
16
+ type: type ?? 'success',
17
+ content: content,
18
+ isClosable: true,
19
+ allowAutoHiding: type === 'success',
20
+ });
21
+ }
22
+
23
+ export default createToast;
@@ -1,6 +1,8 @@
1
+ import React from 'react';
2
+ import cn from 'bem-cn-lite';
1
3
  import _ from 'lodash';
2
4
  import DataTable from '@yandex-cloud/react-data-table';
3
- import {Link as ExternalLink, Tooltip} from '@yandex-cloud/uikit';
5
+ import {Button, Tooltip} from '@yandex-cloud/uikit';
4
6
 
5
7
  import Icon from '../components/Icon/Icon';
6
8
  import EntityStatus from '../components/EntityStatus/EntityStatus';
@@ -13,6 +15,8 @@ import routes, {createHref} from '../routes';
13
15
  import {STORAGE, TABLETS} from '../containers/Node/NodePages';
14
16
  import {formatBytes} from './index';
15
17
 
18
+ const b = cn('kv-nodes');
19
+
16
20
  export function getNodesColumns({showTooltip, hideTooltip, tabletsPath, getNodeRef}) {
17
21
  const columns = [
18
22
  {
@@ -21,40 +25,33 @@ export function getNodesColumns({showTooltip, hideTooltip, tabletsPath, getNodeR
21
25
  width: '80px',
22
26
  align: DataTable.RIGHT,
23
27
  },
24
- {
25
- name: 'NodeRef',
26
- header: '',
27
- sortable: false,
28
- render: ({row}) => {
29
- const nodeRef = getNodeRef ? getNodeRef(row) : undefined;
30
- return (
31
- nodeRef && (
32
- <ExternalLink href={nodeRef}>
33
- <Icon name="external" />
34
- </ExternalLink>
35
- )
36
- );
37
- },
38
- width: '40px',
39
- align: DataTable.LEFT,
40
- },
41
28
  {
42
29
  name: 'Host',
43
30
  render: ({row, value}) => {
44
31
  const hasStorage = _.find(row?.Roles, (el) => el === STORAGE_ROLE);
32
+ const nodeRef = getNodeRef ? getNodeRef(row) : undefined;
33
+
45
34
  if (typeof value === 'undefined') {
46
35
  return <span>—</span>;
47
36
  }
48
37
  return (
49
- <EntityStatus
50
- name={row.Host}
51
- status={row.Overall}
52
- path={createHref(routes.node, {
53
- id: row.NodeId,
54
- activeTab: hasStorage ? STORAGE : TABLETS,
55
- })}
56
- hasClipboardButton
57
- />
38
+ <React.Fragment>
39
+ <EntityStatus
40
+ name={row.Host}
41
+ status={row.Overall}
42
+ path={createHref(routes.node, {
43
+ id: row.NodeId,
44
+ activeTab: hasStorage ? STORAGE : TABLETS,
45
+ })}
46
+ hasClipboardButton
47
+ className={b('host-name')}
48
+ />
49
+ {nodeRef && (
50
+ <Button size="s" href={nodeRef} className={b('external-button')}>
51
+ <Icon name="external" />
52
+ </Button>
53
+ )}
54
+ </React.Fragment>
58
55
  );
59
56
  },
60
57
  width: '350px',
@@ -136,7 +133,7 @@ export function getNodesColumns({showTooltip, hideTooltip, tabletsPath, getNodeR
136
133
  },
137
134
  {
138
135
  name: 'Tablets',
139
- width: '330px',
136
+ width: '430px',
140
137
  render: ({row}) => {
141
138
  return row.Tablets ? (
142
139
  <TabletsStatistic
@@ -1,7 +1,7 @@
1
1
  import numeral from 'numeral';
2
2
  import _ from 'lodash';
3
3
 
4
- import {MEGABYTE, TERABYTE, DAY_IN_SECONDS} from './constants';
4
+ import {MEGABYTE, TERABYTE, DAY_IN_SECONDS, GIGABYTE} from './constants';
5
5
 
6
6
  import locales from 'numeral/locales'; // eslint-disable-line no-unused-vars
7
7
  numeral.locale('ru');
@@ -11,6 +11,10 @@ export const formatBytes = (bytes) => {
11
11
  return numeral(bytes).format('0 ib').replace('i', '');
12
12
  };
13
13
 
14
+ export const formatBytesToGigabyte = (bytes) => {
15
+ return `${Math.floor(bytes / GIGABYTE)} GB`;
16
+ };
17
+
14
18
  export const stringifyVdiskId = (id) => {
15
19
  return Object.values(id).join('-');
16
20
  };
@@ -57,7 +61,7 @@ export const calcUptime = (milliseconds) => {
57
61
  return formatUptime((currentDate - Number(milliseconds)) / 1000);
58
62
  };
59
63
 
60
- // функция определяет, сколько нод имеют статус Connected "true"
64
+ // determine how many nodes have status Connected "true"
61
65
  export const getConnectedNodesCount = (nodeStateInfo) => {
62
66
  return nodeStateInfo?.reduce((acc, item) => (item.Connected ? acc + 1 : acc), 0);
63
67
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-embedded-ui",
3
- "version": "0.1.0",
3
+ "version": "1.0.1",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -12,6 +12,7 @@
12
12
  "@testing-library/jest-dom": "^5.15.0",
13
13
  "@testing-library/react": "^11.2.7",
14
14
  "@testing-library/user-event": "^12.8.3",
15
+ "@types/qs": "^6.9.7",
15
16
  "@yandex-cloud/i18n": "^0.2.0",
16
17
  "@yandex-cloud/paranoid": "^1.0.0",
17
18
  "@yandex-cloud/react-data-table": "^0.2.1",
@@ -30,10 +31,10 @@
30
31
  "react-redux": "^7.0.3",
31
32
  "react-router": "^5.0.1",
32
33
  "react-router-dom": "^5.0.1",
33
- "react-scripts": "^4.0.3",
34
+ "react-scripts": "4.0.3",
35
+ "react-split": "^2.0.14",
34
36
  "react-transition-group": "^4.4.2",
35
37
  "react-treeview": "^0.4.7",
36
- "react-use": "^15.3.4",
37
38
  "redux": "^4.0.1",
38
39
  "redux-location-state": "^2.6.0",
39
40
  "redux-thunk": "^2.3.0",
@@ -43,9 +44,10 @@
43
44
  },
44
45
  "scripts": {
45
46
  "start": "react-app-rewired start",
46
- "dev": "REACT_APP_BACKEND=http://localhost:8765 npm start",
47
+ "dev": "DISABLE_ESLINT_PLUGIN=true TSC_COMPILE_ON_ERROR=true REACT_APP_BACKEND=http://localhost:8765 npm start",
47
48
  "build": "react-app-rewired build",
48
49
  "build:embedded": "rm -rf build && REACT_APP_BACKEND=http://localhost:8765 npm run build && ./prepare-build.sh",
50
+ "lint:styles": "stylelint 'src/**/*.scss'",
49
51
  "package": "rm -rf dist && copyfiles -u 1 'src/**/*' dist",
50
52
  "test": "react-app-rewired test",
51
53
  "eject": "react-scripts eject",
@@ -80,10 +82,12 @@
80
82
  "@yandex-cloud/uikit": "^1.7.0",
81
83
  "copyfiles": "^2.4.1",
82
84
  "eslint-config-prettier": "^8.3.0",
85
+ "postcss": "^8.4.6",
83
86
  "prettier": "^2.5.1",
84
87
  "react": "^17.0.2",
85
88
  "react-app-rewired": "^2.1.11",
86
89
  "react-dom": "^17.0.2",
90
+ "stylelint": "^14.3.0",
87
91
  "typescript": "^4.5.4"
88
92
  }
89
93
  }