Skip to content

Commit d24dd74

Browse files
bsekachevnmanovic
authored andcommitted
Added root folder for share functionality (#1005)
1 parent 337f7a0 commit d24dd74

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

cvat-ui/src/components/file-manager/file-manager.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,13 @@ export default class FileManager extends React.PureComponent<Props, State> {
216216

217217
public render(): JSX.Element {
218218
const { withRemote } = this.props;
219+
const { active } = this.state;
219220

220221
return (
221222
<>
222223
<Tabs
223224
type='card'
225+
activeKey={active}
224226
tabBarGutter={5}
225227
onChange={
226228
(activeKey: string): void => this.setState({

cvat-ui/src/containers/file-manager/file-manager.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ interface DispatchToProps {
2626
function mapStateToProps(state: CombinedState): StateToProps {
2727
function convert(items: ShareItem[], path?: string): TreeNodeNormal[] {
2828
return items.map((item): TreeNodeNormal => {
29-
const key = `${path}/${item.name}`.replace(/\/+/g, '/'); // // => /
29+
const key = `${path}${item.name}/`;
3030
return {
3131
key,
32-
title: item.name,
32+
title: item.name || 'root',
3333
isLeaf: item.type !== 'DIR',
3434
children: convert(item.children, key),
3535
};
@@ -38,7 +38,7 @@ function mapStateToProps(state: CombinedState): StateToProps {
3838

3939
const { root } = state.share;
4040
return {
41-
treeData: convert(root.children, root.name),
41+
treeData: convert([root], ''),
4242
};
4343
}
4444

cvat-ui/src/reducers/share-reducer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010

1111
const defaultState: ShareState = {
1212
root: {
13-
name: '/',
13+
name: '',
1414
type: 'DIR',
1515
children: [],
1616
},

0 commit comments

Comments
 (0)