1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 16:51:11 +03:00

fix ProjectLookup re-renders

This commit is contained in:
Keith Grant 2019-12-04 12:59:28 -08:00
parent 9de165a676
commit 3409d39150

View File

@ -79,6 +79,7 @@ class JobTemplateForm extends Component {
};
this.handleProjectValidation = this.handleProjectValidation.bind(this);
this.loadRelatedInstanceGroups = this.loadRelatedInstanceGroups.bind(this);
this.handleProjectUpdate = this.handleProjectUpdate.bind(this);
this.setContentError = this.setContentError.bind(this);
}
@ -120,6 +121,12 @@ class JobTemplateForm extends Component {
};
}
handleProjectUpdate(project) {
const { setFieldValue } = this.props;
setFieldValue('project', project.id);
this.setState({ project });
}
setContentError(contentError) {
this.setState({ contentError });
}
@ -257,10 +264,7 @@ class JobTemplateForm extends Component {
you want this job to execute.`)}
isValid={!form.touched.project || !form.errors.project}
helperTextInvalid={form.errors.project}
onChange={value => {
form.setFieldValue('project', value.id);
this.setState({ project: value });
}}
onChange={this.handleProjectUpdate}
required
/>
)}