mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 17:37:37 -02:30
fix ProjectLookup re-renders
This commit is contained in:
@@ -79,6 +79,7 @@ class JobTemplateForm extends Component {
|
|||||||
};
|
};
|
||||||
this.handleProjectValidation = this.handleProjectValidation.bind(this);
|
this.handleProjectValidation = this.handleProjectValidation.bind(this);
|
||||||
this.loadRelatedInstanceGroups = this.loadRelatedInstanceGroups.bind(this);
|
this.loadRelatedInstanceGroups = this.loadRelatedInstanceGroups.bind(this);
|
||||||
|
this.handleProjectUpdate = this.handleProjectUpdate.bind(this);
|
||||||
this.setContentError = this.setContentError.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) {
|
setContentError(contentError) {
|
||||||
this.setState({ contentError });
|
this.setState({ contentError });
|
||||||
}
|
}
|
||||||
@@ -257,10 +264,7 @@ class JobTemplateForm extends Component {
|
|||||||
you want this job to execute.`)}
|
you want this job to execute.`)}
|
||||||
isValid={!form.touched.project || !form.errors.project}
|
isValid={!form.touched.project || !form.errors.project}
|
||||||
helperTextInvalid={form.errors.project}
|
helperTextInvalid={form.errors.project}
|
||||||
onChange={value => {
|
onChange={this.handleProjectUpdate}
|
||||||
form.setFieldValue('project', value.id);
|
|
||||||
this.setState({ project: value });
|
|
||||||
}}
|
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user