mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 11:20:39 -03:30
Fixes timeout when exporting YAML from network UI
Exporting YAML on dev envs with honcho and in production environments would timeout. This was due to daphne handling the export request in dev but not in production. This fixes network_ui to use uwsgi instead of daphne to handle the request.
This commit is contained in:
parent
05556809d3
commit
89cabf7ca0
@ -3,7 +3,7 @@ from channels.routing import route
|
||||
from awx.network_ui.consumers import ws_connect, ws_message, ws_disconnect
|
||||
|
||||
channel_routing = [
|
||||
route("websocket.connect", ws_connect, path=r"^/network_ui/topology"),
|
||||
route("websocket.receive", ws_message, path=r"^/network_ui/topology"),
|
||||
route("websocket.disconnect", ws_disconnect, path=r"^/network_ui/topology"),
|
||||
route("websocket.connect", ws_connect, path=r"^/network_ui/topology/"),
|
||||
route("websocket.receive", ws_message, path=r"^/network_ui/topology/"),
|
||||
route("websocket.disconnect", ws_disconnect, path=r"^/network_ui/topology/"),
|
||||
]
|
||||
|
||||
@ -5,6 +5,6 @@ from awx.network_ui import views
|
||||
|
||||
app_name = 'network_ui'
|
||||
urlpatterns = [
|
||||
url(r'^topology.json$', views.json_topology_data, name='json_topology_data'),
|
||||
url(r'^topology.yaml$', views.yaml_topology_data, name='yaml_topology_data'),
|
||||
url(r'^topology.json/?$', views.json_topology_data, name='json_topology_data'),
|
||||
url(r'^topology.yaml/?$', views.yaml_topology_data, name='yaml_topology_data'),
|
||||
]
|
||||
|
||||
@ -82,7 +82,10 @@ class TopologyForm(forms.Form):
|
||||
def json_topology_data(request):
|
||||
form = TopologyForm(request.GET)
|
||||
if form.is_valid():
|
||||
return JsonResponse(topology_data(form.cleaned_data['topology_id']))
|
||||
response = JsonResponse(topology_data(form.cleaned_data['topology_id']),
|
||||
content_type='application/force-download')
|
||||
response['Content-Disposition'] = 'attachment; filename="{}"'.format('topology.json')
|
||||
return response
|
||||
else:
|
||||
return HttpResponseBadRequest(form.errors)
|
||||
|
||||
@ -90,9 +93,11 @@ def json_topology_data(request):
|
||||
def yaml_topology_data(request):
|
||||
form = TopologyForm(request.GET)
|
||||
if form.is_valid():
|
||||
return HttpResponse(yaml.safe_dump(topology_data(form.cleaned_data['topology_id']),
|
||||
default_flow_style=False),
|
||||
content_type='application/yaml')
|
||||
response = HttpResponse(yaml.safe_dump(topology_data(form.cleaned_data['topology_id']),
|
||||
default_flow_style=False),
|
||||
content_type='application/force-download')
|
||||
response['Content-Disposition'] = 'attachment; filename="{}"'.format('topology.yaml')
|
||||
return response
|
||||
else:
|
||||
return HttpResponseBadRequest(form.errors)
|
||||
|
||||
|
||||
@ -615,7 +615,7 @@ and for interaction performance on the UI.
|
||||
Messages
|
||||
--------
|
||||
|
||||
JSON messages are passed over the `/network_ui/topology` websocket between the
|
||||
JSON messages are passed over the `/network_ui/topology/` websocket between the
|
||||
test client and the test server. The protocol that is used for all messages is
|
||||
in ABNF (RFC5234):
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ server {
|
||||
sendfile off;
|
||||
}
|
||||
|
||||
location ~ ^/(websocket|network_ui) {
|
||||
location ~ ^/(websocket|network_ui/topology/) {
|
||||
# Pass request to the upstream alias
|
||||
proxy_pass http://daphne;
|
||||
# Require http version 1.1 to allow for upgrade requests
|
||||
@ -90,7 +90,7 @@ server {
|
||||
sendfile off;
|
||||
}
|
||||
|
||||
location ~ ^/(websocket|network_ui) {
|
||||
location ~ ^/(websocket|network_ui/topology/) {
|
||||
# Pass request to the upstream alias
|
||||
proxy_pass http://daphne;
|
||||
# Require http version 1.1 to allow for upgrade requests
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user