diff --git a/awx/ui_next/src/screens/Inventory/InventoryGroups/InventoryGroup/InventoryGroup.jsx b/awx/ui_next/src/screens/Inventory/InventoryGroups/InventoryGroup/InventoryGroup.jsx
index 9a4994c8fe..d665c19176 100644
--- a/awx/ui_next/src/screens/Inventory/InventoryGroups/InventoryGroup/InventoryGroup.jsx
+++ b/awx/ui_next/src/screens/Inventory/InventoryGroups/InventoryGroup/InventoryGroup.jsx
@@ -51,14 +51,24 @@ function InventoryGroups({ i18n, match, setBreadcrumb, inventory }) {
key="edit"
path="/inventories/inventory/:id/groups/:groupId/edit"
render={() => {
- return ;
+ return (
+
+ );
}}
/>,
{
- return ;
+ return (
+
+ );
}}
/>,
{
try {
await GroupsAPI.destroy(inventoryGroup.id);
@@ -29,10 +33,42 @@ function InventoryGroupDetail({ i18n, history, match, inventoryGroup }) {
setError(err);
}
};
-
if (error) {
return ;
}
+ if (isDeleteModalOpen) {
+ return (
+ setIsDeleteModalOpen(false)}
+ actions={[
+ ,
+ ,
+ ]}
+ >
+ {i18n._(t`Are you sure you want to delete:`)}
+
+ {inventoryGroup.name}
+
+
+ );
+ }
return (
@@ -41,23 +77,47 @@ function InventoryGroupDetail({ i18n, history, match, inventoryGroup }) {
label={i18n._(t`Description`)}
value={inventoryGroup.description}
/>
+
+ }
+ />
-
+ {i18n._(t`${formatDateString(inventoryGroup.created)} by`)}{' '}
+
+ {inventoryGroup.summary_fields.created_by.username}
+
+
+ }
/>
+ {i18n._(t`${formatDateString(inventoryGroup.modified)} by`)}{' '}
+
+ {inventoryGroup.summary_fields.modified_by.username}
+
+
+ }
/>
@@ -75,7 +135,7 @@ function InventoryGroupDetail({ i18n, history, match, inventoryGroup }) {
diff --git a/awx/ui_next/src/screens/Inventory/InventoryGroups/InventoryGroupDetail/InventoryGroupDetail.test.jsx b/awx/ui_next/src/screens/Inventory/InventoryGroups/InventoryGroupDetail/InventoryGroupDetail.test.jsx
index d1803d1928..2a762aa435 100644
--- a/awx/ui_next/src/screens/Inventory/InventoryGroups/InventoryGroupDetail/InventoryGroupDetail.test.jsx
+++ b/awx/ui_next/src/screens/Inventory/InventoryGroups/InventoryGroupDetail/InventoryGroupDetail.test.jsx
@@ -13,14 +13,16 @@ const inventoryGroup = {
description: 'Bar',
variables: 'bizz: buzz',
id: 1,
- created: '10:00',
- modified: '12:00',
+ created: '2019-12-02T15:58:16.276813Z',
+ modified: '2019-12-03T20:33:46.207654Z',
summary_fields: {
created_by: {
username: 'James',
+ id: 13,
},
modified_by: {
username: 'Bond',
+ id: 14,
},
},
};
@@ -49,8 +51,10 @@ describe('', () => {
test('InventoryGroupDetail renders successfully', () => {
expect(wrapper.length).toBe(1);
});
- test('should call api to delete the group', () => {
+ test('should open delete modal and then call api to delete the group', () => {
wrapper.find('button[aria-label="Delete"]').simulate('click');
+ expect(wrapper.find('Modal').length).toBe(1);
+ wrapper.find('button[aria-label="confirm delete"]').simulate('click');
expect(GroupsAPI.destroy).toBeCalledWith(1);
});
test('should navigate user to edit form on edit button click', async () => {
@@ -67,12 +71,8 @@ describe('', () => {
expect(wrapper.find('Detail[label="Description"]').prop('value')).toBe(
'Bar'
);
- expect(wrapper.find('Detail[label="Created"]').prop('value')).toBe(
- '10:00 by James'
- );
- expect(wrapper.find('Detail[label="Modified"]').prop('value')).toBe(
- '12:00 by Bond'
- );
+ expect(wrapper.find('Detail[label="Created"]').length).toBe(1);
+ expect(wrapper.find('Detail[label="Modified"]').length).toBe(1);
expect(wrapper.find('VariablesInput').prop('value')).toBe('bizz: buzz');
});
});
diff --git a/awx/ui_next/src/screens/Inventory/InventoryGroups/InventoryGroupForm/InventoryGroupForm.jsx b/awx/ui_next/src/screens/Inventory/InventoryGroups/InventoryGroupForm/InventoryGroupForm.jsx
index 0ae49c22d4..f6dea49aee 100644
--- a/awx/ui_next/src/screens/Inventory/InventoryGroups/InventoryGroupForm/InventoryGroupForm.jsx
+++ b/awx/ui_next/src/screens/Inventory/InventoryGroups/InventoryGroupForm/InventoryGroupForm.jsx
@@ -2,10 +2,9 @@ import React from 'react';
import { withRouter } from 'react-router-dom';
import { withI18n } from '@lingui/react';
import { Formik } from 'formik';
-import { Form, Card, CardBody, CardHeader } from '@patternfly/react-core';
+import { Form, Card, CardBody } from '@patternfly/react-core';
import { t } from '@lingui/macro';
-import CardCloseButton from '@components/CardCloseButton';
import FormRow from '@components/FormRow';
import FormField from '@components/FormField';
import FormActionGroup from '@components/FormActionGroup/FormActionGroup';
@@ -18,7 +17,6 @@ function InventoryGroupForm({
group = {},
handleSubmit,
handleCancel,
- match,
}) {
const initialValues = {
name: group.name || '',
@@ -28,11 +26,6 @@ function InventoryGroupForm({
return (
-
-
-