From f6e507ad1289267d0951ae190ca457d19b36d14a Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Fri, 23 Mar 2018 13:36:01 -0400 Subject: [PATCH] add API setting for UI live updates include context data update help text --- awx/settings/defaults.py | 4 ++++ awx/ui/conf.py | 10 ++++++++++ awx/ui/templates/ui/index.html | 1 + awx/ui/views.py | 2 ++ 4 files changed, 17 insertions(+) diff --git a/awx/settings/defaults.py b/awx/settings/defaults.py index b381548668..89d1727188 100644 --- a/awx/settings/defaults.py +++ b/awx/settings/defaults.py @@ -168,6 +168,10 @@ STDOUT_MAX_BYTES_DISPLAY = 1048576 # on how many events to display before truncating/hiding MAX_UI_JOB_EVENTS = 4000 +# Returned in index.html, tells the UI if it should make requests +# to update job data in response to status changes websocket events +UI_LIVE_UPDATES_ENABLED = True + # The maximum size of the ansible callback event's res data structure # beyond this limit and the value will be removed MAX_EVENT_RES_DATA = 700000 diff --git a/awx/ui/conf.py b/awx/ui/conf.py index 0d626c28f0..df88890faf 100644 --- a/awx/ui/conf.py +++ b/awx/ui/conf.py @@ -63,3 +63,13 @@ register( category=_('UI'), category_slug='ui', ) + +register( + 'UI_LIVE_UPDATES_ENABLED', + field_class=fields.BooleanField, + label=_('Enable Live Updates in the UI'), + 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', +) diff --git a/awx/ui/templates/ui/index.html b/awx/ui/templates/ui/index.html index 38bbad9de3..ce8af6b086 100644 --- a/awx/ui/templates/ui/index.html +++ b/awx/ui/templates/ui/index.html @@ -12,6 +12,7 @@ diff --git a/awx/ui/views.py b/awx/ui/views.py index 0a47154615..994da49732 100644 --- a/awx/ui/views.py +++ b/awx/ui/views.py @@ -2,6 +2,7 @@ # All Rights Reserved. from django.views.generic.base import TemplateView, RedirectView +from django.conf import settings class IndexView(TemplateView): @@ -9,6 +10,7 @@ class IndexView(TemplateView): def get_context_data(self, **kwargs): context = super(IndexView, self).get_context_data(**kwargs) + context['UI_LIVE_UPDATES_ENABLED'] = settings.UI_LIVE_UPDATES_ENABLED # Add any additional context info here. return context