fix missing vnfd composer constraint
[osm/LW-UI.git] / static / src / descriptorhandler / composer.js
index 175f46b..4b8bfd5 100644 (file)
@@ -72,13 +72,18 @@ $(document).ready(function () {
         form_data.forEach(function (value, key) {
             formDataJson[key] = value;
         });
+        var dialog = bootbox.dialog({
+            message: '<div class="text-center"><i class="fa fa-spin fa-spinner"></i> Updating...</div>',
+            closeButton: true
+        });
         if (graph_editor._selected_node) {
             graph_editor.updateDataNode(graph_editor._selected_node, formDataJson, function () {
-
+                dialog.modal('hide');
             }, function (result) {
                 var data = result.responseJSON;
                 var title = "Error " + (data && data.code ? data.code : 'unknown');
                 var message = data && data.detail ? data.detail : 'No detail available.';
+                dialog.modal('hide');
                 bootbox.alert({
                     title: title,
                     message: message
@@ -86,11 +91,12 @@ $(document).ready(function () {
             })
         } else {
             graph_editor.updateGraphParams(formDataJson, function () {
-
+                dialog.modal('hide');
             }, function (result) {
                 var data = result.responseJSON;
                 var title = "Error " + (data && data.code ? data.code : 'unknown');
                 var message = data && data.detail ? data.detail : 'No detail available.';
+                dialog.modal('hide');
                 bootbox.alert({
                     title: title,
                     message: message
@@ -112,7 +118,7 @@ function initDropOnGraph() {
 
         var nodetype = $('#' + elemet_id).attr('type-name');
         var random_name = nodetype + "_" + generateUID();
-
+        console.log(nodetype)
         var node_information = {
             'id': random_name,
             'info': {
@@ -128,21 +134,17 @@ function initDropOnGraph() {
             'x': e.layerX,
             'y': e.layerY
         };
-        if (nodetype === 'ns_vl') {
 
-            graph_editor.addNode(node_information, function () {
-                console.log("OK")
-            }, function (error) {
-                showAlert(error)
-            })
-        } else if (nodetype === 'vnf') {
+        if (nodetype === 'vnf') {
             node_information['id'] = $('#' + elemet_id).attr('desc_id');
-            graph_editor.addNode(node_information, function () {
-                console.log("OK")
-            }, function (error) {
-                showAlert(error)
-            })
         }
+
+        graph_editor.addNode(node_information, function () {
+            console.log("OK")
+        }, function (error) {
+            showAlert(error)
+        })
+
     };
 
     dropZone.ondragover = function (ev) {
@@ -255,7 +257,7 @@ function updatePalette(view) {
             var node = nodes[n];
             if (nodes_properties[node]) {
                 palette_template += '<div id="drag_' + n + '" class="node ui-draggable"' +
-                    'type-name="' + n + '" draggable="true" ondragstart="nodeDragStart(event)">' +
+                    'type-name="' + node + '" draggable="true" ondragstart="nodeDragStart(event)">' +
                     '<div class="icon" style="background-color:' + nodes_properties[node].color + '"></div>' +
                     '<div class="name">' + nodes_properties[node].name + '</div></div>';
             }