refactoring urls 51/6351/2
authorlombardofr <lombardo@everyup.it>
Wed, 18 Jul 2018 07:47:28 +0000 (09:47 +0200)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Thu, 19 Jul 2018 12:13:19 +0000 (13:13 +0100)
Change-Id: If7c9bbfec35f733b3154fd74d83794764f4dad44
Signed-off-by: lombardofr <lombardo@everyup.it>
21 files changed:
instancehandler/template/instance_list.html
instancehandler/template/instance_list_ns.html
instancehandler/template/instance_list_vnf.html
instancehandler/template/instance_operations_list.html
instancehandler/template/instance_topology_view.html
instancehandler/template/modal/instance_create.html
instancehandler/views.py
projecthandler/template/project/osm/descriptor/descriptorlist.html
projecthandler/template/project/osm/osm_project_details.html
projecthandler/template/project/osm/osm_project_left_sidebar.html
projecthandler/urls/project.py
sdnctrlhandler/template/sdn_create.html
sdnctrlhandler/template/sdn_list.html
sdnctrlhandler/views.py
sf_t3d/urls.py
static/src/sdnctrlhandler/sdn_list.js
static/src/userhandler/user_list.js
vimhandler/template/vim_create.html
vimhandler/template/vim_list.html
vimhandler/template/vim_show.html
vimhandler/views.py

index 5888519..5471c19 100644 (file)
@@ -25,7 +25,7 @@
 
 {% block breadcrumb_body %}
     {{ block.super }}
-    <li><a href="{% url 'projects:instances:list'  type=type %}">{{ type|upper }} Instances</a></li>
+    <li><a href="{% url 'instances:list'  type=type %}">{{ type|upper }} Instances</a></li>
 {% endblock %}
 
 {% block content_body %}
index 2da870d..2481d87 100644 (file)
@@ -7,7 +7,7 @@
 
             <button type="button" class="btn btn-default" data-container="body"
                     data-toggle="tooltip" data-placement="top" title="Instantiate NS"
-                    onclick="javascript:openModalCreateNS({ 'project_id':'{{ project_id }}','vim_list_url': '{% url "projects:vims:list"  %}', 'nsd_list_url': '{% url "projects:list_descriptors" descriptor_type='nsd' %}'})">
+                    onclick="javascript:openModalCreateNS({ 'project_id':'{{ project_id }}','vim_list_url': '{% url "vims:list"  %}', 'nsd_list_url': '{% url "projects:list_descriptors" descriptor_type='nsd' %}'})">
                 <i class="fa fa-paper-plane"></i> <span> New NS</span></button>
 
         </div>
                     <td>
                         <div class="btn-group">
                             <button type="button" class="btn btn-default"
-                                    onclick="javascript:showInstanceDetails('{% url 'projects:instances:show' instance_id=i|get:'_id'  type=type %}')"
+                                    onclick="javascript:showInstanceDetails('{% url 'instances:show' instance_id=i|get:'_id'  type=type %}')"
                                     data-toggle="tooltip" data-placement="top" data-container="body" title="Show Info">
                                 <i class="fa fa-info"></i>
                             </button>
                             <!--
                             <button type="button" class="btn btn-default"
-                                    onclick="javascript:showInstanceTopology('{% url 'projects:instances:show_topology' instance_id=i|get:'_id'  type=type %}')"
+                                    onclick="javascript:showInstanceTopology('{% url 'instances:show_topology' instance_id=i|get:'_id'  type=type %}')"
                                     data-toggle="tooltip" data-placement="top" data-container="body" title="Show Topology">
                                 <i class="fa fa-sitemap"></i>
                             </button>
                             -->
 
                             <button type="button" class="btn btn-default"
-                                    onclick="javascript:deleteNs('{% url 'projects:instances:delete' instance_id=i|get:'_id'  type=type %}')"
+                                    onclick="javascript:deleteNs('{% url 'instances:delete' instance_id=i|get:'_id'  type=type %}')"
                                     data-toggle="tooltip" data-placement="top" data-container="body" title="Delete"><i
                                     class="far fa-trash-alt"></i></button>
 
                                 <span class="fa fa-caret-down"></span></button>
                             <ul class="dropdown-menu">
                                 <li><a href="#"
