ydb-embedded-ui 1.8.0 → 1.8.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +8 -0
- package/dist/containers/Tenant/Diagnostics/Diagnostics.tsx +7 -13
- package/dist/containers/Tenant/Diagnostics/DiagnosticsPages.ts +20 -0
- package/dist/containers/Tenant/Schema/SchemaTree/SchemaTree.tsx +2 -2
- package/dist/containers/Tenant/utils/schema.ts +15 -3
- package/dist/containers/Tenant/utils/schemaActions.ts +57 -57
- package/dist/types/api/schema.ts +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [1.8.1](https://github.com/ydb-platform/ydb-embedded-ui/compare/v1.8.0...v1.8.1) (2022-07-06)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* **Tenant:** diagnostics view for table indexes ([63d3133](https://github.com/ydb-platform/ydb-embedded-ui/commit/63d3133c0d61f6d39186f0c5df2eb6983a9c8bf7))
|
9
|
+
* **Tenant:** own context actions for table indexes ([3cd946a](https://github.com/ydb-platform/ydb-embedded-ui/commit/3cd946a333be402cec70569affef5865b0dd8934))
|
10
|
+
|
3
11
|
## [1.8.0](https://github.com/ydb-platform/ydb-embedded-ui/compare/v1.7.1...v1.8.0) (2022-07-05)
|
4
12
|
|
5
13
|
|
@@ -30,9 +30,8 @@ import Tablets from '../../Tablets/Tablets';
|
|
30
30
|
|
31
31
|
import routes, {createHref} from '../../../routes';
|
32
32
|
import type {EPathType} from '../../../types/api/schema';
|
33
|
-
import {isTableType} from '../utils/schema';
|
34
33
|
import {TenantGeneralTabsIds, TenantTabsGroups} from '../TenantPages';
|
35
|
-
import {GeneralPagesIds, DATABASE_PAGES,
|
34
|
+
import {GeneralPagesIds, DATABASE_PAGES, getPagesByType} from './DiagnosticsPages';
|
36
35
|
//@ts-ignore
|
37
36
|
import {enableAutorefresh, disableAutorefresh} from '../../../store/reducers/schema';
|
38
37
|
import {setTopLevelTab, setDiagnosticsTab} from '../../../store/reducers/tenant';
|
@@ -66,20 +65,15 @@ function Diagnostics(props: DiagnosticsProps) {
|
|
66
65
|
|
67
66
|
const {name: tenantName} = queryParams;
|
68
67
|
|
69
|
-
const
|
68
|
+
const isRoot = currentSchemaPath === tenantName;
|
70
69
|
|
71
70
|
const pages = useMemo(() => {
|
72
|
-
|
73
|
-
|
74
|
-
let pages = DIR_PAGES;
|
75
|
-
|
76
|
-
if (isDatabase) {
|
77
|
-
pages = DATABASE_PAGES;
|
78
|
-
} else if (isTable) {
|
79
|
-
pages = TABLE_PAGES;
|
71
|
+
if (isRoot) {
|
72
|
+
return DATABASE_PAGES;
|
80
73
|
}
|
81
|
-
|
82
|
-
|
74
|
+
|
75
|
+
return getPagesByType(props.type);
|
76
|
+
}, [props.type, isRoot]);
|
83
77
|
|
84
78
|
const forwardToDiagnosticTab = (tab: GeneralPagesIds) => {
|
85
79
|
dispatch(setDiagnosticsTab(tab));
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import {EPathType} from "../../../types/api/schema";
|
2
|
+
|
1
3
|
export enum GeneralPagesIds {
|
2
4
|
'overview' = 'Overview',
|
3
5
|
'topQueries' = 'topQueries',
|
@@ -73,3 +75,21 @@ export const DATABASE_PAGES = [
|
|
73
75
|
export const TABLE_PAGES = [overview, topShards, graph, tablets, hotKeys, describe];
|
74
76
|
|
75
77
|
export const DIR_PAGES = [overview, topShards, describe];
|
78
|
+
|
79
|
+
export const INDEX_PAGES = [overview];
|
80
|
+
|
81
|
+
export const getPagesByType = (type?: EPathType) => {
|
82
|
+
switch (type) {
|
83
|
+
case EPathType.EPathTypeColumnStore:
|
84
|
+
case EPathType.EPathTypeSubDomain:
|
85
|
+
return DATABASE_PAGES;
|
86
|
+
case EPathType.EPathTypeColumnTable:
|
87
|
+
case EPathType.EPathTypeTable:
|
88
|
+
return TABLE_PAGES;
|
89
|
+
case EPathType.EPathTypeTableIndex:
|
90
|
+
return INDEX_PAGES;
|
91
|
+
case EPathType.EPathTypeDir:
|
92
|
+
default:
|
93
|
+
return DIR_PAGES;
|
94
|
+
}
|
95
|
+
}
|
@@ -32,9 +32,9 @@ export function SchemaTree(props: SchemaTreeProps) {
|
|
32
32
|
{concurrentId: `NavigationTree.getSchema|${path}`},
|
33
33
|
)
|
34
34
|
.then(({PathDescription: {Children = []} = {}}) => {
|
35
|
-
return Children.map(({Name = '', PathType}) => ({
|
35
|
+
return Children.map(({Name = '', PathType, PathSubType}) => ({
|
36
36
|
name: Name,
|
37
|
-
type: mapPathTypeToNavigationTreeType(PathType),
|
37
|
+
type: mapPathTypeToNavigationTreeType(PathType, PathSubType),
|
38
38
|
// FIXME: should only be explicitly set to true for tables with indexes
|
39
39
|
// at the moment of writing there is no property to determine this, fix later
|
40
40
|
expandable: true,
|
@@ -1,8 +1,19 @@
|
|
1
1
|
import type {NavigationTreeNodeType} from 'ydb-ui-components';
|
2
|
-
import {EPathType} from '../../../types/api/schema';
|
2
|
+
import {EPathSubType, EPathType} from '../../../types/api/schema';
|
3
|
+
|
4
|
+
const mapTablePathSubTypeToNavigationTreeType = (subType?: EPathSubType) => {
|
5
|
+
switch (subType) {
|
6
|
+
case EPathSubType.EPathSubTypeSyncIndexImplTable:
|
7
|
+
case EPathSubType.EPathSubTypeAsyncIndexImplTable:
|
8
|
+
return 'index_table';
|
9
|
+
default:
|
10
|
+
return 'table';
|
11
|
+
}
|
12
|
+
};
|
3
13
|
|
4
14
|
export const mapPathTypeToNavigationTreeType = (
|
5
15
|
type: EPathType = EPathType.EPathTypeDir,
|
16
|
+
subType?: EPathSubType,
|
6
17
|
defaultType: NavigationTreeNodeType = 'directory'
|
7
18
|
): NavigationTreeNodeType => {
|
8
19
|
switch (type) {
|
@@ -10,11 +21,12 @@ export const mapPathTypeToNavigationTreeType = (
|
|
10
21
|
return 'database';
|
11
22
|
case EPathType.EPathTypeTable:
|
12
23
|
case EPathType.EPathTypeColumnTable:
|
13
|
-
return
|
24
|
+
return mapTablePathSubTypeToNavigationTreeType(subType);
|
14
25
|
case EPathType.EPathTypeDir:
|
15
26
|
case EPathType.EPathTypeColumnStore:
|
16
|
-
case EPathType.EPathTypeTableIndex:
|
17
27
|
return 'directory';
|
28
|
+
case EPathType.EPathTypeTableIndex:
|
29
|
+
return 'index';
|
18
30
|
default:
|
19
31
|
return defaultType;
|
20
32
|
}
|
@@ -15,7 +15,6 @@ const createTableTemplate = (path: string) => {
|
|
15
15
|
PRIMARY KEY (\`id\`)
|
16
16
|
);`;
|
17
17
|
};
|
18
|
-
|
19
18
|
const alterTableTemplate = (path: string) => {
|
20
19
|
return `ALTER TABLE \`${path}\`
|
21
20
|
ADD COLUMN is_deleted Bool;`;
|
@@ -32,40 +31,23 @@ const upsertQueryTemplate = (path: string) => {
|
|
32
31
|
VALUES ( );`;
|
33
32
|
};
|
34
33
|
|
35
|
-
|
34
|
+
const bindActions = (
|
35
|
+
path: string,
|
36
36
|
dispatch: Dispatch<any>,
|
37
37
|
setActivePath: (path: string) => void,
|
38
|
-
) =>
|
39
|
-
(path: string
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
const onCreateTableClick = () => {
|
45
|
-
dispatch(changeUserInput({input: createTableTemplate(path)}));
|
46
|
-
switchTabToQuery();
|
47
|
-
setActivePath(path);
|
48
|
-
};
|
38
|
+
) => {
|
39
|
+
const inputQuery = (tmpl: (path: string) => string) => () => {
|
40
|
+
dispatch(changeUserInput({input: tmpl(path)}));
|
41
|
+
dispatch(setTopLevelTab(TenantGeneralTabsIds.query))
|
42
|
+
setActivePath(path);
|
43
|
+
}
|
49
44
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
const onSelectQueryClick = () => {
|
57
|
-
dispatch(changeUserInput({input: selectQueryTemplate(path)}));
|
58
|
-
switchTabToQuery();
|
59
|
-
setActivePath(path);
|
60
|
-
};
|
61
|
-
|
62
|
-
const onUpsertQueryClick = () => {
|
63
|
-
dispatch(changeUserInput({input: upsertQueryTemplate(path)}));
|
64
|
-
switchTabToQuery();
|
65
|
-
setActivePath(path);
|
66
|
-
};
|
67
|
-
|
68
|
-
const onCopyPathClick = () => {
|
45
|
+
return {
|
46
|
+
createTable: inputQuery(createTableTemplate),
|
47
|
+
alterTable: inputQuery(alterTableTemplate),
|
48
|
+
selectQuery: inputQuery(selectQueryTemplate),
|
49
|
+
upsertQuery: inputQuery(upsertQueryTemplate),
|
50
|
+
copyPath: () => {
|
69
51
|
navigator.clipboard
|
70
52
|
.writeText(path)
|
71
53
|
.then(() => {
|
@@ -82,34 +64,52 @@ export const getActions = (
|
|
82
64
|
type: 'error',
|
83
65
|
});
|
84
66
|
});
|
85
|
-
}
|
86
|
-
|
87
|
-
const onOpenPreviewClick = () => {
|
67
|
+
},
|
68
|
+
openPreview: () => {
|
88
69
|
dispatch(setShowPreview(true));
|
89
|
-
|
70
|
+
dispatch(setTopLevelTab(TenantGeneralTabsIds.query))
|
90
71
|
setActivePath(path);
|
91
|
-
}
|
72
|
+
},
|
73
|
+
};
|
74
|
+
};
|
92
75
|
|
93
|
-
|
76
|
+
export const getActions = (
|
77
|
+
dispatch: Dispatch<any>,
|
78
|
+
setActivePath: (path: string) => void,
|
79
|
+
) =>
|
80
|
+
(path: string, type: NavigationTreeNodeType) => {
|
81
|
+
const actions = bindActions(path, dispatch, setActivePath);
|
82
|
+
const copyItem = {text: 'Copy path', action: actions.copyPath};
|
94
83
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
]
|
106
|
-
|
107
|
-
|
108
|
-
|
84
|
+
switch (type) {
|
85
|
+
case 'database':
|
86
|
+
case 'directory':
|
87
|
+
return [
|
88
|
+
[
|
89
|
+
copyItem,
|
90
|
+
],
|
91
|
+
[
|
92
|
+
{text: 'Create table...', action: actions.createTable},
|
93
|
+
],
|
94
|
+
];
|
95
|
+
case 'table':
|
96
|
+
return [
|
97
|
+
[
|
98
|
+
{text: 'Open preview', action: actions.openPreview},
|
99
|
+
copyItem,
|
100
|
+
],
|
101
|
+
[
|
102
|
+
{text: 'Alter table...', action: actions.alterTable},
|
103
|
+
{text: 'Select query...', action: actions.selectQuery},
|
104
|
+
{text: 'Upsert query...', action: actions.upsertQuery},
|
105
|
+
],
|
106
|
+
];
|
107
|
+
case 'index_table':
|
108
|
+
return [
|
109
109
|
copyItem,
|
110
|
-
]
|
111
|
-
|
112
|
-
|
113
|
-
]
|
114
|
-
|
110
|
+
];
|
111
|
+
case 'index':
|
112
|
+
default:
|
113
|
+
return [];
|
114
|
+
}
|
115
115
|
};
|
package/dist/types/api/schema.ts
CHANGED
@@ -91,7 +91,7 @@ export enum EPathType {
|
|
91
91
|
EPathTypeTableIndex = 'EPathTypeTableIndex',
|
92
92
|
}
|
93
93
|
|
94
|
-
enum EPathSubType {
|
94
|
+
export enum EPathSubType {
|
95
95
|
EPathSubTypeEmpty = 'EPathSubTypeEmpty',
|
96
96
|
EPathSubTypeSyncIndexImplTable = 'EPathSubTypeSyncIndexImplTable',
|
97
97
|
EPathSubTypeAsyncIndexImplTable = 'EPathSubTypeAsyncIndexImplTable',
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "ydb-embedded-ui",
|
3
|
-
"version": "1.8.
|
3
|
+
"version": "1.8.1",
|
4
4
|
"files": [
|
5
5
|
"dist"
|
6
6
|
],
|
@@ -40,7 +40,7 @@
|
|
40
40
|
"reselect": "4.0.0",
|
41
41
|
"sass": "1.32.8",
|
42
42
|
"web-vitals": "1.1.2",
|
43
|
-
"ydb-ui-components": "2.
|
43
|
+
"ydb-ui-components": "2.2.0"
|
44
44
|
},
|
45
45
|
"scripts": {
|
46
46
|
"start": "react-app-rewired start",
|