Merge pull request #8545 from nixocio/ui_issue_4968

Mark `Host Config Key` as a required field

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot]
2020-11-06 17:23:16 +00:00
committed by GitHub
3 changed files with 7 additions and 1 deletions

View File

@@ -36,7 +36,7 @@ const mockJobTemplate = {
diff_mode: false, diff_mode: false,
extra_vars: '---', extra_vars: '---',
forks: 0, forks: 0,
host_config_key: '', host_config_key: '1234',
id: 1, id: 1,
inventory: 2, inventory: 2,
job_slice_count: 1, job_slice_count: 1,
@@ -225,6 +225,10 @@ describe('<JobTemplateEdit />', () => {
); );
}); });
await waitForElement(wrapper, 'EmptyStateBody', el => el.length === 0); await waitForElement(wrapper, 'EmptyStateBody', el => el.length === 0);
expect(wrapper.find('FormGroup[label="Host Config Key"]').length).toBe(1);
expect(
wrapper.find('FormGroup[label="Host Config Key"]').prop('isRequired')
).toBe(true);
}); });
test('handleSubmit should call api update', async () => { test('handleSubmit should call api update', async () => {

View File

@@ -589,6 +589,7 @@ function JobTemplateForm({
validate={ validate={
allowCallbacks ? required(null, i18n) : null allowCallbacks ? required(null, i18n) : null
} }
isRequired={allowCallbacks}
/> />
</FormColumnLayout> </FormColumnLayout>
</> </>

View File

@@ -56,6 +56,7 @@ describe('<JobTemplateForm />', () => {
webhook_key: 'webhook key', webhook_key: 'webhook key',
webhook_service: 'github', webhook_service: 'github',
webhook_credential: 7, webhook_credential: 7,
host_config_key: '',
}; };
const mockInstanceGroups = [ const mockInstanceGroups = [
{ {