1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 09:51:09 +03:00

add API setting for UI live updates

include context data

update help text
This commit is contained in:
AlanCoding 2018-03-23 13:36:01 -04:00 committed by Jared Tabor
parent 61aafe15d6
commit f6e507ad12
4 changed files with 17 additions and 0 deletions

View File

@ -168,6 +168,10 @@ STDOUT_MAX_BYTES_DISPLAY = 1048576
# on how many events to display before truncating/hiding # on how many events to display before truncating/hiding
MAX_UI_JOB_EVENTS = 4000 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 # The maximum size of the ansible callback event's res data structure
# beyond this limit and the value will be removed # beyond this limit and the value will be removed
MAX_EVENT_RES_DATA = 700000 MAX_EVENT_RES_DATA = 700000

View File

@ -63,3 +63,13 @@ register(
category=_('UI'), category=_('UI'),
category_slug='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',
)

View File

@ -12,6 +12,7 @@
<link rel="shortcut icon" href="{{ STATIC_URL }}assets/favicon.ico?v={{version}}" /> <link rel="shortcut icon" href="{{ STATIC_URL }}assets/favicon.ico?v={{version}}" />
<script> <script>
var $basePath = "{{ STATIC_URL }}"; var $basePath = "{{ STATIC_URL }}";
var $liveUpdates = "{{ UI_LIVE_UPDATES_ENABLED }}";
</script> </script>
<script src="{{ STATIC_URL }}app.vendor.js?v={{version}}"></script> <script src="{{ STATIC_URL }}app.vendor.js?v={{version}}"></script>
<script src="{{ STATIC_URL }}app.js?v={{version}}"></script> <script src="{{ STATIC_URL }}app.js?v={{version}}"></script>

View File

@ -2,6 +2,7 @@
# All Rights Reserved. # All Rights Reserved.
from django.views.generic.base import TemplateView, RedirectView from django.views.generic.base import TemplateView, RedirectView
from django.conf import settings
class IndexView(TemplateView): class IndexView(TemplateView):
@ -9,6 +10,7 @@ class IndexView(TemplateView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(IndexView, self).get_context_data(**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. # Add any additional context info here.
return context return context