Skip to content

Commit

Permalink
Setting modification to address requests from UI_NEXT devs (ansible#1…
Browse files Browse the repository at this point in the history
…4996)

Modification to settings

- Add hidden to indicate to UI_NEXT to hide the field
- Add warning_text to indicate to UI_NEXT to display the warning when specific setting is modified
- Address some non required field being marked as required
  • Loading branch information
TheRealHaoLiu authored and djyasin committed Nov 11, 2024
1 parent ac34121 commit 188cddf
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions awx/api/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
default='',
label=_('Login redirect override URL'),
help_text=_('URL to which unauthorized users will be redirected to log in. If blank, users will be sent to the login page.'),
warning_text=_('Changing the redirect URL could impact the ability to login if local authentication is also disabled.'),
category=_('Authentication'),
category_slug='authentication',
)
Expand Down
2 changes: 2 additions & 0 deletions awx/api/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ def get_field_info(self, field):
field_info = OrderedDict()
field_info['type'] = self.label_lookup[field]
field_info['required'] = getattr(field, 'required', False)
field_info['hidden'] = getattr(field, 'hidden', False)

text_attrs = [
'read_only',
'label',
'help_text',
'warning_text',
'min_length',
'max_length',
'min_value',
Expand Down
1 change: 1 addition & 0 deletions awx/conf/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
# Optional; category_slug will be slugified version of category if not
# explicitly provided.
category_slug='cows',
hidden=True,
)


Expand Down
4 changes: 4 additions & 0 deletions awx/conf/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,19 +127,23 @@ def get_setting_field(self, setting, mixin_class=None, for_user=False, **kwargs)
encrypted = bool(field_kwargs.pop('encrypted', False))
defined_in_file = bool(field_kwargs.pop('defined_in_file', False))
unit = field_kwargs.pop('unit', None)
hidden = field_kwargs.pop('hidden', False)
warning_text = field_kwargs.pop('warning_text', None)
if getattr(field_kwargs.get('child', None), 'source', None) is not None:
field_kwargs['child'].source = None
field_instance = field_class(**field_kwargs)
field_instance.category_slug = category_slug
field_instance.category = category
field_instance.depends_on = depends_on
field_instance.unit = unit
field_instance.hidden = hidden
if placeholder is not empty:
field_instance.placeholder = placeholder
field_instance.defined_in_file = defined_in_file
if field_instance.defined_in_file:
field_instance.help_text = str(_('This value has been set manually in a settings file.')) + '\n\n' + str(field_instance.help_text)
field_instance.encrypted = encrypted
field_instance.warning_text = warning_text
original_field_instance = field_instance
if field_class != original_field_class:
original_field_instance = original_field_class(**field_kwargs)
Expand Down
6 changes: 6 additions & 0 deletions awx/main/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
),
category=_('System'),
category_slug='system',
required=False,
)

register(
Expand Down Expand Up @@ -774,6 +775,7 @@
allow_null=True,
category=_('System'),
category_slug='system',
required=False,
)
register(
'AUTOMATION_ANALYTICS_LAST_ENTRIES',
Expand Down Expand Up @@ -815,6 +817,7 @@
help_text=_('Max jobs to allow bulk jobs to launch'),
category=_('Bulk Actions'),
category_slug='bulk',
hidden=True,
)

register(
Expand All @@ -825,6 +828,7 @@
help_text=_('Max number of hosts to allow to be created in a single bulk action'),
category=_('Bulk Actions'),
category_slug='bulk',
hidden=True,
)

register(
Expand All @@ -835,6 +839,7 @@
help_text=_('Max number of hosts to allow to be deleted in a single bulk action'),
category=_('Bulk Actions'),
category_slug='bulk',
hidden=True,
)

register(
Expand All @@ -845,6 +850,7 @@
help_text=_('Enable preview of new user interface.'),
category=_('System'),
category_slug='system',
hidden=True,
)

register(
Expand Down
2 changes: 2 additions & 0 deletions awx/ui/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
help_text=_('Maximum number of job events for the UI to retrieve within a single request.'),
category=_('UI'),
category_slug='ui',
hidden=True,
)

register(
Expand All @@ -68,4 +69,5 @@
help_text=_('If disabled, the page will not refresh when events are received. Reloading the page will be required to get the latest details.'),
category=_('UI'),
category_slug='ui',
hidden=True,
)

0 comments on commit 188cddf

Please sign in to comment.