Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Do not merge] Remove EE field from Project related screens #9721

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ import { Config } from '../../contexts/Config';
import { Detail, DeletedDetail } from '../DetailList';
import CredentialChip from '../CredentialChip';
import { toTitleCase } from '../../util/strings';
import ExecutionEnvironmentDetail from '../ExecutionEnvironmentDetail';

function PromptProjectDetail({ i18n, resource }) {
const {
allow_override,
custom_virtualenv,
local_path,
scm_branch,
scm_clean,
Expand Down Expand Up @@ -65,11 +63,6 @@ function PromptProjectDetail({ i18n, resource }) {
) : (
<DeletedDetail label={i18n._(t`Organization`)} />
)}
<ExecutionEnvironmentDetail
virtualEnvironment={custom_virtualenv}
executionEnvironment={summary_fields?.default_environment}
isDefaultEnvironment
/>
<Detail
label={i18n._(t`Source Control Type`)}
value={scm_type === '' ? i18n._(t`Manual`) : toTitleCase(scm_type)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,6 @@ describe('PromptProjectDetail', () => {
assertDetail(wrapper, 'Project Base Path', 'dir/foo/bar');
assertDetail(wrapper, 'Playbook Directory', '_6__demo_project');
assertDetail(wrapper, 'Source Control Credential', 'Scm: mock scm');
const executionEnvironment = wrapper.find('ExecutionEnvironmentDetail');
expect(executionEnvironment).toHaveLength(1);
expect(executionEnvironment.find('dt').text()).toEqual(
'Default Execution Environment'
);
expect(executionEnvironment.find('dd').text()).toEqual(
mockProject.summary_fields.default_environment.name
);
expect(
wrapper
.find('Detail[label="Options"]')
Expand Down
10 changes: 1 addition & 9 deletions awx/ui_next/src/components/PromptDetail/data.project.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@
"name":"Default",
"description":""
},
"default_environment": {
"id": 1,
"name": "Default EE",
"description": "",
"image": "quay.io/ansible/awx-ee"
},
"credential": {
"id": 9,
"name": "mock scm",
Expand Down Expand Up @@ -107,8 +101,6 @@
"scm_update_on_launch":true,
"scm_update_cache_timeout":3,
"allow_override":true,
"custom_virtualenv": "mock virtual env",
"last_update_failed":false,
"last_updated":"2020-03-11T20:18:14Z",
"default_environment": 1
"last_updated":"2020-03-11T20:18:14Z"
}
1 change: 0 additions & 1 deletion awx/ui_next/src/screens/Project/ProjectAdd/ProjectAdd.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ function ProjectAdd() {
} = await ProjectsAPI.create({
...values,
organization: values.organization.id,
default_environment: values.default_environment?.id,
});
history.push(`/projects/${id}/details`);
} catch (error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ describe('<ProjectAdd />', () => {
scm_update_on_launch: true,
scm_update_cache_timeout: 3,
allow_override: false,
custom_virtualenv: '/var/lib/awx/venv/custom-env',
default_environment: { id: 1, name: 'Foo' },
};

const projectOptionsResolve = {
Expand Down Expand Up @@ -106,7 +104,6 @@ describe('<ProjectAdd />', () => {
expect(ProjectsAPI.create).toHaveBeenCalledWith({
...projectData,
organization: 2,
default_environment: 1,
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
UserDateDetail,
} from '../../../components/DetailList';
import ErrorDetail from '../../../components/ErrorDetail';
import ExecutionEnvironmentDetail from '../../../components/ExecutionEnvironmentDetail';
import CredentialChip from '../../../components/CredentialChip';
import { ProjectsAPI } from '../../../api';
import { toTitleCase } from '../../../util/strings';
Expand All @@ -27,7 +26,6 @@ function ProjectDetail({ project, i18n }) {
const {
allow_override,
created,
custom_virtualenv,
description,
id,
local_path,
Expand Down Expand Up @@ -129,11 +127,6 @@ function ProjectDetail({ project, i18n }) {
label={i18n._(t`Cache Timeout`)}
value={`${scm_update_cache_timeout} ${i18n._(t`Seconds`)}`}
/>
<ExecutionEnvironmentDetail
virtualEnvironment={custom_virtualenv}
executionEnvironment={summary_fields?.default_environment}
isDefaultEnvironment
/>
<Config>
{({ project_base_dir }) => (
<Detail
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ describe('<ProjectDetail />', () => {
id: 10,
name: 'Foo',
},
default_environment: {
id: 12,
name: 'Bar',
image: 'quay.io/ansible/awx-ee',
},
credential: {
id: 1000,
name: 'qux',
Expand Down Expand Up @@ -76,8 +71,6 @@ describe('<ProjectDetail />', () => {
scm_update_on_launch: true,
scm_update_cache_timeout: 5,
allow_override: true,
custom_virtualenv: '/custom-venv',
default_environment: 1,
};

test('initially renders successfully', () => {
Expand Down Expand Up @@ -105,15 +98,6 @@ describe('<ProjectDetail />', () => {
'Cache Timeout',
`${mockProject.scm_update_cache_timeout} Seconds`
);
const executionEnvironment = wrapper.find('ExecutionEnvironmentDetail');
expect(executionEnvironment).toHaveLength(1);
expect(executionEnvironment.find('dt').text()).toEqual(
'Default Execution Environment'
);
expect(executionEnvironment.find('dd').text()).toEqual(
mockProject.summary_fields.default_environment.name
);

const dateDetails = wrapper.find('UserDateDetail');
expect(dateDetails).toHaveLength(2);
expect(dateDetails.at(0).prop('label')).toEqual('Created');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ function ProjectEdit({ project }) {
} = await ProjectsAPI.update(project.id, {
...values,
organization: values.organization.id,
default_environment: values.default_environment?.id || null,
});
history.push(`/projects/${id}/details`);
} catch (error) {
Expand Down
30 changes: 0 additions & 30 deletions awx/ui_next/src/screens/Project/shared/ProjectForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import ContentLoading from '../../../components/ContentLoading';
import FormActionGroup from '../../../components/FormActionGroup/FormActionGroup';
import FormField, { FormSubmitError } from '../../../components/FormField';
import OrganizationLookup from '../../../components/Lookup/OrganizationLookup';
import ExecutionEnvironmentLookup from '../../../components/Lookup/ExecutionEnvironmentLookup';
import { CredentialTypesAPI, ProjectsAPI } from '../../../api';
import { required } from '../../../util/validators';
import {
Expand Down Expand Up @@ -100,14 +99,6 @@ function ProjectFormFields({
validate: required(i18n._(t`Select a value for this field`), i18n),
});

const [
executionEnvironmentField,
executionEnvironmentMeta,
executionEnvironmentHelpers,
] = useField({
name: 'default_environment',
});

/* Save current scm subform field values to state */
const saveSubFormState = form => {
const currentScmFormFields = { ...scmFormFields };
Expand Down Expand Up @@ -185,25 +176,6 @@ function ProjectFormFields({
required
autoPopulate={!project?.id}
/>
<ExecutionEnvironmentLookup
helperTextInvalid={executionEnvironmentMeta.error}
isValid={
!executionEnvironmentMeta.touched || !executionEnvironmentMeta.error
}
onBlur={() => executionEnvironmentHelpers.setTouched()}
value={executionEnvironmentField.value}
onChange={value => executionEnvironmentHelpers.setValue(value)}
popoverContent={i18n._(
t`Select the default execution environment for this project.`
)}
tooltip={i18n._(
t`Select an organization before editing the default execution environment.`
)}
globallyAvailable
isDisabled={!organizationField.value}
organizationId={organizationField.value?.id}
isDefaultEnvironment
/>
<FormGroup
fieldId="project-scm-type"
helperTextInvalid={scmTypeMeta.error}
Expand Down Expand Up @@ -376,8 +348,6 @@ function ProjectForm({ i18n, project, submitError, ...props }) {
scm_update_cache_timeout: project.scm_update_cache_timeout || 0,
scm_update_on_launch: project.scm_update_on_launch || false,
scm_url: project.scm_url || '',
default_environment:
project.summary_fields?.default_environment || null,
}}
onSubmit={handleSubmit}
>
Expand Down