Browse Source

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
tags/4.0.0.0rc1
ank 3 years ago
parent
commit
8b731e1a87

+ 6
- 4
gbpui/column_filters.py View File

@@ -13,6 +13,7 @@
13 13
 import logging
14 14
 import os
15 15
 
16
+from django.conf import settings
16 17
 from django.core.urlresolvers import reverse
17 18
 from django.utils.safestring import mark_safe
18 19
 
@@ -143,7 +144,8 @@ def update_policyaction_attributes(request, paction):
143 144
 
144 145
 
145 146
 def update_sc_spec_attributes(request, scspec):
146
-    img_path = "/static/dashboard/img/"
147
+    static_url = getattr(settings, 'STATIC_URL', "/static/")
148
+    img_path = static_url + "dashboard/img/"
147 149
     provider = "default"
148 150
     nodes = scspec.nodes
149 151
     nodes = [client.get_servicechain_node(request, item) for item in nodes]
@@ -154,8 +156,8 @@ def update_sc_spec_attributes(request, scspec):
154 156
     if os.path.exists(ds_path):
155 157
         local_img_path = ds_path
156 158
     else:
157
-        local_img_path = "/usr/share/openstack-dashboard/openstack_dashboard/" \
158
-            + "static/dashboard/img/"
159
+        local_img_path = "/usr/share/openstack-dashboard/" \
160
+            + "openstack_dashboard/static/dashboard/img/"
159 161
     if os.path.exists(local_img_path):
160 162
         providers = os.listdir(local_img_path)
161 163
         for p in providers:
@@ -239,7 +241,7 @@ def update_classifier_attributes(classifiers):
239 241
     if type(classifiers) == list:
240 242
         for classifier in classifiers:
241 243
             classifier.set_id_as_name_if_empty()
242
-            if classifier.protocol in ['tcp', 'udp'] and classifier.port_range \
244
+            if classifier.protocol in ['tcp', 'udp'] and classifier.port_range\
243 245
                     in port_protocol_map:
244 246
                 classifier.protocol = port_protocol_map[classifier.port_range]
245 247
     else:

+ 1
- 1
gbpui/panels/application_policy/templates/application_policy/_add_policy_classifier.html View File

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

+ 1
- 1
gbpui/panels/application_policy/templates/application_policy/_update_policy_classifier.html View File

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

+ 3
- 2
gbpui/panels/network_services/tabs.py View File

@@ -13,6 +13,7 @@
13 13
 import json
14 14
 import yaml
15 15
 
16
+from django.contrib.staticfiles.templatetags.staticfiles import static
16 17
 from django.core.urlresolvers import reverse_lazy
17 18
 from django.utils.translation import ugettext_lazy as _
18 19
 
@@ -164,7 +165,7 @@ class ServiceChainNodeDetailsTab(tabs.Tab):
164 165
                 node["text"] = key
165 166
             else:
166 167
                 node["text"] = key + " : " + str(value)
167
-                node["icon"] = "/static/dashboard/img/text.png"
168
+                node["icon"] = static("dashboard/img/text.png")
168 169
 
169 170
             tree.append(node)
170 171
         return json.dumps(tree)
@@ -206,7 +207,7 @@ class ServiceChainNodeDetailsTab(tabs.Tab):
206 207
                 node["text"] = key
207 208
             else:
208 209
                 node["text"] = key + " : " + str(value)
209
-                node["icon"] = "/static/dashboard/img/text.png"
210
+                node["icon"] = static("dashboard/img/text.png")
210 211
             arr.append(node)
211 212
         return arr
212 213
 

+ 2
- 2
gbpui/panels/network_services/templates/network_services/_create_service_chain_spec.html View File

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

+ 5
- 4
gbpui/panels/network_services/templates/network_services/_scnode_details.html View File

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

+ 2
- 2
gbpui/panels/network_services/templates/network_services/_update_service_chain_spec.html View File

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