-                                       onclick="javascript:performAction('{% url 'projects:instances:action' instance_id=i|get:'_id'  type=type %}')">
+                                       onclick="javascript:performAction('{% url 'instances:action' instance_id=i|get:'_id'  type=type %}')">
                                     <i class="fa fa-magic"></i> Exec NS Primitive</a></li>
                                 <li>
-                                    <a href="{% url 'projects:instances:ns_operations'  type=type instance_id=i|get:'_id' %}">
+                                    <a href="{% url 'instances:ns_operations'  type=type instance_id=i|get:'_id' %}">
                                         <i class="fa fa-list"></i> Active operations</a></li>
                                 <li class="divider"></li>
                                 <li><a href="#"
-                                       onclick="javascript:newAlarmNs('{% url 'projects:instances:ns_create_alarm' instance_id=i|get:'_id'  type=type %}')">
+                                       onclick="javascript:newAlarmNs('{% url 'instances:ns_create_alarm' instance_id=i|get:'_id'  type=type %}')">
                                     <i class="far fa-bell"></i> New Alarm</a></li>
                                 <li><a href="#"
-                                       onclick="javascript:exportMetricNs('{% url 'projects:instances:ns_export_metric' instance_id=i|get:'_id'  type=type %}')">
+                                       onclick="javascript:exportMetricNs('{% url 'instances:ns_export_metric' instance_id=i|get:'_id'  type=type %}')">
                                     <i class="far fa-chart-bar"></i> Export metric</a></li>
                                 <li class="divider"></li>
                                 <li>
-                                    <a href="javascript:deleteNs('{% url 'projects:instances:delete' instance_id=i|get:'_id'  type=type %}', true)">
+                                    <a href="javascript:deleteNs('{% url 'instances:delete' instance_id=i|get:'_id'  type=type %}', true)">
                                         <i class="far fa-trash-alt" style="color:red" ></i> Force delete</a></li>
                             </ul>
 
index 410fcb0..b8fd9cc 100644 (file)
@@ -37,7 +37,7 @@
                     <td>
                         <div class="btn-group">
                             <button type="button" class="btn btn-default"
-                                    onclick="javascript:showInstanceDetails('{% url 'projects:instances:show' instance_id=i|get:'_id'  type=type %}')"
+                                    onclick="javascript:showInstanceDetails('{% url 'instances:show' instance_id=i|get:'_id'  type=type %}')"
                                     data-toggle="tooltip" data-placement="top" data-container="body" title="Show Info">
                                 <i class="fa fa-info"></i>
                             </button>
index e72b56c..55c097b 100644 (file)
@@ -25,7 +25,7 @@
 
 {% block breadcrumb_body %}
     {{ block.super }}
-    <li><a href="{% url 'projects:instances:list'  type=type %}">Instances</a></li>
+    <li><a href="{% url 'instances:list'  type=type %}">Instances</a></li>
 {% endblock %}
 
 {% block content_body %}
@@ -74,7 +74,7 @@
                                 <td>
                                     <div class="btn-group">
                                         <button type="button" class="btn btn-default"
-                                                onclick="javascript:showOperationDetails('{% url 'projects:instances:ns_operation' op_id=i|get:'_id' instance_id=i|get:'nsInstanceId'  type=type %}')"
+                                                onclick="javascript:showOperationDetails('{% url 'instances:ns_operation' op_id=i|get:'_id' instance_id=i|get:'nsInstanceId'  type=type %}')"
                                                 data-toggle="tooltip" data-placement="top" data-container="body" title="More Info"><i
                                                 class="fa fa-info"></i>
                                         </button>
index 627770d..fb67fbc 100644 (file)
@@ -24,7 +24,7 @@
 
 {% block breadcrumb_body %}
     {{ block.super }}
-    <li><a href="{% url 'projects:instances:list'  type=type %}">{{ type|upper }} Instances</a></li>
+    <li><a href="{% url 'instances:list'  type=type %}">{{ type|upper }} Instances</a></li>
     <li><a href="#"><i class="fa fa-sitemap"></i> {{ type|upper }} Topology</a></li>
 {% endblock %}
 
