Policy Classifier creation dialog keeps loading forever

Due to change in horizon base url from / to /dashboard,
javascript files are not getting loaded

Change-Id: I7bd713124ffaff4d3a884a1ba40b1bdd1342439e
Closes-bug: #1538679
This commit is contained in:
ank 2016-01-28 17:47:56 +05:30 committed by Sumit Naiksatam
parent 6b892f36ec
commit 8b731e1a87
9 changed files with 42 additions and 38 deletions

View File

@ -13,6 +13,7 @@
import logging
import os
from django.conf import settings
from django.core.urlresolvers import reverse
from django.utils.safestring import mark_safe
@ -143,7 +144,8 @@ def update_policyaction_attributes(request, paction):
def update_sc_spec_attributes(request, scspec):
img_path = "/static/dashboard/img/"
static_url = getattr(settings, 'STATIC_URL', "/static/")
img_path = static_url + "dashboard/img/"
provider = "default"
nodes = scspec.nodes
nodes = [client.get_servicechain_node(request, item) for item in nodes]
@ -154,8 +156,8 @@ def update_sc_spec_attributes(request, scspec):
if os.path.exists(ds_path):
local_img_path = ds_path
else:
local_img_path = "/usr/share/openstack-dashboard/openstack_dashboard/" \
+ "static/dashboard/img/"
local_img_path = "/usr/share/openstack-dashboard/" \
+ "openstack_dashboard/static/dashboard/img/"
if os.path.exists(local_img_path):
providers = os.listdir(local_img_path)
for p in providers:
@ -239,7 +241,7 @@ def update_classifier_attributes(classifiers):
if type(classifiers) == list:
for classifier in classifiers:
classifier.set_id_as_name_if_empty()
if classifier.protocol in ['tcp', 'udp'] and classifier.port_range \
if classifier.protocol in ['tcp', 'udp'] and classifier.port_range\
in port_protocol_map:
classifier.protocol = port_protocol_map[classifier.port_range]
else:

View File

@ -26,5 +26,5 @@
{% block modal-js %}
<script src='/static/dashboard/js/horizon.protocolmap.js' type="text/javascript"></script>
<script src='{{ STATIC_URL }}dashboard/js/horizon.protocolmap.js' type="text/javascript"></script>
{% endblock %}

View File

@ -25,5 +25,5 @@
{% endblock %}
{% block modal-js %}
<script src='/static/dashboard/js/horizon.protocolmap.js' type="text/javascript"></script>
<script src='{{ STATIC_URL }}dashboard/js/horizon.protocolmap.js' type="text/javascript"></script>
{% endblock %}

View File

@ -13,6 +13,7 @@
import json
import yaml
from django.contrib.staticfiles.templatetags.staticfiles import static
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
@ -164,7 +165,7 @@ class ServiceChainNodeDetailsTab(tabs.Tab):
node["text"] = key
else:
node["text"] = key + " : " + str(value)
node["icon"] = "/static/dashboard/img/text.png"
node["icon"] = static("dashboard/img/text.png")
tree.append(node)
return json.dumps(tree)
@ -206,7 +207,7 @@ class ServiceChainNodeDetailsTab(tabs.Tab):
node["text"] = key
else:
node["text"] = key + " : " + str(value)
node["icon"] = "/static/dashboard/img/text.png"
node["icon"] = static("dashboard/img/text.png")
arr.append(node)
return arr

View File

