Skip to content

Commit

Permalink
Added root folder for share functionality (cvat-ai#1005)
Browse files Browse the repository at this point in the history
  • Loading branch information
bsekachev authored and Chris Lee-Messer committed Mar 5, 2020
1 parent bb5ee67 commit 91f2d95
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions cvat-ui/src/components/file-manager/file-manager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,13 @@ export default class FileManager extends React.PureComponent<Props, State> {

public render(): JSX.Element {
const { withRemote } = this.props;
const { active } = this.state;

return (
<>
<Tabs
type='card'
activeKey={active}
tabBarGutter={5}
onChange={
(activeKey: string): void => this.setState({
Expand Down
6 changes: 3 additions & 3 deletions cvat-ui/src/containers/file-manager/file-manager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ interface DispatchToProps {
function mapStateToProps(state: CombinedState): StateToProps {
function convert(items: ShareItem[], path?: string): TreeNodeNormal[] {
return items.map((item): TreeNodeNormal => {
const key = `${path}/${item.name}`.replace(/\/+/g, '/'); // // => /
const key = `${path}${item.name}/`;
return {
key,
title: item.name,
title: item.name || 'root',
isLeaf: item.type !== 'DIR',
children: convert(item.children, key),
};
Expand All @@ -38,7 +38,7 @@ function mapStateToProps(state: CombinedState): StateToProps {

const { root } = state.share;
return {
treeData: convert(root.children, root.name),
treeData: convert([root], ''),
};
}

Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/src/reducers/share-reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {

const defaultState: ShareState = {
root: {
name: '/',
name: '',
type: 'DIR',
children: [],
},
Expand Down

0 comments on commit 91f2d95

Please sign in to comment.