ydb-embedded-ui 4.6.0 → 4.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/assets/icons/versions.svg +3 -0
  3. package/dist/components/NodeHostWrapper/NodeHostWrapper.tsx +6 -1
  4. package/dist/components/Tablet/Tablet.tsx +17 -3
  5. package/dist/components/TabletsStatistic/TabletsStatistic.tsx +23 -16
  6. package/dist/containers/App/Content.js +5 -2
  7. package/dist/containers/AsideNavigation/AsideNavigation.tsx +50 -18
  8. package/dist/containers/Cluster/Cluster.tsx +6 -13
  9. package/dist/containers/Cluster/ClusterInfo/ClusterInfo.tsx +3 -3
  10. package/dist/containers/Cluster/{utils.ts → utils.tsx} +11 -0
  11. package/dist/containers/Header/Header.scss +9 -0
  12. package/dist/containers/Header/Header.tsx +70 -14
  13. package/dist/containers/Header/breadcrumbs.ts +146 -0
  14. package/dist/containers/Node/Node.tsx +21 -27
  15. package/dist/containers/Node/NodePages.ts +10 -6
  16. package/dist/containers/Storage/StorageGroups/StorageGroups.tsx +11 -3
  17. package/dist/containers/Tablet/Tablet.tsx +35 -27
  18. package/dist/containers/Tablet/TabletInfo/TabletInfo.tsx +2 -2
  19. package/dist/containers/TabletsFilters/TabletsFilters.js +13 -15
  20. package/dist/containers/Tenant/Diagnostics/Consumers/columns/columns.tsx +1 -1
  21. package/dist/containers/Tenant/Diagnostics/DetailedOverview/DetailedOverview.scss +5 -1
  22. package/dist/containers/Tenant/Diagnostics/Diagnostics.tsx +4 -14
  23. package/dist/containers/Tenant/Diagnostics/Healthcheck/Healthcheck.scss +5 -3
  24. package/dist/containers/Tenant/Diagnostics/Healthcheck/Healthcheck.tsx +1 -1
  25. package/dist/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.js +2 -1
  26. package/dist/containers/Tenant/Diagnostics/TopQueries/TopQueries.tsx +9 -16
  27. package/dist/containers/Tenant/ObjectGeneral/ObjectGeneral.tsx +11 -11
  28. package/dist/containers/Tenant/ObjectSummary/ObjectSummary.tsx +7 -3
  29. package/dist/containers/Tenant/{QueryEditor/QueryResult/QueryResult.js → Query/ExecuteResult/ExecuteResult.js} +3 -5
  30. package/dist/containers/Tenant/{QueryEditor/QueryResult/QueryResult.scss → Query/ExecuteResult/ExecuteResult.scss} +1 -1
  31. package/dist/containers/Tenant/{QueryEditor/QueryExplain/QueryExplain.js → Query/ExplainResult/ExplainResult.js} +3 -5
  32. package/dist/containers/Tenant/{QueryEditor/QueryExplain/QueryExplain.scss → Query/ExplainResult/ExplainResult.scss} +1 -1
  33. package/dist/containers/Tenant/Query/QueriesHistory/QueriesHistory.scss +20 -0
  34. package/dist/containers/Tenant/Query/QueriesHistory/QueriesHistory.tsx +60 -0
  35. package/dist/containers/Tenant/Query/Query.scss +16 -0
  36. package/dist/containers/Tenant/Query/Query.tsx +73 -0
  37. package/dist/containers/Tenant/{QueryEditor → Query/QueryEditor}/QueryEditor.js +39 -88
  38. package/dist/containers/Tenant/{QueryEditor → Query/QueryEditor}/QueryEditor.scss +7 -23
  39. package/dist/containers/Tenant/{QueryEditor → Query}/QueryEditorControls/QueryEditorControls.scss +1 -4
  40. package/dist/containers/Tenant/Query/QueryTabs/QueryTabs.tsx +59 -0
  41. package/dist/containers/Tenant/{QueryEditor → Query}/SaveQuery/SaveQuery.js +5 -5
  42. package/dist/containers/Tenant/Query/SavedQueries/SavedQueries.scss +55 -0
  43. package/dist/containers/Tenant/Query/SavedQueries/SavedQueries.tsx +150 -0
  44. package/dist/containers/Tenant/Query/i18n/en.json +12 -0
  45. package/dist/containers/Tenant/Query/i18n/ru.json +12 -0
  46. package/dist/containers/Tenant/Query/utils/getPreparedResult.ts +30 -0
  47. package/dist/containers/Tenant/Tenant.scss +0 -8
  48. package/dist/containers/Tenant/Tenant.tsx +24 -46
  49. package/dist/containers/Tenant/TenantPages.tsx +7 -16
  50. package/dist/containers/Tenant/utils/constants.ts +10 -0
  51. package/dist/containers/Tenant/utils/schemaActions.ts +9 -4
  52. package/dist/containers/Tenants/Tenants.js +26 -13
  53. package/dist/routes.ts +21 -7
  54. package/dist/services/api.ts +9 -5
  55. package/dist/store/reducers/executeQuery.ts +18 -4
  56. package/dist/store/reducers/header/header.ts +31 -0
  57. package/dist/store/reducers/header/types.ts +54 -0
  58. package/dist/store/reducers/index.ts +1 -1
  59. package/dist/store/reducers/node/types.ts +2 -0
  60. package/dist/store/reducers/settings/settings.ts +8 -3
  61. package/dist/store/reducers/tablet.ts +18 -1
  62. package/dist/store/reducers/tenant/constants.ts +9 -1
  63. package/dist/store/reducers/tenant/tenant.ts +23 -4
  64. package/dist/store/reducers/tenant/types.ts +9 -5
  65. package/dist/store/reducers/topic.ts +1 -1
  66. package/dist/store/state-url-mapping.js +6 -3
  67. package/dist/types/store/executeQuery.ts +4 -1
  68. package/dist/types/store/query.ts +5 -0
  69. package/dist/types/store/tablet.ts +7 -4
  70. package/dist/utils/constants.ts +5 -1
  71. package/package.json +2 -1
  72. package/dist/containers/Tenant/ObjectGeneralTabs/ObjectGeneralTabs.scss +0 -9
  73. package/dist/containers/Tenant/ObjectGeneralTabs/ObjectGeneralTabs.tsx +0 -68
  74. package/dist/containers/Tenant/QueryEditor/QueriesHistory/QueriesHistory.scss +0 -85
  75. package/dist/containers/Tenant/QueryEditor/QueriesHistory/QueriesHistory.tsx +0 -95
  76. package/dist/containers/Tenant/QueryEditor/SavedQueries/SavedQueries.js +0 -161
  77. package/dist/containers/Tenant/QueryEditor/SavedQueries/SavedQueries.scss +0 -93
  78. package/dist/containers/Tenant/QueryEditor/i18n/en.json +0 -3
  79. package/dist/containers/Tenant/QueryEditor/i18n/ru.json +0 -3
  80. package/dist/store/reducers/header.ts +0 -26
  81. /package/dist/containers/Tenant/{QueryEditor → Query}/Issues/Issues.scss +0 -0
  82. /package/dist/containers/Tenant/{QueryEditor → Query}/Issues/Issues.tsx +0 -0
  83. /package/dist/containers/Tenant/{QueryEditor → Query}/Issues/models.ts +0 -0
  84. /package/dist/containers/Tenant/{QueryEditor → Query}/QueryDuration/QueryDuration.scss +0 -0
  85. /package/dist/containers/Tenant/{QueryEditor → Query}/QueryDuration/QueryDuration.tsx +0 -0
  86. /package/dist/containers/Tenant/{QueryEditor → Query}/QueryEditorControls/OldQueryEditorControls.tsx +0 -0
  87. /package/dist/containers/Tenant/{QueryEditor → Query}/QueryEditorControls/QueryEditorControls.tsx +0 -0
  88. /package/dist/containers/Tenant/{QueryEditor → Query}/QueryEditorControls/shared.ts +0 -0
  89. /package/dist/containers/Tenant/{QueryEditor → Query}/SaveQuery/SaveQuery.scss +0 -0
  90. /package/dist/containers/Tenant/{QueryEditor → Query}/i18n/index.ts +0 -0
