mirror of
https://github.com/ZwareBear/awx.git
synced 2026-03-20 07:43:35 -05:00
Merge pull request #13372 from vidyanambiar/aap-7757
Fix for Save button not responding on Job Settings page
This commit is contained in:
@@ -141,14 +141,14 @@ function JobsEdit() {
|
|||||||
<FormColumnLayout>
|
<FormColumnLayout>
|
||||||
<InputField
|
<InputField
|
||||||
name="AWX_ISOLATION_BASE_PATH"
|
name="AWX_ISOLATION_BASE_PATH"
|
||||||
config={jobs.AWX_ISOLATION_BASE_PATH}
|
config={jobs.AWX_ISOLATION_BASE_PATH ?? null}
|
||||||
isRequired
|
isRequired={Boolean(options?.AWX_ISOLATION_BASE_PATH)}
|
||||||
/>
|
/>
|
||||||
<InputField
|
<InputField
|
||||||
name="SCHEDULE_MAX_JOBS"
|
name="SCHEDULE_MAX_JOBS"
|
||||||
config={jobs.SCHEDULE_MAX_JOBS}
|
config={jobs.SCHEDULE_MAX_JOBS ?? null}
|
||||||
type="number"
|
type={options?.SCHEDULE_MAX_JOBS ? 'number' : undefined}
|
||||||
isRequired
|
isRequired={Boolean(options?.SCHEDULE_MAX_JOBS)}
|
||||||
/>
|
/>
|
||||||
<InputField
|
<InputField
|
||||||
name="DEFAULT_JOB_TIMEOUT"
|
name="DEFAULT_JOB_TIMEOUT"
|
||||||
|
|||||||
@@ -122,4 +122,22 @@ describe('<JobsEdit />', () => {
|
|||||||
await waitForElement(wrapper, 'ContentLoading', (el) => el.length === 0);
|
await waitForElement(wrapper, 'ContentLoading', (el) => el.length === 0);
|
||||||
expect(wrapper.find('ContentError').length).toBe(1);
|
expect(wrapper.find('ContentError').length).toBe(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Form input fields that are invisible (due to being set manually via a settings file) should not prevent submitting the form', async () => {
|
||||||
|
const mockOptions = Object.assign({}, mockAllOptions);
|
||||||
|
// If AWX_ISOLATION_BASE_PATH has been set in a settings file it will be absent in the PUT options
|
||||||
|
delete mockOptions['actions']['PUT']['AWX_ISOLATION_BASE_PATH'];
|
||||||
|
await act(async () => {
|
||||||
|
wrapper = mountWithContexts(
|
||||||
|
<SettingsProvider value={mockOptions.actions}>
|
||||||
|
<JobsEdit />
|
||||||
|
</SettingsProvider>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
await waitForElement(wrapper, 'ContentLoading', (el) => el.length === 0);
|
||||||
|
await act(async () => {
|
||||||
|
wrapper.find('Form').invoke('onSubmit')();
|
||||||
|
});
|
||||||
|
expect(SettingsAPI.updateAll).toHaveBeenCalledTimes(1);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -397,7 +397,10 @@ const InputField = ({ name, config, type = 'text', isRequired = false }) => {
|
|||||||
};
|
};
|
||||||
InputField.propTypes = {
|
InputField.propTypes = {
|
||||||
name: string.isRequired,
|
name: string.isRequired,
|
||||||
config: shape({}).isRequired,
|
config: shape({}),
|
||||||
|
};
|
||||||
|
InputField.defaultProps = {
|
||||||
|
config: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
const TextAreaField = ({ name, config, isRequired = false }) => {
|
const TextAreaField = ({ name, config, isRequired = false }) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user