$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("Delete 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 = {};
checkedCheckBoxes.each(function(index, value) {
gatewaysToDelete.push(checkedCheckBoxes[index].id);
});
+ if (checkedCheckBoxes.size() === 0) {
+ alert('Please select at least one gateway');
+ return false;
+ }
if (gatewaysToDelete.length > 0) {
requestData["gatewaysToDelete"] = gatewaysToDelete.toString();
var url = one.f.switchmanager.rootUrl + "/subnetGateway/delete";
$("#" + 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",
.prop("checked",
false);
}
- event.stopPropagation();
+ e.stopPropagation();
});
});
});
$dashlet.append($button);
// Delete static route button
- var button = one.lib.dashlet.button.single("Delete Static Route(s)", one.f.switchmanager.staticRouteConfig.id.dashlet.remove, "btn-primary", "btn-mini");
+ var button = one.lib.dashlet.button.single("Delete Static Route(s)", one.f.switchmanager.staticRouteConfig.id.dashlet.remove, "btn-danger", "btn-mini");
var $button = one.lib.dashlet.button.button(button);
$button.click(function() {
var requestData = {};
checkedCheckBoxes.each(function(index, value) {
routesToDelete.push(checkedCheckBoxes[index].id);
});
+ if (checkedCheckBoxes.size() === 0) {
+ alert('Please select at least one static route');
+ return false;
+ }
if (routesToDelete.length > 0) {
requestData["routesToDelete"] = routesToDelete.toString();
var url = one.f.switchmanager.rootUrl + "/staticRoute/delete";
$("#" + one.f.switchmanager.staticRouteConfig.id.dashlet.datagrid).find(':checkbox').prop('checked',
$("#"+one.f.switchmanager.staticRouteConfig.id.dashlet.selectAll).is(':checked'));
});
- $(".staticRoute").click(function(){
+ $(".staticRoute").click(function(e){
if (!$('.staticRoute[type=checkbox]:not(:checked)').length) {
$("#"+one.f.switchmanager.staticRouteConfig.id.dashlet.selectAll)
.prop("checked",
.prop("checked",
false);
}
- event.stopPropagation();
+ e.stopPropagation();
});
});
});
$dashlet.append($button);
// Delete span port button
- var button = one.lib.dashlet.button.single("Delete SPAN Port(s)", one.f.switchmanager.spanPortConfig.id.dashlet.remove, "btn-primary", "btn-mini");
+ var button = one.lib.dashlet.button.single("Delete SPAN Port(s)", one.f.switchmanager.spanPortConfig.id.dashlet.remove, "btn-danger", "btn-mini");
var $button = one.lib.dashlet.button.button(button);
$button.click(function() {
checkedCheckBoxes.each(function(index, value) {
spanPortsToDelete += decodeURIComponent(checkedCheckBoxes[index].getAttribute("spanPort")) + "###";
});
+ if (checkedCheckBoxes.size() === 0) {
+ alert('Please select at least one SPAN port');
+ return false;
+ }
var requestData = {};
requestData["spanPortsToDelete"] = spanPortsToDelete;
$("#" + one.f.switchmanager.spanPortConfig.id.dashlet.datagrid).find(':checkbox').prop('checked',
$("#"+one.f.switchmanager.spanPortConfig.id.dashlet.selectAll).is(':checked'));
});
- $(".spanPortConfig").click(function(){
+ $(".spanPortConfig").click(function(e){
if (!$('.spanPortConfig[type=checkbox]:not(:checked)').length) {
$("#"+one.f.switchmanager.spanPortConfig.id.dashlet.selectAll)
.prop("checked",
.prop("checked",
false);
}
- event.stopPropagation();
+ e.stopPropagation();
});
});
});
$modal.modal();
});
$dashlet.append($button);
- var button = one.lib.dashlet.button.single("Remove Flow Entry", one.f.flows.id.dashlet.removeMultiple, "btn-primary", "btn-mini");
+ var button = one.lib.dashlet.button.single("Remove Flow Entry", one.f.flows.id.dashlet.removeMultiple, "btn-danger", "btn-mini");
var $button = one.lib.dashlet.button.button(button);
$button.click(function() {
var checkedCheckBoxes = $('.flowEntry[type=checkbox]:checked');
+ if (checkedCheckBoxes.size() === 0) {
+ alert('Please select at least one flow');
+ return false;
+ }
var requestData = [];
var node = $td.find("span").data("nodeid");
one.f.flows.detail(id, node);
});
- $(".flowEntry").click(function(){
+ $(".flowEntry").click(function(e){
if (!$('.flowEntry[type=checkbox]:not(:checked)').length) {
$("#"+one.f.flows.id.dashlet.datagrid.selectAllFlows)
.prop("checked",
.prop("checked",
false);
}
- event.stopPropagation();
+ e.stopPropagation();
});
});
});