ydb-embedded-ui 4.31.2 → 4.32.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,6 +6,7 @@ import {DEFAULT_INTERSECTION_OBSERVER_MARGIN} from './constants';
6
6
  interface UseIntersectionObserverProps {
7
7
  onEntry: OnEntry;
8
8
  onLeave: OnLeave;
9
+ /** Intersection observer calculate margins based on container element properties */
9
10
  parentContainer?: Element | null;
10
11
  }
11
12
 
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import {useEffect, useMemo, useRef} from 'react';
2
2
  import {useLocation, useRouteMatch} from 'react-router';
3
3
  import cn from 'bem-cn-lite';
4
4
  import {useDispatch} from 'react-redux';
@@ -8,7 +8,7 @@ import {Link} from 'react-router-dom';
8
8
 
9
9
  import {TABLETS, STORAGE, NODE_PAGES, OVERVIEW, STRUCTURE} from './NodePages';
10
10
  import {Tablets} from '../Tablets';
11
- import {Storage} from '../Storage/Storage';
11
+ import {StorageWrapper} from '../Storage/StorageWrapper';
12
12
  import NodeStructure from './NodeStructure/NodeStructure';
13
13
  import {Loader} from '../../components/Loader';
14
14
  import {BasicNodeViewer} from '../../components/BasicNodeViewer';
@@ -38,6 +38,8 @@ interface NodeProps {
38
38
  }
39
39
 
