mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 18:09:57 -03:30
Remove EE from WorkflowJobTemplate screens
Remove EE from WorkflowJobTemplate screens Related ansible/awx#10443 Related ansible/awx#10399
This commit is contained in:
parent
15444bef70
commit
7b9bcd0481
@ -274,10 +274,12 @@ function TemplateListItem({
|
||||
dataCy={`template-${template.id}-project`}
|
||||
/>
|
||||
)}
|
||||
<ExecutionEnvironmentDetail
|
||||
virtualEnvironment={template.custom_virtualenv}
|
||||
executionEnvironment={summaryFields?.execution_environment}
|
||||
/>
|
||||
{template.type === 'job_template' && (
|
||||
<ExecutionEnvironmentDetail
|
||||
virtualEnvironment={template.custom_virtualenv}
|
||||
executionEnvironment={summaryFields?.execution_environment}
|
||||
/>
|
||||
)}
|
||||
<Detail
|
||||
label={t`Last Modified`}
|
||||
value={formatDateString(template.modified)}
|
||||
|
||||
@ -37,10 +37,7 @@ function WorkflowJobTemplateAdd() {
|
||||
try {
|
||||
const {
|
||||
data: { id },
|
||||
} = await WorkflowJobTemplatesAPI.create({
|
||||
...templatePayload,
|
||||
execution_environment: values.execution_environment?.id,
|
||||
});
|
||||
} = await WorkflowJobTemplatesAPI.create(templatePayload);
|
||||
await Promise.all(await submitLabels(id, labels, organizationId));
|
||||
history.push(`/templates/workflow_job_template/${id}/visualizer`);
|
||||
} catch (err) {
|
||||
|
||||
@ -6,7 +6,6 @@ import {
|
||||
WorkflowJobTemplatesAPI,
|
||||
OrganizationsAPI,
|
||||
LabelsAPI,
|
||||
ExecutionEnvironmentsAPI,
|
||||
UsersAPI,
|
||||
} from '../../../api';
|
||||
import {
|
||||
@ -38,10 +37,6 @@ describe('<WorkflowJobTemplateAdd/>', () => {
|
||||
},
|
||||
});
|
||||
|
||||
ExecutionEnvironmentsAPI.read.mockResolvedValueOnce({
|
||||
data: { results: [{ id: 1, name: 'Foo', image: 'localhost.com' }] },
|
||||
});
|
||||
|
||||
UsersAPI.readAdminOfOrganizations.mockResolvedValue({
|
||||
data: { count: 0, results: [] },
|
||||
});
|
||||
@ -94,11 +89,6 @@ describe('<WorkflowJobTemplateAdd/>', () => {
|
||||
.find('LabelSelect')
|
||||
.find('SelectToggle')
|
||||
.simulate('click');
|
||||
|
||||
wrapper.find('ExecutionEnvironmentLookup').invoke('onChange')({
|
||||
id: 1,
|
||||
name: 'Foo',
|
||||
});
|
||||
});
|
||||
|
||||
await act(async () => {
|
||||
@ -132,7 +122,6 @@ describe('<WorkflowJobTemplateAdd/>', () => {
|
||||
webhook_credential: undefined,
|
||||
webhook_service: '',
|
||||
webhook_url: '',
|
||||
execution_environment: 1,
|
||||
});
|
||||
|
||||
expect(WorkflowJobTemplatesAPI.associateLabel).toHaveBeenCalledTimes(1);
|
||||
|
||||
@ -139,18 +139,6 @@ function WorkflowJobTemplateDetail({ template }) {
|
||||
value={scmBranch}
|
||||
/>
|
||||
)}
|
||||
{summary_fields?.execution_environment && (
|
||||
<Detail
|
||||
label={t`Execution Environment`}
|
||||
value={
|
||||
<Link
|
||||
to={`/execution_environments/${summary_fields.execution_environment.id}/details`}
|
||||
>
|
||||
{summary_fields.execution_environment.name}
|
||||
</Link>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
<Detail label={t`Job Type`} value={toTitleCase(type)} />
|
||||
{summary_fields.inventory && (
|
||||
<Detail
|
||||
|
||||
@ -25,12 +25,6 @@ describe('<WorkflowJobTemplateDetail/>', () => {
|
||||
created_by: { id: 1, username: 'Athena' },
|
||||
modified_by: { id: 1, username: 'Apollo' },
|
||||
organization: { id: 1, name: 'Org' },
|
||||
execution_environment: {
|
||||
id: 4,
|
||||
name: 'Demo EE',
|
||||
description: '',
|
||||
image: 'quay.io/ansible/awx-ee',
|
||||
},
|
||||
inventory: { kind: 'Foo', id: 1, name: 'Bar' },
|
||||
labels: {
|
||||
results: [
|
||||
@ -49,7 +43,6 @@ describe('<WorkflowJobTemplateDetail/>', () => {
|
||||
},
|
||||
webhook_service: 'Github',
|
||||
webhook_key: 'Foo webhook key',
|
||||
execution_environment: 4,
|
||||
scm_branch: 'main',
|
||||
limit: 'servers',
|
||||
};
|
||||
@ -169,10 +162,6 @@ describe('<WorkflowJobTemplateDetail/>', () => {
|
||||
};
|
||||
|
||||
renderedValues.map(value => assertValue(value));
|
||||
|
||||
expect(
|
||||
wrapper.find(`Detail[label="Execution Environment"] dd`).text()
|
||||
).toBe('Demo EE');
|
||||
});
|
||||
|
||||
test('should have proper number of delete detail requests', async () => {
|
||||
|
||||
@ -26,13 +26,11 @@ function WorkflowJobTemplateEdit({ template }) {
|
||||
organization,
|
||||
webhook_credential,
|
||||
webhook_key,
|
||||
execution_environment,
|
||||
...templatePayload
|
||||
} = values;
|
||||
templatePayload.inventory = inventory?.id || null;
|
||||
templatePayload.organization = organization?.id || null;
|
||||
templatePayload.webhook_credential = webhook_credential?.id || null;
|
||||
templatePayload.execution_environment = execution_environment?.id || null;
|
||||
|
||||
const formOrgId =
|
||||
organization?.id || inventory?.summary_fields?.organization.id || null;
|
||||
|
||||
@ -6,7 +6,6 @@ import {
|
||||
WorkflowJobTemplatesAPI,
|
||||
OrganizationsAPI,
|
||||
LabelsAPI,
|
||||
ExecutionEnvironmentsAPI,
|
||||
UsersAPI,
|
||||
InventoriesAPI,
|
||||
} from '../../../api';
|
||||
@ -21,7 +20,6 @@ jest.mock('../../../util/useDebounce');
|
||||
jest.mock('../../../api/models/WorkflowJobTemplates');
|
||||
jest.mock('../../../api/models/Organizations');
|
||||
jest.mock('../../../api/models/Labels');
|
||||
jest.mock('../../../api/models/ExecutionEnvironments');
|
||||
jest.mock('../../../api/models/Users');
|
||||
jest.mock('../../../api/models/Inventories');
|
||||
|
||||
@ -30,12 +28,6 @@ const mockTemplate = {
|
||||
name: 'Foo',
|
||||
description: 'Foo description',
|
||||
summary_fields: {
|
||||
execution_environment: {
|
||||
id: 1,
|
||||
name: 'Default EE',
|
||||
description: '',
|
||||
image: 'quay.io/ansible/awx-ee',
|
||||
},
|
||||
inventory: { id: 1, name: 'Inventory 1' },
|
||||
organization: { id: 1, name: 'Organization 1' },
|
||||
labels: {
|
||||
@ -48,18 +40,8 @@ const mockTemplate = {
|
||||
scm_branch: 'devel',
|
||||
limit: '5000',
|
||||
variables: '---',
|
||||
execution_environment: 1,
|
||||
};
|
||||
|
||||
const mockExecutionEnvironment = [
|
||||
{
|
||||
id: 1,
|
||||
name: 'Default EE',
|
||||
description: '',
|
||||
image: 'quay.io/ansible/awx-ee',
|
||||
},
|
||||
];
|
||||
|
||||
describe('<WorkflowJobTemplateEdit/>', () => {
|
||||
let wrapper;
|
||||
let history;
|
||||
@ -92,16 +74,6 @@ describe('<WorkflowJobTemplateEdit/>', () => {
|
||||
data: { actions: { GET: {}, POST: {} } },
|
||||
});
|
||||
|
||||
ExecutionEnvironmentsAPI.read.mockResolvedValue({
|
||||
data: {
|
||||
results: mockExecutionEnvironment,
|
||||
count: 1,
|
||||
},
|
||||
});
|
||||
ExecutionEnvironmentsAPI.readOptions.mockResolvedValue({
|
||||
data: { actions: { GET: {}, POST: {} } },
|
||||
});
|
||||
|
||||
UsersAPI.readAdminOfOrganizations.mockResolvedValue({
|
||||
data: { count: 1, results: [{ id: 1, name: 'Default' }] },
|
||||
});
|
||||
@ -150,9 +122,6 @@ describe('<WorkflowJobTemplateEdit/>', () => {
|
||||
.find('SelectToggle')
|
||||
.simulate('click');
|
||||
wrapper.update();
|
||||
wrapper.find('TextInput#execution-environments-input').invoke('onChange')(
|
||||
''
|
||||
);
|
||||
wrapper.find('input#wfjt-description').simulate('change', {
|
||||
target: { value: 'main', name: 'scm_branch' },
|
||||
});
|
||||
@ -208,7 +177,6 @@ describe('<WorkflowJobTemplateEdit/>', () => {
|
||||
ask_limit_on_launch: false,
|
||||
ask_scm_branch_on_launch: false,
|
||||
ask_variables_on_launch: false,
|
||||
execution_environment: null,
|
||||
});
|
||||
wrapper.update();
|
||||
await expect(WorkflowJobTemplatesAPI.disassociateLabel).toBeCalledWith(6, {
|
||||
@ -255,12 +223,6 @@ describe('<WorkflowJobTemplateEdit/>', () => {
|
||||
name: 'Foo',
|
||||
description: 'Foo description',
|
||||
summary_fields: {
|
||||
execution_environment: {
|
||||
id: 1,
|
||||
name: 'Default EE',
|
||||
description: '',
|
||||
image: 'quay.io/ansible/awx-ee',
|
||||
},
|
||||
inventory: { id: 1, name: 'Inventory 1' },
|
||||
labels: {
|
||||
results: [
|
||||
@ -272,7 +234,6 @@ describe('<WorkflowJobTemplateEdit/>', () => {
|
||||
scm_branch: 'devel',
|
||||
limit: '5000',
|
||||
variables: '---',
|
||||
execution_environment: 1,
|
||||
};
|
||||
|
||||
let newWrapper;
|
||||
@ -319,7 +280,6 @@ describe('<WorkflowJobTemplateEdit/>', () => {
|
||||
ask_scm_branch_on_launch: false,
|
||||
ask_variables_on_launch: false,
|
||||
description: 'bar',
|
||||
execution_environment: 1,
|
||||
extra_vars: '---',
|
||||
inventory: 1,
|
||||
limit: '5000',
|
||||
|
||||
@ -19,10 +19,7 @@ import {
|
||||
SubFormLayout,
|
||||
} from '../../../components/FormLayout';
|
||||
import OrganizationLookup from '../../../components/Lookup/OrganizationLookup';
|
||||
import {
|
||||
InventoryLookup,
|
||||
ExecutionEnvironmentLookup,
|
||||
} from '../../../components/Lookup';
|
||||
import { InventoryLookup } from '../../../components/Lookup';
|
||||
import { VariablesField } from '../../../components/CodeEditor';
|
||||
import FormActionGroup from '../../../components/FormActionGroup';
|
||||
import ContentError from '../../../components/ContentError';
|
||||
@ -65,12 +62,6 @@ function WorkflowJobTemplateForm({
|
||||
'webhook_credential'
|
||||
);
|
||||
|
||||
const [
|
||||
executionEnvironmentField,
|
||||
executionEnvironmentMeta,
|
||||
executionEnvironmentHelpers,
|
||||
] = useField('execution_environment');
|
||||
|
||||
useEffect(() => {
|
||||
if (enableWebhooks) {
|
||||
webhookServiceHelpers.setValue(webhookServiceMeta.initialValue);
|
||||
@ -102,14 +93,6 @@ function WorkflowJobTemplateForm({
|
||||
[setFieldValue, setFieldTouched]
|
||||
);
|
||||
|
||||
const handleExecutionEnvironmentUpdate = useCallback(
|
||||
value => {
|
||||
setFieldValue('execution_environment', value);
|
||||
setFieldTouched('execution_environment', true, false);
|
||||
},
|
||||
[setFieldValue, setFieldTouched]
|
||||
);
|
||||
|
||||
if (hasContentError) {
|
||||
return <ContentError error={hasContentError} />;
|
||||
}
|
||||
@ -206,18 +189,6 @@ function WorkflowJobTemplateForm({
|
||||
aria-label={t`source control branch`}
|
||||
/>
|
||||
</FieldWithPrompt>
|
||||
<ExecutionEnvironmentLookup
|
||||
helperTextInvalid={executionEnvironmentMeta.error}
|
||||
isValid={
|
||||
!executionEnvironmentMeta.touched || !executionEnvironmentMeta.error
|
||||
}
|
||||
onBlur={() => executionEnvironmentHelpers.setTouched()}
|
||||
value={executionEnvironmentField.value}
|
||||
onChange={handleExecutionEnvironmentUpdate}
|
||||
tooltip={t`Select the default execution environment for this organization to run on.`}
|
||||
globallyAvailable
|
||||
organizationId={organizationField.value?.id}
|
||||
/>
|
||||
</FormColumnLayout>
|
||||
<FormFullWidthLayout>
|
||||
<FormGroup
|
||||
@ -332,8 +303,6 @@ const FormikApp = withFormik({
|
||||
? `${urlOrigin}${template.related.webhook_receiver}`
|
||||
: '',
|
||||
webhook_key: template.webhook_key || '',
|
||||
execution_environment:
|
||||
template.summary_fields?.execution_environment || null,
|
||||
};
|
||||
},
|
||||
handleSubmit: async (values, { props, setErrors }) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user