add add/remove buttons to basic add/remove dialog
authorScott Baker <smbaker@gmail.com>
Tue, 15 Apr 2014 17:42:36 +0000 (10:42 -0700)
committerScott Baker <smbaker@gmail.com>
Tue, 15 Apr 2014 17:42:36 +0000 (10:42 -0700)
planetstack/templates/admin/dashboard/tenant.html

index 83556fd..24db6c4 100644 (file)
@@ -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");
                                                }