main
Maya 5 years ago
parent 7309d99074
commit 143fe28d39

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

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

Loading…
Cancel
Save