+ 21
- 21
gbpui/static/dashboard/css/jstree.css View File

@@ -392,7 +392,7 @@
392 392
 }
393 393
 .jstree-default .jstree-node,
394 394
 .jstree-default .jstree-icon {
395
-  background-image: url("/static/dashboard/img/32px.png");
395
+  background-image: url("../img/32px.png");
396 396
 }
397 397
 .jstree-default .jstree-node {
398 398
   background-position: -292px -4px;
@@ -488,13 +488,13 @@
488 488
   background-position: 0 0;
489 489
 }
490 490
 .jstree-default > .jstree-container-ul .jstree-loading > .jstree-ocl {
491
-  background: url("/static/dashboard/img/throbber.gif") center center no-repeat;
491
+  background: url("../img/throbber.gif") center center no-repeat;
492 492
 }
493 493
 .jstree-default .jstree-file {
494
-  background: url("/static/dashboard/img/32px.png") -100px -68px no-repeat;
494
+  background: url("../img/32px.png") -100px -68px no-repeat;
495 495
 }
496 496
 .jstree-default .jstree-folder {
497
-  background: url("/static/dashboard/img/32px.png") -260px -4px no-repeat;
497
+  background: url("../img/32px.png") -260px -4px no-repeat;
498 498
 }
499 499
 .jstree-default > .jstree-container-ul > .jstree-node {
500 500
   margin-left: 0;
@@ -506,7 +506,7 @@
506 506
 }
507 507
 #jstree-dnd.jstree-default .jstree-ok,
508 508
 #jstree-dnd.jstree-default .jstree-er {
509
-  background-image: url("/static/dashboard/img/32px.png");
509
+  background-image: url("../img/32px.png");
510 510
   background-repeat: no-repeat;
511 511
   background-color: transparent;
512 512
 }
@@ -556,7 +556,7 @@
556 556
 }
557 557
 .jstree-default-small .jstree-node,
558 558
 .jstree-default-small .jstree-icon {
559
-  background-image: url("/static/dashboard/img/32px.png");
559
+  background-image: url("../img/32px.png");
560 560
 }
561 561
 .jstree-default-small .jstree-node {
562 562
   background-position: -295px -7px;
@@ -652,13 +652,13 @@
652 652
   background-position: 0 0;
653 653
 }
654 654
 .jstree-default-small > .jstree-container-ul .jstree-loading > .jstree-ocl {
655
-  background: url("/static/dashboard/img/throbber.gif") center center no-repeat;
655
+  background: url("../img/throbber.gif") center center no-repeat;
656 656
 }
657 657
 .jstree-default-small .jstree-file {
658
-  background: url("/static/dashboard/img/32px.png") -103px -71px no-repeat;
658
+  background: url("../img/32px.png") -103px -71px no-repeat;
659 659
 }
660 660
 .jstree-default-small .jstree-folder {
661
-  background: url("/static/dashboard/img/32px.png") -263px -7px no-repeat;
661
+  background: url("../img/32px.png") -263px -7px no-repeat;
662 662
 }
663 663
 .jstree-default-small > .jstree-container-ul > .jstree-node {
664 664
   margin-left: 0;
@@ -670,7 +670,7 @@
670 670
 }
671 671
 #jstree-dnd.jstree-default-small .jstree-ok,
672 672
 #jstree-dnd.jstree-default-small .jstree-er {
673
-  background-image: url("/static/dashboard/img/32px.png");
673
+  background-image: url("../img/32px.png");
674 674
   background-repeat: no-repeat;
675 675
   background-color: transparent;
676 676
 }
@@ -720,7 +720,7 @@
720 720
 }
721 721
 .jstree-default-large .jstree-node,
722 722
 .jstree-default-large .jstree-icon {
723
-  background-image: url("/static/dashboard/img/32px.png");
723
+  background-image: url("../img/32px.png");
724 724
 }
