ydb-embedded-ui 3.4.0 → 3.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/components/BasicNodeViewer/BasicNodeViewer.tsx +2 -3
  3. package/dist/components/ClusterInfo/ClusterInfo.tsx +14 -36
  4. package/dist/components/CopyToClipboard/CopyToClipboard.tsx +1 -2
  5. package/dist/components/CriticalActionDialog/CriticalActionDialog.js +1 -1
  6. package/dist/components/EmptyState/{EmptyState.js → EmptyState.tsx} +12 -15
  7. package/dist/components/EmptyState/index.ts +1 -0
  8. package/dist/components/EnableFullscreenButton/EnableFullscreenButton.tsx +7 -2
  9. package/dist/components/Errors/403/AccessDenied.tsx +1 -1
  10. package/dist/components/Fullscreen/Fullscreen.tsx +1 -1
  11. package/dist/components/Icon/Icon.tsx +33 -0
  12. package/dist/components/Icon/index.ts +1 -0
  13. package/dist/components/Pagination/Pagination.js +1 -1
  14. package/dist/components/QueryExecutionStatus/QueryExecutionStatus.tsx +1 -1
  15. package/dist/components/Tablet/Tablet.tsx +59 -0
  16. package/dist/components/Tablet/index.ts +1 -0
  17. package/dist/components/Tag/Tag.tsx +16 -0
  18. package/dist/components/Tag/index.ts +1 -0
  19. package/dist/components/Tags/Tags.tsx +22 -0
  20. package/dist/components/Tags/index.ts +1 -0
  21. package/dist/containers/Header/Header.tsx +2 -3
  22. package/dist/containers/Header/Host/Host.js +1 -1
  23. package/dist/containers/Node/NodeStructure/Pdisk.tsx +1 -1
  24. package/dist/containers/Nodes/getNodesColumns.tsx +1 -1
  25. package/dist/containers/Storage/EmptyFilter/EmptyFilter.tsx +8 -9
  26. package/dist/containers/Storage/PDisk/PDisk.scss +15 -0
  27. package/dist/containers/Storage/PDisk/PDisk.tsx +38 -13
  28. package/dist/containers/Storage/StorageNodes/StorageNodes.scss +4 -2
  29. package/dist/containers/Storage/StorageNodes/StorageNodes.tsx +1 -0
  30. package/dist/containers/Tablet/Tablet.js +6 -6
  31. package/dist/containers/Tablets/Tablets.scss +0 -4
  32. package/dist/containers/Tablets/Tablets.tsx +1 -2
  33. package/dist/containers/TabletsFilters/TabletsFilters.js +1 -1
  34. package/dist/containers/Tenant/Diagnostics/Consumers/TopicStats/ConsumersTopicStats.scss +1 -1
  35. package/dist/containers/Tenant/Diagnostics/Consumers/columns/columns.tsx +27 -1
  36. package/dist/containers/Tenant/Diagnostics/DetailedOverview/DetailedOverview.tsx +1 -2
  37. package/dist/containers/Tenant/Diagnostics/HotKeys/HotKeys.js +1 -1
  38. package/dist/containers/Tenant/Diagnostics/Network/Network.js +1 -1
  39. package/dist/containers/Tenant/Diagnostics/Partitions/Partitions.tsx +17 -13
  40. package/dist/containers/Tenant/Diagnostics/Partitions/PartitionsWrapper.tsx +2 -0
  41. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.js +1 -1
  42. package/dist/containers/Tenant/ObjectSummary/ObjectSummary.tsx +1 -1
  43. package/dist/containers/Tenant/Preview/Preview.js +1 -1
  44. package/dist/containers/Tenant/QueryEditor/QueryEditor.js +1 -1
  45. package/dist/containers/Tenant/QueryEditor/SavedQueries/SavedQueries.js +1 -1
  46. package/dist/containers/Tenant/Schema/SchemaViewer/SchemaViewer.js +1 -1
  47. package/dist/containers/Tenant/TenantPages.tsx +1 -2
  48. package/dist/containers/Tenant/utils/paneVisibilityToggleHelpers.tsx +2 -2
  49. package/dist/services/api.d.ts +11 -0
  50. package/dist/services/api.js +3 -3
  51. package/dist/store/reducers/consumer.ts +14 -0
  52. package/dist/store/reducers/{host.js → host.ts} +9 -5
  53. package/dist/store/reducers/shardsWorkload.ts +4 -0
  54. package/dist/store/reducers/tablet.ts +111 -0
  55. package/dist/store/reducers/topic.ts +13 -0
  56. package/dist/store/state-url-mapping.js +3 -0
  57. package/dist/types/api/cluster.ts +34 -0
  58. package/dist/types/api/systemState.ts +13 -0
  59. package/dist/types/api/tablet.ts +12 -4
  60. package/dist/types/store/consumer.ts +10 -2
  61. package/dist/types/store/host.ts +23 -0
  62. package/dist/types/store/tablet.ts +50 -0
  63. package/dist/types/store/tooltip.ts +3 -1
  64. package/dist/types/store/topic.ts +3 -2
  65. package/package.json +7 -5
  66. package/dist/components/Icon/Icon.js +0 -28
  67. package/dist/components/Tablet/Tablet.js +0 -61
  68. package/dist/components/Tag/Tag.js +0 -14
  69. package/dist/components/Tags/Tags.js +0 -36
  70. package/dist/store/reducers/tablet.js +0 -94