index 384e782..a776697 100644 (file)
@@ -6,7 +6,7 @@
                     <span aria-hidden="true">×</span></button>
                 <h4 class="modal-title">New Instance</h4>
             </div>
-            <form id="formCreateNS" action='{% url "projects:instances:create"   %}'
+            <form id="formCreateNS" action='{% url "instances:create"   %}'
                   class="form-horizontal"
                   method="post" enctype="multipart/form-data">
                 {% csrf_token %}
index 2148b7b..149b9c1 100644 (file)
@@ -78,7 +78,7 @@ def create(request):
     user = osmutils.get_user(request)
     client = Client()
     result = client.ns_create(user.get_token(), ns_data)
-    return __response_handler(request, result, 'projects:instances:list', to_redirect=True, type='ns',
+    return __response_handler(request, result, 'instances:list', to_redirect=True, type='ns',
                               )
 
 
@@ -132,7 +132,7 @@ def delete(request, instance_id=None, type=None):
     client = Client()
     result = client.ns_delete(user.get_token(), instance_id, force)
     print result
-    return __response_handler(request, result, 'projects:instances:list', to_redirect=True, type='ns',
+    return __response_handler(request, result, 'instances:list', to_redirect=True, type='ns',
                               )
 
 
index c995844..ee3eaa7 100644 (file)
@@ -42,7 +42,7 @@
                                 {% if descriptor_type == "nsd" %}
                                     <button type="button" class="btn btn-default" data-container="body"
                                             data-toggle="tooltip" data-placement="top" title="Instantiate NS"
-                                            onclick="javascript:openModalCreateNS({ 'project_id':'{{ project_id }}', 'descriptor_type': '{{ descriptor_type }}', 'descriptor_name':'{{ k|get:"name" }}', 'descriptor_id':'{{ k|get:"_id" }}','vim_list_url': '{% url "projects:vims:list"  %}',  'nsd_list_url': '{% url "projects:list_descriptors"  descriptor_type=descriptor_type %}' })">
+                                            onclick="javascript:openModalCreateNS({ 'project_id':'{{ project_id }}', 'descriptor_type': '{{ descriptor_type }}', 'descriptor_name':'{{ k|get:"name" }}', 'descriptor_id':'{{ k|get:"_id" }}','vim_list_url': '{% url "vims:list"  %}',  'nsd_list_url': '{% url "projects:list_descriptors"  descriptor_type=descriptor_type %}' })">
                                         <i class="fa fa-paper-plane"></i></button>
                                 {% endif %}
                                 <button type="button" class="btn btn-default" data-container="body"
index b0a1203..5158d8f 100644 (file)
@@ -62,7 +62,7 @@
                     <div class="inner"><h3>{{ project_overview.ns }}</h3>
                         <p>NS Instances</p></div>
                     <div class="icon"><i class="fa fa-sitemap fa-fw"></i></div>
-                    <a href='{% url "projects:instances:list"  type="ns"  %}' class="small-box-footer">Open list <i
+                    <a href='{% url "instances:list"  type="ns"  %}' class="small-box-footer">Open list <i
                             class="fa fa-arrow-circle-right"></i></a></div>
             </div>
 
@@ -71,7 +71,7 @@
                     <div class="inner"><h3>{{ project_overview.vnf }}</h3>
                         <p>VNF Instances</p></div>
                     <div class="icon"><i class="far fa-hdd fa-fw"></i></div>
-                    <a href='{% url "projects:instances:list"  type="vnf"  %}' class="small-box-footer">Open list <i
+                    <a href='{% url "instances:list"  type="vnf"  %}' class="small-box-footer">Open list <i
                             class="fa fa-arrow-circle-right"></i></a></div>
             </div>
 
index b07c432..82becc5 100644 (file)
@@ -38,8 +38,8 @@
 
                 </ul>
             </li>
-            {% url "projects:instances:list"  type='ns' as  instance_ns_list_url %}
-            {% url "projects:instances:list"  type='vnf' as  instance_vnf_list_url %}
+            {% url "instances:list"  type='ns' as  instance_ns_list_url %}
+            {% url "instances:list"  type='vnf' as  instance_vnf_list_url %}
             <li {% if request.get_full_path == instance_ns_list_url or  request.get_full_path == instance_vnf_list_url %}
                 class="active treeview menu-open" {% else %} class="treeview  menu-open" {% endif %} >
                 <a href="#">
                     </span>
                 </a>
                 <ul class="treeview-menu" style="display: block;">
-                    {% url "projects:instances:list"  type='ns' as  instance_ns_list_url %}
+                    {% url "instances:list"  type='ns' as  instance_ns_list_url %}
                     <li {% if request.get_full_path == instance_ns_list_url %} class="active" {% endif %} >
-                        <a href='{% url "projects:instances:list"   type="ns" %}'>
+                        <a href='{% url "instances:list"   type="ns" %}'>
                             <i class="fa fa-sitemap fa-fw"></i> <span>NS Instances</span>
                         </a>
 
                     </li>
-                    {% url "projects:instances:list"  type='vnf' as  instance_vnf_list_url %}
+                    {% url "instances:list"  type='vnf' as  instance_vnf_list_url %}
                     <li {% if request.get_full_path == instance_vnf_list_url %} class="active" {% endif %} >
-                        <a href='{% url "projects:instances:list"   type="vnf" %}'>
+                        <a href='{% url "instances:list"   type="vnf" %}'>
                             <i class="far fa-hdd fa-fw"></i> <span>VNF Instances</span>
                         </a>
                     </li>
                 </ul>
             </li>
 
-            {% url "projects:sdns:list"   as sdn_list_url %}
+            {% url "sdns:list"   as sdn_list_url %}
             <li {% if request.get_full_path == sdn_list_url %} class="active" {% endif %}>
-                <a href='{% url "projects:sdns:list"   %}'>
+                <a href='{% url "sdns:list"   %}'>
                     <i class="fas fa-globe fa-fw"></i> <span>SDN Controllers</span>
                 </a>
             </li>
 
-            {% url "projects:vims:list"   as  vim_list_url %}
+            {% url "vims:list"   as  vim_list_url %}
             <li {% if request.get_full_path == vim_list_url %} class="active" {% endif %}>
-                <a href='{% url "projects:vims:list"   %}'>
+                <a href='{% url "vims:list"   %}'>
                     <i class="fa fa-server fa-fw"></i> <span>VIM Accounts</span>
                 </a>
             </li>
index 1e3b24e..e0395c8 100644 (file)
@@ -36,8 +36,6 @@ urlpatterns = [
         name='new_descriptor'),
     url(r'^composer$', views.open_composer, name='open_composer'),
     url(r'^availablenodes', views.get_available_nodes, name='get_available_nodes'),
-    url(r'^sdn/', include('sdnctrlhandler.urls', namespace='sdns'), name='sdns_base'),
-    url(r'^vims/', include('vimhandler.urls', namespace='vims'), name='vims_base'),
-    url(r'^instances/', include('instancehandler.urls', namespace='instances'), name='instances_base'),
+
 
 ]
\ No newline at end of file
index 75d010d..cd912bc 100644 (file)
@@ -19,7 +19,7 @@
 
 {% block breadcrumb_body %}
     {{ block.super }}
-    <li><a href="{% url 'projects:sdns:list'  %}">SDN Controllers</a></li>
+    <li><a href="{% url 'sdns:list'  %}">SDN Controllers</a></li>
 {% endblock %}
 
 {% block content_body %}
@@ -27,7 +27,7 @@
 
     <div class="row">
         <div class="col-md-12">
-            <form action='{% url 'projects:sdns:create'  %}' method="post">
+            <form action='{% url 'sdns:create'  %}' method="post">
                 {% csrf_token %}
                 <div class="box">
                     <div class="box-header with-border">
 
                     </div>
                     <div class="box-footer">
-                        <button onclick="location.href='{% url 'projects:sdns:list'  %}'"
+                        <button onclick="location.href='{% url 'sdns:list'  %}'"
                                 class="btn btn-default pull-left">Back to
                             SDN Controllers
                         </button>
index acb73d1..627278c 100644 (file)
@@ -17,7 +17,7 @@
 
 {% block breadcrumb_body %}
     {{ block.super }}
-    <li><a href="{% url 'projects:sdns:list'  %}">SDN Controllers</a></li>
+    <li><a href="{% url 'sdns:list'  %}">SDN Controllers</a></li>
 {% endblock %}
 
 {% block content_body %}
@@ -31,7 +31,7 @@
                 <div class="box-header with-border">
                     <h3 class="box-title">Registered SDN Controllers</h3>
                     <div class="box-tools">
-                        <a href='{% url "projects:sdns:create"  %}' class="btn btn-block btn-primary btn-sm"><i
+                        <a href='{% url "sdns:create"  %}' class="btn btn-block btn-primary btn-sm"><i
                                 class="fa fa-plus"></i><span> New SDN Controller</span></a>
                     </div>
                 </div>
index 26488ce..aa89a59 100644 (file)
@@ -63,7 +63,7 @@ def create(request):
 
         result = client.sdn_create(user.get_token(), sdn_data)
 
-        return __response_handler(request, result, 'projects:sdns:list', to_redirect=True, )
+        return __response_handler(request, result, 'sdns:list', to_redirect=True, )
 
 
 @login_required
@@ -75,7 +75,7 @@ def delete(request, sdn_id=None):
         del_res = client.sdn_delete(user.get_token(), sdn_id)
     except Exception as e:
         log.exception(e)
-    return __response_handler(request, {}, 'projects:sdns:list', to_redirect=True, )
+    return __response_handler(request, {}, 'sdns:list', to_redirect=True, )
 
 
 @login_required
index 4902f8d..ea95716 100644 (file)
@@ -21,14 +21,14 @@ from sf_t3d import views
 
 app_name = 'base'
 urlpatterns = [
-    #url(r'^admin/', admin.site.urls),
-    url(r'^auth/$', user_views.user_login, name='auth_user'),
-    #url(r'^register', user_views.register_view, name='register_user'),
-    url(r'^projects/', include('projecthandler.urls.project', namespace='projects'), name='projects_base'),
-    url(r'^users/', include('userhandler.urls', namespace='users'), name='users_base'),
-
     url(r'^$', views.home, name='home'),
     url(r'^home', views.home, name='home'),
+    url(r'^auth/$', user_views.user_login, name='auth_user'),
+    url(r'^projects/', include('projecthandler.urls.project', namespace='projects'), name='projects_base'),
+    url(r'^sdn/', include('sdnctrlhandler.urls', namespace='sdns'), name='sdns_base'),
+    url(r'^vims/', include('vimhandler.urls', namespace='vims'), name='vims_base'),
+    url(r'^instances/', include('instancehandler.urls', namespace='instances'), name='instances_base'),
+    url(r'^admin/users/', include('userhandler.urls', namespace='users'), name='users_base'),
     url(r'^forbidden', views.forbidden, name='forbidden'),
 
 ]
index 606da3a..9da94be 100644 (file)
@@ -1,7 +1,7 @@
 function deleteSDN(sdn_uuid) {
     bootbox.confirm("Are you sure want to delete?", function (result) {
         if (result) {
-            location.href = '/projects/sdn/' + sdn_uuid + '/delete'
+            location.href = '/sdn/' + sdn_uuid + '/delete'
         }
     })
 }
@@ -13,7 +13,7 @@ function showSDN(sdn_uuid) {
     });
 
     $.ajax({
-        url: '/projects/sdn/' + sdn_uuid ,
+        url: '/sdn/' + sdn_uuid ,
         //url: '/sdn/' + sdn_uuid,
         type: 'GET',
         dataType: "json",
index 196b878..282c314 100644 (file)
@@ -23,8 +23,6 @@ function openModalCreateUser(args) {
         }
     });
 
