ydb-embedded-ui 4.2.0 → 4.3.0

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.
Files changed (29) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/containers/Tenant/Diagnostics/Diagnostics.tsx +2 -2
  3. package/dist/containers/Tenant/Diagnostics/Partitions/Partitions.tsx +111 -193
  4. package/dist/containers/Tenant/Diagnostics/Partitions/PartitionsControls/PartitionsControls.tsx +182 -0
  5. package/dist/containers/Tenant/Diagnostics/Partitions/columns/Columns.scss +1 -1
  6. package/dist/containers/Tenant/Diagnostics/Partitions/columns/columns.tsx +15 -6
  7. package/dist/containers/Tenant/Diagnostics/Partitions/utils/constants.ts +13 -1
  8. package/dist/containers/Tenant/Diagnostics/Partitions/utils/index.ts +26 -0
  9. package/dist/containers/Tenant/Diagnostics/Partitions/utils/types.ts +2 -2
  10. package/dist/containers/Tenant/Diagnostics/Partitions/utils/useGetPartitionsColumns.ts +27 -0
  11. package/dist/services/api.ts +1 -1
  12. package/dist/store/reducers/index.ts +2 -2
  13. package/dist/store/reducers/partitions/partitions.ts +104 -0
  14. package/dist/store/reducers/partitions/types.ts +47 -0
  15. package/dist/store/reducers/partitions/utils.ts +99 -0
  16. package/dist/store/reducers/settings.js +2 -2
  17. package/dist/store/reducers/topic.ts +7 -0
  18. package/dist/store/state-url-mapping.js +1 -1
  19. package/dist/types/api/topic.ts +1 -1
  20. package/dist/utils/constants.ts +1 -1
  21. package/dist/utils/createToast.tsx +1 -1
  22. package/dist/utils/hooks/index.ts +1 -0
  23. package/dist/utils/hooks/useSetting.ts +23 -0
  24. package/dist/utils/tablet.ts +14 -13
  25. package/package.json +1 -1
  26. package/dist/containers/Tenant/Diagnostics/Partitions/PartitionsWrapper.tsx +0 -81
  27. package/dist/containers/Tenant/Diagnostics/Partitions/index.ts +0 -1
  28. package/dist/store/reducers/consumer.ts +0 -174
  29. package/dist/types/store/consumer.ts +0 -63