725 725
 .jstree-default-large .jstree-node {
726 726
   background-position: -288px 0px;
@@ -816,13 +816,13 @@
816 816
   background-position: 0 0;
817 817
 }
818 818
 .jstree-default-large > .jstree-container-ul .jstree-loading > .jstree-ocl {
819
-  background: url("/static/dashboard/img/throbber.gif") center center no-repeat;
819
+  background: url("../img/throbber.gif") center center no-repeat;
820 820
 }
821 821
 .jstree-default-large .jstree-file {
822
-  background: url("/static/dashboard/img/32px.png") -96px -64px no-repeat;
822
+  background: url("../img/32px.png") -96px -64px no-repeat;
823 823
 }
824 824
 .jstree-default-large .jstree-folder {
825
-  background: url("/static/dashboard/img/32px.png") -256px 0px no-repeat;
825
+  background: url("../img/32px.png") -256px 0px no-repeat;
826 826
 }
827 827
 .jstree-default-large > .jstree-container-ul > .jstree-node {
828 828
   margin-left: 0;
@@ -834,7 +834,7 @@
834 834
 }
835 835
 #jstree-dnd.jstree-default-large .jstree-ok,
836 836
 #jstree-dnd.jstree-default-large .jstree-er {
837
-  background-image: url("/static/dashboard/img/32px.png");
837
+  background-image: url("../img/32px.png");
838 838
   background-repeat: no-repeat;
839 839
   background-color: transparent;
840 840
 }
@@ -869,12 +869,12 @@
869 869
     height: 40px;
870 870
   }
871 871
   #jstree-dnd.jstree-dnd-responsive > .jstree-ok {
872
-    background-image: url("/static/dashboard/img/40px.png");
872
+    background-image: url("../img/40px.png");
873 873
     background-position: 0 -200px;
874 874
     background-size: 120px 240px;
875 875
   }
876 876
   #jstree-dnd.jstree-dnd-responsive > .jstree-er {
877
-    background-image: url("/static/dashboard/img/40px.png");
877
+    background-image: url("../img/40px.png");
878 878
     background-position: -40px -200px;
879 879
     background-size: 120px 240px;
880 880
   }
@@ -893,7 +893,7 @@
893 893
 	*/
894 894
   }
895 895
   .jstree-default-responsive .jstree-icon {
896
-    background-image: url("/static/dashboard/img/40px.png");
896
+    background-image: url("../img/40px.png");
897 897
   }
898 898
   .jstree-default-responsive .jstree-node,
899 899
   .jstree-default-responsive .jstree-leaf > .jstree-ocl {
@@ -995,7 +995,7 @@
995 995
   .jstree-default-responsive .jstree-node > .jstree-ocl,
996 996
   .jstree-default-responsive .jstree-themeicon,
997 997
   .jstree-default-responsive .jstree-checkbox {
998
-    background-image: url("/static/dashboard/img/40px.png");
998
+    background-image: url("../img/40px.png");
999 999
     background-size: 120px 240px;
1000 1000
   }
1001 1001
   .jstree-default-responsive .jstree-node {
@@ -1017,11 +1017,11 @@
1017 1017
     background-position: 0 0;
1018 1018
   }
1019 1019
   .jstree-default-responsive .jstree-file {
1020
-    background: url("/static/dashboard/img/40px.png") 0 -160px no-repeat;
1020
+    background: url("../img/40px.png") 0 -160px no-repeat;
1021 1021
     background-size: 120px 240px;
1022 1022
   }
1023 1023
   .jstree-default-responsive .jstree-folder {
1024
-    background: url("/static/dashboard/img/40px.png") -40px -40px no-repeat;
1024
+    background: url("../img/40px.png") -40px -40px no-repeat;
1025 1025
     background-size: 120px 240px;
1026 1026
   }
1027 1027
   .jstree-default-responsive > .jstree-container-ul > .jstree-node {

+ 1
- 1
gbpui/static/dashboard/css/scspec.css View File

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

Loading…
Cancel
Save