X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fweb%2Fdevices%2Fsrc%2Fmain%2Fresources%2Fjs%2Fpage.js;h=2488d06d0cae7745a4efc58c8d8a42ff1f565271;hb=e383b2e0b9072b7b5b3e3903b8a42ab3917b7f63;hp=a138eb909e58a185fffb133624225d12c2801d0d;hpb=674ec80fc65bf6e1d389d2b9f4c302bc214dcfb3;p=controller.git
diff --git a/opendaylight/web/devices/src/main/resources/js/page.js b/opendaylight/web/devices/src/main/resources/js/page.js
index a138eb909e..2488d06d0c 100644
--- a/opendaylight/web/devices/src/main/resources/js/page.js
+++ b/opendaylight/web/devices/src/main/resources/js/page.js
@@ -464,7 +464,10 @@ one.f.switchmanager.subnetGatewayConfig = {
},
modal: {
modal: "one_f_switchmanager_subnetGatewayConfig_id_modal_modal",
+ ports : "one_f_switchmanager_subnetGatewayConfig_id_modal_ports",
save: "one_f_switchmanager_subnetGatewayConfig_id_modal_save",
+ remove: "one_f_switchmanager_subnetGatewayConfig_id_modal_remove",
+ cancel: "one_f_switchmanager_subnetGatewayConfig_id_modal_cancel",
form: {
name : "one_f_switchmanager_subnetGatewayConfig_id_modal_form_gatewayname",
gatewayIPAddress : "one_f_switchmanager_subnetGatewayConfig_id_modal_form_gatewayipaddress",
@@ -492,29 +495,19 @@ one.f.switchmanager.subnetGatewayConfig = {
$dashlet.append($button);
// Delete gateway ip address button
- var button = one.lib.dashlet.button.single("Delete Gateway IP Address(es)",
- one.f.switchmanager.subnetGatewayConfig.id.dashlet.removeIPAddress, "btn-primary", "btn-mini");
+ var button = one.lib.dashlet.button.single("Remove Gateway IP Address",
+ one.f.switchmanager.subnetGatewayConfig.id.dashlet.removeIPAddress, "btn-danger", "btn-mini");
var $button = one.lib.dashlet.button.button(button);
$button.click(function() {
- var requestData = {};
var gatewaysToDelete = [];
var checkedCheckBoxes = $("#" + one.f.switchmanager.subnetGatewayConfig.id.dashlet.datagrid).find("tbody input:checked")
checkedCheckBoxes.each(function(index, value) {
gatewaysToDelete.push(checkedCheckBoxes[index].id);
});
- if (gatewaysToDelete.length > 0) {
- requestData["gatewaysToDelete"] = gatewaysToDelete.toString();
- var url = one.f.switchmanager.rootUrl + "/subnetGateway/delete";
- one.f.switchmanager.subnetGatewayConfig.ajax.main(url, requestData, function(response) {
- if (response.status == true) {
- // refresh dashlet by passing dashlet div as param
- one.lib.alert("Subnet Gateway(s) successfully removed");
- } else {
- one.lib.alert(response.message);
- }
- one.f.switchmanager.subnetGatewayConfig.dashlet($("#right-bottom .dashlet"));
- });
+ if (checkedCheckBoxes.size() === 0) {
+ return false;
}
+ one.f.switchmanager.subnetGatewayConfig.modal.removeMultiple.dialog(gatewaysToDelete)
});
$dashlet.append($button);
@@ -542,7 +535,7 @@ one.f.switchmanager.subnetGatewayConfig = {
$("#" + one.f.switchmanager.subnetGatewayConfig.id.dashlet.datagrid).find(':checkbox').prop('checked',
$("#"+one.f.switchmanager.subnetGatewayConfig.id.dashlet.selectAll).is(':checked'));
});
- $(".subnetGatewayConfig").click(function(){
+ $(".subnetGatewayConfig").click(function(e){
if (!$('.subnetGatewayConfig[type=checkbox]:not(:checked)').length) {
$("#"+one.f.switchmanager.subnetGatewayConfig.id.dashlet.selectAll)
.prop("checked",
@@ -552,7 +545,7 @@ one.f.switchmanager.subnetGatewayConfig = {
.prop("checked",
false);
}
- event.stopPropagation();
+ e.stopPropagation();
});
});
});
@@ -582,7 +575,7 @@ one.f.switchmanager.subnetGatewayConfig = {
ports: function() {
var h3 = "Add Ports";
var footer = one.f.switchmanager.subnetGatewayConfig.modal.footer();
- var $modal = one.lib.modal.spawn(one.f.switchmanager.subnetGatewayConfig.id.modal.modal, h3, "", footer);
+ var $modal = one.lib.modal.spawn(one.f.switchmanager.subnetGatewayConfig.id.modal.ports, h3, "", footer);
// bind save button
$('#' + one.f.switchmanager.subnetGatewayConfig.id.modal.save, $modal).click(function() {
one.f.switchmanager.subnetGatewayConfig.modal.save.ports($modal);
@@ -687,7 +680,11 @@ one.f.switchmanager.subnetGatewayConfig = {
one.f.switchmanager.subnetGatewayConfig.registry['currentNode'] = node;
var $ports = $('#' + one.f.switchmanager.subnetGatewayConfig.id.modal.form.ports);
var ports = nodeports[node];
- one.lib.form.select.inject($ports, ports);
+ var options = {};
+ $(ports).each(function(idx, val) {
+ options[val.internalPortName] = val.portName+' ('+val.portId+')';
+ });
+ one.lib.form.select.inject($ports, options);
one.lib.form.select.prepend($ports, { '' : 'Please Select a Port' });
$ports.val($ports.find("option:first").val());
});
@@ -720,6 +717,64 @@ one.f.switchmanager.subnetGatewayConfig = {
var $saveButton = one.lib.dashlet.button.button(saveButton);
footer.push($saveButton);
return footer;
+ },
+ removeMultiple: {
+ dialog: function(gatewaysToDelete) {
+ var h3 = 'Remove Gateway IP Address';
+
+ var footer = one.f.switchmanager.subnetGatewayConfig.modal.removeMultiple.footer();
+ var $body = one.f.switchmanager.subnetGatewayConfig.modal.removeMultiple.body(gatewaysToDelete);
+ var $modal = one.lib.modal.spawn(one.f.switchmanager.subnetGatewayConfig.id.modal.modal, h3, $body, footer);
+
+ // bind close button
+ $('#'+one.f.switchmanager.subnetGatewayConfig.id.modal.cancel, $modal).click(function() {
+ $modal.modal('hide');
+ });
+
+ // bind remove rule button
+ $('#'+one.f.switchmanager.subnetGatewayConfig.id.modal.remove, $modal).click(this, function(e) {
+ var requestData = {};
+ if (gatewaysToDelete.length > 0) {
+ requestData["gatewaysToDelete"] = gatewaysToDelete.toString();
+ var url = one.f.switchmanager.rootUrl + "/subnetGateway/delete";
+ one.f.switchmanager.subnetGatewayConfig.ajax.main(url, requestData, function(response) {
+ $modal.modal('hide');
+ if (response.status == true) {
+ // refresh dashlet by passing dashlet div as param
+ one.lib.alert("Gateway IP Address(es) successfully removed");
+ } else {
+ alert(response.message);
+ }
+ one.f.switchmanager.subnetGatewayConfig.dashlet($("#right-bottom .dashlet"));
+ });
+ }
+ });
+ $modal.modal();
+ },
+ footer : function() {
+ var footer = [];
+ var remove = one.lib.dashlet.button.single('Remove Gateway IP Address',one.f.switchmanager.subnetGatewayConfig.id.modal.remove, 'btn-danger', '');
+ var $remove = one.lib.dashlet.button.button(remove);
+ footer.push($remove);
+
+ var cancel = one.lib.dashlet.button.single('Cancel', one.f.switchmanager.subnetGatewayConfig.id.modal.cancel, '', '');
+ var $cancel = one.lib.dashlet.button.button(cancel);
+ footer.push($cancel);
+
+ return footer;
+ },
+ body : function (gatewayList) {
+ var $p = $(document.createElement('p'));
+ var p = 'Remove the following Gateway IP Address(es)?';
+ //creata a BS label for each rule and append to list
+ $(gatewayList).each(function(){
+ var $span = $(document.createElement('span'));
+ $span.append(this);
+ p += '
' + $span[0].outerHTML;
+ });
+ $p.append(p);
+ return $p;
+ }
}
},
// data functions
@@ -746,7 +801,7 @@ one.f.switchmanager.subnetGatewayConfig = {
},
{
property: 'nodePorts',
- label: 'Node/Ports',
+ label: 'Ports',
sortable: false
}
],
@@ -759,12 +814,11 @@ one.f.switchmanager.subnetGatewayConfig = {
var nodePorts = JSON.parse(json);
var nodePortHtml = "