diff --git a/awx/ui_next/src/components/TemplateList/TemplateListItem.jsx b/awx/ui_next/src/components/TemplateList/TemplateListItem.jsx
index 70c0076fd2..ac14dd281c 100644
--- a/awx/ui_next/src/components/TemplateList/TemplateListItem.jsx
+++ b/awx/ui_next/src/components/TemplateList/TemplateListItem.jsx
@@ -225,25 +225,27 @@ function TemplateListItem({
+
}
dataCy={`template-${template.id}-activity`}
/>
- {summaryFields.credentials && summaryFields.credentials.length && (
+ {summaryFields.organization && (
- {summaryFields.credentials.map(c => (
-
- ))}
-
+ {summaryFields.organization.name}
+
}
- dataCy={`template-${template.id}-credentials`}
+ dataCy={`template-${template.id}-organization`}
/>
)}
{summaryFields.inventory ? (
@@ -260,24 +262,6 @@ function TemplateListItem({
)
)}
- {summaryFields.labels && summaryFields.labels.results.length > 0 && (
-
- {summaryFields.labels.results.map(l => (
-
- {l.name}
-
- ))}
-
- }
- dataCy={`template-${template.id}-labels`}
- />
- )}
{summaryFields.project && (
+ {summaryFields.credentials && summaryFields.credentials.length && (
+
+ {summaryFields.credentials.map(c => (
+
+ ))}
+
+ }
+ dataCy={`template-${template.id}-credentials`}
+ />
+ )}
+ {summaryFields.labels && summaryFields.labels.results.length > 0 && (
+
+ {summaryFields.labels.results.map(l => (
+
+ {l.name}
+
+ ))}
+
+ }
+ dataCy={`template-${template.id}-labels`}
+ />
+ )}
|
diff --git a/awx/ui_next/src/components/TemplateList/TemplateListItem.test.jsx b/awx/ui_next/src/components/TemplateList/TemplateListItem.test.jsx
index a86512af09..79945665cd 100644
--- a/awx/ui_next/src/components/TemplateList/TemplateListItem.test.jsx
+++ b/awx/ui_next/src/components/TemplateList/TemplateListItem.test.jsx
@@ -377,4 +377,66 @@ describe('', () => {
'Custom virtual environment /var/lib/awx/env must be replaced by an execution environment.'
);
});
+
+ test('should render expected details in expanded section', async () => {
+ const wrapper = mountWithContexts(
+
+ );
+ expect(
+ wrapper
+ .find('Tr')
+ .last()
+ .prop('isExpanded')
+ ).toBe(false);
+ await act(async () =>
+ wrapper.find('button[aria-label="Details"]').simulate('click')
+ );
+ wrapper.update();
+ expect(
+ wrapper
+ .find('Tr')
+ .last()
+ .prop('isExpanded')
+ ).toBe(true);
+
+ function assertDetail(label, value) {
+ expect(wrapper.find(`Detail[label="${label}"] dt`).text()).toBe(label);
+ expect(wrapper.find(`Detail[label="${label}"] dd`).text()).toBe(value);
+ }
+
+ assertDetail('Description', 'mock description');
+ assertDetail('Organization', "Mike's Org");
+ assertDetail('Inventory', "Mike's Inventory");
+ assertDetail('Project', "Mike's Project");
+ expect(
+ wrapper.find('Detail[label="Credentials"]').containsAllMatchingElements([
+
+ SSH:Credential 1
+ ,
+
+ Awx:Credential 2
+ ,
+ ])
+ ).toEqual(true);
+ expect(
+ wrapper
+ .find('Detail[label="Labels"]')
+ .containsAllMatchingElements([L_91o2])
+ ).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);
+ });
});
diff --git a/awx/ui_next/src/components/TemplateList/data.job_template.json b/awx/ui_next/src/components/TemplateList/data.job_template.json
index 804c3b72a2..ff5994da47 100644
--- a/awx/ui_next/src/components/TemplateList/data.job_template.json
+++ b/awx/ui_next/src/components/TemplateList/data.job_template.json
@@ -28,6 +28,11 @@
"webhook_key": "/api/v2/job_templates/7/webhook_key/"
},
"summary_fields": {
+ "organization": {
+ "id": 1,
+ "name": "Mike's Org",
+ "description": ""
+ },
"inventory": {
"id": 1,
"name": "Mike's Inventory",