From: Scott Baker Date: Tue, 15 Apr 2014 17:42:36 +0000 (-0700) Subject: add add/remove buttons to basic add/remove dialog X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=c96b43a6df28015c532619bb548b608b58118b25;p=plstackapi.git add add/remove buttons to basic add/remove dialog --- diff --git a/planetstack/templates/admin/dashboard/tenant.html b/planetstack/templates/admin/dashboard/tenant.html index 83556fd..24db6c4 100644 --- a/planetstack/templates/admin/dashboard/tenant.html +++ b/planetstack/templates/admin/dashboard/tenant.html @@ -227,7 +227,7 @@ $(document).ready(function () { count : newTableData[newRow] - tableData[newRow], slice : $("#advTenantSliceDropDown").val(), actionToDo: "add", - csrfmiddlewaretoken: "{{ csrf_token }}", // < here + csrfmiddlewaretoken: "{{ csrf_token }}", // < here state:"inactive" }, type : 'POST', complete:function(){ @@ -300,9 +300,42 @@ $(document).ready(function () { width: 350, modal: true, buttons: { - "Submit": function () { - /************Code to add or remove slivers for a slice will go here*******/ - }, + "Add": function () { + delta = parseInt($("#numOfSlivers").val()); + $(this).dialog("close"); + $.ajax({ + url : '/tenantaddorremsliver/', + dataType : 'json', + data: { + count : delta, + slice : $("#tenantSliceDropDown").val(), + actionToDo: "add", + csrfmiddlewaretoken: "{{ csrf_token }}", // < here + state:"inactive" }, + type : 'POST', + complete:function(){ + location.reload(); + } + }); + }, + "Remove": function () { + delta = parseInt($("#numOfSlivers").val()); + $(this).dialog("close"); + $.ajax({ + url : '/tenantaddorremsliver/', + dataType : 'json', + data: { + count : delta, + slice : $("#tenantSliceDropDown").val(), + actionToDo: "rem", + csrfmiddlewaretoken: "{{ csrf_token }}", // < here + state:"inactive" }, + type : 'POST', + complete:function(){ + location.reload(); + } + }); + }, Cancel: function () { $(this).dialog("close"); }