mirror of
https://github.com/ansible/awx.git
synced 2026-02-13 14:46:54 -03:30
Add organization to EE details page
Add organization to EE details page. See: https://github.com/ansible/awx/issues/9432
This commit is contained in:
@@ -18,7 +18,15 @@ import { ExecutionEnvironmentsAPI } from '../../../api';
|
|||||||
|
|
||||||
function ExecutionEnvironmentDetails({ executionEnvironment, i18n }) {
|
function ExecutionEnvironmentDetails({ executionEnvironment, i18n }) {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const { id, name, image, description, pull } = executionEnvironment;
|
const {
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
image,
|
||||||
|
description,
|
||||||
|
pull,
|
||||||
|
organization,
|
||||||
|
summary_fields,
|
||||||
|
} = executionEnvironment;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
request: deleteExecutionEnvironment,
|
request: deleteExecutionEnvironment,
|
||||||
@@ -51,6 +59,21 @@ function ExecutionEnvironmentDetails({ executionEnvironment, i18n }) {
|
|||||||
value={description}
|
value={description}
|
||||||
dataCy="execution-environment-detail-description"
|
dataCy="execution-environment-detail-description"
|
||||||
/>
|
/>
|
||||||
|
<Detail
|
||||||
|
label={i18n._(t`Organization`)}
|
||||||
|
value={
|
||||||
|
organization ? (
|
||||||
|
<Link
|
||||||
|
to={`/organizations/${summary_fields.organization.id}/details`}
|
||||||
|
>
|
||||||
|
{summary_fields.organization.name}
|
||||||
|
</Link>
|
||||||
|
) : (
|
||||||
|
i18n._(t`Globally Available`)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
dataCy="execution-environment-detail-organization"
|
||||||
|
/>
|
||||||
<Detail
|
<Detail
|
||||||
label={i18n._(t`Pull`)}
|
label={i18n._(t`Pull`)}
|
||||||
value={pull === '' ? i18n._(t`Missing`) : toTitleCase(pull)}
|
value={pull === '' ? i18n._(t`Missing`) : toTitleCase(pull)}
|
||||||
|
|||||||
@@ -67,6 +67,45 @@ describe('<ExecutionEnvironmentDetails/>', () => {
|
|||||||
expect(wrapper.find('Detail[label="Description"]').prop('value')).toEqual(
|
expect(wrapper.find('Detail[label="Description"]').prop('value')).toEqual(
|
||||||
'Foo'
|
'Foo'
|
||||||
);
|
);
|
||||||
|
expect(wrapper.find('Detail[label="Organization"]').prop('value')).toEqual(
|
||||||
|
'Globally Available'
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
wrapper.find('Detail[label="Credential"]').prop('value').props.children
|
||||||
|
).toEqual(executionEnvironment.summary_fields.credential.name);
|
||||||
|
const dates = wrapper.find('UserDateDetail');
|
||||||
|
expect(dates).toHaveLength(2);
|
||||||
|
expect(dates.at(0).prop('date')).toEqual(executionEnvironment.created);
|
||||||
|
expect(dates.at(1).prop('date')).toEqual(executionEnvironment.modified);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should render organization detail', async () => {
|
||||||
|
await act(async () => {
|
||||||
|
wrapper = mountWithContexts(
|
||||||
|
<ExecutionEnvironmentDetails
|
||||||
|
executionEnvironment={{
|
||||||
|
...executionEnvironment,
|
||||||
|
organization: 1,
|
||||||
|
summary_fields: {
|
||||||
|
organization: { id: 1, name: 'Bar' },
|
||||||
|
credential: {
|
||||||
|
id: 4,
|
||||||
|
name: 'Container Registry',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
wrapper.update();
|
||||||
|
|
||||||
|
expect(wrapper.find('Detail[label="Image"]').prop('value')).toEqual(
|
||||||
|
executionEnvironment.image
|
||||||
|
);
|
||||||
|
expect(wrapper.find('Detail[label="Description"]').prop('value')).toEqual(
|
||||||
|
'Foo'
|
||||||
|
);
|
||||||
|
expect(wrapper.find(`Detail[label="Organization"] dd`).text()).toBe('Bar');
|
||||||
expect(
|
expect(
|
||||||
wrapper.find('Detail[label="Credential"]').prop('value').props.children
|
wrapper.find('Detail[label="Credential"]').prop('value').props.children
|
||||||
).toEqual(executionEnvironment.summary_fields.credential.name);
|
).toEqual(executionEnvironment.summary_fields.credential.name);
|
||||||
|
|||||||
Reference in New Issue
Block a user