-
-
-
-
+
diff --git a/tests/Architecture/FrontendRuntimeContractSupport.php b/tests/Architecture/FrontendRuntimeContractSupport.php
index 357f48c..65a89d5 100644
--- a/tests/Architecture/FrontendRuntimeContractSupport.php
+++ b/tests/Architecture/FrontendRuntimeContractSupport.php
@@ -27,6 +27,7 @@ trait FrontendRuntimeContractSupport
'web/js/components/app-custom-field-options-toggle.js',
'web/js/components/app-tenant-sso-toggle.js',
'web/js/components/app-settings-telemetry.js',
+ 'web/js/components/app-settings-audit.js',
'web/js/components/app-standard-detail-page.js',
'web/js/components/app-auto-submit.js',
'modules/bookmarks/web/js/components/app-bookmark-save.js',
diff --git a/web/js/app-init.js b/web/js/app-init.js
index 497c25e..cc5aee9 100644
--- a/web/js/app-init.js
+++ b/web/js/app-init.js
@@ -20,6 +20,7 @@ import { initCustomFieldOptionsToggle } from './components/app-custom-field-opti
import { initTenantSsoToggle } from './components/app-tenant-sso-toggle.js';
import { initTenantLdapToggle } from './components/app-tenant-ldap-toggle.js';
import { initTelemetrySettings } from './components/app-settings-telemetry.js';
+import { initSettingsAudit } from './components/app-settings-audit.js';
import { initStandardDetailPages } from './components/app-standard-detail-page.js';
import { initAutoSubmit } from './components/app-auto-submit.js';
import { initTabs } from './components/app-tabs.js';
@@ -196,6 +197,10 @@ const bootRuntime = async () => {
scope: 'global',
configPath: 'components.settingsTelemetry',
});
+ runtime.register('settings-audit', initSettingsAudit, {
+ scope: 'global',
+ configPath: 'components.settingsAudit',
+ });
runtime.register('auto-submit', initAutoSubmit, {
scope: 'global',
configPath: 'components.autoSubmit',
diff --git a/web/js/components/app-settings-audit.js b/web/js/components/app-settings-audit.js
new file mode 100644
index 0000000..214ef5f
--- /dev/null
+++ b/web/js/components/app-settings-audit.js
@@ -0,0 +1,24 @@
+/**
+ * Shows/hides audit retention field based on the audit-enabled toggle.
+ */
+import { syncControlState, createConditionalToggleInit } from '../core/app-conditional-controls.js';
+
+const initRoot = (root) => {
+ const enabledInput = root.querySelector('[data-audit-enabled-toggle]');
+ const dependent = root.querySelector('[data-audit-when-enabled]');
+ if (!(enabledInput instanceof HTMLInputElement) || !(dependent instanceof HTMLElement)) {
+ return null;
+ }
+ const sync = () => syncControlState(dependent, enabledInput.checked);
+ enabledInput.addEventListener('change', sync);
+ sync();
+ return () => {
+ enabledInput.removeEventListener('change', sync);
+ };
+};
+
+export const initSettingsAudit = createConditionalToggleInit({
+ rootSelector: '[data-settings-audit-root]',
+ boundKey: 'settingsAuditBound',
+ initRoot,
+});