VIM accounts part of the project view 48/6248/4
authorlombardof <flombardo@cnit.it>
Sun, 3 Jun 2018 14:52:12 +0000 (16:52 +0200)
committerlombardof <flombardo@cnit.it>
Tue, 12 Jun 2018 15:38:18 +0000 (17:38 +0200)
Change-Id: I58992f1fd42dcf78b2db33a285af1b8032a954db
Signed-off-by: lombardof <flombardo@cnit.it>
instancehandler/template/instance_list_ns.html
projecthandler/template/project/osm/descriptor/descriptorlist.html
projecthandler/template/project/osm/osm_project_left_sidebar.html
projecthandler/urls/project.py
sf_t3d/urls.py
template/left_sidebar_base.html
vimhandler/template/vim_create.html
vimhandler/template/vim_list.html
vimhandler/template/vim_show.html
vimhandler/views.py

index 0e32765..bc3b94a 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 "vim:list" %}', 'nsd_list_url': '{% url "projects:list_descriptors" project_id=project_id descriptor_type='nsd' %}'})">
+                    onclick="javascript:openModalCreateNS({ 'project_id':'{{ project_id }}','vim_list_url': '{% url "projects:vims:list" project_id=project_id %}', 'nsd_list_url': '{% url "projects:list_descriptors" project_id=project_id descriptor_type='nsd' %}'})">
                 <i class="fa fa-paper-plane"></i> <span> New NS</span></button>
 
         </div>
index f2f4c8d..67f4a75 100644 (file)
@@ -37,7 +37,7 @@
                     <td>
                         <div class="btn-group">
                             {% 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 "vim:list" %}',  'nsd_list_url': '{% url "projects:list_descriptors" project_id=project_id descriptor_type=descriptor_type  %}' })"><i class="fa fa-paper-plane"></i></button>
+                            <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" project_id=project_id%}',  'nsd_list_url': '{% url "projects:list_descriptors" project_id=project_id descriptor_type=descriptor_type  %}' })"><i class="fa fa-paper-plane"></i></button>
                             {% endif %}
                             <button type="button" class="btn btn-default" data-container="body" data-toggle="tooltip" data-placement="top" title="Edit" onclick="javascript:openDescriptorView('{{project_id}}', '{{descriptor_type}}', '{{ k|get:"_id" }}')"><i class="fa fa-edit"></i></button>
                             <button type="button" class="btn btn-default" data-container="body" data-toggle="tooltip" data-placement="top" title="Show content" onclick="javascript:openPackageContentList('{{project_id}}', '{{descriptor_type}}', '{{ k|get:"_id" }}')"><i class="fa fa-folder-open"></i></button>
index 495f85e..b265080 100644 (file)
                      <i class="fa fa-list fa-fw"></i><span>SDN Controllers</span>
                  </a>
              </li>
-            <li class="header">CONFIG</li>
-            {% url "vim:list"  type='ns' as  vim_list_url %}
+
+            {% url "projects:vims:list"  project_id=project_id as  vim_list_url %}
              <li {% if request.get_full_path == vim_list_url %} class="active" {% endif %}>
-                 <a href='{% url "vim:list" %}'>
+                 <a href='{% url "projects:vims:list"  project_id=project_id %}'>
                      <i class="fa fa-list fa-fw"></i><span>VIM Accounts</span>
                  </a>
              </li>
