ydb-embedded-ui 1.4.2 → 1.5.2
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.
- package/CHANGELOG.md +31 -0
- package/dist/components/GroupTreeViewer/GroupTreeViewer.js +3 -2
- package/dist/components/GroupTreeViewer/GroupTreeViewer.scss +0 -2
- package/dist/components/SplitPane/SplitPane.tsx +8 -8
- package/dist/containers/App/App.js +1 -0
- package/dist/containers/App/App.scss +0 -26
- package/dist/containers/Authentication/Authentication.tsx +1 -0
- package/dist/containers/Tenant/Diagnostics/Diagnostics.tsx +14 -21
- package/dist/containers/Tenant/Diagnostics/Healthcheck/IssuesViewer/IssueViewer.scss +11 -23
- package/dist/containers/Tenant/Diagnostics/Healthcheck/IssuesViewer/IssuesViewer.js +7 -7
- package/dist/containers/Tenant/ObjectSummary/ObjectSummary.scss +9 -15
- package/dist/containers/Tenant/ObjectSummary/ObjectSummary.tsx +18 -21
- package/dist/containers/Tenant/QueryEditor/QueryEditor.js +2 -2
- package/dist/containers/Tenant/Schema/SchemaTree/SchemaTree.tsx +62 -0
- package/dist/containers/Tenant/Tenant.tsx +2 -2
- package/dist/containers/Tenant/utils/schema.ts +17 -0
- package/dist/containers/Tenant/utils/schemaActions.ts +115 -0
- package/dist/services/api.d.ts +3 -0
- package/dist/services/api.js +2 -2
- package/dist/store/reducers/tenant.js +30 -0
- package/dist/store/state-url-mapping.js +6 -0
- package/package.json +8 -4
- package/dist/components/TreeView/TreeView.js +0 -60
- package/dist/components/TreeView/TreeView.scss +0 -39
- package/dist/containers/Tenant/Schema/SchemaNode/SchemaNode.js +0 -170
- package/dist/containers/Tenant/Schema/SchemaNode/SchemaNode.scss +0 -62
- package/dist/containers/Tenant/Schema/SchemaNodeActions/SchemaNodeActions.scss +0 -17
- package/dist/containers/Tenant/Schema/SchemaNodeActions/SchemaNodeActions.tsx +0 -125
- package/dist/containers/Tenant/Schema/SchemaTree/SchemaTree.js +0 -116
- package/dist/containers/Tenant/Schema/SchemaTree/SchemaTree.scss +0 -17
- package/dist/styles/react-treeview.scss +0 -45
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,36 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
### [1.5.2](https://github.com/ydb-platform/ydb-embedded-ui/compare/v1.5.1...v1.5.2) (2022-05-26)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* **Tenant:** always update diagnostics tabs for root ([db03266](https://github.com/ydb-platform/ydb-embedded-ui/commit/db03266fd7dd6e4588c1db0d109bdfaa8f693e2d))
|
9
|
+
* **Tenant:** don't use HistoryAPI and redux-location-state together ([c1bc562](https://github.com/ydb-platform/ydb-embedded-ui/commit/c1bc5621e3ead44b1b84e592f8d7106bbc918e37))
|
10
|
+
|
11
|
+
### [1.5.1](https://github.com/ydb-platform/ydb-embedded-ui/compare/v1.5.0...v1.5.1) (2022-05-25)
|
12
|
+
|
13
|
+
|
14
|
+
### Bug Fixes
|
15
|
+
|
16
|
+
* **Authentication:** submit form with enter in the login field ([7b6132a](https://github.com/ydb-platform/ydb-embedded-ui/commit/7b6132a6b2556939648167f30b08c5688b56ab98))
|
17
|
+
|
18
|
+
## [1.5.0](https://github.com/ydb-platform/ydb-embedded-ui/compare/v1.4.2...v1.5.0) (2022-05-24)
|
19
|
+
|
20
|
+
|
21
|
+
### Features
|
22
|
+
|
23
|
+
* **Healthcheck:** use TreeView in issues viewer ([bcd81e5](https://github.com/ydb-platform/ydb-embedded-ui/commit/bcd81e56dc613cf3e9f31d77d930b79e070372e4))
|
24
|
+
* **Tenant:** use NavigationTree for schemas ([f2867e1](https://github.com/ydb-platform/ydb-embedded-ui/commit/f2867e18898028ca265df46fcc8bfa4f929173f0))
|
25
|
+
|
26
|
+
|
27
|
+
### Bug Fixes
|
28
|
+
|
29
|
+
* **Healthcheck:** don't display reasonsItems in issues viewer ([f0a545f](https://github.com/ydb-platform/ydb-embedded-ui/commit/f0a545f7c70d449c121d64f8d1820e53b880a0fc))
|
30
|
+
* **Tenant:** add ellipsis to menu items inserting queries ([09135a2](https://github.com/ydb-platform/ydb-embedded-ui/commit/09135a2777ec9183ddf71bd2a4de66c5ef422ac8))
|
31
|
+
* **Tenant:** change messages for path copy toasts ([09adfa5](https://github.com/ydb-platform/ydb-embedded-ui/commit/09adfa52735bf706deb1ee9bf37f4bfa459b3758))
|
32
|
+
* **Tenant:** switch to query tab for inserted query ([991f156](https://github.com/ydb-platform/ydb-embedded-ui/commit/991f156ff819c58ff79146a44b57fb400729f325))
|
33
|
+
|
3
34
|
### [1.4.2](https://github.com/ydb-platform/ydb-embedded-ui/compare/v1.4.1...v1.4.2) (2022-05-23)
|
4
35
|
|
5
36
|
|
@@ -3,10 +3,11 @@ import PropTypes from 'prop-types';
|
|
3
3
|
import cn from 'bem-cn-lite';
|
4
4
|
import {withRouter} from 'react-router';
|
5
5
|
|
6
|
+
import {TreeView} from 'ydb-ui-components';
|
7
|
+
|
6
8
|
import GroupViewer from '../GroupViewer/GroupViewer';
|
7
9
|
import PDiskViewer from '../PDiskViewer/PDiskViewer';
|
8
10
|
import EntityStatus from '../EntityStatus/EntityStatus';
|
9
|
-
import TreeView from '../TreeView/TreeView';
|
10
11
|
import {stringifyVdiskId} from '../../utils';
|
11
12
|
import routes, {createHref} from '../../routes';
|
12
13
|
import {backend} from '../../store';
|
@@ -50,7 +51,7 @@ class GroupTreeViewer extends React.Component {
|
|
50
51
|
<div className={b()}>
|
51
52
|
<TreeView
|
52
53
|
key={group.GroupID}
|
53
|
-
|
54
|
+
name={label2}
|
54
55
|
collapsed={collapsed}
|
55
56
|
onClick={onClick}
|
56
57
|
>
|
@@ -18,8 +18,8 @@ interface SplitPaneProps {
|
|
18
18
|
minSize?: number[];
|
19
19
|
triggerCollapse?: boolean;
|
20
20
|
triggerExpand?: boolean;
|
21
|
-
|
22
|
-
|
21
|
+
onSplitStartDragAdditional?: VoidFunction;
|
22
|
+
onSplitDragAdditional?: VoidFunction;
|
23
23
|
}
|
24
24
|
|
25
25
|
const minSizeDefaultInner = [0, 100];
|
@@ -41,17 +41,17 @@ function SplitPane(props: SplitPaneProps) {
|
|
41
41
|
localStorage.setItem(defaultSizePaneKey, sizes.join(','));
|
42
42
|
};
|
43
43
|
const onDragHandler = (sizes: number[]) => {
|
44
|
-
const {
|
45
|
-
if (
|
46
|
-
|
44
|
+
const {onSplitDragAdditional} = props;
|
45
|
+
if (onSplitDragAdditional) {
|
46
|
+
onSplitDragAdditional();
|
47
47
|
}
|
48
48
|
setDefaultSizePane(sizes);
|
49
49
|
};
|
50
50
|
|
51
51
|
const onDragStartHandler = () => {
|
52
|
-
const {
|
53
|
-
if (
|
54
|
-
|
52
|
+
const {onSplitStartDragAdditional} = props;
|
53
|
+
if (onSplitStartDragAdditional) {
|
54
|
+
onSplitStartDragAdditional();
|
55
55
|
}
|
56
56
|
setInnerSizes(undefined);
|
57
57
|
};
|
@@ -117,32 +117,6 @@ body,
|
|
117
117
|
border-color: var(--yc-color-text-danger);
|
118
118
|
}
|
119
119
|
|
120
|
-
.tree-view_item {
|
121
|
-
/* stylelint-disable-next-line declaration-no-important*/
|
122
|
-
cursor: default !important;
|
123
|
-
}
|
124
|
-
|
125
|
-
.tree-view_children {
|
126
|
-
margin-left: 25px;
|
127
|
-
}
|
128
|
-
|
129
|
-
.tree-view_arrow {
|
130
|
-
padding: 2px;
|
131
|
-
|
132
|
-
line-height: 0.8;
|
133
|
-
|
134
|
-
transform: rotate(90deg);
|
135
|
-
}
|
136
|
-
|
137
|
-
.tree-view_arrow-collapsed {
|
138
|
-
transform: rotate(0deg);
|
139
|
-
}
|
140
|
-
|
141
|
-
.tree-view_arrow:after {
|
142
|
-
font-size: var(--yc-text-body2-font-size);
|
143
|
-
content: '❯';
|
144
|
-
}
|
145
|
-
|
146
120
|
.data-table__row:hover .entity-status__clipboard-button {
|
147
121
|
display: flex;
|
148
122
|
}
|
@@ -3,7 +3,7 @@ import qs from 'qs';
|
|
3
3
|
import cn from 'bem-cn-lite';
|
4
4
|
import {Link} from 'react-router-dom';
|
5
5
|
import {useDispatch, useSelector} from 'react-redux';
|
6
|
-
import {
|
6
|
+
import {useLocation} from 'react-router';
|
7
7
|
|
8
8
|
import {Switch, Tabs} from '@yandex-cloud/uikit';
|
9
9
|
|
@@ -34,8 +34,10 @@ import {TenantGeneralTabsIds, TenantTabsGroups} from '../TenantPages';
|
|
34
34
|
import {GeneralPagesIds, DATABASE_PAGES, TABLE_PAGES, DIR_PAGES} from './DiagnosticsPages';
|
35
35
|
//@ts-ignore
|
36
36
|
import {enableAutorefresh, disableAutorefresh} from '../../../store/reducers/schema';
|
37
|
+
import {setTopLevelTab, setDiagnosticsTab} from '../../../store/reducers/tenant';
|
37
38
|
|
38
39
|
import './Diagnostics.scss';
|
40
|
+
|
39
41
|
interface DiagnosticsProps {
|
40
42
|
type: string;
|
41
43
|
additionalTenantInfo?: any;
|
@@ -51,16 +53,17 @@ function Diagnostics(props: DiagnosticsProps) {
|
|
51
53
|
currentSchema: currentItem = {},
|
52
54
|
autorefresh,
|
53
55
|
} = useSelector((state: any) => state.schema);
|
56
|
+
const {
|
57
|
+
diagnosticsTab = GeneralPagesIds.overview,
|
58
|
+
} = useSelector((state: any) => state.tenant);
|
54
59
|
|
55
60
|
const location = useLocation();
|
56
61
|
|
57
|
-
const history = useHistory();
|
58
|
-
|
59
62
|
const queryParams = qs.parse(location.search, {
|
60
63
|
ignoreQueryPrefix: true,
|
61
64
|
});
|
62
65
|
|
63
|
-
const {name: tenantName
|
66
|
+
const {name: tenantName} = queryParams;
|
64
67
|
|
65
68
|
const isDatabase = currentSchemaPath === tenantName;
|
66
69
|
|
@@ -76,25 +79,20 @@ function Diagnostics(props: DiagnosticsProps) {
|
|
76
79
|
pages = TABLE_PAGES;
|
77
80
|
}
|
78
81
|
return pages;
|
79
|
-
}, [props.type]);
|
82
|
+
}, [props.type, isDatabase]);
|
80
83
|
|
81
84
|
const forwardToDiagnosticTab = (tab: GeneralPagesIds) => {
|
82
|
-
|
83
|
-
createHref(routes.tenant, undefined, {
|
84
|
-
...queryParams,
|
85
|
-
[TenantTabsGroups.generalTab]: tab,
|
86
|
-
}),
|
87
|
-
);
|
85
|
+
dispatch(setDiagnosticsTab(tab));
|
88
86
|
};
|
89
87
|
const activeTab = useMemo(() => {
|
90
|
-
if (pages.find((el) => el.id ===
|
91
|
-
return
|
88
|
+
if (pages.find((el) => el.id === diagnosticsTab)) {
|
89
|
+
return diagnosticsTab;
|
92
90
|
} else {
|
93
91
|
const newPage = pages[0].id;
|
94
92
|
forwardToDiagnosticTab(newPage);
|
95
93
|
return newPage;
|
96
94
|
}
|
97
|
-
}, [pages,
|
95
|
+
}, [pages, diagnosticsTab]);
|
98
96
|
|
99
97
|
const onAutorefreshToggle = (value: boolean) => {
|
100
98
|
if (value) {
|
@@ -105,12 +103,7 @@ function Diagnostics(props: DiagnosticsProps) {
|
|
105
103
|
};
|
106
104
|
|
107
105
|
const forwardToGeneralTab = (tab: TenantGeneralTabsIds) => {
|
108
|
-
|
109
|
-
createHref(routes.tenant, undefined, {
|
110
|
-
...queryParams,
|
111
|
-
[TenantTabsGroups.general]: tab,
|
112
|
-
}),
|
113
|
-
);
|
106
|
+
dispatch(setTopLevelTab(tab));
|
114
107
|
};
|
115
108
|
|
116
109
|
const renderTabContent = () => {
|
@@ -118,7 +111,7 @@ function Diagnostics(props: DiagnosticsProps) {
|
|
118
111
|
|
119
112
|
const tenantNameString = tenantName as string;
|
120
113
|
|
121
|
-
switch (
|
114
|
+
switch (diagnosticsTab) {
|
122
115
|
case GeneralPagesIds.overview: {
|
123
116
|
return (
|
124
117
|
<DetailedOverview
|
@@ -5,37 +5,14 @@
|
|
5
5
|
align-items: center;
|
6
6
|
|
7
7
|
height: 40px;
|
8
|
-
margin-left: 36px;
|
9
8
|
|
10
9
|
cursor: pointer;
|
11
|
-
.km-tree-view__arrow-icon + & {
|
12
|
-
margin-left: 0;
|
13
|
-
}
|
14
10
|
|
15
11
|
&_active {
|
16
12
|
border-radius: 4px;
|
17
13
|
background: var(--yc-color-base-info);
|
18
14
|
}
|
19
15
|
|
20
|
-
&__wpapper {
|
21
|
-
& .km-tree-view__node-wrapper {
|
22
|
-
height: 40px;
|
23
|
-
|
24
|
-
& .km-tree-view__arrow-icon {
|
25
|
-
display: flex;
|
26
|
-
align-items: center;
|
27
|
-
|
28
|
-
width: 36px;
|
29
|
-
height: 36px;
|
30
|
-
margin: 0;
|
31
|
-
}
|
32
|
-
}
|
33
|
-
|
34
|
-
& .tree-view_item {
|
35
|
-
margin: 0;
|
36
|
-
}
|
37
|
-
}
|
38
|
-
|
39
16
|
&__field {
|
40
17
|
padding: 0 10px;
|
41
18
|
|
@@ -173,4 +150,15 @@
|
|
173
150
|
}
|
174
151
|
}
|
175
152
|
}
|
153
|
+
|
154
|
+
.ydb-tree-view {
|
155
|
+
&__item {
|
156
|
+
height: 40px;
|
157
|
+
}
|
158
|
+
|
159
|
+
.tree-view_arrow {
|
160
|
+
width: 40px;
|
161
|
+
height: 40px;
|
162
|
+
}
|
163
|
+
}
|
176
164
|
}
|
@@ -7,7 +7,8 @@ import _filter from 'lodash/fp/filter';
|
|
7
7
|
import _sortBy from 'lodash/fp/sortBy';
|
8
8
|
import _uniqBy from 'lodash/fp/uniqBy';
|
9
9
|
|
10
|
-
import TreeView from '
|
10
|
+
import {TreeView} from 'ydb-ui-components';
|
11
|
+
|
11
12
|
import EntityStatus from '../../../../../components/EntityStatus/EntityStatus';
|
12
13
|
|
13
14
|
import './IssueViewer.scss';
|
@@ -29,7 +30,7 @@ const issueBlock = cn('issue');
|
|
29
30
|
|
30
31
|
const IssueRow = ({data, treeLevel, active, setInfoForActive, onClick}) => {
|
31
32
|
// eslint-disable-next-line no-unused-vars
|
32
|
-
const {id, status, message, type, ...rest} = data;
|
33
|
+
const {id, status, message, type, reasonsItems, ...rest} = data;
|
33
34
|
|
34
35
|
useEffect(() => {
|
35
36
|
if (active) {
|
@@ -45,7 +46,7 @@ const IssueRow = ({data, treeLevel, active, setInfoForActive, onClick}) => {
|
|
45
46
|
</div>
|
46
47
|
<div
|
47
48
|
className={issueBlock('field', {message: true})}
|
48
|
-
style={{marginLeft: -treeLevel *
|
49
|
+
style={{marginLeft: -treeLevel * 24 + 'px'}}
|
49
50
|
>
|
50
51
|
{message}
|
51
52
|
</div>
|
@@ -85,21 +86,20 @@ const IssuesViewer = ({issues}) => {
|
|
85
86
|
return (
|
86
87
|
<TreeView
|
87
88
|
key={id}
|
88
|
-
|
89
|
+
name={
|
89
90
|
<IssueRow
|
90
91
|
data={item}
|
91
92
|
treeLevel={treeLevel}
|
92
93
|
active={isActive}
|
93
94
|
setInfoForActive={setInfoData}
|
94
|
-
onClick={() => setActiveItem(id)}
|
95
95
|
/>
|
96
96
|
}
|
97
|
-
className={issueBlock('wpapper', {active: isActive})}
|
98
97
|
collapsed={
|
99
98
|
typeof collapsedIssues[id] === 'undefined' || collapsedIssues[id]
|
100
99
|
}
|
101
100
|
hasArrow={hasArrow}
|
102
|
-
onClick={() =>
|
101
|
+
onClick={() => setActiveItem(id)}
|
102
|
+
onArrowClick={() => {
|
103
103
|
const newValue =
|
104
104
|
typeof collapsedIssues[id] === 'undefined'
|
105
105
|
? false
|
@@ -26,8 +26,8 @@
|
|
26
26
|
|
27
27
|
&__action-button {
|
28
28
|
position: absolute;
|
29
|
-
top:
|
30
|
-
right:
|
29
|
+
top: 8px; // centered relative to the heading
|
30
|
+
right: 5px; // centered relative to the collapsed panel
|
31
31
|
|
32
32
|
background-color: var(--yc-color-base-background);
|
33
33
|
&_hidden {
|
@@ -41,32 +41,26 @@
|
|
41
41
|
align-items: center;
|
42
42
|
}
|
43
43
|
|
44
|
-
&__tree {
|
44
|
+
&__tree-wrapper {
|
45
45
|
display: flex;
|
46
|
-
overflow: scroll;
|
47
|
-
flex: 0 0 auto;
|
48
46
|
flex-direction: column;
|
47
|
+
}
|
48
|
+
|
49
|
+
&__tree {
|
50
|
+
overflow-y: scroll;
|
51
|
+
flex: 1 1 auto;
|
49
52
|
|
50
53
|
height: 100%;
|
51
54
|
padding: 0 12px 12px;
|
52
|
-
|
53
|
-
.tree-view_item {
|
54
|
-
margin: 0;
|
55
|
-
padding: 2px 0;
|
56
|
-
}
|
57
|
-
|
58
|
-
& > div > .tree-view {
|
59
|
-
padding-bottom: 15px;
|
60
|
-
}
|
61
55
|
}
|
62
56
|
|
63
57
|
&__tree-header {
|
64
58
|
display: flex;
|
59
|
+
flex: 0 0 auto;
|
65
60
|
justify-content: space-between;
|
66
61
|
align-items: center;
|
67
62
|
|
68
63
|
padding: 12px 12px 8px;
|
69
|
-
@include sticky-top();
|
70
64
|
}
|
71
65
|
|
72
66
|
&__tree-title {
|
@@ -7,18 +7,13 @@ import qs from 'qs';
|
|
7
7
|
import _ from 'lodash';
|
8
8
|
|
9
9
|
import {Button, HelpTooltip, Loader, Tabs} from '@yandex-cloud/uikit';
|
10
|
-
|
10
|
+
|
11
11
|
import SplitPane from '../../../components/SplitPane';
|
12
|
-
|
13
|
-
import SchemaNode from '../Schema/SchemaNode/SchemaNode';
|
14
|
-
//@ts-ignore
|
12
|
+
import {SchemaTree} from '../Schema/SchemaTree/SchemaTree';
|
15
13
|
import Acl from '../Acl/Acl';
|
16
|
-
//@ts-ignore
|
17
14
|
import SchemaViewer from '../Schema/SchemaViewer/SchemaViewer';
|
18
15
|
import CopyToClipboard from '../../../components/CopyToClipboard/CopyToClipboard';
|
19
|
-
//@ts-ignore
|
20
16
|
import InfoViewer from '../../../components/InfoViewer/InfoViewer';
|
21
|
-
//@ts-ignore
|
22
17
|
import Icon from '../../../components/Icon/Icon';
|
23
18
|
|
24
19
|
import {OLAP_TABLE_TYPE, TABLE_TYPE} from '../Tenant';
|
@@ -26,7 +21,6 @@ import {OLAP_TABLE_TYPE, TABLE_TYPE} from '../Tenant';
|
|
26
21
|
import {
|
27
22
|
DEFAULT_IS_TENANT_COMMON_INFO_COLLAPSED,
|
28
23
|
DEFAULT_SIZE_TENANT_SUMMARY_KEY,
|
29
|
-
//@ts-ignore
|
30
24
|
} from '../../../utils/constants';
|
31
25
|
import {
|
32
26
|
TenantGeneralTabsIds,
|
@@ -41,10 +35,11 @@ import {
|
|
41
35
|
paneVisibilityToggleReducerCreator,
|
42
36
|
PaneVisibilityToggleButtons,
|
43
37
|
} from '../utils/paneVisibilityToggleHelpers';
|
44
|
-
//@ts-ignore
|
45
38
|
import {setShowPreview} from '../../../store/reducers/schema';
|
39
|
+
import {setTopLevelTab} from '../../../store/reducers/tenant';
|
46
40
|
|
47
41
|
import './ObjectSummary.scss';
|
42
|
+
|
48
43
|
const b = cn('object-summary');
|
49
44
|
|
50
45
|
const getInitialIsSummaryCollapsed = () => {
|
@@ -103,7 +98,7 @@ function ObjectSummary(props: ObjectSummaryProps) {
|
|
103
98
|
});
|
104
99
|
|
105
100
|
const {name: tenantName, info: infoTab} = queryParams;
|
106
|
-
const
|
101
|
+
const pathData = _.get(data[tenantName as string], 'PathDescription.Self');
|
107
102
|
const currentSchemaData = _.get(data[currentSchemaPath], 'PathDescription.Self');
|
108
103
|
|
109
104
|
const tableSchema =
|
@@ -195,13 +190,20 @@ function ObjectSummary(props: ObjectSummaryProps) {
|
|
195
190
|
|
196
191
|
const renderTree = () => {
|
197
192
|
return (
|
198
|
-
<div>
|
193
|
+
<div className={b('tree-wrapper')}>
|
199
194
|
<div className={b('tree-header')}>
|
200
195
|
<div className={b('tree-title')}>Navigation</div>
|
201
196
|
</div>
|
202
197
|
<div className={b('tree')}>
|
203
|
-
{
|
204
|
-
<
|
198
|
+
{pathData && (
|
199
|
+
<SchemaTree
|
200
|
+
rootPath={tenantName as string}
|
201
|
+
// for the root pathData.Name contains the same string as tenantName,
|
202
|
+
// but without the leading slash
|
203
|
+
rootName={pathData?.Name || tenantName}
|
204
|
+
rootType={pathData.PathType}
|
205
|
+
currentPath={currentSchemaPath}
|
206
|
+
/>
|
205
207
|
)}
|
206
208
|
</div>
|
207
209
|
</div>
|
@@ -215,18 +217,13 @@ function ObjectSummary(props: ObjectSummaryProps) {
|
|
215
217
|
dispatchCommonInfoVisibilityState(PaneVisibilityActionTypes.triggerExpand);
|
216
218
|
};
|
217
219
|
|
218
|
-
const
|
220
|
+
const onSplitStartDragAdditional = () => {
|
219
221
|
dispatchCommonInfoVisibilityState(PaneVisibilityActionTypes.clear);
|
220
222
|
};
|
221
223
|
|
222
224
|
const onOpenPreview = () => {
|
223
225
|
dispatch(setShowPreview(true));
|
224
|
-
|
225
|
-
createHref(routes.tenant, undefined, {
|
226
|
-
...queryParams,
|
227
|
-
[TenantTabsGroups.general]: TenantGeneralTabsIds.query,
|
228
|
-
}),
|
229
|
-
);
|
226
|
+
dispatch(setTopLevelTab(TenantGeneralTabsIds.query));
|
230
227
|
};
|
231
228
|
|
232
229
|
const renderCommonInfoControls = () => {
|
@@ -278,7 +275,7 @@ function ObjectSummary(props: ObjectSummaryProps) {
|
|
278
275
|
<SplitPane
|
279
276
|
direction="vertical"
|
280
277
|
defaultSizePaneKey={DEFAULT_SIZE_TENANT_SUMMARY_KEY}
|
281
|
-
|
278
|
+
onSplitStartDragAdditional={onSplitStartDragAdditional}
|
282
279
|
triggerCollapse={commonInfoVisibilityState.triggerCollapse}
|
283
280
|
triggerExpand={commonInfoVisibilityState.triggerExpand}
|
284
281
|
minSize={[200, 52]}
|
@@ -298,7 +298,7 @@ function QueryEditor(props) {
|
|
298
298
|
dispatchResultVisibilityState(PaneVisibilityActionTypes.triggerExpand);
|
299
299
|
};
|
300
300
|
|
301
|
-
const
|
301
|
+
const onSplitStartDragAdditional = () => {
|
302
302
|
dispatchResultVisibilityState(PaneVisibilityActionTypes.clear);
|
303
303
|
};
|
304
304
|
|
@@ -636,7 +636,7 @@ function QueryEditor(props) {
|
|
636
636
|
triggerExpand={resultVisibilityState.triggerExpand}
|
637
637
|
minSize={[0, 52]}
|
638
638
|
collapsedSizes={[100, 0]}
|
639
|
-
|
639
|
+
onSplitStartDragAdditional={onSplitStartDragAdditional}
|
640
640
|
>
|
641
641
|
<div className={b('pane-wrapper')}>
|
642
642
|
<div className={b('monaco-wrapper')}>
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import {useDispatch} from 'react-redux';
|
2
|
+
|
3
|
+
import {NavigationTree} from 'ydb-ui-components';
|
4
|
+
|
5
|
+
import {setCurrentSchemaPath, getSchema} from '../../../../store/reducers/schema';
|
6
|
+
import {getDescribe} from '../../../../store/reducers/describe';
|
7
|
+
import {getSchemaAcl} from '../../../../store/reducers/schemaAcl';
|
8
|
+
|
9
|
+
import {calcNavigationTreeType} from '../../utils/schema';
|
10
|
+
import {getActions} from '../../utils/schemaActions';
|
11
|
+
|
12
|
+
interface SchemaTreeProps {
|
13
|
+
rootPath: string;
|
14
|
+
rootName: string;
|
15
|
+
rootType: string;
|
16
|
+
currentPath: string;
|
17
|
+
}
|
18
|
+
|
19
|
+
export function SchemaTree(props: SchemaTreeProps) {
|
20
|
+
const {
|
21
|
+
rootPath,
|
22
|
+
rootName,
|
23
|
+
rootType,
|
24
|
+
currentPath,
|
25
|
+
} = props;
|
26
|
+
|
27
|
+
const dispatch = useDispatch();
|
28
|
+
|
29
|
+
const fetchPath = (path: string) => window.api.getSchema(
|
30
|
+
{path},
|
31
|
+
{concurrentId: `NavigationTree.getSchema|${path}`},
|
32
|
+
)
|
33
|
+
.then(({PathDescription: {Children = []} = {}}) => {
|
34
|
+
return Children.map(({Name, PathType}) => ({
|
35
|
+
name: Name,
|
36
|
+
type: calcNavigationTreeType(PathType),
|
37
|
+
}));
|
38
|
+
});
|
39
|
+
|
40
|
+
const handleActivePathUpdate = (activePath: string) => {
|
41
|
+
dispatch(setCurrentSchemaPath(activePath));
|
42
|
+
dispatch(getSchema({path: activePath}));
|
43
|
+
dispatch(getDescribe({path: activePath}));
|
44
|
+
dispatch(getSchemaAcl({path: activePath}));
|
45
|
+
};
|
46
|
+
|
47
|
+
return (
|
48
|
+
<NavigationTree
|
49
|
+
rootState={{
|
50
|
+
path: rootPath,
|
51
|
+
name: rootName,
|
52
|
+
type: calcNavigationTreeType(rootType),
|
53
|
+
collapsed: false,
|
54
|
+
}}
|
55
|
+
fetchPath={fetchPath}
|
56
|
+
getActions={getActions(dispatch, handleActivePathUpdate)}
|
57
|
+
activePath={currentPath}
|
58
|
+
onActivePathUpdate={handleActivePathUpdate}
|
59
|
+
cache={false}
|
60
|
+
/>
|
61
|
+
);
|
62
|
+
}
|
@@ -127,7 +127,7 @@ function Tenant(props: TenantProps) {
|
|
127
127
|
dispatchSummaryVisibilityAction(PaneVisibilityActionTypes.triggerExpand);
|
128
128
|
};
|
129
129
|
|
130
|
-
const
|
130
|
+
const onSplitStartDragAdditional = () => {
|
131
131
|
dispatchSummaryVisibilityAction(PaneVisibilityActionTypes.clear);
|
132
132
|
};
|
133
133
|
|
@@ -139,7 +139,7 @@ function Tenant(props: TenantProps) {
|
|
139
139
|
triggerCollapse={summaryVisibilityState.triggerCollapse}
|
140
140
|
triggerExpand={summaryVisibilityState.triggerExpand}
|
141
141
|
minSize={[36, 200]}
|
142
|
-
|
142
|
+
onSplitStartDragAdditional={onSplitStartDragAdditional}
|
143
143
|
>
|
144
144
|
<ObjectSummary
|
145
145
|
type={entityType as string}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import type {NavigationTreeNodeType} from "ydb-ui-components";
|
2
|
+
|
3
|
+
const DB_TYPES = new Set(['EPathTypeSubDomain']);
|
4
|
+
const TABLE_TYPES = new Set(['EPathTypeTable', 'EPathTypeOlapTable']);
|
5
|
+
const DIR_TYPES = new Set(['EPathTypeDir', 'EPathTypeOlapStore']);
|
6
|
+
|
7
|
+
export const calcNavigationTreeType = (type: string): NavigationTreeNodeType => {
|
8
|
+
if (DIR_TYPES.has(type)) {
|
9
|
+
return 'directory';
|
10
|
+
} else if (TABLE_TYPES.has(type)) {
|
11
|
+
return 'table';
|
12
|
+
} else if (DB_TYPES.has(type)) {
|
13
|
+
return 'database';
|
14
|
+
}
|
15
|
+
|
16
|
+
return 'directory';
|
17
|
+
};
|