-
-
     $('#modal_new_user').modal('show');
 }
 
index 187dc87..f7f91a2 100644 (file)
@@ -19,7 +19,7 @@
 
 {% block breadcrumb_body %}
     {{ block.super }}
-    <li><a href="{% url 'projects:vims:list'  %}">VIMS</a></li>
+    <li><a href="{% url 'vims:list'  %}">VIMS</a></li>
 {% endblock %}
 
 {% block content_body %}
@@ -27,7 +27,7 @@
 
     <div class="row">
         <div class="col-md-12">
-            <form action='{% url "projects:vims:create"   %}' method="post">
+            <form action='{% url "vims:create"   %}' method="post">
                 {% csrf_token %}
                 <div class="box">
                     <div class="box-header with-border">
 
                     </div>
                     <div class="box-footer">
-                        <button onclick="location.href='{% url 'projects:vims:list' %}'" class="btn btn-default pull-left">Back to
+                        <button onclick="location.href='{% url 'vims:list' %}'" class="btn btn-default pull-left">Back to
                             VIM Accounts
                         </button>
                         <button class="btn btn-primary pull-right">Create</button>
index 535f4db..d1b9545 100644 (file)
@@ -19,7 +19,7 @@
 
 {% block breadcrumb_body %}
     {{ block.super }}