index eb88a9e..452365a 100644 (file)
@@ -22,6 +22,7 @@ urlpatterns = [
     url(r'^new/', views.create_new_project, name='new_project'),
     url(r'^(?P<project_id>\d+)/$', views.open_project, name='open_project'),
     url(r'^(?P<project_id>\d+)/sdn/', include('sdnctrlhandler.urls', namespace='sdns'), name='sdns_base'),
+    url(r'^(?P<project_id>\d+)/vims/', include('vimhandler.urls', namespace='vims'), name='vims_base'),
     url(r'^(?P<project_id>\d+)/instances/', include('instancehandler.urls', namespace='instances'), name='instances_base'),
     url(r'^(?P<project_id>\d+)/delete$', views.delete_project, name='delete_project'),
     url(r'^(?P<project_id>\d+)/graph(/$)', views.graph, name='graph_view'),
index bea83a2..5b82f5a 100644 (file)
@@ -26,7 +26,7 @@ urlpatterns = [
     url(r'^auth_guest/$', user_views.guest_login, name='auth_user_guest'),
     url(r'^register', user_views.register_view, name='register_user'),
     url(r'^projects/', include('projecthandler.urls.project', namespace='projects'), name='projects_base'),
-    url(r'^vims/', include('vimhandler.urls', namespace='vim'), name='vims_base'),
+    #url(r'^vims/', include('vimhandler.urls', namespace='vim'), name='vims_base'),
     #url(r'^sdn/', include('sdnctrlhandler.urls', namespace='sdn'), name='sdns_base'),
 
     url(r'^$', views.home, name='home'),
index 20f664e..d2f4b56 100644 (file)
@@ -9,9 +9,6 @@
             <li {% if request.get_full_path == home_url %} class="active" {% endif %} ><a href='{% url "home" %}'><i class="fa fa-home fa-fw"></i><span>Home</span></a></li>
             {% url "projects:projects_list" as  projects_list_url %}
             <li {% if request.get_full_path == projects_list_url %} class="active" {% endif %}><a href='{% url "projects:projects_list" %}'><i class="fa fa-th-list fa-fw"></i><span>Projects</span></a></li>
-            {% url "vim:list" as  vims_list_url %}
-            <li {% if request.get_full_path == vims_list_url %} class="active" {% endif %}><a href='{% url "vim:list" %}'><i class="fa fa-th-list fa-fw"></i><span>VIM Accounts</span></a></li>
-
 
 
             {% block left_sidebar_base %}
index a68527e..4368735 100644 (file)
 {% endblock %}
 {% block left_sidebar %}
 
-    {% include 'left_sidebar_base.html' %}
+    {% include 'osm/osm_project_left_sidebar.html' %}
 
 {% endblock %}
 
 
 {% block breadcrumb_body %}
     {{ block.super }}
-    <li><a href="{% url 'vim:list' %}">VIMS</a></li>
+    <li><a href="{% url 'projects:vims:list' project_id=project_id %}">VIMS</a></li>
 {% endblock %}
 
 {% block content_body %}
@@ -27,7 +27,7 @@
 
     <div class="row">
         <div class="col-md-12">
-            <form action='{% url "vim:create" %}' method="post">
+            <form action='{% url "projects:vims:create" project_id=project_id  %}' method="post">
                 {% csrf_token %}
                 <div class="box">
                     <div class="box-header with-border">
 
                     </div>
                     <div class="box-footer">
-                        <button onclick="location.href='{% url 'vim:list' %}'" class="btn btn-default pull-left">Back to
+                        <button onclick="location.href='{% url 'projects:vims:list' project_id=project_id%}'" class="btn btn-default pull-left">Back to
                             VIM Accounts
                         </button>
                         <button class="btn btn-primary pull-right">Create</button>
index 08a64a0..753cb46 100644 (file)
 {% endblock %}
 {% block left_sidebar %}
 
-    {% include 'left_sidebar_base.html' %}
+   {% include 'osm/osm_project_left_sidebar.html' %}
 
 {% endblock %}
 
 
 {% block breadcrumb_body %}
     {{ block.super }}
-    <li><a href="{% url 'vim:list' %}">VIMS</a></li>
+    <li><a href="{% url "projects:vims:list"  project_id=project_id %}">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 "vim:create" %}' class="btn btn-block btn-primary btn-sm"><i
+                        <a href='{% url "projects:vims:create"  project_id=project_id %}' 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 "vim:show" vim_id=p|get:"_id" %}'" data-toggle="tooltip" data-placement="top" data-container="body" title="Show Info"><i
+                                                onclick="location.href='{% url "projects:vims:show"  project_id=project_id 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('{{ p|get:"_id" }}')" data-toggle="tooltip" data-placement="top" data-container="body" title="Delete"><i
+                                                onclick="javascript:deleteVim('{% url "projects:vims:delete"  project_id=project_id vim_id=p|get:"_id" %}')" data-toggle="tooltip" data-placement="top" data-container="body" title="Delete"><i
                                                 class="fa fa-trash-o" ></i></button>
                                     </div>
                                 </td>
 
     <script>
 
