mirror of
https://github.com/ansible/awx.git
synced 2026-04-11 04:59:22 -02:30
Add column org to template list
Add column org to template list See: https://github.com/ansible/awx/issues/11795
This commit is contained in:
@@ -241,6 +241,7 @@ function TemplateList({ defaultParams }) {
|
|||||||
<HeaderRow qsConfig={qsConfig} isExpandable>
|
<HeaderRow qsConfig={qsConfig} isExpandable>
|
||||||
<HeaderCell sortKey="name">{t`Name`}</HeaderCell>
|
<HeaderCell sortKey="name">{t`Name`}</HeaderCell>
|
||||||
<HeaderCell sortKey="type">{t`Type`}</HeaderCell>
|
<HeaderCell sortKey="type">{t`Type`}</HeaderCell>
|
||||||
|
<HeaderCell sortKey="organization">{t`Organization`}</HeaderCell>
|
||||||
<HeaderCell sortKey="last_job_run">{t`Last Ran`}</HeaderCell>
|
<HeaderCell sortKey="last_job_run">{t`Last Ran`}</HeaderCell>
|
||||||
<HeaderCell>{t`Actions`}</HeaderCell>
|
<HeaderCell>{t`Actions`}</HeaderCell>
|
||||||
</HeaderRow>
|
</HeaderRow>
|
||||||
|
|||||||
@@ -182,6 +182,15 @@ function TemplateListItem({
|
|||||||
)}
|
)}
|
||||||
</TdBreakWord>
|
</TdBreakWord>
|
||||||
<Td dataLabel={t`Type`}>{toTitleCase(template.type)}</Td>
|
<Td dataLabel={t`Type`}>{toTitleCase(template.type)}</Td>
|
||||||
|
<Td dataLabel={t`Organization`}>
|
||||||
|
{summaryFields.organization ? (
|
||||||
|
<Link
|
||||||
|
to={`/organizations/${summaryFields.organization.id}/details`}
|
||||||
|
>
|
||||||
|
{summaryFields.organization.name}
|
||||||
|
</Link>
|
||||||
|
) : null}
|
||||||
|
</Td>
|
||||||
<Td dataLabel={t`Last Ran`}>{lastRun}</Td>
|
<Td dataLabel={t`Last Ran`}>{lastRun}</Td>
|
||||||
<ActionsTd dataLabel={t`Actions`}>
|
<ActionsTd dataLabel={t`Actions`}>
|
||||||
<ActionItem
|
<ActionItem
|
||||||
@@ -270,19 +279,6 @@ function TemplateListItem({
|
|||||||
dataCy={`template-${template.id}-activity`}
|
dataCy={`template-${template.id}-activity`}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
{summaryFields.organization && (
|
|
||||||
<Detail
|
|
||||||
label={t`Organization`}
|
|
||||||
value={
|
|
||||||
<Link
|
|
||||||
to={`/organizations/${summaryFields.organization.id}/details`}
|
|
||||||
>
|
|
||||||
{summaryFields.organization.name}
|
|
||||||
</Link>
|
|
||||||
}
|
|
||||||
dataCy={`template-${template.id}-organization`}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{summaryFields.inventory ? (
|
{summaryFields.inventory ? (
|
||||||
<Detail
|
<Detail
|
||||||
label={t`Inventory`}
|
label={t`Inventory`}
|
||||||
|
|||||||
@@ -10,6 +10,50 @@ import TemplateListItem from './TemplateListItem';
|
|||||||
jest.mock('../../api');
|
jest.mock('../../api');
|
||||||
|
|
||||||
describe('<TemplateListItem />', () => {
|
describe('<TemplateListItem />', () => {
|
||||||
|
test('should display expected data', () => {
|
||||||
|
const wrapper = mountWithContexts(
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
<TemplateListItem
|
||||||
|
isSelected={false}
|
||||||
|
template={{
|
||||||
|
id: 1,
|
||||||
|
name: 'Template 1',
|
||||||
|
url: '/templates/job_template/1',
|
||||||
|
type: 'job_template',
|
||||||
|
summary_fields: {
|
||||||
|
organization: {
|
||||||
|
id: 1,
|
||||||
|
name: 'Foo',
|
||||||
|
},
|
||||||
|
user_capabilities: {
|
||||||
|
start: true,
|
||||||
|
},
|
||||||
|
recent_jobs: [
|
||||||
|
{
|
||||||
|
id: 123,
|
||||||
|
name: 'Template 1',
|
||||||
|
status: 'failed',
|
||||||
|
finished: '2020-02-26T22:38:41.037991Z',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
);
|
||||||
|
expect(wrapper.find('Td[dataLabel="Name"]').text()).toBe('Template 1');
|
||||||
|
expect(wrapper.find('Td[dataLabel="Type"]').text()).toBe('Job Template');
|
||||||
|
expect(wrapper.find('Td[dataLabel="Organization"]').text()).toBe('Foo');
|
||||||
|
expect(
|
||||||
|
wrapper.find('Td[dataLabel="Organization"]').find('Link').prop('to')
|
||||||
|
).toBe('/organizations/1/details');
|
||||||
|
expect(wrapper.find('Td[dataLabel="Last Ran"]').text()).toBe(
|
||||||
|
'2/26/2020, 10:38:41 PM'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
test('launch button shown to users with start capabilities', () => {
|
test('launch button shown to users with start capabilities', () => {
|
||||||
const wrapper = mountWithContexts(
|
const wrapper = mountWithContexts(
|
||||||
<table>
|
<table>
|
||||||
@@ -401,7 +445,6 @@ describe('<TemplateListItem />', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
assertDetail('Description', 'mock description');
|
assertDetail('Description', 'mock description');
|
||||||
assertDetail('Organization', "Mike's Org");
|
|
||||||
assertDetail('Inventory', "Mike's Inventory");
|
assertDetail('Inventory', "Mike's Inventory");
|
||||||
assertDetail('Project', "Mike's Project");
|
assertDetail('Project', "Mike's Project");
|
||||||
assertDetail('Execution Environment', 'Mock EE 1.2.3');
|
assertDetail('Execution Environment', 'Mock EE 1.2.3');
|
||||||
@@ -420,9 +463,6 @@ describe('<TemplateListItem />', () => {
|
|||||||
.find('Detail[label="Labels"]')
|
.find('Detail[label="Labels"]')
|
||||||
.containsAllMatchingElements([<span>L_91o2</span>])
|
.containsAllMatchingElements([<span>L_91o2</span>])
|
||||||
).toEqual(true);
|
).toEqual(true);
|
||||||
expect(wrapper.find('Detail[label="Organization"] dd a').prop('href')).toBe(
|
|
||||||
'/organizations/1/details'
|
|
||||||
);
|
|
||||||
expect(wrapper.find(`Detail[label="Activity"] Sparkline`)).toHaveLength(1);
|
expect(wrapper.find(`Detail[label="Activity"] Sparkline`)).toHaveLength(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user