@ -8,7 +8,7 @@
{% block modal-header %}{% trans "Create Service Chain Spec" %}{% endblock %}
{% block modal-body %}
<link href="/static/dashboard/css/scspec.css" rel='stylesheet' type='text/css'>
<link href="{{ STATIC_URL }}dashboard/css/scspec.css" rel='stylesheet' type='text/css'>
<div class="left">
<fieldset>
<table class="table-fixed" id="nodeListIdContainer">
@ -51,7 +51,7 @@
{% block modal-js %}
<script src='/static/dashboard/js/horizon.scspec.js' type='text/javascript'></script>
<script src='{{ STATIC_URL }}dashboard/js/horizon.scspec.js' type='text/javascript'></script>
<script>
if (typeof $ !== 'undefined') {
horizon.Node.sc_init($(".workflow"));

View File

@ -1,8 +1,9 @@
{% load i18n sizeformat parse_date %}
{% load url from future %}
{% load staticfiles %}
{% block css %}
<link href="/static/dashboard/css/jstree.css" rel='stylesheet' type='text/css'>
<link href="{% static "dashboard/css/jstree.css" %}" rel='stylesheet' type='text/css'>
{% endblock %}
<div class="info row detail">
<hr class="header_rule">
@ -23,8 +24,8 @@
<dd>{{ scnode.shared }}</dd>
<dt>
<img src="/static/dashboard/img/config_as_text.png"
data-swap="/static/dashboard/img/config_as_tree.png"
<img src="{% static "dashboard/img/config_as_text.png" %}"
data-swap="{% static "dashboard/img/config_as_tree.png" %}"
id="display_format" alt="" > {% trans "Config" %}</dt>
<dd >
<div style="white-space:pre;display:none" id="config_text" >{{ scnode.config }} </div>
@ -35,7 +36,7 @@
</div>
{% block custom_js %}
<script src='/static/dashboard/js/jstree.min.js' type='text/javascript'></script>
<script src='{% static "dashboard/js/jstree.min.js" %}' type='text/javascript'></script>
<script type="text/javascript">
function display_config_as_tree(){
var data = JSON.stringify({{scnode.tree|safe}});

View File

@ -8,7 +8,7 @@
{% block modal-header %}{% trans "Update Service Chain Spec" %}{% endblock %}
{% block modal-body %}
<link href="/static/dashboard/css/scspec.css" rel='stylesheet' type='text/css'>
<link href="{{ STATIC_URL }}dashboard/css/scspec.css" rel='stylesheet' type='text/css'>
<div class="left">
<table class="table-fixed" id="nodeListIdContainer">
<tbody>
@ -48,7 +48,7 @@
{% block modal-js %}
<script src='/static/dashboard/js/horizon.scspec.js' type='text/javascript'></script>
<script src='{{ STATIC_URL }}dashboard/js/horizon.scspec.js' type='text/javascript'></script>
<script>
if (typeof $ !== 'undefined') {
horizon.Node.sc_init($(".workflow"));

View File

@ -392,7 +392,7 @@
}
.jstree-default .jstree-node,
.jstree-default .jstree-icon {
background-image: url("/static/dashboard/img/32px.png");
background-image: url("../img/32px.png");
}
.jstree-default .jstree-node {
background-position: -292px -4px;
@ -488,13 +488,13 @@
background-position: 0 0;
}
.jstree-default > .jstree-container-ul .jstree-loading > .jstree-ocl {
background: url("/static/dashboard/img/throbber.gif") center center no-repeat;
background: url("../img/throbber.gif") center center no-repeat;
}
.jstree-default .jstree-file {
background: url("/static/dashboard/img/32px.png") -100px -68px no-repeat;
background: url("../img/32px.png") -100px -68px no-repeat;
}
.jstree-default .jstree-folder {
background: url("/static/dashboard/img/32px.png") -260px -4px no-repeat;
background: url("../img/32px.png") -260px -4px no-repeat;
}
.jstree-default > .jstree-container-ul > .jstree-node {
margin-left: 0;
@ -506,7 +506,7 @@
}
#jstree-dnd.jstree-default .jstree-ok,
#jstree-dnd.jstree-default .jstree-er {
background-image: url("/static/dashboard/img/32px.png");
background-image: url("../img/32px.png");
background-repeat: no-repeat;
background-color: transparent;
}
@ -556,7 +556,7 @@
}
.jstree-default-small .jstree-node,
.jstree-default-small .jstree-icon {
background-image: url("/static/dashboard/img/32px.png");
background-image: url("../img/32px.png");
}
.jstree-default-small .jstree-node {
background-position: -295px -7px;
@ -652,13 +652,13 @@
background-position: 0 0;
}
.jstree-default-small > .jstree-container-ul .jstree-loading > .jstree-ocl {
background: url("/static/dashboard/img/throbber.gif") center center no-repeat;
background: url("../img/throbber.gif") center center no-repeat;
}
.jstree-default-small .jstree-file {
background: url("/static/dashboard/img/32px.png") -103px -71px no-repeat;
background: url("../img/32px.png") -103px -71px no-repeat;
}
.jstree-default-small .jstree-folder {
background: url("/static/dashboard/img/32px.png") -263px -7px no-repeat;
background: url("../img/32px.png") -263px -7px no-repeat;
}
.jstree-default-small > .jstree-container-ul > .jstree-node {
margin-left: 0;
@ -670,7 +670,7 @@
}
#jstree-dnd.jstree-default-small .jstree-ok,
#jstree-dnd.jstree-default-small .jstree-er {
background-image: url("/static/dashboard/img/32px.png");
background-image: url("../img/32px.png");
background-repeat: no-repeat;
background-color: transparent;
}
@ -720,7 +720,7 @@
}
.jstree-default-large .jstree-node,
.jstree-default-large .jstree-icon {
background-image: url("/static/dashboard/img/32px.png");
background-image: url("../img/32px.png");
}
.jstree-default-large .jstree-node {
background-position: -288px 0px;
@ -816,13 +816,13 @@
background-position: 0 0;
}
.jstree-default-large > .jstree-container-ul .jstree-loading > .jstree-ocl {
background: url("/static/dashboard/img/throbber.gif") center center no-repeat;
background: url("../img/throbber.gif") center center no-repeat;
}
.jstree-default-large .jstree-file {
background: url("/static/dashboard/img/32px.png") -96px -64px no-repeat;
background: url("../img/32px.png") -96px -64px no-repeat;
}
.jstree-default-large .jstree-folder {
background: url("/static/dashboard/img/32px.png") -256px 0px no-repeat;
background: url("../img/32px.png") -256px 0px no-repeat;
}
.jstree-default-large > .jstree-container-ul > .jstree-node {
margin-left: 0;
@ -834,7 +834,7 @@
}
#jstree-dnd.jstree-default-large .jstree-ok,
#jstree-dnd.jstree-default-large .jstree-er {
background-image: url("/static/dashboard/img/32px.png");
background-image: url("../img/32px.png");
background-repeat: no-repeat;
background-color: transparent;
}
@ -869,12 +869,12 @@
height: 40px;
}
#jstree-dnd.jstree-dnd-responsive > .jstree-ok {
background-image: url("/static/dashboard/img/40px.png");
background-image: url("../img/40px.png");
background-position: 0 -200px;
background-size: 120px 240px;
}
#jstree-dnd.jstree-dnd-responsive > .jstree-er {
background-image: url("/static/dashboard/img/40px.png");
background-image: url("../img/40px.png");
background-position: -40px -200px;
background-size: 120px 240px;
}
@ -893,7 +893,7 @@
*/
}
.jstree-default-responsive .jstree-icon {
background-image: url("/static/dashboard/img/40px.png");
background-image: url("../img/40px.png");
}
.jstree-default-responsive .jstree-node,
.jstree-default-responsive .jstree-leaf > .jstree-ocl {
@ -995,7 +995,7 @@
.jstree-default-responsive .jstree-node > .jstree-ocl,
.jstree-default-responsive .jstree-themeicon,
.jstree-default-responsive .jstree-checkbox {
background-image: url("/static/dashboard/img/40px.png");
background-image: url("../img/40px.png");
background-size: 120px 240px;
}
.jstree-default-responsive .jstree-node {
@ -1017,11 +1017,11 @@
background-position: 0 0;
}
.jstree-default-responsive .jstree-file {
background: url("/static/dashboard/img/40px.png") 0 -160px no-repeat;
background: url("../img/40px.png") 0 -160px no-repeat;
background-size: 120px 240px;
}
.jstree-default-responsive .jstree-folder {
background: url("/static/dashboard/img/40px.png") -40px -40px no-repeat;
background: url("../img/40px.png") -40px -40px no-repeat;
background-size: 120px 240px;
}
.jstree-default-responsive > .jstree-container-ul > .jstree-node {

View File

@ -62,7 +62,7 @@
border-radius: 3px;
cursor: move;
padding-left: 23px;
background: #ffffff url('/static/dashboard/img/drag.png?93ec7e23f795') no-repeat 11px 50%; }
background: #ffffff url('../img/drag.png?93ec7e23f795') no-repeat 11px 50%; }
.nodelist li em {
font-size: 0.5em;
line-height: 1em;