X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=static%2Fsrc%2Fdescriptorhandler%2Fcomposer.js;h=aef680fdde49946a46222efc1d6b1cfba5591275;hb=8c35a0fcca1548bbf99e6b4464e039971c96ecc7;hp=d56e22fd9c97b0f90ecbc799c83f1a5abebb9e23;hpb=c43f285349b9222b3017eaeec5d0959653a0c814;p=osm%2FLW-UI.git diff --git a/static/src/descriptorhandler/composer.js b/static/src/descriptorhandler/composer.js index d56e22f..aef680f 100644 --- a/static/src/descriptorhandler/composer.js +++ b/static/src/descriptorhandler/composer.js @@ -18,7 +18,7 @@ var graph_editor = new TCD3.ModelGraphEditor(); var type_view = { - "nsd": ["vnf", "ns_vl"], + "nsd": ["vnf", "ns_vl", "ns_cp"], "vnfd": ["vdu", "cp", "vnf_vl", "int_cp"] }; @@ -118,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': { @@ -134,21 +134,23 @@ 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 (result) { + var data = result.responseJSON; + var title = "Error " + (data && data.code ? data.code : 'unknown'); + var message = data && data.detail ? data.detail : 'No detail available.'; + bootbox.alert({ + title: title, + message: message + }); + }) + }; dropZone.ondragover = function (ev) { @@ -197,6 +199,11 @@ function refreshElementInfo(event, element) { vduDetails(element.info.osm); break; case 'int_cp': + intcpDetails(element.info.osm); + break; + case 'ns_cp': + nscpDetails(element.info.osm); + break; case 'cp': cpDetails(element.info.osm); break; @@ -259,9 +266,9 @@ function updatePalette(view) { var nodes_properties = osm_gui_properties['nodes']; for (var n in nodes) { var node = nodes[n]; - if (nodes_properties[node]) { + if (nodes_properties[node] && (nodes_properties[node].draggable != false)) { palette_template += '
' + + 'type-name="' + node + '" draggable="true" ondragstart="nodeDragStart(event)">' + '
' + '
' + nodes_properties[node].name + '
'; } @@ -289,7 +296,13 @@ function updatePalette(view) { palette.append(palette_template) }, error: function (result) { - showAlert(result); + var data = result.responseJSON; + var title = "Error " + (data && data.code ? data.code : 'unknown'); + var message = data && data.detail ? data.detail : 'No detail available.'; + bootbox.alert({ + title: title, + message: message + }); } }); } @@ -315,6 +328,15 @@ function vduDetails(vdur) { side.append(vdur_template) } +function intcpDetails(cp) { + var side = $('#side_form'); + var cp_template = getMainSection('Int. Connection Point'); + + cp_template += getChildrenTable(cp, true); + side.empty(); + side.append(cp_template); +} + function cpDetails(cp) { var side = $('#side_form'); var cp_template = getMainSectionWithSubmitButton('Connection Point'); @@ -324,6 +346,15 @@ function cpDetails(cp) { side.append(cp_template); } +function nscpDetails(cp) { + var side = $('#side_form'); + var cp_template = getMainSection('Connection Point'); + + cp_template += getChildrenTable(cp, true); + side.empty(); + side.append(cp_template); +} + function vlDetails(vl) { var side = $('#side_form'); var vl_template = getMainSectionWithSubmitButton('Virtual Link');