package/dist/routes.ts CHANGED
@@ -1,22 +1,36 @@
1
+ import type {Location} from 'history';
1
2
  import qs from 'qs';
2
3
  import {compile} from 'path-to-regexp';
3
4
  import isEmpty from 'lodash/isEmpty';
4
5
 
5
6
  import {backend, clusterName, webVersion} from './store';
6
7
 
8
+ export const CLUSTER = 'cluster';
9
+ export const TENANT = 'tenant';
10
+ export const NODE = 'node';
11
+ export const TABLET = 'tablet';
12
+
7
13
  const routes = {
8
- cluster: '/cluster/:activeTab?',
9
- tenant: '/tenant',
10
- node: '/node/:id/:activeTab?',
11
- tablet: '/tablet/:id',
12
- tabletsFilters: '/tabletsFilters',
13
- auth: '/auth',
14
+ cluster: `/${CLUSTER}/:activeTab?`,
15
+ tenant: `/${TENANT}`,
16
+ node: `/${NODE}/:id/:activeTab?`,
17
+ tablet: `/${TABLET}/:id`,
18
+ tabletsFilters: `/tabletsFilters`,
19
+ auth: `/auth`,
20
+ };
21
+
22
+ export const parseQuery = (location: Location) => {
23
+ return qs.parse(location.search, {
24
+ ignoreQueryPrefix: true,
25
+ });
14
26
  };
