Added checkbox 'copy_data'

main
Maya 5 years ago
parent aecbb5a7dd
commit 5762fddf1a

@ -875,6 +875,7 @@
data_original_chunk_type: undefined,
use_zip_chunks: undefined,
use_cache: undefined,
copy_data: undefined,
};
for (const property in data) {
@ -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
@ -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);

@ -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;

@ -26,11 +26,14 @@ export interface AdvancedConfiguration {
useZipChunks: boolean;
dataChunkSize?: number;
useCache: boolean;
activeTab: string;
copyData?: boolean;
}
type Props = FormComponentProps & {
onSubmit(values: AdvancedConfiguration): void;
installedGit: boolean;
activeTab: string;
};
function isPositiveInteger(_: any, value: any, callback: any): void {
@ -114,6 +117,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;
@ -386,10 +409,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>

@ -42,6 +42,7 @@ const defaultState = {
lfs: false,
useZipChunks: true,
useCache: true,
activeTab: 'local',
},
labels: [],
files: {
@ -115,10 +116,13 @@ class CreateTaskContent extends React.PureComponent<Props & RouteComponentProps,
};
private changeFileManagerTab = (key: string): void => {
// todo
// add field to state CreateTaskData.AdvancedConfiguration
// change state here
// draw checkbox depending on the state
const values = this.state.advanced;
this.setState({
advanced: {
...values,
activeTab: key
}
});
};
private handleSubmitClick = (): void => {
@ -217,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;
}}

Loading…
Cancel
Save