How do I add a settings toggle option to AWX UI?

How do I add customization settings to AWX UI?

I want to add a toggleable boolean option to the MiscSystem page. I’ve added everything I think I need to my own awx fork and have deployed it with the custom setting configured in the operator and functionally my code works, but the setting doesn’t appear in the UI.

Using ACTIVITY_STREAM_ENABLED as a reference, I’ve added the custom setting to the following files:

  • ./awx/main/conf.py
  • ./awx/settings/defaults.py
  • ./awx/ui/src/screens/Setting/MiscSystem/MiscSystemDetail/MiscSystemDetail.js
  • ./awx/ui/src/screens/Setting/MiscSystem/MiscSystemDetail/MiscSystemDetail.test.js
  • ./awx/ui/src/screens/Setting/MiscSystem/MiscSystemEdit/MiscSystemEdit.js
  • ./awx/ui/src/screens/Setting/MiscSystem/MiscSystemEdit/MiscSystemEdit.test.js
  • ./awx/ui/src/screens/Setting/shared/data.allSettingOptions.json
  • ./awx/ui/src/screens/Setting/shared/data.allSettings.json

But the setting doesn’t appear in the UI. I do know that a new UI setting would need to be added to the awx frontend in ansible-ui, but that should only affect UI-Next right? As seen in the screenshot, I don’t have the preview enabled right now.

How did you build customized image to include modified ui?
The file awx/ui/.ui-built have to be removed (by hand or make clean-ui) before any build command with make to trigger rebuilding ui.

I’m building https://github.com/Denney-tech/awx/tree/custom from source in a dockerfile on OpenShift using the Dockerfile.j2 as a reference, and there is no ./awx/ui/.ui-built file in the source prior to starting the build.

Does make requirements_awx and make sdist not make both UI and UI-Next? UI is the old UI that we normally see, and UI-Next is the optional preview of the new ansible-ui? For now, I just wanted to modify UI and worry about UI-Next later.

@kurokobo Well now it shows up. Maybe it needed to do something on the backend or I needed to clear browser cache?

It resolved itself somehow because I definitely was using the latest image I had built. :man_shrugging:

1 Like