15
27
 
28
+ export type Query = Record<string | number, string | number | string[] | number[] | undefined>;
29
+
16
30
  export function createHref(
17
31
  route: string,
18
32
  params?: Record<string, string | number>,
19
- query: Record<string | number, string | number | string[] | number[] | undefined> = {},
33
+ query: Query = {},
20
34
  ) {
21
35
  let extendedQuery = query;
22
36
 
@@ -44,11 +44,15 @@ export class YdbEmbeddedAPI extends AxiosWrapper {
44
44
  getPath(path: string) {
45
45
  return `${BACKEND}${path}`;
46
46
  }
47
- getClusterInfo(clusterName?: string) {
48
- return this.get<TClusterInfo>(this.getPath('/viewer/json/cluster'), {
49
- name: clusterName,
50
- tablets: true,
51
- });
47
+ getClusterInfo(clusterName?: string, {concurrentId}: AxiosOptions = {}) {
48
+ return this.get<TClusterInfo>(
49
+ this.getPath('/viewer/json/cluster'),
50
+ {
51
+ name: clusterName,
52
+ tablets: true,
53
+ },
54
+ {concurrentId: concurrentId || `getClusterInfo`},
55
+ );
52
56
  }
53
57
  getClusterNodes({concurrentId}: AxiosOptions = {}) {
54
58
  return this.get<TEvSystemStateResponse>(
@@ -23,7 +23,8 @@ const CHANGE_USER_INPUT = 'query/CHANGE_USER_INPUT';
23
23
  const SAVE_QUERY_TO_HISTORY = 'query/SAVE_QUERY_TO_HISTORY';
24
24
  const GO_TO_PREVIOUS_QUERY = 'query/GO_TO_PREVIOUS_QUERY';
25
25
  const GO_TO_NEXT_QUERY = 'query/GO_TO_NEXT_QUERY';
26
- const MONACO_HOT_KEY = 'query/MONACO_HOT_KEY';
26
+ const SET_MONACO_HOT_KEY = 'query/SET_MONACO_HOT_KEY';
27
+ const SET_TENANT_PATH = 'query/SET_TENANT_PATH';
27
28
 
28
29
  const queriesHistoryInitial: string[] = parseJson(getValueFromLS(QUERIES_HISTORY_KEY, '[]'));
29
30
 
@@ -128,12 +129,18 @@ const executeQuery: Reducer<ExecuteQueryState, ExecuteQueryAction> = (
128
129
  };
129
130
  }
130
131
 
131
- case MONACO_HOT_KEY: {
132
+ case SET_MONACO_HOT_KEY: {
132
133
  return {
133
134
  ...state,
134
135
  monacoHotKey: action.data,
135
136
  };
136
137
  }
138
+ case SET_TENANT_PATH: {
139
+ return {
140
+ ...state,
141
+ tenantPath: action.data,
142
+ };
143
+ }
137
144
 
138
145
  default:
139
146
  return state;
@@ -186,9 +193,16 @@ export const changeUserInput = ({input}: {input: string}) => {
186
193
  } as const;
187
194
  };
188
195
 
189
- export const setMonacoHotKey = (value: MonacoHotKeyAction) => {
196
+ export const setMonacoHotKey = (value: MonacoHotKeyAction | null) => {
197
+ return {
198
+ type: SET_MONACO_HOT_KEY,
199
+ data: value,
200
+ } as const;
201
+ };
202
+
203
+ export const setTenantPath = (value: string) => {
190
204
  return {
191
- type: MONACO_HOT_KEY,
205
+ type: SET_TENANT_PATH,
192
206
  data: value,
193
207
  } as const;
194
208
  };
@@ -0,0 +1,31 @@
1
+ import type {Reducer} from 'redux';
2
+
3
+ import type {HeaderAction, HeaderState, Page, PageBreadcrumbsOptions} from './types';
4
+
5
+ const SET_HEADER_BREADCRUMBS = 'header/SET_HEADER_BREADCRUMBS';
6
+
7
+ const initialState = {
8
+ pageBreadcrumbsOptions: {},
9
+ };
10
+
11
+ const header: Reducer<HeaderState, HeaderAction> = (state = initialState, action) => {
12
+ switch (action.type) {
13
+ case SET_HEADER_BREADCRUMBS:
14
+ return {
15
+ page: action.page,
16
+ pageBreadcrumbsOptions: action.options,
17
+ };
18
+ default:
19
+ return state;
20
+ }
21
+ };
22
+
23
+ export function setHeaderBreadcrumbs<T extends Page>(page: T, options: PageBreadcrumbsOptions<T>) {
24
+ return {
25
+ type: SET_HEADER_BREADCRUMBS,
26
+ page,
27
+ options,
28
+ } as const;
29
+ }
30
+
31
+ export default header;
@@ -0,0 +1,54 @@
1
+ import type {ClusterTab} from '../../../containers/Cluster/utils';
2
+
3
+ import {setHeaderBreadcrumbs} from './header';
4
+
5
+ export type Page = 'cluster' | 'tenant' | 'node' | 'tablets' | 'tablet' | undefined;
6
+
7
+ export interface ClusterBreadcrumbsOptions {
8
+ clusterName?: string;
9
+ clusterTab?: ClusterTab;
10
+ }
11
+
12
+ export interface TenantBreadcrumbsOptions extends ClusterBreadcrumbsOptions {
13
+ tenantName?: string;
14
+ }
15
+
16
+ export interface NodeBreadcrumbsOptions extends TenantBreadcrumbsOptions {
17
+ nodeId?: string | number;
18
+ }
19
+
20
+ export interface TabletsBreadcrumbsOptions extends TenantBreadcrumbsOptions {
21
+ nodeIds?: string[] | number[];
22
+ state?: string;
23
+ type?: string;
24
+ }
25
+
26
+ export interface TabletBreadcrumbsOptions extends TabletsBreadcrumbsOptions {
27
+ tabletId?: string;
28
+ }
29
+
30
+ export type BreadcrumbsOptions =
31
+ | ClusterBreadcrumbsOptions
32
+ | TenantBreadcrumbsOptions
33
+ | NodeBreadcrumbsOptions
34
+ | TabletsBreadcrumbsOptions
35
+ | TabletBreadcrumbsOptions;
36
+
37
+ export type PageBreadcrumbsOptions<T extends Page = undefined> = T extends 'cluster'
38
+ ? ClusterBreadcrumbsOptions
39
+ : T extends 'tenant'
40
+ ? TenantBreadcrumbsOptions
41
+ : T extends 'node'
42
+ ? NodeBreadcrumbsOptions
43
+ : T extends 'tablets'
44
+ ? TabletsBreadcrumbsOptions
45
+ : T extends 'tablet'
46
+ ? TabletBreadcrumbsOptions
47
+ : {};
48
+
49
+ export interface HeaderState {
50
+ page?: Page;
51
+ pageBreadcrumbsOptions: BreadcrumbsOptions;
52
+ }
53
+
54
+ export type HeaderAction = ReturnType<typeof setHeaderBreadcrumbs>;
@@ -31,7 +31,7 @@ import shardsWorkload from './shardsWorkload';
31
31
  import hotKeys from './hotKeys';
32
32
  import olapStats from './olapStats';
33
33
  import authentication from './authentication';
34
- import header from './header';
34
+ import header from './header/header';
35
35
  import saveQuery from './saveQuery';
36
36
  import fullscreen from './fullscreen';
37
37
  import singleClusterMode from './singleClusterMode';
@@ -28,10 +28,12 @@ export interface NodeState {
28
28
  data: TEvSystemStateResponse;
29
29
  loading: boolean;
30
30
  wasLoaded: boolean;
31
+ error?: IResponseError;
31
32
 
32
33
  nodeStructure: TStorageInfo;
33
34
  loadingStructure: boolean;
34
35
  wasLoadedStructure: boolean;
36
+ errorStructure?: IResponseError;
35
37
  }
36
38
 
37
39
  export type NodeAction =
@@ -5,7 +5,7 @@ import type {ValueOf} from '../../../types/common';
5
5
  import {
6
6
  SAVED_QUERIES_KEY,
7
7
  THEME_KEY,
8
- TENANT_INITIAL_TAB_KEY,
8
+ TENANT_INITIAL_PAGE_KEY,
9
9
  INVERTED_DISKS_KEY,
10
10
  ASIDE_HEADER_COMPACT_KEY,
11
11
  USE_NODES_ENDPOINT_IN_DIAGNOSTICS_KEY,
@@ -18,6 +18,8 @@ import '../../../services/api';
18
18
  import {getValueFromLS, parseJson} from '../../../utils/utils';
19
19
  import {QueryModes} from '../../../types/store/query';
20
20
 
21
+ import {TENANT_PAGES_IDS} from '../tenant/constants';
22
+
21
23
  import type {RootState} from '..';
22
24
  import type {
23
25
  SetSettingValueAction,
@@ -58,11 +60,14 @@ export const initialState = {
58
60
  'false',
59
61
  ),
60
62
  [SAVED_QUERIES_KEY]: readSavedSettingsValue(SAVED_QUERIES_KEY, '[]'),
61
- [TENANT_INITIAL_TAB_KEY]: readSavedSettingsValue(TENANT_INITIAL_TAB_KEY),
63
+ [TENANT_INITIAL_PAGE_KEY]: readSavedSettingsValue(
64
+ TENANT_INITIAL_PAGE_KEY,
65
+ TENANT_PAGES_IDS.query,
66
+ ),
62
67
  [QUERY_INITIAL_MODE_KEY]: readSavedSettingsValue(QUERY_INITIAL_MODE_KEY, QueryModes.script),
63
68
  [ASIDE_HEADER_COMPACT_KEY]: readSavedSettingsValue(ASIDE_HEADER_COMPACT_KEY, 'true'),
64
69
  [PARTITIONS_HIDDEN_COLUMNS_KEY]: readSavedSettingsValue(PARTITIONS_HIDDEN_COLUMNS_KEY),
65
- [CLUSTER_INFO_HIDDEN_KEY]: readSavedSettingsValue(CLUSTER_INFO_HIDDEN_KEY, 'false'),
70
+ [CLUSTER_INFO_HIDDEN_KEY]: readSavedSettingsValue(CLUSTER_INFO_HIDDEN_KEY, 'true'),
66
71
  },
67
72
  systemSettings,
68
73
  };
@@ -16,9 +16,11 @@ import {prepareNodesMap} from '../../utils/nodes';
16
16
  export const FETCH_TABLET = createRequestActionTypes('TABLET', 'FETCH_TABLET');
17
17
  export const FETCH_TABLET_DESCRIBE = createRequestActionTypes('TABLET', 'FETCH_TABLET_DESCRIBE');
18
18
 
19
+ const CLEAR_TABLET_DATA = 'tablet/CLEAR_TABLET_DATA';
20
+
19
21
  const initialState = {
20
22
  loading: false,
21
- tenantPath: '-',
23
+ tenantPath: undefined,
22
24
  };
23
25
 
24
26
  const tablet: Reducer<ITabletState, ITabletAction> = (state = initialState, action) => {
@@ -57,6 +59,15 @@ const tablet: Reducer<ITabletState, ITabletAction> = (state = initialState, acti
57
59
  error: undefined,
58
60
  };
59
61
  }
62
+ case CLEAR_TABLET_DATA: {
63
+ return {
64
+ ...state,
65
+ id: undefined,
66
+ tenantPath: undefined,
67
+ data: undefined,
68
+ history: undefined,
69
+ };
70
+ }
60
71
  default:
61
72
  return state;
62
73
  }
@@ -122,4 +133,10 @@ export const getTabletDescribe = (tenantId: TDomainKey = {}) => {
122
133
  });
123
134
  };
124
135
 
136
+ export const clearTabletData = () => {
137
+ return {
138
+ type: CLEAR_TABLET_DATA,
139
+ } as const;
140
+ };
141
+
125
142
  export default tablet;
@@ -1,8 +1,16 @@
1
- export const TENANT_GENERAL_TABS_IDS = {
1
+ export const TENANT_PAGE = 'tenantPage';
2
+
3
+ export const TENANT_PAGES_IDS = {
2
4
  query: 'query',
3
5
  diagnostics: 'diagnostics',
4
6
  } as const;
5
7
 
8
+ export const TENANT_QUERY_TABS_ID = {
9
+ newQuery: 'newQuery',
10
+ history: 'history',
11
+ saved: 'saved',
12
+ } as const;
13
+
6
14
  export const TENANT_DIAGNOSTICS_TABS_IDS = {
7
15
  overview: 'overview',
8
16
  topQueries: 'topQueries',
@@ -1,7 +1,13 @@
1
1
  import type {Reducer} from 'redux';
2
2
 
3
3
  import type {TTenant} from '../../../types/api/tenant';
4
- import type {TenantAction, TenantDiagnosticsTab, TenantGeneralTab, TenantState} from './types';
4
+ import type {
5
+ TenantAction,
6
+ TenantDiagnosticsTab,
7
+ TenantPage,
8
+ TenantQueryTab,
9
+ TenantState,
10
+ } from './types';
5
11
 
6
12
  import '../../../services/api';
7
13
  import {createRequestActionTypes, createApiRequest} from '../../utils';
@@ -9,6 +15,7 @@ import {createRequestActionTypes, createApiRequest} from '../../utils';
9
15
  export const FETCH_TENANT = createRequestActionTypes('tenant', 'FETCH_TENANT');
10
16
 
11
17
  const SET_TOP_LEVEL_TAB = 'tenant/SET_TOP_LEVEL_TAB';
18
+ const SET_QUERY_TAB = 'tenant/SET_QUERY_TAB';
12
19
  const SET_DIAGNOSTICS_TAB = 'tenant/SET_DIAGNOSTICS_TAB';
13
20
  const CLEAR_TENANT = 'tenant/CLEAR_TENANT';
14
21
 
@@ -53,10 +60,15 @@ const tenantReducer: Reducer<TenantState, TenantAction> = (state = initialState,
53
60
  case SET_TOP_LEVEL_TAB: {
54
61
  return {
55
62
  ...state,
56
- topLevelTab: action.data,
63
+ tenantPage: action.data,
64
+ };
65
+ }
66
+ case SET_QUERY_TAB: {
67
+ return {
68
+ ...state,
69
+ queryTab: action.data,
57
70
  };
58
71
  }
59
-
60
72
  case SET_DIAGNOSTICS_TAB: {
61
73
  return {
62
74
  ...state,
@@ -83,9 +95,16 @@ export const clearTenant = () => {
83
95
  return {type: CLEAR_TENANT} as const;
84
96
  };
85
97
 
86
- export function setTopLevelTab(tab: TenantGeneralTab) {
98
+ export function setTenantPage(page: TenantPage) {
87
99
  return {
88
100
  type: SET_TOP_LEVEL_TAB,
101
+ data: page,
102
+ } as const;
103
+ }
104
+
105
+ export function setQueryTab(tab: TenantQueryTab) {
106
+ return {
107
+ type: SET_QUERY_TAB,
89
108
  data: tab,
90
109
  } as const;
91
110
  }
@@ -3,16 +3,19 @@ import type {TTenant} from '../../../types/api/tenant';
3
3
  import type {ValueOf} from '../../../types/common';
4
4
  import type {ApiRequestAction} from '../../utils';
5
5
 
6
- import {TENANT_DIAGNOSTICS_TABS_IDS, TENANT_GENERAL_TABS_IDS} from './constants';
7
- import {FETCH_TENANT, clearTenant, setDiagnosticsTab, setTopLevelTab} from './tenant';
6
+ import {TENANT_QUERY_TABS_ID, TENANT_DIAGNOSTICS_TABS_IDS, TENANT_PAGES_IDS} from './constants';
7
+ import {FETCH_TENANT, clearTenant, setDiagnosticsTab, setQueryTab, setTenantPage} from './tenant';
8
8
 
9
- export type TenantGeneralTab = ValueOf<typeof TENANT_GENERAL_TABS_IDS>;
9
+ export type TenantPage = ValueOf<typeof TENANT_PAGES_IDS>;
10
+
11
+ export type TenantQueryTab = ValueOf<typeof TENANT_QUERY_TABS_ID>;
10
12
  export type TenantDiagnosticsTab = ValueOf<typeof TENANT_DIAGNOSTICS_TABS_IDS>;
11
13
 
12
14
  export interface TenantState {
13
15
  loading: boolean;
14
16
  wasLoaded: boolean;
15
- topLevelTab?: TenantGeneralTab;
17
+ tenantPage?: TenantPage;
18
+ queryTab?: TenantQueryTab;
16
19
  diagnosticsTab?: TenantDiagnosticsTab;
17
20
  tenant?: TTenant;
18
21
  error?: IResponseError;
@@ -21,5 +24,6 @@ export interface TenantState {
21
24
  export type TenantAction =
22
25
  | ApiRequestAction<typeof FETCH_TENANT, TTenant | undefined, IResponseError>
23
26
  | ReturnType<typeof clearTenant>
24
- | ReturnType<typeof setTopLevelTab>
27
+ | ReturnType<typeof setTenantPage>
28
+ | ReturnType<typeof setQueryTab>
25
29
  | ReturnType<typeof setDiagnosticsTab>;
@@ -35,7 +35,7 @@ const topic: Reducer<ITopicState, ITopicAction> = (state = initialState, action)
35
35
  };
36
36
  }
37
37
  case FETCH_TOPIC.SUCCESS: {
38
- // On older version it can return HTML page of Internal Viewer with an error
38
+ // On older version it can return HTML page of Developer UI with an error
39
39
  if (typeof action.data !== 'object') {
40
40
  return {...state, loading: false, error: {}};
41
41
  }
@@ -42,10 +42,13 @@ const paramSetup = {
42
42
  stateKey: 'tablets.typeFilter',
43
43
  type: 'array',
44
44
  },
45
- general: {
46
- stateKey: 'tenant.topLevelTab',
45
+ tenantPage: {
46
+ stateKey: 'tenant.tenantPage',
47
47
  },
48
- generalTab: {
48
+ queryTab: {
49
+ stateKey: 'tenant.queryTab',
50
+ },
51
+ diagnosticsTab: {
49
52
  stateKey: 'tenant.diagnosticsTab',
50
53
  },
51
54
  shardsMode: {
@@ -5,6 +5,7 @@ import {
5
5
  goToPreviousQuery,
6
6
  setMonacoHotKey,
7
7
  goToNextQuery,
8
+ setTenantPath,
8
9
  MONACO_HOT_KEY_ACTIONS,
9
10
  } from '../../store/reducers/executeQuery';
10
11
  import type {ApiRequestAction} from '../../store/utils';
@@ -22,6 +23,7 @@ export interface ExecuteQueryState {
22
23
  currentIndex: number;
23
24
  };
24
25
  monacoHotKey: null | MonacoHotKeyAction;
26
+ tenantPath?: string;
25
27
  data?: IQueryResult;
26
28
  stats?: IQueryResult['stats'];
27
29
  error?: string | ErrorResponse;
@@ -35,4 +37,5 @@ export type ExecuteQueryAction =
35
37
  | ReturnType<typeof goToPreviousQuery>
36
38
  | ReturnType<typeof changeUserInput>
37
39
  | ReturnType<typeof saveQueryToHistory>
38
- | ReturnType<typeof setMonacoHotKey>;
40
+ | ReturnType<typeof setMonacoHotKey>
41
+ | ReturnType<typeof setTenantPath>;
@@ -29,3 +29,8 @@ export enum QueryModes {
29
29
  data = 'data',
30
30
  query = 'query',
31
31
  }
32
+
33
+ export interface SavedQuery {
34
+ name: string;
35
+ body: string;
36
+ }
@@ -1,8 +1,8 @@
1
+ import type {ApiRequestAction} from '../../store/utils';
1
2
  import type {IResponseError} from '../api/error';
2
3
  import type {ETabletState, TTabletStateInfo} from '../api/tablet';
3
4
 
4
- import {FETCH_TABLET, FETCH_TABLET_DESCRIBE} from '../../store/reducers/tablet';
5
- import {ApiRequestAction} from '../../store/utils';
5
+ import {FETCH_TABLET, FETCH_TABLET_DESCRIBE, clearTabletData} from '../../store/reducers/tablet';
6
6
 
7
7
  export interface ITabletPreparedHistoryItem {
8
8
  nodeId: string;
@@ -16,7 +16,7 @@ export interface ITabletPreparedHistoryItem {
16
16
 
17
17
  export interface ITabletState {
18
18
  loading: boolean;
19
- tenantPath: string;
19
+ tenantPath?: string;
20
20
  error?: IResponseError;
21
21
  id?: string;
22
22
  history?: ITabletPreparedHistoryItem[];
@@ -44,7 +44,10 @@ type ITabletDescribeApiRequestAction = ApiRequestAction<
44
44
  IResponseError
45
45
  >;
46
46
 
47
- export type ITabletAction = ITabletApiRequestAction | ITabletDescribeApiRequestAction;
47
+ export type ITabletAction =
48
+ | ITabletApiRequestAction
49
+ | ITabletDescribeApiRequestAction
50
+ | ReturnType<typeof clearTabletData>;
48
51
 
49
52
  export interface ITabletRootStateSlice {
50
53
  tablet: ITabletState;
@@ -75,6 +75,8 @@ export const COLORS_PRIORITY = {
75
75
  grey: 1,
76
76
  };
77
77
 
78
+ export const DEVELOPER_UI = 'Developer UI';
79
+
78
80
  export const THEME_KEY = 'theme';
79
81
  export const INVERTED_DISKS_KEY = 'invertedDisks';
80
82
  export const USE_NODES_ENDPOINT_IN_DIAGNOSTICS_KEY = 'useNodesEndpointInDiagnostics';
@@ -102,9 +104,11 @@ export const DEFAULT_TABLE_SETTINGS = {
102
104
  highlightRows: true,
103
105
  } as const;
104
106
 
105
- export const TENANT_INITIAL_TAB_KEY = 'saved_tenant_initial_tab';
106
107
  export const QUERY_INITIAL_MODE_KEY = 'query_initial_mode';
107
108
 
108
109
  export const PARTITIONS_HIDDEN_COLUMNS_KEY = 'partitionsHiddenColumns';
109
110
 
110
111
  export const CLUSTER_INFO_HIDDEN_KEY = 'clusterInfoHidden';
112
+
113
+ // Remain "tab" in key name for backward compatibility
114
+ export const TENANT_INITIAL_PAGE_KEY = 'saved_tenant_initial_tab';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-embedded-ui",
3
- "version": "4.6.0",
3
+ "version": "4.8.0",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -103,6 +103,7 @@
103
103
  "@commitlint/cli": "^15.0.0",
104
104
  "@commitlint/config-conventional": "^15.0.0",
105
105
  "@gravity-ui/eslint-config": "^1.0.2",
106
+ "@gravity-ui/icons": "^2.2.0",
106
107
  "@gravity-ui/prettier-config": "^1.0.1",
107
108
  "@gravity-ui/stylelint-config": "^1.0.1",
108
109
  "@gravity-ui/tsconfig": "^1.0.0",
@@ -1,9 +0,0 @@
1
- @import '../../../styles/mixins.scss';
2
-
3
- .object-general-tabs {
4
- padding: 12px 20px 0 12px;
5
-
6
- &__tab {
7
- text-decoration: none;
8
- }
9
- }
@@ -1,68 +0,0 @@
1
- import qs from 'qs';
2
- import {connect} from 'react-redux';
3
- import {useLocation} from 'react-router';
4
- import {Link} from 'react-router-dom';
5
- import cn from 'bem-cn-lite';
6
-
7
- import {Tabs} from '@gravity-ui/uikit';
8
-
9
- import routes, {createHref} from '../../../routes';
10
- import {TENANT_INITIAL_TAB_KEY} from '../../../utils/constants';
11
- import {setSettingValue} from '../../../store/reducers/settings/settings';
12
-
13
- import {TenantTabsGroups, TENANT_GENERAL_TABS} from '../TenantPages';
14
-
15
- import './ObjectGeneralTabs.scss';
16
-
17
- const b = cn('object-general-tabs');
18
-
19
- interface ObjectGeneralTabsProps {
20
- setSettingValue: (name: string, value: string) => void;
21
- }
22
-
23
- function ObjectGeneralTabs(props: ObjectGeneralTabsProps) {
24
- const location = useLocation();
25
-
26
- const queryParams = qs.parse(location.search, {
27
- ignoreQueryPrefix: true,
28
- });
29
-
30
- const {name: tenantName, general: generalTab} = queryParams;
31
-
32
- const renderContent = () => {
33
- if (!tenantName) {
34
- return null;
35
- }
36
- return (
37
- <div className={b()}>
38
- <Tabs
39
- size="xl"
40
- items={TENANT_GENERAL_TABS}
41
- activeTab={generalTab as string}
42
- wrapTo={({id}, node) => {
43
- const path = createHref(routes.tenant, undefined, {
44
- ...queryParams,
45
- name: tenantName as string,
46
- [TenantTabsGroups.general]: id,
47
- });
48
- return (
49
- <Link to={path} key={id} className={b('tab')}>
50
- {node}
51
- </Link>
52
- );
53
- }}
54
- allowNotSelected
55
- onSelectTab={(id) => props.setSettingValue(TENANT_INITIAL_TAB_KEY, id)}
56
- />
57
- </div>
58
- );
59
- };
60
-
61
- return renderContent();
62
- }
63
-
64
- const mapDispatchToProps = {
65
- setSettingValue,
66
- };
67
-
68
- export default connect(null, mapDispatchToProps)(ObjectGeneralTabs);