projects
/
osm
/
LW-UI.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix bug 973
[osm/LW-UI.git]
/
static
/
src
/
descriptorhandler
/
composer.js
diff --git
a/static/src/descriptorhandler/composer.js
b/static/src/descriptorhandler/composer.js
index
175f46b
..
aef680f
100644
(file)
--- 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 = {
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"]
};
"vnfd": ["vdu", "cp", "vnf_vl", "int_cp"]
};
@@
-72,13
+72,18
@@
$(document).ready(function () {
form_data.forEach(function (value, key) {
formDataJson[key] = value;
});
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 () {
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.';
}, 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
bootbox.alert({
title: title,
message: message
@@
-86,11
+91,12
@@
$(document).ready(function () {
})
} else {
graph_editor.updateGraphParams(formDataJson, 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.';
}, 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
bootbox.alert({
title: title,
message: message
@@
-112,7
+118,7
@@
function initDropOnGraph() {
var nodetype = $('#' + elemet_id).attr('type-name');
var random_name = nodetype + "_" + generateUID();
var nodetype = $('#' + elemet_id).attr('type-name');
var random_name = nodetype + "_" + generateUID();
-
+ console.log(nodetype)
var node_information = {
'id': random_name,
'info': {
var node_information = {
'id': random_name,
'info': {
@@
-128,21
+134,23
@@
function initDropOnGraph() {
'x': e.layerX,
'y': e.layerY
};
'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');
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) {
};
dropZone.ondragover = function (ev) {
@@
-191,6
+199,11
@@
function refreshElementInfo(event, element) {
vduDetails(element.info.osm);
break;
case 'int_cp':
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;
case 'cp':
cpDetails(element.info.osm);
break;
@@
-253,9
+266,9
@@
function updatePalette(view) {
var nodes_properties = osm_gui_properties['nodes'];
for (var n in nodes) {
var node = nodes[n];
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 += '<div id="drag_' + n + '" class="node ui-draggable"' +
palette_template += '<div id="drag_' + n + '" class="node ui-draggable"' +
- 'type-name="' + n + '" draggable="true" ondragstart="nodeDragStart(event)">' +
+ 'type-name="' + n
ode
+ '" 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>';
}
'<div class="icon" style="background-color:' + nodes_properties[node].color + '"></div>' +
'<div class="name">' + nodes_properties[node].name + '</div></div>';
}
@@
-283,7
+296,13
@@
function updatePalette(view) {
palette.append(palette_template)
},
error: function (result) {
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
+ });
}
});
}
}
});
}
@@
-309,6
+328,15
@@
function vduDetails(vdur) {
side.append(vdur_template)
}
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');
function cpDetails(cp) {
var side = $('#side_form');
var cp_template = getMainSectionWithSubmitButton('Connection Point');
@@
-318,6
+346,15
@@
function cpDetails(cp) {
side.append(cp_template);
}
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');
function vlDetails(vl) {
var side = $('#side_form');
var vl_template = getMainSectionWithSubmitButton('Virtual Link');