added create nsi button in netslice template list 34/7134/1
authorlombardofr <lombardo@everyup.it>
Tue, 29 Jan 2019 16:19:28 +0000 (17:19 +0100)
committerlombardofr <lombardo@everyup.it>
Tue, 29 Jan 2019 16:19:28 +0000 (17:19 +0100)
Change-Id: I155696de31253ce8afb8a26db8ec2360d6f1e07a
Signed-off-by: lombardofr <lombardo@everyup.it>
netslicehandler/template/nst_list.html
static/src/instancehandler/instance_create.js

index 41525ef..57e940f 100644 (file)
@@ -32,6 +32,7 @@ Network Slices Templates
 {% block content_body %}
 {{ block.super }}
 {% include 'modal/nst_details.html' %}
+{% include 'modal/instance_create_nsi.html' %}
 {% csrf_token %}
 <div class="row">
     <div class="col-md-12">
@@ -96,6 +97,7 @@ Network Slices Templates
 <script src="/static/src/drop_zone.js"></script>
 <script src="/static/src/netslicehandler/onboard_template.js"></script>
 <script src="/static/src/netslicehandler/templates_list.js"></script>
+<script src="/static/src/instancehandler/instance_create.js"></script>
 <script>
     var csrf_token = '{{csrf_token}}';
     var table;
@@ -147,6 +149,10 @@ Network Slices Templates
                 {
                     "render": function (data, type, row) {
                         return '<div class="btn-group">' +
+                            '   <button type="button" class="btn btn-default" data-container="body"\n' +
+                               'data-toggle="tooltip" data-placement="top" title="Instantiate NS"\n' +
+                               'onclick="javascript:openModalCreateNSI({\'template_name\':\''+row["name"]+'\', \'template_id\':\''+row["_id"]+'\', \'project_id\':\'{{ project_id }}\',\'vim_list_url\': \'{% url "vims:list"  %}\', \'nst_list_url\': \'{% url "netslices:list_templates" %}\'})">\n' +
+                               '<i class="fa fa-paper-plane"></i></button>\n'+
                             '     <button type="button" class="btn btn-default"' +
                             '             onclick="javascript:showNstDetails(\'' + row["_id"] + '\')"' +
                             '             data-toggle="tooltip" data-placement="top" data-container="body" title="Open">' +
index 3cce0c4..fd6ecfa 100644 (file)
@@ -148,14 +148,13 @@ function openModalCreateNSI(args) {
             }
         }
     });
-
-    if (args.descriptor_id) {
+    if (args.template_id) {
         // Set the value, creating a new option if necessary
-        if ($('#nstId').find("option[value='" + args.descriptor_id + "']").length) {
-            $('#nstId').val(args.descriptor_id).trigger('change');
+        if ($('#nstId').find("option[value='" + args.template_id + "']").length) {
+            $('#nstId').val(args.template_id).trigger('change');
         } else {
             // Create a DOM Option and pre-select by default
-            var newOption = new Option(args.descriptor_name, args.descriptor_id, true, true);
+            var newOption = new Option(args.template_name, args.template_id, true, true);
             // Append it to the select
             $('#nstId').append(newOption).trigger('change');
         }