Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added root folder for share functionality #1005

Merged
merged 1 commit into from
Dec 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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