main
Maya 5 years ago
parent 7309d99074
commit 143fe28d39

@ -26,14 +26,13 @@ export interface AdvancedConfiguration {
useZipChunks: boolean;
dataChunkSize?: number;
useCache: boolean;
activeTab: string;
copyData?: boolean;
}
type Props = FormComponentProps & {
onSubmit(values: AdvancedConfiguration): void;
installedGit: boolean;
activeTab: string;
activeFileManagerTab: string;
};
function isPositiveInteger(_: any, value: any, callback: any): void {
@ -81,7 +80,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, activeTab } = this.props;
const { form, onSubmit } = this.props;
form.validateFields((error, values): void => {
if (!error) {
@ -103,7 +102,6 @@ class AdvancedConfigurationForm extends React.PureComponent<Props> {
onSubmit({
...values,
frameFilter: values.frameStep ? `step=${values.frameStep}` : undefined,
activeTab: activeTab,
});
resolve();
} else {
@ -410,11 +408,11 @@ class AdvancedConfigurationForm extends React.PureComponent<Props> {
}
public render(): JSX.Element {
const { installedGit, activeTab } = this.props;
const { installedGit, activeFileManagerTab } = this.props;
return (
<Form>
{activeTab === 'share' ? this.renderCopyDataChechbox() : null}
{activeFileManagerTab === 'share' ? this.renderCopyDataChechbox() : null}
<Row>
<Col>{this.renderUzeZipChunks()}</Col>

@ -23,6 +23,7 @@ export interface CreateTaskData {
advanced: AdvancedConfiguration;
labels: any[];
files: Files;
activeFileManagerTab: string;
}
interface Props {
@ -42,7 +43,6 @@ const defaultState = {
lfs: false,
useZipChunks: true,
useCache: true,
activeTab: 'local',
},
labels: [],
files: {
@ -50,6 +50,7 @@ const defaultState = {
share: [],
remote: [],
},
activeFileManagerTab: 'local',
};
class CreateTaskContent extends React.PureComponent<Props & RouteComponentProps, State> {
@ -116,12 +117,10 @@ class CreateTaskContent extends React.PureComponent<Props & RouteComponentProps,
};
private changeFileManagerTab = (key: string): void => {
const values = this.state.advanced;
const values = this.state;
this.setState({
advanced: {
...values,
activeTab: key
}
...values,
activeFileManagerTab: key
});
};
@ -221,7 +220,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}
activeFileManagerTab={this.state.activeFileManagerTab}
wrappedComponentRef={(component: any): void => {
this.advancedConfigurationComponent = component;
}}

Loading…
Cancel
Save