40
40
  function Node(props: NodeProps) {
41
+ const container = useRef<HTMLDivElement>(null);
42
+
41
43
  const dispatch = useDispatch();
42
44
  const location = useLocation();
43
45
 
@@ -50,7 +52,7 @@ function Node(props: NodeProps) {
50
52
  const {id: nodeId, activeTab} = match.params;
51
53
  const {tenantName: tenantNameFromQuery} = parseQuery(location);
52
54
 
53
- const {activeTabVerified, nodeTabs} = React.useMemo(() => {
55
+ const {activeTabVerified, nodeTabs} = useMemo(() => {
54
56
  const hasStorage = node?.Roles?.find((el) => el === STORAGE_ROLE);
55
57
 
56
58
  let actualActiveTab = activeTab;
@@ -69,7 +71,7 @@ function Node(props: NodeProps) {
69
71
  return {activeTabVerified: actualActiveTab, nodeTabs: actualNodeTabs};
70
72
  }, [activeTab, node]);
71
73
 
72
- React.useEffect(() => {
74
+ useEffect(() => {
73
75
  const tenantName = node?.Tenants?.[0] || tenantNameFromQuery?.toString();
74
76
 
75
77
  dispatch(
@@ -81,7 +83,7 @@ function Node(props: NodeProps) {
81
83
  );
82
84
  }, [dispatch, node, nodeId, tenantNameFromQuery]);
83
85
 
84
- React.useEffect(() => {
86
+ useEffect(() => {
85
87
  const fetchData = () => dispatch(getNodeInfo(nodeId));
86
88
  fetchData();
87
89
  autofetcher.start();
@@ -119,7 +121,7 @@ function Node(props: NodeProps) {
119
121
  case STORAGE: {
120
122
  return (
121
123
  <div className={b('storage')}>
122
- <Storage nodeId={nodeId} />
124
+ <StorageWrapper nodeId={nodeId} parentContainer={container.current} />
123
125
  </div>
124
126
  );
125
127
  }
@@ -146,7 +148,7 @@ function Node(props: NodeProps) {
146
148
  } else {
147
149
  if (node) {
148
150
  return (
149
- <div className={b(null, props.className)}>
151
+ <div className={b(null, props.className)} ref={container}>
150
152
  <BasicNodeViewer
151
153
  node={node}
152
154
  additionalNodesProps={props.additionalNodesProps}
@@ -6,6 +6,7 @@ import {VirtualNodes} from './VirtualNodes';
6
6
  import {Nodes} from './Nodes';
7
7
 
8
8
  interface NodesWrapperProps {
9
+ path?: string;
9
10
  parentContainer?: Element | null;
10
11
  additionalNodesProps?: AdditionalNodesProps;
11
12
  }
@@ -38,11 +38,12 @@ import './Nodes.scss';
38
38
  const b = cn('ydb-nodes');
39
39
 
40
40
  interface NodesProps {
41
+ path?: string;
41
42
  parentContainer?: Element | null;
42
43
  additionalNodesProps?: AdditionalNodesProps;
43
44
  }
44
45
 
45
- export const VirtualNodes = ({parentContainer, additionalNodesProps}: NodesProps) => {
46
+ export const VirtualNodes = ({path, parentContainer, additionalNodesProps}: NodesProps) => {
46
47
  const [searchValue, setSearchValue] = useState('');
47
48
  const [problemFilter, setProblemFilter] = useState<ProblemFilterValue>(ProblemFilterValues.ALL);
48
49
  const [uptimeFilter, setUptimeFilter] = useState<NodesUptimeFilterValues>(
@@ -50,14 +51,15 @@ export const VirtualNodes = ({parentContainer, additionalNodesProps}: NodesProps
50
51
  );
51
52
 
52
53
  const filters = useMemo(() => {
53
- return [searchValue, problemFilter, uptimeFilter];
54
- }, [searchValue, problemFilter, uptimeFilter]);
54
+ return [path, searchValue, problemFilter, uptimeFilter];
55
+ }, [path, searchValue, problemFilter, uptimeFilter]);
55
56
 
56
57
  const fetchData = useCallback<FetchData<NodesPreparedEntity>>(
57
58
  async (limit, offset, {sortOrder, columnId} = {}) => {
58
59
  return await getNodes({
59
60
  limit,
60
61
  offset,
62
+ path,
61
63
  filter: searchValue,
62
64
  problems_only: getProblemParamValue(problemFilter),
63
65
  uptime: getUptimeParamValue(uptimeFilter),
@@ -65,7 +67,7 @@ export const VirtualNodes = ({parentContainer, additionalNodesProps}: NodesProps
65
67
  sortValue: columnId as NodesSortValue,
66
68
  });
67
69
  },
68
- [problemFilter, searchValue, uptimeFilter],
70
+ [path, problemFilter, searchValue, uptimeFilter],
69
71
  );
70
72
 
71
73
  const getRowClassName: GetRowClassName<NodesPreparedEntity> = (row) => {
@@ -45,7 +45,8 @@
45
45
  padding-top: 0;
46
46
  }
47
47
 
48
- .data-table__sticky_moving {
48
+ .data-table__sticky_moving,
49
+ .ydb-virtual-table__head {
49
50
  top: 46px !important;
50
51
  }
51
52
  }
@@ -1,4 +1,4 @@
1
- import {useMemo} from 'react';
1
+ import {useMemo, useRef} from 'react';
2
2
  import qs from 'qs';
3
3
  import cn from 'bem-cn-lite';
4
4
  import {Link} from 'react-router-dom';
@@ -20,8 +20,8 @@ import {TENANT_DIAGNOSTICS_TABS_IDS} from '../../../store/reducers/tenant/consta
20
20
  import {Loader} from '../../../components/Loader';
21
21
 
22
22
  import {Heatmap} from '../../Heatmap';
23
- import {Nodes} from '../../Nodes';
24
- import {Storage} from '../../Storage/Storage';
23
+ import {NodesWrapper} from '../../Nodes/NodesWrapper';
24
+ import {StorageWrapper} from '../../Storage/StorageWrapper';
25
25
  import {Tablets} from '../../Tablets';
26
26
 
27
27
  import Describe from './Describe/Describe';
@@ -49,6 +49,8 @@ interface DiagnosticsProps {
49
49
  const b = cn('kv-tenant-diagnostics');
50
50
 
51
51
  function Diagnostics(props: DiagnosticsProps) {
52
+ const container = useRef<HTMLDivElement>(null);
53
+
52
54
  const dispatch = useDispatch();
53
55
  const {currentSchemaPath, autorefresh, wasLoaded} = useSelector((state: any) => state.schema);
54
56
  const {diagnosticsTab = TENANT_DIAGNOSTICS_TABS_IDS.overview} = useTypedSelector(
@@ -121,9 +123,10 @@ function Diagnostics(props: DiagnosticsProps) {
121
123
  }
122
124
  case TENANT_DIAGNOSTICS_TABS_IDS.nodes: {
123
125
  return (
124
- <Nodes
126
+ <NodesWrapper
125
127
  path={currentSchemaPath}
126
128
  additionalNodesProps={props.additionalNodesProps}
129
+ parentContainer={container.current}
127
130
  />
128
131
  );
129
132
  }
@@ -131,7 +134,9 @@ function Diagnostics(props: DiagnosticsProps) {
131
134
  return <Tablets path={currentSchemaPath} />;
132
135
  }
133
136
  case TENANT_DIAGNOSTICS_TABS_IDS.storage: {
134
- return <Storage tenant={tenantNameString} />;
137
+ return (
138
+ <StorageWrapper tenant={tenantNameString} parentContainer={container.current} />
139
+ );
135
140
  }
136
141
  case TENANT_DIAGNOSTICS_TABS_IDS.network: {
137
142
  return <Network path={tenantNameString} />;
@@ -196,7 +201,7 @@ function Diagnostics(props: DiagnosticsProps) {
196
201
  }
197
202
 
198
203
  return (
199
- <div className={b()}>
204
+ <div className={b()} ref={container}>
200
205
  {renderTabs()}
201
206
  <div className={b('page-wrapper')}>{renderTabContent()}</div>
202
207
  </div>
@@ -19,7 +19,7 @@
19
19
  "settings.useNodesEndpoint.title": "Break the Nodes tab in Diagnostics",
20
20
  "settings.useNodesEndpoint.popover": "Use /viewer/json/nodes endpoint for Nodes Tab in diagnostics. It could return incorrect data on some versions",
21
21
 
22
- "settings.useVirtualTables.title": "Use table with data load on scroll for Nodes and Storage cluster tabs",
22
+ "settings.useVirtualTables.title": "Use table with data load on scroll for Nodes and Storage tabs",
23
23
  "settings.useVirtualTables.popover": "It will increase performance, but could work unstable",
24
24
 
25
25
  "settings.queryUseMultiSchema.title": "Allow queries with multiple result sets",
@@ -19,7 +19,7 @@
19
19
  "settings.useNodesEndpoint.title": "Сломать вкладку Nodes в диагностике",
20
20
  "settings.useNodesEndpoint.popover": "Использовать эндпоинт /viewer/json/nodes для вкладки Nodes в диагностике. Может возвращать некорректные данные на некоторых версиях",
21
21
 
22
- "settings.useVirtualTables.title": "Использовать таблицу с загрузкой данных по скроллу для вкладок Nodes и Storage кластера",
22
+ "settings.useVirtualTables.title": "Использовать таблицу с загрузкой данных по скроллу для вкладок Nodes и Storage",
23
23
  "settings.useVirtualTables.popover": "Это улучшит производительность, но может работать нестабильно",
24
24
 
25
25
  "settings.queryUseMultiSchema.title": "Разрешить запросы с несколькими результатами",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-embedded-ui",
3
- "version": "4.31.2",
3
+ "version": "4.32.0",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -56,6 +56,7 @@
56
56
  "build": "rm -rf build && DISABLE_ESLINT_PLUGIN=true react-app-rewired build",
57
57
  "//build:embedded": "echo 'PUBLIC_URL is a setting for create-react-app. Embedded version is built and hosted as is on ydb servers, with no way of knowing the final URL pattern. PUBLIC_URL=. keeps paths to all static relative, allowing servers to handle them as needed'",
58
58
  "build:embedded": "GENERATE_SOURCEMAP=false PUBLIC_URL=. REACT_APP_BACKEND=http://localhost:8765 npm run build",
59
+ "build:embedded:archive": "npm run build:embedded && mv build embedded-ui && zip -r embedded-ui.zip embedded-ui && rm -rf embedded-ui",
59
60
  "lint:styles": "stylelint 'src/**/*.scss'",
60
61
  "unimported": "npx unimported --no-cache",
61
62
  "package": "rm -rf dist && copyfiles -u 1 'src/**/*' dist",