-        function deleteVim(vim_uuid) {
+        function deleteVim(url) {
             bootbox.confirm("Are you sure want to delete?", function (result) {
                 if (result) {
-                    location.href = '/vims/' + vim_uuid + '/delete'
+                    location.href = url//'/vims/' + vim_uuid + '/delete'
                 }
             })
         }
index cc796e2..74e816a 100644 (file)
@@ -1,24 +1,6 @@
 {% extends "base.html" %}
 {% load get %}
 {% load staticfiles %}
-{% block head_base %}
-    {% with skin_css="AdminLTE/dist/css/skins/skin-purple.min.css"%}
-        {{ block.super }}
-    {% endwith %}
-{% endblock %}
-
-{% block body %}
-    {% with skin="purple"%}
-        {{ block.super }}
-    {% endwith %}
-{% endblock %}
-{% block logo_sidebar %}
-    {% with logo_mini="assets/img/osm_small_logo.png" logo="assets/img/OSM-logo.png" %}
-        {{ block.super }}
-    {% endwith %}
-{% endblock %}
-
-
 
 {% block head_block %}
     {{ block.super }}
 {% endblock %}
 {% block left_sidebar %}
 
-    {% include 'left_sidebar_base.html' %}
+    {% include 'osm/osm_project_left_sidebar.html' %}
 
 {% endblock %}
 
 
 {% block breadcrumb_body %}
     {{ block.super }}
-    <li><a href="{% url 'vim:list' %}">VIMS</a></li>
+    <li><a href="{% url 'projects:vims:list' project_id=project_id%}">VIMS</a></li>
 {% endblock %}
 
 {% block content_body %}
             </div>
             <div class="box-footer">
                 <div class="">
-                    <button onclick="location.href='{% url 'vim:list' %}'" class="btn btn-primary">Back to VIM Accounts</button>
+                    <button onclick="location.href='{% url 'projects:vims:list' project_id=project_id%}'" class="btn btn-primary">Back to VIM Accounts</button>
                 </div>
             </div>
         </div>
index 19b58ad..28c264c 100644 (file)
@@ -24,19 +24,22 @@ import logging
 logging.basicConfig(level=logging.DEBUG)
 log = logging.getLogger('view.py')
 
+
 @login_required
-def list(request):
+def list(request, project_id):
     client = Client()
     result = client.vim_list()
     print result
     result = {
+        "project_id": project_id,
         "datacenters": result
     }
     return __response_handler(request, result, 'vim_list.html')
 
+
 @login_required
-def create(request):
-    result = {}
+def create(request, project_id):
+    result = {'project_id': project_id}
     if request.method == 'GET':
         return __response_handler(request, result, 'vim_create.html')
     else:
@@ -67,24 +70,25 @@ def create(request):
                 print e
         result = client.vim_create(vim_data)
         # TODO  'vim:show', to_redirect=True, vim_id=vim_id
-        return __response_handler(request, result, 'vim:list', to_redirect=True)
+        return __response_handler(request, result, 'projects:vims:list', to_redirect=True, project_id=project_id)
 
 @login_required
-def delete(request, vim_id=None):
+def delete(request, project_id, vim_id=None):
     try:
         client = Client()
         del_res = client.vim_delete(vim_id)
     except Exception as e:
         log.exception(e)
-    return __response_handler(request, {}, 'vim:list', to_redirect=True)
+    return __response_handler(request, {}, 'projects:vims:list', to_redirect=True, project_id=project_id)
 
 @login_required
-def show(request, vim_id=None):
+def show(request, project_id, vim_id=None):
     client = Client()
     datacenter = client.vim_get(vim_id)
     print datacenter
     return __response_handler(request, {
-        "datacenter": datacenter
+        "datacenter": datacenter,
+        "project_id": project_id
     }, 'vim_show.html')