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

Share without copying & mount cloud storages #2377

Merged
merged 24 commits into from
Dec 2, 2020
Merged
Show file tree
Hide file tree
Changes from 14 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: 1 addition & 1 deletion cvat-core/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cvat-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cvat-core",
"version": "3.8.1",
"version": "3.9.0",
"description": "Part of Computer Vision Tool which presents an interface for client-side integration",
"main": "babel.config.js",
"scripts": {
Expand Down
20 changes: 20 additions & 0 deletions cvat-core/src/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,7 @@
data_original_chunk_type: undefined,
use_zip_chunks: undefined,
use_cache: undefined,
copy_data: undefined,
};

for (const property in data) {
Expand Down Expand Up @@ -1117,6 +1118,22 @@
data.use_cache = useCache;
},
},
/**
* @name copyData
* @type {boolean}
* @memberof module:API.cvat.classes.Task
* @instance
* @throws {module:API.cvat.exceptions.ArgumentError}
*/
copyData: {
get: () => data.copy_data,
set: (copyData) => {
if (typeof copyData !== 'boolean') {
throw new ArgumentError('Value must be a boolean');
}
data.copy_data = copyData;
},
},
/**
* After task has been created value can be appended only.
* @name labels
Expand Down Expand Up @@ -1695,6 +1712,9 @@
if (typeof this.dataChunkSize !== 'undefined') {
taskDataSpec.chunk_size = this.dataChunkSize;
}
if (typeof this.copyData !== 'undefined') {
taskDataSpec.copy_data = this.copyData;
}

const task = await serverProxy.tasks.createTask(taskSpec, taskDataSpec, onUpdate);
return new Task(task);
Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cvat-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cvat-ui",
"version": "1.9.14",
"version": "1.10.0",
"description": "CVAT single-page application",
"main": "src/index.tsx",
"scripts": {
Expand Down
3 changes: 3 additions & 0 deletions cvat-ui/src/actions/tasks-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,9 @@ export function createTaskAsync(data: any): ThunkAction<Promise<void>, {}, {}, A
if (data.advanced.dataChunkSize) {
description.data_chunk_size = data.advanced.dataChunkSize;
}
if (data.advanced.copyData) {
description.copy_data = data.advanced.copyData;
}

const taskInstance = new cvat.classes.Task(description);
taskInstance.clientFiles = data.files.local;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@ export interface AdvancedConfiguration {
useZipChunks: boolean;
dataChunkSize?: number;
useCache: boolean;
activeTab: string;
bsekachev marked this conversation as resolved.
Show resolved Hide resolved
copyData?: boolean;
}

type Props = FormComponentProps & {
onSubmit(values: AdvancedConfiguration): void;
installedGit: boolean;
activeTab: string;
bsekachev marked this conversation as resolved.
Show resolved Hide resolved
};

function isPositiveInteger(_: any, value: any, callback: any): void {
Expand Down Expand Up @@ -78,7 +81,7 @@ function isIntegerRange(min: number, max: number, _: any, value: any, callback:
class AdvancedConfigurationForm extends React.PureComponent<Props> {
public submit(): Promise<void> {
return new Promise((resolve, reject) => {
const { form, onSubmit } = this.props;
const { form, onSubmit, activeTab } = this.props;

form.validateFields((error, values): void => {
if (!error) {
Expand All @@ -100,6 +103,7 @@ class AdvancedConfigurationForm extends React.PureComponent<Props> {
onSubmit({
...values,
frameFilter: values.frameStep ? `step=${values.frameStep}` : undefined,
activeTab: activeTab,
bsekachev marked this conversation as resolved.
Show resolved Hide resolved
});
resolve();
} else {
Expand All @@ -114,6 +118,26 @@ class AdvancedConfigurationForm extends React.PureComponent<Props> {
form.resetFields();
}

renderCopyDataChechbox(): JSX.Element {
const { form } = this.props;
return (
<Row>
<Col>
<Form.Item help='If you have a low data transfer rate over the network you can copy data into CVAT to speed up work'>
{form.getFieldDecorator('copyData', {
initialValue: false,
valuePropName: 'checked',
})(
<Checkbox>
<Text className='cvat-text-color'>Copy data into CVAT</Text>
</Checkbox>,
)}
</Form.Item>
</Col>
</Row>
);
}

private renderImageQuality(): JSX.Element {
const { form } = this.props;

Expand Down Expand Up @@ -386,10 +410,12 @@ class AdvancedConfigurationForm extends React.PureComponent<Props> {
}

public render(): JSX.Element {
const { installedGit } = this.props;

const { installedGit, activeTab } = this.props;
return (
<Form>

{activeTab === 'share' ? this.renderCopyDataChechbox() : null}

<Row>
<Col>{this.renderUzeZipChunks()}</Col>
</Row>
Expand Down
13 changes: 13 additions & 0 deletions cvat-ui/src/components/create-task-page/create-task-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const defaultState = {
lfs: false,
useZipChunks: true,
useCache: true,
activeTab: 'local',
bsekachev marked this conversation as resolved.
Show resolved Hide resolved
},
labels: [],
files: {
Expand Down Expand Up @@ -114,6 +115,16 @@ class CreateTaskContent extends React.PureComponent<Props & RouteComponentProps,
});
};

private changeFileManagerTab = (key: string): void => {
const values = this.state.advanced;
this.setState({
advanced: {
...values,
activeTab: key
}
});
};

private handleSubmitClick = (): void => {
if (!this.validateLabels()) {
notification.error({
Expand Down Expand Up @@ -192,6 +203,7 @@ class CreateTaskContent extends React.PureComponent<Props & RouteComponentProps,
<Text type='danger'>* </Text>
<Text className='cvat-text-color'>Select files:</Text>
<ConnectedFileManager
onChangeActiveKey={this.changeFileManagerTab}
ref={(container: any): void => {
this.fileManagerContainer = container;
}}
Expand All @@ -209,6 +221,7 @@ class CreateTaskContent extends React.PureComponent<Props & RouteComponentProps,
<Collapse.Panel key='1' header={<Text className='cvat-title'>Advanced configuration</Text>}>
<AdvancedConfigurationForm
installedGit={installedGit}
activeTab={this.state.advanced.activeTab}
wrappedComponentRef={(component: any): void => {
this.advancedConfigurationComponent = component;
}}
Expand Down
10 changes: 6 additions & 4 deletions cvat-ui/src/components/file-manager/file-manager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ interface Props {
withRemote: boolean;
treeData: TreeNodeNormal[];
onLoadData: (key: string, success: () => void, failure: () => void) => void;
onChangeActiveKey(key: string): void;
}

export default class FileManager extends React.PureComponent<Props, State> {
Expand Down Expand Up @@ -215,7 +216,7 @@ export default class FileManager extends React.PureComponent<Props, State> {
}

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

return (
Expand All @@ -224,11 +225,12 @@ export default class FileManager extends React.PureComponent<Props, State> {
type='card'
activeKey={active}
tabBarGutter={5}
onChange={(activeKey: string): void =>
onChange={(activeKey: string): void => {
onChangeActiveKey(activeKey);
this.setState({
active: activeKey as any,
})
}
});
}}
>
{this.renderLocalSelector()}
{this.renderShareSelector()}
Expand Down
4 changes: 3 additions & 1 deletion cvat-ui/src/containers/file-manager/file-manager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { ShareItem, CombinedState } from 'reducers/interfaces';
interface OwnProps {
ref: any;
withRemote: boolean;
onChangeActiveKey(key: string): void;
}

interface StateToProps {
Expand Down Expand Up @@ -68,12 +69,13 @@ export class FileManagerContainer extends React.PureComponent<Props> {
}

public render(): JSX.Element {
const { treeData, getTreeData, withRemote } = this.props;
const { treeData, getTreeData, withRemote, onChangeActiveKey } = this.props;

return (
<FileManagerComponent
treeData={treeData}
onLoadData={getTreeData}
onChangeActiveKey={onChangeActiveKey}
withRemote={withRemote}
ref={(component): void => {
this.managerComponentRef = component;
Expand Down
3 changes: 3 additions & 0 deletions cvat/apps/documentation/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,9 @@ You can change the share device path to your actual share. For user convenience
we have defined the environment variable \$CVAT_SHARE_URL. This variable
contains a text (url for example) which is shown in the client-share browser.

You can [mount](/cvat/apps/documentation/mounting_cloud_storages.md)
your cloud storage as a FUSE and use it later as a share.

### Email verification

You can enable email verification for newly registered users.
Expand Down
Loading