ydb-embedded-ui 4.0.0 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/components/ClusterInfo/ClusterInfo.tsx +3 -3
  3. package/dist/components/LabelWithPopover/LabelWithPopover.tsx +10 -4
  4. package/dist/{containers/Nodes/NodesTable.scss → components/NodeHostWrapper/NodeHostWrapper.scss} +4 -6
  5. package/dist/components/NodeHostWrapper/NodeHostWrapper.tsx +60 -0
  6. package/dist/components/TabletsStatistic/TabletsStatistic.scss +1 -1
  7. package/dist/containers/App/App.scss +7 -4
  8. package/dist/containers/AsideNavigation/AsideNavigation.tsx +1 -11
  9. package/dist/containers/Header/Header.tsx +1 -1
  10. package/dist/containers/Nodes/getNodesColumns.tsx +7 -46
  11. package/dist/containers/Storage/StorageGroups/StorageGroups.tsx +3 -12
  12. package/dist/containers/Storage/StorageNodes/StorageNodes.scss +0 -24
  13. package/dist/containers/Storage/StorageNodes/StorageNodes.tsx +2 -39
  14. package/dist/containers/Storage/VDisk/VDisk.tsx +4 -11
  15. package/dist/containers/Storage/VDiskPopup/VDiskPopup.tsx +13 -16
  16. package/dist/containers/Storage/utils/types.ts +2 -1
  17. package/dist/containers/Tablet/Tablet.scss +4 -0
  18. package/dist/containers/Tablet/TabletTable/TabletTable.tsx +28 -6
  19. package/dist/containers/Tenant/Diagnostics/Healthcheck/Healthcheck.scss +1 -1
  20. package/dist/containers/Tenant/Diagnostics/Overview/TableInfo/prepareTableInfo.ts +4 -3
  21. package/dist/containers/Tenant/QueryEditor/Issues/Issues.scss +1 -1
  22. package/dist/containers/Tenant/QueryEditor/QueryEditorControls/OldQueryEditorControls.tsx +1 -1
  23. package/dist/containers/Tenant/QueryEditor/QueryEditorControls/QueryEditorControls.tsx +1 -1
  24. package/dist/containers/Tenant/Schema/SchemaViewer/SchemaViewer.js +12 -0
  25. package/dist/containers/Tenants/Tenants.js +1 -1
  26. package/dist/containers/UserSettings/UserSettings.tsx +19 -17
  27. package/dist/services/api.ts +383 -0
  28. package/dist/store/reducers/{cluster.js → cluster/cluster.ts} +9 -14
  29. package/dist/store/reducers/cluster/types.ts +13 -0
  30. package/dist/store/reducers/executeTopQueries.ts +2 -2
  31. package/dist/store/reducers/index.ts +5 -4
  32. package/dist/store/reducers/node.js +5 -1
  33. package/dist/store/reducers/nodesList.ts +2 -7
  34. package/dist/store/reducers/settings.js +1 -14
  35. package/dist/store/reducers/storage.js +12 -0
  36. package/dist/store/reducers/tablet.ts +16 -2
  37. package/dist/store/reducers/{tenants.js → tenants/tenants.ts} +14 -9
  38. package/dist/store/reducers/tenants/types.ts +17 -0
  39. package/dist/store/utils.ts +3 -2
  40. package/dist/types/api/acl.ts +25 -0
  41. package/dist/types/api/cluster.ts +3 -0
  42. package/dist/types/api/compute.ts +5 -3
  43. package/dist/types/api/netInfo.ts +48 -0
  44. package/dist/types/api/nodes.ts +5 -3
  45. package/dist/types/api/pdisk.ts +11 -2
  46. package/dist/types/api/storage.ts +5 -3
  47. package/dist/types/api/tenant.ts +18 -3
  48. package/dist/types/api/vdisk.ts +10 -2
  49. package/dist/types/api/whoami.ts +19 -0
  50. package/dist/types/store/tablet.ts +1 -0
  51. package/dist/types/window.d.ts +5 -0
  52. package/dist/utils/createToast.tsx +2 -2
  53. package/dist/utils/hooks/useTypedSelector.ts +2 -2
  54. package/dist/utils/nodes.ts +14 -1
  55. package/package.json +4 -4
  56. package/dist/services/api.d.ts +0 -87
  57. package/dist/services/api.js +0 -278