@@ -1,174 +0,0 @@
1
- /* eslint-disable camelcase */
2
- import type {Reducer} from 'redux';
3
- import {createSelector, Selector} from 'reselect';
4
-
5
- import type {
6
- IConsumerAction,
7
- IConsumerRootStateSlice,
8
- IConsumerState,
9
- IPreparedPartitionData,
10
- } from '../../types/store/consumer';
11
-
12
- import '../../services/api';
13
-
14
- import {convertBytesObjectToSpeed} from '../../utils/bytesParsers';
15
- import {parseLag, parseTimestampToIdleTime} from '../../utils/timeParsers';
16
- import {isNumeric} from '../../utils/utils';
17
-
18
- import {createRequestActionTypes, createApiRequest} from '../utils';
19
-
20
- export const FETCH_CONSUMER = createRequestActionTypes('consumer', 'FETCH_CONSUMER');
21
-
22
- const SET_DATA_WAS_NOT_LOADED = 'consumer/SET_DATA_WAS_NOT_LOADED';
23
- const SET_SELECTED_CONSUMER = 'consumer/SET_SELECTED_CONSUMER';
24
-
25
- const initialState = {
26
- loading: false,
27
- wasLoaded: false,
28
- data: {},
29
- };
30
-
31
- const consumer: Reducer<IConsumerState, IConsumerAction> = (state = initialState, action) => {
32
- switch (action.type) {
33
- case FETCH_CONSUMER.REQUEST: {
34
- return {
35
- ...state,
36
- loading: true,
37
- };
38
- }
39
- case FETCH_CONSUMER.SUCCESS: {
40
- // On older version it can return HTML page of Internal Viewer with an error
41
- if (typeof action.data !== 'object') {
42
- return {...state, loading: false, error: {}};
43
- }
44
-
45
- return {
46
- ...state,
47
- data: action.data,
48
- loading: false,
49
- wasLoaded: true,
50
- error: undefined,
51
- };
52
- }
53
- case FETCH_CONSUMER.FAILURE: {
54
- if (action.error?.isCancelled) {
55
- return state;
56
- }
57
-
58
- return {
59
- ...state,
60
- error: action.error,
61
- loading: false,
62
- };
63
- }
64
- case SET_DATA_WAS_NOT_LOADED: {
65
- return {
66
- ...state,
67
- wasLoaded: false,
68
- };
69
- }
70
- case SET_SELECTED_CONSUMER: {
71
- return {
72
- ...state,
73
- selectedConsumer: action.data,
74
- };
75
- }
76
- default:
77
- return state;
78
- }
79
- };
80
-
81
- export const setDataWasNotLoaded = () => {
82
- return {
83
- type: SET_DATA_WAS_NOT_LOADED,
84
- } as const;
85
- };
86
-
87
- export const setSelectedConsumer = (value?: string) => {
88
- return {
89
- type: SET_SELECTED_CONSUMER,
90
- data: value,
91
- } as const;
92
- };
93
-
94
- export function getConsumer(path?: string, consumerName?: string) {
95
- return createApiRequest({
96
- request: window.api.getConsumer({path, consumer: consumerName}),
97
- actions: FETCH_CONSUMER,
98
- });
99
- }
100
-
101
- export const selectPartitions = (state: IConsumerRootStateSlice) => state.consumer.data?.partitions;
102
-
103
- export const selectPreparedPartitionsData: Selector<
104
- IConsumerRootStateSlice,
105
- IPreparedPartitionData[] | undefined
106
- > = createSelector([selectPartitions], (partitions) => {
107
- return partitions?.map((partition) => {
108
- // describe_consumer endpoint doesn't return zero values, so some values will be initialized with 0
109
- const {partition_id = '0', partition_stats, partition_consumer_stats} = partition;
110
-
111
- const {
112
- partition_offsets,
113
- store_size_bytes = '0',
114
- last_write_time: partition_last_write_time,
115
- max_write_time_lag: partition_write_lag,
116
- bytes_written,
117
- partition_node_id = 0,
118
- } = partition_stats || {};
119
-
120
- const {start: start_offset = '0', end: end_offset = '0'} = partition_offsets || {};
121
-
122
- const {
123
- last_read_offset = '0',
124
- committed_offset = '0',
125
- read_session_id,
126
- last_read_time: consumer_last_read_time,
127
- max_read_time_lag: consumer_read_lag,
128
- max_write_time_lag: consumer_write_lag,
129
- bytes_read,
130
- reader_name,
131
- connection_node_id = 0,
132
- } = partition_consumer_stats || {};
133
-
134
- const uncommitedMessages =
135
- isNumeric(end_offset) && isNumeric(committed_offset)
136
- ? Number(end_offset) - Number(committed_offset)
137
- : 0;
138
-
139
- const unreadMessages =
140
- isNumeric(end_offset) && isNumeric(last_read_offset)
141
- ? Number(end_offset) - Number(last_read_offset)
142
- : 0;
143
-
144
- return {
145
- partitionId: partition_id,
146
- storeSize: store_size_bytes,
147
-
148
- writeSpeed: convertBytesObjectToSpeed(bytes_written),
149
- readSpeed: convertBytesObjectToSpeed(bytes_read),
150
-
151
- partitionWriteLag: parseLag(partition_write_lag),
152
- partitionWriteIdleTime: parseTimestampToIdleTime(partition_last_write_time),
153
-
154
- consumerWriteLag: parseLag(consumer_write_lag),
155
- consumerReadLag: parseLag(consumer_read_lag),
156
- consumerReadIdleTime: parseTimestampToIdleTime(consumer_last_read_time),
157
-
158
- uncommitedMessages,
159
- unreadMessages,
160
-
161
- startOffset: start_offset,
162
- endOffset: end_offset,
163
- commitedOffset: committed_offset,
164
-
165
- readSessionId: read_session_id,
166
- readerName: reader_name,
167
-
168
- partitionNodeId: partition_node_id,
169
- connectionNodeId: connection_node_id,
170
- };
171
- });
172
- });
173
-
174
- export default consumer;
@@ -1,63 +0,0 @@
1
- import type {IProcessSpeedStats} from '../../utils/bytesParsers';
2
- import type {ApiRequestAction} from '../../store/utils';
3
-
4
- import {
5
- FETCH_CONSUMER,
6
- setDataWasNotLoaded,
7
- setSelectedConsumer,
8
- } from '../../store/reducers/consumer';
9
-
10
- import type {DescribeConsumerResult} from '../api/consumer';
11
- import type {IResponseError} from '../api/error';
12
-
13
- // All fields should be present though they could be undefined
14
- export interface IPreparedPartitionData {
15
- partitionId: string;
16
- storeSize: string;
17
-
18
- writeSpeed: IProcessSpeedStats;
19
- readSpeed: IProcessSpeedStats;
20
-
21
- partitionWriteLag: number;
22
- partitionWriteIdleTime: number;
23
-
24
- consumerWriteLag: number;
25
- consumerReadLag: number;
26
- consumerReadIdleTime: number;
27
-
28
- uncommitedMessages: number;
29
- unreadMessages: number;
30
-
31
- startOffset: string;
32
- endOffset: string;
33
- commitedOffset: string;
34
-
35
- readSessionId: string | undefined;
36
- readerName: string | undefined;
37
-
38
- partitionNodeId: number;
39
- connectionNodeId: number;
40
- }
41
-
42
- export interface IConsumerState {
43
- loading: boolean;
44
- wasLoaded: boolean;
45
- selectedConsumer?: string;
46
- data?: DescribeConsumerResult;
47
- error?: IResponseError;
48
- }
49
-
50
- type IConsumerApiRequestAction = ApiRequestAction<
51
- typeof FETCH_CONSUMER,
52
- DescribeConsumerResult,
53
- IResponseError
54
- >;
55
-
56
- export type IConsumerAction =
57
- | IConsumerApiRequestAction
58
- | ReturnType<typeof setDataWasNotLoaded>
59
- | ReturnType<typeof setSelectedConsumer>;
60
-
61
- export interface IConsumerRootStateSlice {
62
- consumer: IConsumerState;
63
- }