-    <li><a href="{% url "projects:vims:list"   %}">VIMS</a></li>
+    <li><a href="{% url "vims:list"   %}">VIMS</a></li>
 {% endblock %}
 
 {% block content_body %}
@@ -33,7 +33,7 @@
                 <div class="box-header with-border">
                     <h3 class="box-title">Registered VIM</h3>
                     <div class="box-tools">
-                        <a href='{% url "projects:vims:create"   %}' class="btn btn-block btn-primary btn-sm"><i
+                        <a href='{% url "vims:create"   %}' class="btn btn-block btn-primary btn-sm"><i
                                 class="fa fa-plus"></i><span> New VIM</span></a>
                     </div>
                 </div>
                                 <td>
                                     <div class="btn-group">
                                         <button type="button" class="btn btn-default"
-                                                onclick="location.href='{% url "projects:vims:show"   vim_id=p|get:"_id" %}'" data-toggle="tooltip" data-placement="top" data-container="body" title="Show Info"><i
+                                                onclick="location.href='{% url "vims:show"   vim_id=p|get:"_id" %}'" data-toggle="tooltip" data-placement="top" data-container="body" title="Show Info"><i
                                                 class="fa fa-info"></i></button>
                                         <button type="button" class="btn btn-default"
-                                                onclick="javascript:deleteVim('{% url "projects:vims:delete"   vim_id=p|get:"_id" %}')" data-toggle="tooltip" data-placement="top" data-container="body" title="Delete"><i
+                                                onclick="javascript:deleteVim('{% url "vims:delete"   vim_id=p|get:"_id" %}')" data-toggle="tooltip" data-placement="top" data-container="body" title="Delete"><i
                                                 class="far fa-trash-alt" ></i></button>
                                     </div>
                                 </td>