@@ -26,16 +26,6 @@ export function readSavedSettingsValue(key, defaultValue) {
26
26
  return savedValue ?? defaultValue;
27
27
  }
28
28
 
29
- // navigation managed its compact state internally before, and its approach is not compatible with settings
30
- // try reading the old localStorage entry to use it as a default value, for backward compatibility
31
- // assume it is safe to remove this code block if it is at least a few months old
32
- // there a two of these, search for a similar comment
33
- let legacyAsideNavCompactState = '';
34
- try {
35
- legacyAsideNavCompactState = String(JSON.parse(getValueFromLS('nvAsideHeader')).isCompact);
36
- localStorage.removeItem('nvAsideHeader');
37
- } catch {}
38
-
39
29
  export const initialState = {
40
30
  problemFilter: ALL,
41
31
  userSettings: {
@@ -53,10 +43,7 @@ export const initialState = {
53
43
  [SAVED_QUERIES_KEY]: readSavedSettingsValue(SAVED_QUERIES_KEY, '[]'),
54
44
  [TENANT_INITIAL_TAB_KEY]: readSavedSettingsValue(TENANT_INITIAL_TAB_KEY),
55
45
  [QUERY_INITIAL_MODE_KEY]: readSavedSettingsValue(QUERY_INITIAL_MODE_KEY, QueryModes.script),
56
- [ASIDE_HEADER_COMPACT_KEY]: readSavedSettingsValue(
57
- ASIDE_HEADER_COMPACT_KEY,
58
- legacyAsideNavCompactState || 'true',
59
- ),
46
+ [ASIDE_HEADER_COMPACT_KEY]: readSavedSettingsValue(ASIDE_HEADER_COMPACT_KEY, 'true'),
60
47
  [PARTITIONS_SELECTED_COLUMNS_KEY]: readSavedSettingsValue(PARTITIONS_SELECTED_COLUMNS_KEY),
61
48
  },
62
49
  systemSettings,
@@ -271,10 +271,22 @@ export const getFlatListStorageGroups = createSelector([getStoragePools], (stora
271
271
  ? currentType
272
272
  : 'Mixed';
273
273
  }, '');
274
+
275
+ // VDisk doesn't have its own StoragePoolName when located inside StoragePool data
276
+ const vDisks = group.VDisks?.map((vdisk) => ({
277
+ ...vdisk,
278
+ StoragePoolName: pool.Name,
279
+ Donors: vdisk.Donors?.map((donor) => ({
280
+ ...donor,
281
+ StoragePoolName: pool.Name,
282
+ })),
283
+ }));
284
+
274
285
  return [
275
286
  ...acc,
276
287
  {
277
288
  ...group,
289
+ VDisks: vDisks,
278
290
  Read: readSpeedBytesPerSec,
279
291
  Write: writeSpeedBytesPerSec,
280
292
  PoolName: pool.Name,
@@ -11,6 +11,7 @@ import type {
11
11
  import '../../services/api';
12
12
 
13
13
  import {createRequestActionTypes, createApiRequest} from '../utils';
14
+ import {prepareNodesMap} from '../../utils/nodes';
14
15
 
15
16
  export const FETCH_TABLET = createRequestActionTypes('TABLET', 'FETCH_TABLET');
16
17
  export const FETCH_TABLET_DESCRIBE = createRequestActionTypes('TABLET', 'FETCH_TABLET_DESCRIBE');
@@ -63,9 +64,19 @@ const tablet: Reducer<ITabletState, ITabletAction> = (state = initialState, acti
63
64
 
64
65
  export const getTablet = (id: string) => {
65
66
  return createApiRequest({
66
- request: Promise.all([window.api.getTablet({id}), window.api.getTabletHistory({id})]),
67
+ request: Promise.all([
68
+ window.api.getTablet({id}),
69
+ window.api.getTabletHistory({id}),
70
+ window.api.getNodesList(),
71
+ ]),
67
72
  actions: FETCH_TABLET,
68
- dataHandler: ([tabletResponseData, historyResponseData]): ITabletHandledResponse => {
73
+ dataHandler: ([
74
+ tabletResponseData,
75
+ historyResponseData,
76
+ nodesList,
77
+ ]): ITabletHandledResponse => {
78
+ const nodesMap = prepareNodesMap(nodesList);
79
+
69
80
  const historyData = Object.keys(historyResponseData).reduce<
70
81
  ITabletPreparedHistoryItem[]
71
82
  >((list, nodeId) => {
@@ -75,6 +86,8 @@ export const getTablet = (id: string) => {
75
86
 
76
87
  const {ChangeTime, Generation, State, Leader, FollowerId} = leaderTablet;
77
88
 
89
+ const fqdn = nodesMap && nodeId ? nodesMap.get(Number(nodeId)) : undefined;
90
+
78
91
  list.push({
79
92
  nodeId,
80
93
  generation: Generation,
@@ -82,6 +95,7 @@ export const getTablet = (id: string) => {
82
95
  state: State,
83
96
  leader: Leader,
84
97
  followerId: FollowerId,
98
+ fqdn,
85
99
  });
86
100
  }
87
101
  return list;
@@ -1,12 +1,15 @@
1
- import _ from 'lodash';
2
- import {createRequestActionTypes, createApiRequest} from '../utils';
3
- import '../../services/api';
1
+ import type {Reducer} from 'redux';
4
2
 
5
- const FETCH_TENANTS = createRequestActionTypes('tenants', 'FETCH_TENANTS');
3
+ import '../../../services/api';
4
+ import {createRequestActionTypes, createApiRequest} from '../../utils';
6
5
 
7
- const initialState = {loading: true, wasLoaded: false, data: {}};
6
+ import type {TenantsAction, TenantsState} from './types';
8
7
 
9
- const tenants = function (state = initialState, action) {
8
+ export const FETCH_TENANTS = createRequestActionTypes('tenants', 'FETCH_TENANTS');
9
+
10
+ const initialState = {loading: true, wasLoaded: false};
11
+
12
+ const tenants: Reducer<TenantsState, TenantsAction> = (state = initialState, action) => {
10
13
  switch (action.type) {
11
14
  case FETCH_TENANTS.REQUEST: {
12
15
  return {
@@ -35,20 +38,22 @@ const tenants = function (state = initialState, action) {
35
38
  }
36
39
  };
37
40
 
38
- export function getTenantsInfo(clusterName) {
41
+ export function getTenantsInfo(clusterName?: string) {
39
42
  return createApiRequest({
40
43
  request: window.api.getTenants(clusterName),
41
44
  actions: FETCH_TENANTS,
42
45
  dataHandler: (response, getState) => {
43
46
  const {singleClusterMode} = getState();
47
+
44
48
  if (singleClusterMode) {
45
49
  return response.TenantInfo;
46
50
  } else {
47
- return response.databases?.map((tenant) => {
51
+ return response.TenantInfo?.map((tenant) => {
48
52
  const node = tenant.Nodes ? tenant.Nodes[0] : {};
49
53
  const address =
50
54
  node.Host && node.Endpoints
51
- ? _.find(node.Endpoints, {Name: 'http-mon'})?.Address
55
+ ? node.Endpoints.find((endpoint) => endpoint.Name === 'http-mon')
56
+ ?.Address
52
57
  : undefined;
53
58
  const backend = node.Host ? `${node.Host}${address ? address : ''}` : undefined;
54
59
  return {...tenant, backend};
@@ -0,0 +1,17 @@
1
+ import {FETCH_TENANTS} from './tenants';
2
+
3
+ import type {TTenant} from '../../../types/api/tenant';
4
+ import type {ApiRequestAction} from '../../utils';
5
+
6
+ export interface PreparedTenant extends TTenant {
7
+ backend?: string;
8
+ }
9
+
10
+ export interface TenantsState {
11
+ loading: boolean;
12
+ wasLoaded: boolean;
13
+ tenants?: PreparedTenant[];
14
+ error?: unknown;
15
+ }
16
+
17
+ export type TenantsAction = ApiRequestAction<typeof FETCH_TENANTS, PreparedTenant[], unknown>;
@@ -4,6 +4,7 @@ import {AxiosResponse} from 'axios';
4
4
  import createToast from '../utils/createToast';
5
5
 
6
6
  import {SET_UNAUTHENTICATED} from './reducers/authentication';
7
+ import type {GetState} from './reducers';
7
8
 
8
9
  export const nop = (result: any) => result;
9
10
 
@@ -24,7 +25,7 @@ const isAxiosResponse = (response: any): response is AxiosResponse =>
24
25
  type CreateApiRequestParams<Actions, Response, HandledResponse> = {
25
26
  actions: Actions;
26
27
  request: Promise<Response>;
27
- dataHandler?: (data: Response, getState?: () => any) => HandledResponse;
28
+ dataHandler?: (data: Response, getState: GetState) => HandledResponse;
28
29
  };
29
30
 
30
31
  export function createApiRequest<
@@ -36,7 +37,7 @@ export function createApiRequest<
36
37
  request,
37
38
  dataHandler = nop,
38
39
  }: CreateApiRequestParams<Actions, Response, HandledResponse>) {
39
- const doRequest = async function (dispatch: Dispatch, getState: () => any) {
40
+ const doRequest = async function (dispatch: Dispatch, getState: GetState) {
40
41
  dispatch({
41
42
  type: actions.REQUEST,
42
43
  });
@@ -0,0 +1,25 @@
1
+ /**
2
+ * endpoint: /viewer/json/acl
3
+ *
4
+ * source: https://github.com/ydb-platform/ydb/blob/main/ydb/core/viewer/protos/viewer.proto
5
+ *
6
+ * incomplete, only fields that present for ACL requests
7
+ */
8
+ export interface TMetaInfo {
9
+ Common: TMetaCommonInfo;
10
+ }
11
+
12
+ /** incomplete */
13
+ export interface TMetaCommonInfo {
14
+ Path: string;
15
+ Owner?: string;
16
+ ACL?: TACE[];
17
+ }
18
+
19
+ interface TACE {
20
+ AccessType: string;
21
+ AccessRights?: string[];
22
+ Subject: string;
23
+ InheritanceType?: string[];
24
+ AccessRule: string;
25
+ }
@@ -31,4 +31,7 @@ export interface TClusterInfo {
31
31
  Tenants?: string;
32
32
  /** uint64 */
33
33
  Tablets?: string;
34
+
35
+ Balancer?: string; // additional
36
+ Solomon?: string; // additional
34
37
  }
@@ -2,9 +2,11 @@ import {EFlag} from './enums';
2
2
  import {TEndpoint, TLegacyNodeLocation, TPoolStats} from './nodes';
3
3
  import {TMetrics} from './tenant';
4
4
 
5
- // endpoint: viewer/json/compute
6
- // source: https://github.com/ydb-platform/ydb/blob/main/ydb/core/viewer/protos/viewer.proto
7
-
5
+ /**
6
+ * endpoint: viewer/json/compute
7
+ *
8
+ * source: https://github.com/ydb-platform/ydb/blob/main/ydb/core/viewer/protos/viewer.proto
9
+ */
8
10
  export interface TComputeInfo {
9
11
  Overall: EFlag;
10
12
  Tenants?: TComputeTenantInfo[];
@@ -0,0 +1,48 @@
1
+ import type {EFlag} from './enums';
2
+
3
+ /**
4
+ * endpoint: /viewer/json/netinfo
5
+ *
6
+ * source: https://github.com/ydb-platform/ydb/blob/main/ydb/core/viewer/protos/viewer.proto
7
+ */
8
+ export interface TNetInfo {
9
+ Overall: EFlag;
10
+ Tenants?: TNetTenantInfo[];
11
+ }
12
+
13
+ interface TNetTenantInfo {
14
+ Overall: EFlag;
15
+ Name: string;
16
+ Nodes?: TNetNodeInfo[];
17
+ }
18
+
19
+ interface TNetNodeInfo {
20
+ NodeId: number;
21
+ Overall: EFlag;
22
+ Peers?: TNetNodePeerInfo[];
23
+ NodeType: ENodeType;
24
+ DataCenter: string;
25
+ Rack: string;
26
+ Host: string;
27
+ Port: number;
28
+ }
29
+
30
+ interface TNetNodePeerInfo {
31
+ NodeId: number;
32
+ PeerName: string;
33
+ Connected: boolean;
34
+ ConnectStatus: EFlag;
35
+ /** uint64 */
36
+ ChangeTime: string;
37
+ NodeType: ENodeType;
38
+ DataCenter: string;
39
+ Rack: string;
40
+ Host: string;
41
+ Port: number;
42
+ }
43
+
44
+ enum ENodeType {
45
+ UnknownNodeType,
46
+ Static,
47
+ Dynamic,
48
+ }
@@ -3,9 +3,11 @@ import {TPDiskStateInfo} from './pdisk';
3
3
  import {TTabletStateInfo} from './tablet';
4
4
  import {TVDiskStateInfo} from './vdisk';
5
5
 
6
- // endpoint: /viewer/json/nodes
7
- // source: https://github.com/ydb-platform/ydb/blob/main/ydb/core/viewer/protos/viewer.proto
8
-
6
+ /**
7
+ * endpoint: /viewer/json/nodes
8
+ *
9
+ * source: https://github.com/ydb-platform/ydb/blob/main/ydb/core/viewer/protos/viewer.proto
10
+ */
9
11
  export interface TNodesInfo {
10
12
  Overall?: EFlag;
11
13
  Nodes?: TNodeInfo[];
@@ -1,7 +1,16 @@
1
1
  import {EFlag} from './enums';
2
2
 
3
- // endpoint: /viewer/json/pdiskinfo
4
- // source: https://github.com/ydb-platform/ydb/blob/main/ydb/core/protos/node_whiteboard.proto
3
+ /**
4
+ * endpoint: /viewer/json/pdiskinfo
5
+ *
6
+ * source: https://github.com/ydb-platform/ydb/blob/main/ydb/core/protos/node_whiteboard.proto
7
+ */
8
+ export interface TEvPDiskStateResponse {
9
+ PDiskStateInfo?: TPDiskStateInfo[];
10
+ /** uint64 */
11
+ ResponseTime?: string;
12
+ ResponseDuration?: number;
13
+ }
5
14
 
6
15
  export interface TPDiskStateInfo {
7
16
  PDiskId?: number;
@@ -1,9 +1,11 @@
1
1
  import {EFlag} from './enums';
2
2
  import {TVDiskStateInfo} from './vdisk';
3
3
 
4
- // endpoint: /viewer/json/storage
5
- // source: https://github.com/ydb-platform/ydb/blob/main/ydb/core/viewer/protos/viewer.proto
6
-
4
+ /**
5
+ * endpoint: /viewer/json/storage
6
+ *
7
+ * source: https://github.com/ydb-platform/ydb/blob/main/ydb/core/viewer/protos/viewer.proto
8
+ */
7
9
  export interface TStorageInfo {
8
10
  Overall?: EFlag;
9
11
  StoragePools?: TStoragePoolInfo[];
@@ -2,13 +2,20 @@ import {EFlag} from './enums';
2
2
  import {TPoolStats, TSystemStateInfo} from './nodes';
3
3
  import {TTabletStateInfo} from './tablet';
4
4
 
5
- // endpoint: /viewer/json/tenantinfo
6
- // source: https://github.com/ydb-platform/ydb/blob/main/ydb/core/viewer/protos/viewer.proto
7
-
5
+ /**
6
+ * endpoint: /viewer/json/tenants
7
+ *
8
+ * source: https://github.com/ydb-platform/ydb/blob/main/ydb/core/viewer/protos/viewer.proto
9
+ */
8
10
  export interface TTenants {
9
11
  Tenants?: TTenant[];
10
12
  }
11
13
 
14
+ /**
15
+ * endpoint: /viewer/json/tenantinfo
16
+ *
17
+ * source: https://github.com/ydb-platform/ydb/blob/main/ydb/core/viewer/protos/viewer.proto
18
+ */
12
19
  export interface TTenantInfo {
13
20
  TenantInfo?: TTenant[];
14
21
  Errors?: string[];
@@ -47,6 +54,9 @@ export interface TTenant {
47
54
  CoresUsed: number;
48
55
  /** uint64 */
49
56
  StorageGroups: string;
57
+
58
+ MonitoringEndpoint?: string; // additional
59
+ ControlPlane?: ControlPlane; // additional
50
60
  }
51
61
 
52
62
  interface THiveDomainStatsStateCount {
@@ -107,6 +117,11 @@ interface TTenantResource {
107
117
  Count: number;
108
118
  }
109
119
 
120
+ /** incomplete */
121
+ interface ControlPlane {
122
+ name?: string;
123
+ }
124
+
110
125
  export enum ETenantType {
111
126
  'UnknownTenantType' = 'UnknownTenantType',
112
127
  'Domain' = 'Domain',
@@ -1,8 +1,16 @@
1
1
  import {EFlag} from './enums';
2
2
  import {TPDiskStateInfo} from './pdisk';
3
3
 
4
- // endpoint: /viewer/json/vdiskinfo
5
- // source: https://github.com/ydb-platform/ydb/blob/main/ydb/core/protos/node_whiteboard.proto
4
+ /**
5
+ * endpoint: /viewer/json/vdiskinfo
6
+ *
7
+ * source: https://github.com/ydb-platform/ydb/blob/main/ydb/core/protos/node_whiteboard.proto
8
+ */
9
+ export interface TEvVDiskStateResponse {
10
+ VDiskStateInfo?: TVDiskStateInfo[];
11
+ ResponseTime?: string;
12
+ ResponseDuration?: number;
13
+ }
6
14
 
7
15
  export interface TVDiskStateInfo {
8
16
  VDiskId?: TVDiskID;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * endpoint: /viewer/json/whoami
3
+ *
4
+ * source: https://github.com/ydb-platform/ydb/blob/main/ydb/library/aclib/protos/aclib.proto
5
+ */
6
+ export interface TUserToken {
7
+ UserSID?: string;
8
+ GroupSIDs?: TProtoHashTable;
9
+ OriginalUserToken?: string;
10
+ AuthType?: string;
11
+ }
12
+
13
+ interface TProtoHashTable {
14
+ Buckets?: TProtoHashBucket[];
15
+ }
16
+
17
+ interface TProtoHashBucket {
18
+ Values?: string[];
19
+ }
@@ -11,6 +11,7 @@ export interface ITabletPreparedHistoryItem {
11
11
  state: ETabletState | undefined;
12
12
  leader: boolean | undefined;
13
13
  followerId: number | undefined;
14
+ fqdn: string | undefined;
14
15
  }
15
16
 
16
17
  export interface ITabletState {
@@ -37,4 +37,9 @@ interface Window {
37
37
  custom_backend?: string;
38
38
 
39
39
  __REDUX_DEVTOOLS_EXTENSION_COMPOSE__?: typeof import('redux').compose;
40
+
41
+ userSettings?: Record<string, string | undefined>;
42
+ systemSettings?: Record<string, string | undefined>;
43
+
44
+ api: import('../services/api').YdbEmbeddedAPI;
40
45
  }
@@ -10,13 +10,13 @@ interface CreateToastProps {
10
10
  }
11
11
 
12
12
  function createToast({name, title, type, content}: CreateToastProps) {
13
- return toaster.createToast({
13
+ return toaster.add({
14
14
  name: name ?? 'Request succeeded',
15
15
  title: title ?? 'Request succeeded',
16
16
  type: type ?? 'success',
17
17
  content: content,
18
18
  isClosable: true,
19
- allowAutoHiding: type === 'success',
19
+ autoHiding: type === 'success' ? 5000 : false,
20
20
  });
21
21
  }
22
22
 
@@ -1,5 +1,5 @@
1
1
  import {TypedUseSelectorHook, useSelector} from 'react-redux';
2
2
 
3
- import {IRootState} from '../../store';
3
+ import {RootState} from '../../store';
4
4
 
5
- export const useTypedSelector: TypedUseSelectorHook<IRootState> = useSelector;
5
+ export const useTypedSelector: TypedUseSelectorHook<RootState> = useSelector;
@@ -1,5 +1,7 @@
1
1
  import type {TSystemStateInfo} from '../types/api/nodes';
2
+ import type {TNodeInfo} from '../types/api/nodesList';
2
3
  import type {INodesPreparedEntity} from '../types/store/nodes';
4
+ import type {NodesMap} from '../types/store/nodesList';
3
5
  import {EFlag} from '../types/api/enums';
4
6
 
5
7
  export enum NodesUptimeFilterValues {
@@ -15,6 +17,17 @@ export const NodesUptimeFilterTitles = {
15
17
  export const isUnavailableNode = (node: INodesPreparedEntity | TSystemStateInfo) =>
16
18
  !node.SystemState || node.SystemState === EFlag.Grey;
17
19
 
20
+ export type NodeAddress = Pick<TSystemStateInfo, 'Host' | 'Endpoints'>;
21
+
18
22
  export interface AdditionalNodesInfo extends Record<string, unknown> {
19
- getNodeRef?: Function;
23
+ getNodeRef?: (node?: NodeAddress) => string;
20
24
  }
25
+
26
+ export const prepareNodesMap = (nodesList?: TNodeInfo[]) => {
27
+ return nodesList?.reduce<NodesMap>((nodesMap, node) => {
28
+ if (node.Id && node.Host) {
29
+ nodesMap.set(Number(node.Id), node.Host);
30
+ }
31
+ return nodesMap;
32
+ }, new Map());
33
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-embedded-ui",
3
- "version": "4.0.0",
3
+ "version": "4.2.0",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -12,7 +12,7 @@
12
12
  "@gravity-ui/axios-wrapper": "^1.3.0",
13
13
  "@gravity-ui/date-utils": "^1.1.1",
14
14
  "@gravity-ui/i18n": "^1.0.0",
15
- "@gravity-ui/navigation": "^0.3.1",
15
+ "@gravity-ui/navigation": "^0.4.0",
16
16
  "@gravity-ui/paranoid": "^1.4.0",
17
17
  "@gravity-ui/react-data-table": "^1.0.3",
18
18
  "axios": "0.19.2",
@@ -39,7 +39,7 @@
39
39
  "reselect": "4.1.6",
40
40
  "sass": "1.32.8",
41
41
  "web-vitals": "1.1.2",
42
- "ydb-ui-components": "^3.0.3"
42
+ "ydb-ui-components": "^3.1.0"
43
43
  },
44
44
  "scripts": {
45
45
  "start": "react-app-rewired start",
@@ -105,7 +105,7 @@
105
105
  "@gravity-ui/prettier-config": "^1.0.1",
106
106
  "@gravity-ui/stylelint-config": "^1.0.1",
107
107
  "@gravity-ui/tsconfig": "^1.0.0",
108
- "@gravity-ui/uikit": "^3.20.2",
108
+ "@gravity-ui/uikit": "^4.11.1",
109
109
  "@playwright/test": "^1.31.1",
110
110
  "@testing-library/jest-dom": "^5.15.0",
111
111
  "@testing-library/react": "^11.2.7",
@@ -1,87 +0,0 @@
1
- type AxiosOptions = {
2
- concurrentId?: string;
3
- };
4
-
5
- interface Window {
6
- api: {
7
- getSchema: (
8
- params: {path: string},
9
- axiosOptions?: AxiosOptions,
10
- ) => Promise<import('../types/api/schema').TEvDescribeSchemeResult>;
11
- getDescribe: (
12
- params: {path: string},
13
- axiosOptions?: AxiosOptions,
14
- ) => Promise<import('../types/api/schema').TEvDescribeSchemeResult>;
15
- getStorageInfo: (
16
- params: {
17
- tenant: string;
18
- filter: string;
19
- nodeId: string;
20
- },
21
- axiosOptions?: AxiosOptions,
22
- ) => Promise<import('../types/api/storage').TStorageInfo>;
23
- getNodes: (
24
- params: import('../types/store/nodes').INodesApiRequestParams,
25
- axiosOptions?: AxiosOptions,
26
- ) => Promise<import('../types/api/nodes').TNodesInfo>;
27
- getCompute: (path: string) => Promise<import('../types/api/compute').TComputeInfo>;
28
- sendQuery: <
29
- Action extends import('../types/api/query').Actions,
30
- Schema extends import('../types/api/query').Schemas = undefined,
31
- >(
32
- params: {
33
- query?: string;
34
- database?: string;
35
- action?: Action;
36
- stats?: string;
37
- schema?: Schema;
38
- },
39
- axiosOptions?: AxiosOptions,
40
- ) => Promise<import('../types/api/query').QueryAPIResponse<Action, Schema>>;
41
- getExplainQuery: <Action extends import('../types/api/query').ExplainActions = 'explain'>(
42
- query: string,
43
- database: string,
44
- action?: Action,
45
- ) => Promise<import('../types/api/query').ExplainResponse<Action>>;
46
- getExplainQueryAst: (
47
- query: string,
48
- database: string,
49
- ) => Promise<import('../types/api/query').ExplainResponse<'explain-ast'>>;
50
- getHealthcheckInfo: (
51
- database: string,
52
- ) => Promise<import('../types/api/healthcheck').HealthCheckAPIResponse>;
53
- getTenantInfo: (params: {
54
- path: string;
55
- }) => Promise<import('../types/api/tenant').TTenantInfo>;
56
- getClusterInfo: () => Promise<import('../types/api/cluster').TClusterInfo>;
57
- getTabletsInfo: (params: {
58
- nodes?: string[];
59
- path?: string;
60
- }) => Promise<import('../types/api/tablet').TEvTabletStateResponse>;
61
- getTabletDescribe: (
62
- tenantId?: import('../types/api/tablet').TDomainKey,
63
- ) => Promise<import('../types/api/schema').TEvDescribeSchemeResult>;
64
- getTablet: (params: {
65
- id?: string;
66
- }) => Promise<import('../types/api/tablet').TEvTabletStateResponse>;
67
- getTabletHistory: (params: {
68
- id?: string;
69
- }) => Promise<import('../types/api/tablet').UnmergedTEvTabletStateResponse>;
70
- getHeatmapData: (params: {
71
- path: string;
72
- }) => Promise<import('../types/api/schema').TEvDescribeSchemeResult>;
73
- getTopic: (params: {
74
- path?: string;
75
- }) => Promise<import('../types/api/topic').DescribeTopicResult>;
76
- getConsumer: (params: {
77
- path?: string;
78
- consumer?: string;
79
- }) => Promise<import('../types/api/consumer').DescribeConsumerResult>;
80
- getHostInfo: () => Promise<import('../types/api/systemState').TEvSystemStateResponse>;
81
- getNodeInfo: (
82
- id?: string,
83
- ) => Promise<import('../types/api/systemState').TEvSystemStateResponse>;
84
- getNodesList: () => Promise<import('../types/api/nodesList').TEvNodesInfo>;
85
- [method: string]: Function;
86
- };
87
- }