ydb-embedded-ui 4.16.0 → 4.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.16.1](https://github.com/ydb-platform/ydb-embedded-ui/compare/v4.16.0...v4.16.1) (2023-08-25)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * fix types for external props ([#522](https://github.com/ydb-platform/ydb-embedded-ui/issues/522)) ([173081f](https://github.com/ydb-platform/ydb-embedded-ui/commit/173081f2f0d2814b2311757988d91fbffc2a509f))
9
+
3
10
  ## [4.16.0](https://github.com/ydb-platform/ydb-embedded-ui/compare/v4.15.1...v4.16.0) (2023-08-25)
4
11
 
5
12
 
@@ -1,7 +1,7 @@
1
1
  import cn from 'bem-cn-lite';
2
2
 
3
3
  import type {TSystemStateInfo} from '../../types/api/nodes';
4
- import type {AdditionalNodesInfo} from '../../utils/nodes';
4
+ import type {AdditionalNodesProps} from '../../types/additionalProps';
5
5
 
6
6
  import EntityStatus from '../EntityStatus/EntityStatus';
7
7
  import {Tags} from '../Tags';
@@ -13,7 +13,7 @@ const b = cn('basic-node-viewer');
13
13
 
14
14
  interface BasicNodeViewerProps {
15
15
  node: TSystemStateInfo;
16
- additionalNodesInfo?: AdditionalNodesInfo;
16
+ additionalNodesInfo?: AdditionalNodesProps;
17
17
  className?: string;
18
18
  }
19
19
 
@@ -3,8 +3,9 @@ import block from 'bem-cn-lite';
3
3
  import {Button, Popover, PopoverBehavior} from '@gravity-ui/uikit';
4
4
 
5
5
  import type {NodesPreparedEntity} from '../../store/reducers/nodes/types';
6
+ import type {NodeAddress} from '../../types/additionalProps';
6
7
  import {getDefaultNodePath} from '../../containers/Node/NodePages';
7
- import {isUnavailableNode, NodeAddress} from '../../utils/nodes';
8
+ import {isUnavailableNode} from '../../utils/nodes';
8
9
 
9
10
  import EntityStatus from '../EntityStatus/EntityStatus';
10
11
  import {NodeEndpointsTooltipContent} from '../TooltipsContent';
@@ -10,8 +10,8 @@ import type {
10
10
  AdditionalClusterProps,
11
11
  AdditionalTenantsProps,
12
12
  AdditionalVersionsProps,
13
+ AdditionalNodesProps,
13
14
  } from '../../types/additionalProps';
14
- import type {AdditionalNodesInfo} from '../../utils/nodes';
15
15
  import routes from '../../routes';
16
16
 
17
17
  import {setHeaderBreadcrumbs} from '../../store/reducers/header/header';
@@ -35,7 +35,7 @@ const b = cn('cluster');
35
35
 
36
36
  interface ClusterProps {
37
37
  additionalTenantsProps?: AdditionalTenantsProps;
38
- additionalNodesInfo?: AdditionalNodesInfo;
38
+ additionalNodesInfo?: AdditionalNodesProps;
39
39
  additionalClusterProps?: AdditionalClusterProps;
40
40
  additionalVersionsProps?: AdditionalVersionsProps;
41
41
  }
@@ -21,6 +21,8 @@ import {setHeaderBreadcrumbs} from '../../store/reducers/header/header';
21
21
  import {AutoFetcher} from '../../utils/autofetcher';
22
22
  import {useTypedSelector} from '../../utils/hooks';
23
23
 
24
+ import type {AdditionalNodesProps} from '../../types/additionalProps';
25
+
24
26
  import {clusterTabsIds} from '../Cluster/utils';
25
27
 
26
28
  import './Node.scss';
@@ -32,7 +34,7 @@ export const STORAGE_ROLE = 'Storage';
32
34
  const autofetcher = new AutoFetcher();
33
35
 
34
36
  interface NodeProps {
35
- additionalNodesInfo?: any;
37
+ additionalNodesInfo?: AdditionalNodesProps;
36
38
  className?: string;
37
39
  }
38
40
 
@@ -13,6 +13,8 @@ import {selectNodeStructure} from '../../../store/reducers/node/selectors';
13
13
  import {AutoFetcher} from '../../../utils/autofetcher';
14
14
  import {useTypedSelector} from '../../../utils/hooks';
15
15
 
16
+ import type {AdditionalNodesProps} from '../../../types/additionalProps';
17
+
16
18
  import {PDisk} from './Pdisk';
17
19
 
18
20
  import './NodeStructure.scss';
@@ -30,7 +32,7 @@ function generateId({type, id}: {type: 'pdisk' | 'vdisk'; id: string}) {
30
32
  interface NodeStructureProps {
31
33
  nodeId: string;
32
34
  className?: string;
33
- additionalNodesInfo?: any;
35
+ additionalNodesInfo?: AdditionalNodesProps;
34
36
  }
35
37
 
36
38
  const autofetcher = new AutoFetcher();
@@ -27,7 +27,7 @@ interface PDiskProps {
27
27
  unfolded?: boolean;
28
28
  id: string;
29
29
  selectedVdiskId?: string;
30
- nodeHref?: string;
30
+ nodeHref?: string | null;
31
31
  }
32
32
 
33
33
  enum VDiskTableColumnsIds {
@@ -62,7 +62,7 @@ function getColumns({
62
62
  }: {
63
63
  pDiskId: number;
64
64
  selectedVdiskId?: string;
65
- nodeHref?: string;
65
+ nodeHref?: string | null;
66
66
  }) {
67
67
  const columns: Column<RowType>[] = [
68
68
  {
@@ -26,7 +26,7 @@ import {
26
26
  useNodesRequestParams,
27
27
  useTableSort,
28
28
  } from '../../utils/hooks';
29
- import {AdditionalNodesInfo, isUnavailableNode, NodesUptimeFilterValues} from '../../utils/nodes';
29
+ import {isUnavailableNode, NodesUptimeFilterValues} from '../../utils/nodes';
30
30
 
31
31
  import {
32
32
  getNodes,
@@ -39,6 +39,7 @@ import {
39
39
  } from '../../store/reducers/nodes/nodes';
40
40
  import {selectFilteredNodes} from '../../store/reducers/nodes/selectors';
41
41
  import {changeFilter, ProblemFilterValues} from '../../store/reducers/settings/settings';
42
+ import type {AdditionalNodesProps} from '../../types/additionalProps';
42
43
 
43
44
  import {isDatabaseEntityType} from '../Tenant/utils/schema';
44
45
 
@@ -53,7 +54,7 @@ const b = cn('ydb-nodes');
53
54
  interface NodesProps {
54
55
  path?: string;
55
56
  type?: EPathType;
56
- additionalNodesInfo?: AdditionalNodesInfo;
57
+ additionalNodesInfo?: AdditionalNodesProps;
57
58
  }
58
59
 
59
60
  export const Nodes = ({path, type, additionalNodesInfo = {}}: NodesProps) => {
@@ -6,11 +6,13 @@ import ProgressViewer from '../../components/ProgressViewer/ProgressViewer';
6
6
  import {TabletsStatistic} from '../../components/TabletsStatistic';
7
7
  import {NodeHostWrapper} from '../../components/NodeHostWrapper/NodeHostWrapper';
8
8
 
9
- import {isSortableNodesProperty, type NodeAddress} from '../../utils/nodes';
9
+ import {isSortableNodesProperty} from '../../utils/nodes';
10
10
  import {formatBytesToGigabyte} from '../../utils/index';
11
11
 
12
12
  import type {NodesPreparedEntity} from '../../store/reducers/nodes/types';
13
13
 
14
+ import type {NodeAddress} from '../../types/additionalProps';
15
+
14
16
  const NODES_COLUMNS_IDS = {
15
17
  NodeId: 'NodeId',
16
18
  Host: 'Host',
@@ -15,6 +15,7 @@ import type {
15
15
  VisibleEntities,
16
16
  } from '../../store/reducers/storage/types';
17
17
  import type {NodesSortParams} from '../../store/reducers/nodes/types';
18
+ import type {AdditionalNodesProps} from '../../types/additionalProps';
18
19
  import {
19
20
  setInitialState,
20
21
  setVisibleEntities,
@@ -45,7 +46,7 @@ import {
45
46
  useTableSort,
46
47
  useTypedSelector,
47
48
  } from '../../utils/hooks';
48
- import {AdditionalNodesInfo, NodesUptimeFilterValues} from '../../utils/nodes';
49
+ import {NodesUptimeFilterValues} from '../../utils/nodes';
49
50
  import {DEFAULT_TABLE_SETTINGS} from '../../utils/constants';
50
51
 
51
52
  import {StorageGroups} from './StorageGroups/StorageGroups';
@@ -59,7 +60,7 @@ import './Storage.scss';
59
60
  const b = cn('global-storage');
60
61
 
61
62
  interface StorageProps {
62
- additionalNodesInfo?: AdditionalNodesInfo;
63
+ additionalNodesInfo?: AdditionalNodesProps;
63
64
  tenant?: string;
64
65
  nodeId?: string;
65
66
  }
@@ -5,10 +5,10 @@ import DataTable, {Column, Settings, SortOrder} from '@gravity-ui/react-data-tab
5
5
  import type {ValueOf} from '../../../types/common';
6
6
  import type {PreparedStorageNode, VisibleEntities} from '../../../store/reducers/storage/types';
7
7
  import type {HandleSort} from '../../../utils/hooks/useTableSort';
8
+ import type {AdditionalNodesProps} from '../../../types/additionalProps';
8
9
 
9
10
  import {VISIBLE_ENTITIES} from '../../../store/reducers/storage/constants';
10
11
  import {
11
- AdditionalNodesInfo,
12
12
  isSortableNodesProperty,
13
13
  isUnavailableNode,
14
14
  NodesUptimeFilterValues,
@@ -40,7 +40,7 @@ interface StorageNodesProps {
40
40
  visibleEntities: VisibleEntities;
41
41
  nodesUptimeFilter: keyof typeof NodesUptimeFilterValues;
42
42
  onShowAll?: VoidFunction;
43
- additionalNodesInfo?: AdditionalNodesInfo;
43
+ additionalNodesInfo?: AdditionalNodesProps;
44
44
  sort?: SortOrder;
45
45
  handleSort?: HandleSort;
46
46
  }
@@ -5,6 +5,7 @@ import cn from 'bem-cn-lite';
5
5
  import {Button, Modal} from '@gravity-ui/uikit';
6
6
 
7
7
  import type {EPathType} from '../../../../types/api/schema';
8
+ import type {AdditionalTenantsProps} from '../../../../types/additionalProps';
8
9
  import {Icon} from '../../../../components/Icon';
9
10
  import Overview from '../Overview/Overview';
10
11
  import {Healthcheck} from '../Healthcheck';
@@ -16,7 +17,7 @@ interface DetailedOverviewProps {
16
17
  type?: EPathType;
17
18
  className?: string;
18
19
  tenantName: string;
19
- additionalTenantInfo?: any;
20
+ additionalTenantInfo?: AdditionalTenantsProps;
20
21
  }
21
22
 
22
23
  const b = cn('kv-detailed-overview');
@@ -8,6 +8,7 @@ import {useLocation} from 'react-router';
8
8
  import {Switch, Tabs} from '@gravity-ui/uikit';
9
9
 
10
10
  import type {EPathType} from '../../../types/api/schema';
11
+ import type {AdditionalTenantsProps, AdditionalNodesProps} from '../../../types/additionalProps';
11
12
 
12
13
  import {useTypedSelector} from '../../../utils/hooks';
13
14
  import routes, {createHref} from '../../../routes';
@@ -41,8 +42,8 @@ import './Diagnostics.scss';
41
42
 
42
43
  interface DiagnosticsProps {
43
44
  type?: EPathType;
44
- additionalTenantInfo?: any;
45
- additionalNodesInfo?: any;
45
+ additionalTenantInfo?: AdditionalTenantsProps;
46
+ additionalNodesInfo?: AdditionalNodesProps;
46
47
  }
47
48
 
48
49
  const b = cn('kv-tenant-diagnostics');
@@ -13,7 +13,8 @@ import {TABLET_STATES, TENANT_DEFAULT_TITLE} from '../../../../utils/constants';
13
13
  import {bytesToGB} from '../../../../utils/utils';
14
14
  import {mapDatabaseTypeToDBName} from '../../utils/schema';
15
15
  import {useAutofetcher, useTypedSelector} from '../../../../utils/hooks';
16
- import {ETabletVolatileState} from '../../../../types/api/tenant';
16
+ import type {ETabletVolatileState} from '../../../../types/api/tenant';
17
+ import type {AdditionalTenantsProps} from '../../../../types/additionalProps';
17
18
  import {getTenantInfo, setDataWasNotLoaded} from '../../../../store/reducers/tenant/tenant';
18
19
 
19
20
  import i18n from './i18n';
@@ -23,7 +24,7 @@ const b = cn('tenant-overview');
23
24
 
24
25
  interface TenantOverviewProps {
25
26
  tenantName: string;
26
- additionalTenantInfo?: any;
27
+ additionalTenantInfo?: AdditionalTenantsProps;
27
28
  }
28
29
 
29
30
  export function TenantOverview({tenantName, additionalTenantInfo}: TenantOverviewProps) {
@@ -118,7 +119,7 @@ export function TenantOverview({tenantName, additionalTenantInfo}: TenantOvervie
118
119
  <div className={b('top-label')}>{tenantType}</div>
119
120
  <div className={b('top')}>
120
121
  {renderName()}
121
- {tenant && additionalTenantInfo && additionalTenantInfo(tenant.Name, tenant.Type)}
122
+ {additionalTenantInfo?.getMonitoringLink?.(Name, Type)}
122
123
  </div>
123
124
  <div className={b('system-tablets')}>
124
125
  {SystemTablets &&
@@ -4,6 +4,7 @@ import cn from 'bem-cn-lite';
4
4
  import {useThemeValue} from '@gravity-ui/uikit';
5
5
 
6
6
  import type {EPathType} from '../../../types/api/schema';
7
+ import type {AdditionalTenantsProps, AdditionalNodesProps} from '../../../types/additionalProps';
7
8
  import {TENANT_PAGES_IDS} from '../../../store/reducers/tenant/constants';
8
9
  import {useSetting} from '../../../utils/hooks';
9
10
  import {TENANT_INITIAL_PAGE_KEY} from '../../../utils/constants';
@@ -18,8 +19,8 @@ const b = cn('object-general');
18
19
 
19
20
  interface ObjectGeneralProps {
20
21
  type?: EPathType;
21
- additionalTenantInfo?: any;
22
- additionalNodesInfo?: any;
22
+ additionalTenantInfo?: AdditionalTenantsProps;
23
+ additionalNodesInfo?: AdditionalNodesProps;
23
24
  }
24
25
 
25
26
  function ObjectGeneral(props: ObjectGeneralProps) {
@@ -5,6 +5,7 @@ import {useLocation} from 'react-router';
5
5
  import qs from 'qs';
6
6
 
7
7
  import type {TEvDescribeSchemeResult} from '../../types/api/schema';
8
+ import type {AdditionalTenantsProps, AdditionalNodesProps} from '../../types/additionalProps';
8
9
 
9
10
  import {DEFAULT_IS_TENANT_SUMMARY_COLLAPSED, DEFAULT_SIZE_TENANT_KEY} from '../../utils/constants';
10
11
  import {useTypedSelector} from '../../utils/hooks';
@@ -37,8 +38,8 @@ const initialTenantSummaryState = {
37
38
  };
38
39
 
39
40
  interface TenantProps {
40
- additionalTenantInfo?: any;
41
- additionalNodesInfo?: any;
41
+ additionalTenantInfo?: AdditionalTenantsProps;
42
+ additionalNodesInfo?: AdditionalNodesProps;
42
43
  }
43
44
 
44
45
  function Tenant(props: TenantProps) {
@@ -106,9 +106,7 @@ export const Tenants = ({additionalTenantsProps}: TenantsProps) => {
106
106
  backend,
107
107
  })}
108
108
  />
109
- {row.Name &&
110
- row.Type &&
111
- additionalTenantsProps?.getMonitoringLink?.(row.Name, row.Type)}
109
+ {additionalTenantsProps?.getMonitoringLink?.(row.Name, row.Type)}
112
110
  </div>
113
111
  );
114
112
  },
@@ -2,6 +2,7 @@ import type {ReactNode} from 'react';
2
2
 
3
3
  import type {InfoViewerItem} from '../components/InfoViewer';
4
4
  import type {ETenantType} from './api/tenant';
5
+ import type {TSystemStateInfo} from './api/nodes';
5
6
  import type {VersionToColorMap} from './versions';
6
7
 
7
8
  export interface AdditionalVersionsProps {
@@ -20,5 +21,11 @@ export interface AdditionalClusterProps {
20
21
 
21
22
  export interface AdditionalTenantsProps {
22
23
  prepareTenantBackend?: (backend: string | undefined) => string | undefined;
23
- getMonitoringLink?: (name: string, type: ETenantType) => ReactNode;
24
+ getMonitoringLink?: (name?: string, type?: ETenantType) => ReactNode;
25
+ }
26
+
27
+ export type NodeAddress = Pick<TSystemStateInfo, 'Host' | 'Endpoints'>;
28
+
29
+ export interface AdditionalNodesProps extends Record<string, unknown> {
30
+ getNodeRef?: (node?: NodeAddress) => string | null;
24
31
  }
@@ -18,12 +18,6 @@ export const NodesUptimeFilterTitles = {
18
18
  export const isUnavailableNode = (node: NodesPreparedEntity | TSystemStateInfo) =>
19
19
  !node.SystemState || node.SystemState === EFlag.Grey;
20
20
 
21
- export type NodeAddress = Pick<TSystemStateInfo, 'Host' | 'Endpoints'>;
22
-
23
- export interface AdditionalNodesInfo extends Record<string, unknown> {
24
- getNodeRef?: (node?: NodeAddress) => string | null;
25
- }
26
-
27
21
  export const prepareNodesMap = (nodesList?: TNodeInfo[]) => {
28
22
  return nodesList?.reduce<NodesMap>((nodesMap, node) => {
29
23
  if (node.Id && node.Host) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-embedded-ui",
3
- "version": "4.16.0",
3
+ "version": "4.16.1",
4
4
  "files": [
5
5
  "dist"
6
6
  ],