diff --git a/awx/main/conf.py b/awx/main/conf.py
index cfe7ebe80d..36bd121055 100644
--- a/awx/main/conf.py
+++ b/awx/main/conf.py
@@ -687,7 +687,7 @@ register(
register(
'AUTOMATION_ANALYTICS_LAST_ENTRIES',
field_class=fields.CharField,
- label=_('Last gathered entries for expensive collectors for Insights for Ansible Automation Platform.'),
+ label=_('Last gathered entries from the data collection service of Insights for Ansible Automation Platform'),
default='',
allow_blank=True,
category=_('System'),
diff --git a/awx/ui/src/screens/Setting/MiscSystem/MiscSystemDetail/MiscSystemDetail.js b/awx/ui/src/screens/Setting/MiscSystem/MiscSystemDetail/MiscSystemDetail.js
index a20c8cebce..d5c9ddb10f 100644
--- a/awx/ui/src/screens/Setting/MiscSystem/MiscSystemDetail/MiscSystemDetail.js
+++ b/awx/ui/src/screens/Setting/MiscSystem/MiscSystemDetail/MiscSystemDetail.js
@@ -5,6 +5,7 @@ import { t } from '@lingui/macro';
import { Button } from '@patternfly/react-core';
import { CaretLeftIcon } from '@patternfly/react-icons';
import { CardBody, CardActionsRow } from 'components/Card';
+import CodeDetail from 'components/DetailList/CodeDetail';
import ContentError from 'components/ContentError';
import ContentLoading from 'components/ContentLoading';
import { DetailList } from 'components/DetailList';
@@ -14,7 +15,11 @@ import useRequest from 'hooks/useRequest';
import { useConfig } from 'contexts/Config';
import { useSettings } from 'contexts/Settings';
import { SettingDetail } from '../../shared';
-import { sortNestedDetails, pluck } from '../../shared/settingUtils';
+import {
+ formatJson,
+ pluck,
+ sortNestedDetails,
+} from '../../shared/settingUtils';
function MiscSystemDetail() {
const { me } = useConfig();
@@ -62,7 +67,12 @@ function MiscSystemDetail() {
const mergedData = {};
Object.keys(systemData).forEach((key) => {
mergedData[key] = options[key];
- mergedData[key].value = systemData[key];
+
+ if (key === 'AUTOMATION_ANALYTICS_LAST_ENTRIES') {
+ mergedData[key].value = formatJson(systemData[key]) ?? '';
+ } else {
+ mergedData[key].value = systemData[key];
+ }
});
return sortNestedDetails(mergedData);
}, [options]),
@@ -91,6 +101,11 @@ function MiscSystemDetail() {
},
];
+ // Display this detail in a code editor for readability
+ if (options?.AUTOMATION_ANALYTICS_LAST_ENTRIES) {
+ options.AUTOMATION_ANALYTICS_LAST_ENTRIES.type = 'nested object';
+ }
+
return (
<>
@@ -99,17 +114,36 @@ function MiscSystemDetail() {
{!isLoading && error && }
{!isLoading && system && (
- {system.map(([key, detail]) => (
-
- ))}
+ {system.map(([key, detail]) => {
+ if (key === 'AUTOMATION_ANALYTICS_LAST_ENTRIES') {
+ return (
+
+ );
+ }
+ return (
+
+ );
+ })}
)}
{me?.is_superuser && (
diff --git a/awx/ui/src/screens/Setting/MiscSystem/MiscSystemDetail/MiscSystemDetail.test.js b/awx/ui/src/screens/Setting/MiscSystem/MiscSystemDetail/MiscSystemDetail.test.js
index fb0e123cad..5993878f63 100644
--- a/awx/ui/src/screens/Setting/MiscSystem/MiscSystemDetail/MiscSystemDetail.test.js
+++ b/awx/ui/src/screens/Setting/MiscSystem/MiscSystemDetail/MiscSystemDetail.test.js
@@ -40,7 +40,8 @@ describe('', () => {
CUSTOM_VENV_PATHS: [],
INSIGHTS_TRACKING_STATE: false,
AUTOMATION_ANALYTICS_LAST_GATHER: null,
- AUTOMATION_ANALYTICS_LAST_ENTRIES: 'foo',
+ AUTOMATION_ANALYTICS_LAST_ENTRIES:
+ '{"foo": "2021-11-24R06:35:15.179Z"}',
AUTOMATION_ANALYTICS_GATHER_INTERVAL: 14400,
},
});
@@ -80,11 +81,6 @@ describe('', () => {
'Unique identifier for an installation',
'db39b9ec-0c6e-4554-987d-42aw9c732ed8'
);
- assertDetail(
- wrapper,
- 'Last gathered entries for expensive collectors for Insights for Ansible Automation Platform.',
- 'foo'
- );
assertDetail(wrapper, 'All Users Visible to Organization Admins', 'On');
assertDetail(
wrapper,
@@ -113,6 +109,11 @@ describe('', () => {
assertDetail(wrapper, 'Red Hat customer username', 'name1');
assertDetail(wrapper, 'Red Hat or Satellite password', 'Encrypted');
assertDetail(wrapper, 'Red Hat or Satellite username', 'name2');
+ assertVariableDetail(
+ wrapper,
+ 'Last gathered entries from the data collection service of Insights for Ansible Automation Platform',
+ '{\n "foo": "2021-11-24R06:35:15.179Z"\n}'
+ );
assertVariableDetail(wrapper, 'Remote Host Headers', '[]');
assertVariableDetail(wrapper, 'Proxy IP Allowed List', '[]');
assertDetail(wrapper, 'Global default execution environment', 'Foo');
diff --git a/awx/ui/src/screens/Setting/MiscSystem/MiscSystemEdit/MiscSystemEdit.js b/awx/ui/src/screens/Setting/MiscSystem/MiscSystemEdit/MiscSystemEdit.js
index 31d3dc14e7..4cb9604cb4 100644
--- a/awx/ui/src/screens/Setting/MiscSystem/MiscSystemEdit/MiscSystemEdit.js
+++ b/awx/ui/src/screens/Setting/MiscSystem/MiscSystemEdit/MiscSystemEdit.js
@@ -222,9 +222,10 @@ function MiscSystemEdit() {
type="number"
isRequired
/>
-
{
+const ObjectField = ({ name, config, revertValue, isRequired = false }) => {
const validate = isRequired ? required(null) : null;
const [field, meta, helpers] = useField({ name, validate });
const isValid = !(meta.touched && meta.error);
@@ -446,7 +446,7 @@ const ObjectField = ({ name, config, isRequired = false }) => {
return config ? (