diff --git a/awx/ui/src/screens/Setting/LDAP/LDAPDetail/LDAPDetail.test.js b/awx/ui/src/screens/Setting/LDAP/LDAPDetail/LDAPDetail.test.js index a5fba4d2b9..d70011b733 100644 --- a/awx/ui/src/screens/Setting/LDAP/LDAPDetail/LDAPDetail.test.js +++ b/awx/ui/src/screens/Setting/LDAP/LDAPDetail/LDAPDetail.test.js @@ -91,7 +91,7 @@ describe('', () => { assertVariableDetail( wrapper, 'LDAP Group Type Parameters', - '{\n "name_attr": "cn",\n "member_attr": "member"\n}' + '{\n "member_attr": "member",\n "name_attr": "cn"\n}' ); assertVariableDetail(wrapper, 'LDAP User Flags By Group', '{}'); assertVariableDetail(wrapper, 'LDAP Organization Map', '{}'); diff --git a/awx/ui/src/screens/Setting/MiscAuthentication/MiscAuthenticationDetail/MiscAuthenticationDetail.test.js b/awx/ui/src/screens/Setting/MiscAuthentication/MiscAuthenticationDetail/MiscAuthenticationDetail.test.js index 70c1a368f9..dd17494386 100644 --- a/awx/ui/src/screens/Setting/MiscAuthentication/MiscAuthenticationDetail/MiscAuthenticationDetail.test.js +++ b/awx/ui/src/screens/Setting/MiscAuthentication/MiscAuthenticationDetail/MiscAuthenticationDetail.test.js @@ -68,7 +68,7 @@ describe('', () => { assertVariableDetail( wrapper, 'OAuth 2 Timeout Settings', - '{\n "ACCESS_TOKEN_EXPIRE_SECONDS": 31536000000,\n "REFRESH_TOKEN_EXPIRE_SECONDS": 2628000,\n "AUTHORIZATION_CODE_EXPIRE_SECONDS": 600\n}' + '{\n "ACCESS_TOKEN_EXPIRE_SECONDS": 31536000000,\n "AUTHORIZATION_CODE_EXPIRE_SECONDS": 600,\n "REFRESH_TOKEN_EXPIRE_SECONDS": 2628000\n}' ); assertDetail(wrapper, 'Login redirect override URL', 'https://foohost'); assertVariableDetail( diff --git a/awx/ui/src/screens/Setting/shared/SettingDetail.js b/awx/ui/src/screens/Setting/shared/SettingDetail.js index ddb121e89c..dca91d0cef 100644 --- a/awx/ui/src/screens/Setting/shared/SettingDetail.js +++ b/awx/ui/src/screens/Setting/shared/SettingDetail.js @@ -4,6 +4,19 @@ import { t } from '@lingui/macro'; import { Detail } from 'components/DetailList'; import CodeDetail from 'components/DetailList/CodeDetail'; +function sortObj(obj) { + if (typeof obj !== 'object' || Array.isArray(obj)) { + return obj; + } + const sorted = {}; + Object.keys(obj) + .sort() + .forEach((key) => { + sorted[key] = sortObj(obj[key]); + }); + return sorted; +} + export default ({ helpText, id, label, type, unit = '', value }) => { const dataType = value === '$encrypted$' ? 'encrypted' : type; let detail = null; @@ -17,7 +30,7 @@ export default ({ helpText, id, label, type, unit = '', value }) => { label={label} mode="javascript" rows={4} - value={JSON.stringify(value || {}, undefined, 2)} + value={JSON.stringify(sortObj(value || {}), undefined, 2)} /> ); break;