@@ -1,8 +1,10 @@
1
1
  import {EFlag} from './enums';
2
2
 
3
- // endpoint: /viewer/json/tabletinfo
4
- // source: https://github.com/ydb-platform/ydb/blob/main/ydb/core/protos/sys_view.proto
5
-
3
+ /**
4
+ * endpoint: /viewer/json/tabletinfo
5
+ *
6
+ * source: https://github.com/ydb-platform/ydb/blob/main/ydb/core/protos/sys_view.proto
7
+ */
6
8
  export interface TEvTabletStateResponse {
7
9
  TabletStateInfo?: TTabletStateInfo[];
8
10
 
@@ -16,6 +18,12 @@ export interface TEvTabletStateResponse {
16
18
  Packed5?: unknown;
17
19
  }
18
20
 
21
+ /**
22
+ * endpoint: /viewer/json/tabletinfo with merge=false in query.
23
+ * Maps nodes to their tablets
24
+ */
25
+ export type UnmergedTEvTabletStateResponse = Record<string, TEvTabletStateResponse>;
26
+
19
27
  export interface TTabletStateInfo {
20
28
  /** uint64 */
21
29
  TabletId?: string;
@@ -46,7 +54,7 @@ interface TCustomTabletAttribute {
46
54
  Value?: string;
47
55
  }
48
56
 
49
- interface TDomainKey {
57
+ export interface TDomainKey {
50
58
  /** fixed64 */
51
59
  SchemeShard?: string;
52
60
  /** fixed64 */
@@ -1,7 +1,11 @@
1
1
  import type {IProcessSpeedStats} from '../../utils/bytesParsers';
2
2
  import type {ApiRequestAction} from '../../store/utils';
3
3
 
4
- import {FETCH_CONSUMER, setDataWasNotLoaded} from '../../store/reducers/consumer';
4
+ import {
5
+ FETCH_CONSUMER,
6
+ setDataWasNotLoaded,
7
+ setSelectedConsumer,
8
+ } from '../../store/reducers/consumer';
5
9
 
6
10
  import type {DescribeConsumerResult} from '../api/consumer';
7
11
  import type {IResponseError} from '../api/error';
@@ -38,6 +42,7 @@ export interface IPreparedPartitionData {
38
42
  export interface IConsumerState {
39
43
  loading: boolean;
40
44
  wasLoaded: boolean;
45
+ selectedConsumer?: string;
41
46
  data?: DescribeConsumerResult;
42
47
  error?: IResponseError;
43
48
  }
@@ -48,7 +53,10 @@ type IConsumerApiRequestAction = ApiRequestAction<
48
53
  IResponseError
49
54
  >;
50
55
 
51
- export type IConsumerAction = IConsumerApiRequestAction | ReturnType<typeof setDataWasNotLoaded>;
56
+ export type IConsumerAction =
57
+ | IConsumerApiRequestAction
58
+ | ReturnType<typeof setDataWasNotLoaded>
59
+ | ReturnType<typeof setSelectedConsumer>;
52
60
 
53
61
  export interface IConsumerRootStateSlice {
54
62
  consumer: IConsumerState;
@@ -0,0 +1,23 @@
1
+ import {FETCH_HOST} from '../../store/reducers/host';
2
+
3
+ import type {ApiRequestAction} from '../../store/utils';
4
+ import type {IResponseError} from '../api/error';
5
+ import type {TSystemStateInfo} from '../api/nodes';
6
+ import type {TEvSystemStateResponse} from '../api/systemState';
7
+
8
+ export interface IHostState {
9
+ loading: boolean;
10
+ wasLoaded: boolean;
11
+ data?: TSystemStateInfo;
12
+ error?: IResponseError;
13
+ }
14
+
15
+ export type IHostAction = ApiRequestAction<
16
+ typeof FETCH_HOST,
17
+ TEvSystemStateResponse,
18
+ IResponseError
19
+ >;
20
+
21
+ export interface IHostRootStateSlice {
22
+ host: IHostState;
23
+ }
@@ -0,0 +1,50 @@
1
+ import type {IResponseError} from '../api/error';
2
+ import type {ETabletState, TTabletStateInfo} from '../api/tablet';
3
+
4
+ import {FETCH_TABLET, FETCH_TABLET_DESCRIBE} from '../../store/reducers/tablet';
5
+ import {ApiRequestAction} from '../../store/utils';
6
+
7
+ export interface ITabletPreparedHistoryItem {
8
+ nodeId: string;
9
+ generation: number | undefined;
10
+ changeTime: string | undefined;
11
+ state: ETabletState | undefined;
12
+ leader: boolean | undefined;
13
+ followerId: number | undefined;
14
+ }
15
+
16
+ export interface ITabletState {
17
+ loading: boolean;
18
+ tenantPath: string;
19
+ error?: IResponseError;
20
+ id?: string;
21
+ history?: ITabletPreparedHistoryItem[];
22
+ data?: TTabletStateInfo;
23
+ }
24
+
25
+ export interface ITabletHandledResponse {
26
+ tabletData: TTabletStateInfo;
27
+ historyData: ITabletPreparedHistoryItem[];
28
+ }
29
+
30
+ export interface ITabletDescribeHandledResponse {
31
+ tenantPath: string;
32
+ }
33
+
34
+ type ITabletApiRequestAction = ApiRequestAction<
35
+ typeof FETCH_TABLET,
36
+ ITabletHandledResponse,
37
+ IResponseError
38
+ >;
39
+
40
+ type ITabletDescribeApiRequestAction = ApiRequestAction<
41
+ typeof FETCH_TABLET_DESCRIBE,
42
+ ITabletDescribeHandledResponse,
43
+ IResponseError
44
+ >;
45
+
46
+ export type ITabletAction = ITabletApiRequestAction | ITabletDescribeApiRequestAction;
47
+
48
+ export interface ITabletRootStateSlice {
49
+ tablet: ITabletState;
50
+ }
@@ -18,7 +18,9 @@ export interface ITooltipState {
18
18
  additionalData?: any;
19
19
  }
20
20
 
21
- export type ITooltipAction = ReturnType<typeof hideTooltip> | ReturnType<typeof showTooltip>;
21
+ export type ShowTooltipFunction = typeof showTooltip;
22
+
23
+ export type ITooltipAction = ReturnType<typeof hideTooltip> | ReturnType<ShowTooltipFunction>;
22
24
 
23
25
  export interface ITooltipRootStateSlice {
24
26
  tooltip: ITooltipState;
@@ -1,4 +1,4 @@
1
- import {FETCH_TOPIC, setDataWasNotLoaded} from '../../store/reducers/topic';
1
+ import {FETCH_TOPIC, cleanTopicData, setDataWasNotLoaded} from '../../store/reducers/topic';
2
2
  import type {ApiRequestAction} from '../../store/utils';
3
3
  import type {IProcessSpeedStats} from '../../utils/bytesParsers';
4
4
  import type {IResponseError} from '../api/error';
@@ -31,7 +31,8 @@ export interface ITopicState {
31
31
 
32
32
  export type ITopicAction =
33
33
  | ApiRequestAction<typeof FETCH_TOPIC, DescribeTopicResult, IResponseError>
34
- | ReturnType<typeof setDataWasNotLoaded>;
34
+ | ReturnType<typeof setDataWasNotLoaded>
35
+ | ReturnType<typeof cleanTopicData>;
35
36
 
36
37
  export interface ITopicRootStateSlice {
37
38
  topic: ITopicState;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-embedded-ui",
3
- "version": "3.4.0",
3
+ "version": "3.4.2",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -30,7 +30,7 @@
30
30
  "react-redux": "7.2.6",
31
31
  "react-router": "5.2.1",
32
32
  "react-router-dom": "5.3.0",
33
- "react-scripts": "4.0.3",
33
+ "react-scripts": "5.0.1",
34
34
  "react-split": "2.0.14",
35
35
  "react-transition-group": "4.4.2",
36
36
  "redux": "4.0.1",
@@ -44,7 +44,7 @@
44
44
  "scripts": {
45
45
  "start": "react-app-rewired start",
46
46
  "dev": "DISABLE_ESLINT_PLUGIN=true TSC_COMPILE_ON_ERROR=true REACT_APP_BACKEND=http://localhost:8765 npm start",
47
- "build": "react-app-rewired build",
47
+ "build": "DISABLE_ESLINT_PLUGIN=true react-app-rewired build",
48
48
  "//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'",
49
49
  "build:embedded": "rm -rf build && PUBLIC_URL=. REACT_APP_BACKEND=http://localhost:8765 npm run build",
50
50
  "lint:styles": "stylelint 'src/**/*.scss'",
@@ -103,7 +103,7 @@
103
103
  "@gravity-ui/prettier-config": "^1.0.1",
104
104
  "@gravity-ui/stylelint-config": "^1.0.1",
105
105
  "@gravity-ui/tsconfig": "^1.0.0",
106
- "@gravity-ui/uikit": "^3.0.1",
106
+ "@gravity-ui/uikit": "^3.20.2",
107
107
  "@testing-library/jest-dom": "^5.15.0",
108
108
  "@testing-library/react": "^11.2.7",
109
109
  "@testing-library/user-event": "^12.8.3",
@@ -123,12 +123,14 @@
123
123
  "lint-staged": "^12.3.7",
124
124
  "postcss": "^8.4.6",
125
125
  "prettier": "^2.5.1",
126
+ "qs": "^6.11.0",
126
127
  "react": "^17.0.2",
127
128
  "react-app-rewired": "^2.1.11",
128
129
  "react-dom": "^17.0.2",
129
130
  "stylelint": "^14.3.0",
130
131
  "ts-jest": "^28.0.7",
131
- "typescript": "^4.5.5"
132
+ "typescript": "^4.5.5",
133
+ "url": "^0.11.0"
132
134
  },
133
135
  "peerDependencies": {
134
136
  "@gravity-ui/uikit": "^3.0.1"
@@ -1,28 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import {Icon as UiKitIcon} from '@gravity-ui/uikit';
3
-
4
- export default function Icon({name, height, width, viewBox, className, onClick}) {
5
- return (
6
- <UiKitIcon
7
- data={{id: `icon.${name}`, viewBox}}
8
- height={height}
9
- width={width}
10
- className={className}
11
- onClick={onClick}
12
- />
13
- );
14
- }
15
-
16
- Icon.propTypes = {
17
- name: PropTypes.string.isRequired,
18
- height: PropTypes.number,
19
- width: PropTypes.number,
20
- viewBox: PropTypes.string,
21
- className: PropTypes.string,
22
- onClick: PropTypes.func,
23
- };
24
- Icon.defaultProps = {
25
- height: 16,
26
- width: 16,
27
- viewBox: '0 0 16 16',
28
- };
@@ -1,61 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import cn from 'bem-cn-lite';
4
-
5
- import {InternalLink} from '../InternalLink';
6
-
7
- import {getTabletLabel} from '../../utils/constants';
8
- import routes, {createHref} from '../../routes';
9
-
10
- import './Tablet.scss';
11
-
12
- const b = cn('tablet');
13
-
14
- class Tablet extends React.PureComponent {
15
- static propTypes = {
16
- className: PropTypes.string,
17
- tablet: PropTypes.object,
18
- onMouseEnter: PropTypes.func,
19
- onMouseLeave: PropTypes.func,
20
- };
21
- static defaultProps = {
22
- onMouseEnter: () => {},
23
- onMouseLeave: () => {},
24
- };
25
- ref = React.createRef();
26
- _onTabletMouseEnter = () => {
27
- const {tablet} = this.props;
28
- this.props.onMouseEnter(this.ref.current, tablet, 'tablet');
29
- };
30
- _onTabletClick = () => {
31
- const {tablet = {}} = this.props;
32
- const {TabletId: id} = tablet;
33
-
34
- if (id) {
35
- this.props.onMouseLeave();
36
- }
37
- };
38
- render() {
39
- const {tablet = {}} = this.props;
40
- const {TabletId: id} = tablet;
41
- const status = tablet.Overall?.toLowerCase();
42
-
43
- return (
44
- <InternalLink
45
- onClick={this._onTabletClick}
46
- to={id && createHref(routes.tablet, {id})}
47
- className={b('wrapper')}
48
- >
49
- <div
50
- ref={this.ref}
51
- className={b({status})}
52
- onMouseEnter={this._onTabletMouseEnter}
53
- onMouseLeave={this.props.onMouseLeave}
54
- >
55
- <div className={b('type')}>{[getTabletLabel(tablet.Type)]}</div>
56
- </div>
57
- </InternalLink>
58
- );
59
- }
60
- }
61
- export default Tablet;
@@ -1,14 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import cn from 'bem-cn-lite';
3
- import './Tag.scss';
4
-
5
- const b = cn('tag');
6
-
7
- export const Tag = ({text, type}) => {
8
- return <div className={b({type})}>{text}</div>;
9
- };
10
-
11
- Tag.propTypes = {
12
- text: PropTypes.string,
13
- type: PropTypes.string,
14
- };
@@ -1,36 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import cn from 'bem-cn-lite';
4
-
5
- import {Tag} from '../Tag/Tag';
6
-
7
- import './Tags.scss';
8
-
9
- const b = cn('tags');
10
-
11
- class Tags extends React.Component {
12
- static propTypes = {
13
- className: PropTypes.string,
14
- tags: PropTypes.arrayOf(PropTypes.string).isRequired,
15
- tagsType: PropTypes.string,
16
- };
17
-
18
- static defaultProps = {
19
- className: '',
20
- };
21
-
22
- render() {
23
- const {tags, className, tagsType} = this.props;
24
-
25
- return (
26
- <div className={`${b()} ${className}`}>
27
- {tags &&
28
- tags.map((tag, tagIndex) => (
29
- <Tag text={tag} key={tagIndex} type={tagsType}></Tag>
30
- ))}
31
- </div>
32
- );
33
- }
34
- }
35
-
36
- export default Tags;
@@ -1,94 +0,0 @@
1
- import {createRequestActionTypes, createApiRequest} from '../utils';
2
- import '../../services/api';
3
- import _ from 'lodash';
4
-
5
- const FETCH_TABLET = createRequestActionTypes('TABLET', 'FETCH_TABLET');
6
- const FETCH_TABLET_DESCRIBE = createRequestActionTypes('TABLET', 'FETCH_TABLET_DESCRIBE');
7
-
8
- const tablet = (state = {loading: false, tenantPath: '-'}, action) => {
9
- switch (action.type) {
10
- case FETCH_TABLET.REQUEST: {
11
- return {
12
- ...state,
13
- loading: true,
14
- };
15
- }
16
- case FETCH_TABLET.SUCCESS: {
17
- const {tablet, history} = action.data;
18
- const {TabletId: id} = tablet;
19
- return {
20
- ...state,
21
- id,
22
- data: tablet,
23
- history,
24
- loading: false,
25
- error: undefined,
26
- };
27
- }
28
- case FETCH_TABLET.FAILURE: {
29
- return {
30
- ...state,
31
- error: action.error,
32
- loading: false,
33
- };
34
- }
35
- case FETCH_TABLET_DESCRIBE.SUCCESS: {
36
- const {tenantPath} = action.data;
37
-
38
- return {
39
- ...state,
40
- tenantPath,
41
- error: undefined,
42
- };
43
- }
44
- default:
45
- return state;
46
- }
47
- };
48
-
49
- export const getTablet = (id) => {
50
- return createApiRequest({
51
- request: Promise.all([window.api.getTablet({id}), window.api.getTabletHistory({id})]),
52
- actions: FETCH_TABLET,
53
- dataHandler: ([tabletData, history]) => {
54
- const historyData = Object.keys(history).reduce((list, nodeId) => {
55
- const tabletInfo = history[nodeId]?.TabletStateInfo;
56
- if (tabletInfo && tabletInfo.length) {
57
- const leaderTablet =
58
- _.find(tabletInfo, (t) => t.Master || t.Leader) || tabletInfo[0];
59
- const {ChangeTime, Generation, State, Master, SlaveId, Leader, FollowerId} =
60
- leaderTablet;
61
- list.push({
62
- nodeId,
63
- generation: Generation,
64
- changeTime: ChangeTime,
65
- state: State,
66
- leader: Master || Leader,
67
- followerId: SlaveId || FollowerId,
68
- });
69
- }
70
- return list;
71
- }, []);
72
-
73
- const {TabletStateInfo = []} = tabletData;
74
- const [tablet = {}] = TabletStateInfo;
75
-
76
- return {tablet, history: historyData};
77
- },
78
- });
79
- };
80
-
81
- export const getTabletDescribe = (TenantId) => {
82
- return createApiRequest({
83
- request: window.api.getTabletDescribe(TenantId),
84
- actions: FETCH_TABLET_DESCRIBE,
85
- dataHandler: (tabletDescribe) => {
86
- const {SchemeShard, PathId} = TenantId;
87
- const tenantPath = tabletDescribe.Path || `${SchemeShard}:${PathId}`;
88
-
89
- return {tenantPath};
90
- },
91
- });
92
- };
93
-
94
- export default tablet;