index 13613de..38f2700 100644 (file)
@@ -18,7 +18,7 @@
 
 {% block breadcrumb_body %}
     {{ block.super }}
-    <li><a href="{% url 'projects:vims:list' %}">VIMS</a></li>
+    <li><a href="{% url 'vims:list' %}">VIMS</a></li>
 {% endblock %}
 
 {% block content_body %}
             </div>
             <div class="box-footer">
                 <div class="">
-                    <button onclick="location.href='{% url 'projects:vims:list' %}'" class="btn btn-primary">Back to VIM Accounts</button>
+                    <button onclick="location.href='{% url 'vims:list' %}'" class="btn btn-primary">Back to VIM Accounts</button>
                 </div>
             </div>
         </div>
index bf88c11..d41ff82 100644 (file)
@@ -76,7 +76,7 @@ def create(request):
                 print e
         result = client.vim_create(user.get_token(), vim_data)
         # TODO  'vim:show', to_redirect=True, vim_id=vim_id
-        return __response_handler(request, result, 'projects:vims:list', to_redirect=True, )
+        return __response_handler(request, result, 'vims:list', to_redirect=True, )
 
 @login_required
 def delete(request, vim_id=None):
@@ -86,7 +86,7 @@ def delete(request, vim_id=None):
         del_res = client.vim_delete(user.get_token(), vim_id)
     except Exception as e:
         log.exception(e)
-    return __response_handler(request, {}, 'projects:vims:list', to_redirect=True, )
+    return __response_handler(request, {}, 'vims:list', to_redirect=True, )
 
 @login_required
 def show(request, vim_id=None):