Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 1 | <!doctype html> |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 2 | <script type="text/javascript" src="http://www.google.com/jsapi"></script> |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 3 | <div id="dialog-form" title="Add/Remove Slivers" style="display: none;"> |
| 4 | <form> |
| 5 | <fieldset> |
| 6 | <label for="numberOfSlivers">Number of Slivers</label> |
| 7 | <input type="text" name="numberOfSlivers" id="numOfSlivers" class="text ui-widget-content ui-corner-all"> |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 8 | <div id=basic-tooltip>Please enter number of slivers</div> |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 9 | </fieldset> |
| 10 | </form> |
| 11 | </div> |
| 12 | <div id="adv-dialog-form" title="Add/Remove Slivers" style="display: none;"> |
| 13 | <form> |
| 14 | <fieldset> |
| 15 | <label for="numberOfSlivers">Number of Slivers</label> |
| 16 | <input type="text" name="numberOfSlivers" id="advNumOfSlivers" class="text ui-widget-content ui-corner-all"> |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 17 | <div id=adv-tooltip>Please enter number of slivers</div> |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 18 | </fieldset> |
| 19 | </form> |
| 20 | </div> |
Scott Baker | a36d77e | 2014-08-29 11:43:23 -0700 | [diff] [blame^] | 21 | <div id="add-user-form" title="Add User" style="display: none;"> |
| 22 | <form> |
| 23 | <fieldset> |
| 24 | <div class="create-slice-row"> |
| 25 | <label for="add-slice-user">Add User</label> |
| 26 | <select id="add-slice-user" class="tenant-create-slice"></select> |
| 27 | </div> |
| 28 | </fieldset> |
| 29 | </form> |
| 30 | </div> |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 31 | <div id="create-slice-form" title="Create New Slice" style="display: none;"> |
| 32 | <form> |
| 33 | <fieldset> |
| 34 | <div class="create-slice-row"> |
| 35 | <label for="new-slice-name">Name</label> |
Scott Baker | 4b0cedd | 2014-04-22 21:01:21 -0700 | [diff] [blame] | 36 | <input type="text" name="new-slice-name" id="new-slice-name"> |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 37 | </div> |
| 38 | <div class="create-slice-row"> |
| 39 | <label for="new-service-class">Service Class</label> |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 40 | <select id="new-service-class" class="tenant-create-slice"></select> |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 41 | </div> |
| 42 | <div class="create-slice-row"> |
| 43 | <label for="new-image">Image</label> |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 44 | <select id="new-image" class="tenant-create-slice"></select> |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 45 | </div> |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 46 | <div class="create-slice-row"> |
Scott Baker | 9d9650d | 2014-05-23 11:50:54 -0700 | [diff] [blame] | 47 | <label for="new-network">Network Ports</label> |
Scott Baker | 168b741 | 2014-05-16 14:25:41 -0700 | [diff] [blame] | 48 | <input type="text" name="new-network" id="new-network"> |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 49 | </div> |
| 50 | <div class="create-slice-row"> |
Scott Baker | 168b741 | 2014-05-16 14:25:41 -0700 | [diff] [blame] | 51 | <label for="private-vol">Include Private Vol</label> |
| 52 | <input type="checkbox" name="checkbox" id="private-vol" value="value"> |
| 53 | </div> |
| 54 | <div class="create-slice-row"> |
Scott Baker | a36d77e | 2014-08-29 11:43:23 -0700 | [diff] [blame^] | 55 | <label for="add-user">Add User</label> |
| 56 | <select id="add-user" class="tenant-create-slice"></select> |
| 57 | </div> |
| 58 | <div class="create-slice-row"> |
| 59 | <label for="mount-data-sets">Data Set</label> |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 60 | <select id="mount-data-sets" class="tenant-create-slice"></select> |
| 61 | </div> |
| 62 | <div class="create-slice-row"> |
| 63 | <label for="number-of-slivers">Number Of Slivers</label> |
Scott Baker | 4b0cedd | 2014-04-22 21:01:21 -0700 | [diff] [blame] | 64 | <input type="text" name="number-of-slivers" id="number-of-slivers"> |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 65 | </div> |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 66 | <div id=tooltip>Slice Name cannot be empty</div> |
| 67 | </fieldset> |
| 68 | </form> |
| 69 | </div> |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 70 | <div id="delete-slice-form" title="Delete a Slice" style="display: none;"> |
| 71 | <form> |
| 72 | <fieldset> |
| 73 | <div class="create-slice-row"> |
| 74 | <label for="delete-slice">Choose a Slice</label> |
| 75 | <select id="delete-slice"></select> |
| 76 | </div> |
| 77 | </fieldset> |
| 78 | </form> |
| 79 | </div> |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 80 | <script type="text/javascript"> |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 81 | google.load('visualization', '1', { |
| 82 | 'packages': ['controls', 'table', 'corechart', 'geochart'] |
| 83 | }); |
| 84 | </script> |
| 85 | <script> |
| 86 | $(document).ready(function () { |
Scott Baker | 168b741 | 2014-05-16 14:25:41 -0700 | [diff] [blame] | 87 | function showSliceData(rows,imageData,serviceLevelData,siteRows,dataSet,value) { |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 88 | $("#service-level-value").empty(); |
| 89 | $("#slice-image-value").empty(); |
| 90 | $("#tenantSiteTable").empty(); |
| 91 | $('#tenantSiteTable').html('<table cellpadding="0" cellspacing="0" border="0" class="display" id="tenantSiteTableData"></table>'); |
| 92 | $("#tenantSliceDropDown").val(value); |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 93 | var siteNames = []; |
| 94 | var sliverCount; |
| 95 | for (row in rows) { |
| 96 | if (rows[row]['sliceName'] == value) { |
| 97 | sliceImageData = rows[row]['preferredImage']; |
| 98 | $("#slice-image-value").html(sliceImageData); |
Scott Baker | 168b741 | 2014-05-16 14:25:41 -0700 | [diff] [blame] | 99 | serviceLevelDataBasic = rows[row]['sliceServiceClass']; |
| 100 | $("#service-level-value").html(serviceLevelDataBasic); |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 101 | var innerRows = rows[row]['sliceSite']; |
| 102 | for (innerRow in innerRows) { |
| 103 | sliverCount = innerRows[innerRow]; |
| 104 | siteNames.push([innerRow, sliverCount]); |
| 105 | } |
| 106 | } |
| 107 | } |
| 108 | oTable = $('#tenantSiteTableData').dataTable({ |
| 109 | "bJQueryUI": true, |
| 110 | "bFilter": false, |
| 111 | "bInfo": false, |
| 112 | "bLengthChange": false, |
| 113 | "aaData": siteNames, |
| 114 | "bStateSave": true, |
| 115 | "aoColumns": [{ |
| 116 | "sTitle": "Site Name" |
| 117 | }, { |
| 118 | "sTitle": "Allocated", |
| 119 | sClass: "alignCenter" |
| 120 | } |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 121 | ] |
| 122 | }); |
| 123 | $('#tenantSliceDropDown').on('change', function () { |
| 124 | var value = $("#tenantSliceDropDown").val(); |
| 125 | //alert(value); |
Scott Baker | 168b741 | 2014-05-16 14:25:41 -0700 | [diff] [blame] | 126 | checkForBasicAdvView(value,rows,imageData,serviceLevelData,siteRows,dataSet); |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 127 | }); |
| 128 | } |
| 129 | |
Scott Baker | 168b741 | 2014-05-16 14:25:41 -0700 | [diff] [blame] | 130 | function downloadSliceInfo(rows,imageData,serviceLevelData,siteRows,dataSet,value){ |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 131 | $("#download-details").unbind().click(function(){ |
| 132 | function download(filename, text) { |
| 133 | var sliceDetails = document.createElement('a'); |
| 134 | sliceDetails.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); |
| 135 | sliceDetails.setAttribute('download', filename); |
| 136 | sliceDetails.click(); |
| 137 | } |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 138 | var sliceInfo; |
| 139 | for (row in rows){ |
| 140 | if(rows[row]['sliceName']==value){ |
Scott Baker | 03e3fff | 2014-04-23 16:51:15 -0700 | [diff] [blame] | 141 | sliceInfo = "Slice Name: "+rows[row]['sliceName']+"\nNumber of Slivers: "+rows[row]['numOfSlivers']+"\nService Level: "+rows[row]['sliceServiceClass']+"\nImage: "+rows[row]['preferredImage']+"\n"; |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 142 | for (instanceNodePairs in rows[row]['instanceNodePair']){ |
| 143 | sliceInfo += instanceNodePairs+"@"+rows[row]['instanceNodePair'][instanceNodePairs]+"\n"; |
| 144 | } |
| 145 | } |
| 146 | } |
| 147 | download('slice.txt', sliceInfo); |
| 148 | }); |
| 149 | } |
| 150 | function editSliverAdv() { |
| 151 | $(".edit-view").click(function () { |
| 152 | var allocatedSlivers = parseInt($(this).parent().siblings(".allocated").html()); |
| 153 | var td = $(this).parent().siblings(".allocated"); |
| 154 | var pos = oTable.fnGetPosition(td[0]); |
Scott Baker | 168b741 | 2014-05-16 14:25:41 -0700 | [diff] [blame] | 155 | $("#numOfSlivers").val("");; |
| 156 | $("#advNumOfSlivers").val("");; |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 157 | $("#adv-tooltip").css("display", "none"); |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 158 | $("#adv-dialog-form").dialog({ |
| 159 | autoOpen: false, |
| 160 | height: 200, |
| 161 | width: 350, |
| 162 | modal: true, |
| 163 | dialogClass: "tenantDialog", |
| 164 | buttons: { |
| 165 | "Add": function () { |
| 166 | allocatedSlivers += parseInt($("#advNumOfSlivers").val()); |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 167 | $("#adv-tooltip").css("display", "block"); |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 168 | $(this).dialog("close"); |
| 169 | td.html(allocatedSlivers); |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 170 | }, |
| 171 | "Remove": function () { |
| 172 | allocatedSlivers -= parseInt($("#advNumOfSlivers").val()); |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 173 | $("#adv-tooltip").css("display", "block"); |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 174 | $(this).dialog("close"); |
| 175 | td.html(allocatedSlivers); |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 176 | } |
| 177 | } |
| 178 | }); |
| 179 | $("#adv-dialog-form").dialog("open"); |
| 180 | }); |
| 181 | } |
| 182 | |
Scott Baker | 168b741 | 2014-05-16 14:25:41 -0700 | [diff] [blame] | 183 | function advShowSliceData(rows,imageData,serviceLevelData,siteRows,dataSet,value) { |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 184 | $("#adv-service-level-value").empty(); |
| 185 | $("#adv-slice-image-value").empty(); |
| 186 | $("#adv-slice-data-set-value").empty(); |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 187 | $("#advTenantSliceDropDown").val(value); |
| 188 | $("<select></select>").attr('id', 'adv-service-level-dropdown').appendTo('#adv-service-level-value'); |
| 189 | $("<select></select>").attr('id', 'adv-image-dropdown').appendTo('#adv-slice-image-value'); |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 190 | $("<select></select>").attr('id', 'adv-dataset-dropdown').appendTo('#adv-slice-data-set-value'); |
| 191 | $('#advTenantSiteTable').html('<table cellpadding="0" cellspacing="0" border="0" class="display" id="advTenantSiteTableData"></table>'); |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 192 | var siteNames = []; |
| 193 | var sliverCount; |
| 194 | var tableData = {}; |
| 195 | for (row in serviceLevelData) { |
| 196 | $("#adv-service-level-dropdown").append("<option>" + serviceLevelData[row]['serviceClass'] + "</option>"); |
| 197 | } |
| 198 | for (row in imageData) { |
Scott Baker | a36d77e | 2014-08-29 11:43:23 -0700 | [diff] [blame^] | 199 | $("#adv-image-dropdown").append("<option>" + imageData[row] + "</option>"); |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 200 | } |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 201 | for (row in dataSet) { |
| 202 | $("#adv-dataset-dropdown").append("<option>" + dataSet[row]['DataSet'] + "</option>"); |
| 203 | } |
| 204 | |
| 205 | for (row in rows) { |
| 206 | if (rows[row]['sliceName'] == value) { |
| 207 | var innerRows = rows[row]['sliceSite']; |
| 208 | $("#adv-service-level-dropdown").val(rows[row]['sliceServiceClass']); |
| 209 | $("#adv-image-dropdown").val(rows[row]['preferredImage']); |
| 210 | $("#adv-dataset-dropdown").val(rows[row]['sliceDataSet']); |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 211 | for (innerRow in innerRows) { |
| 212 | tableData[innerRow] = innerRows[innerRow]; |
| 213 | } |
| 214 | } |
| 215 | } |
| 216 | for (row in siteRows) { |
Scott Baker | a36d77e | 2014-08-29 11:43:23 -0700 | [diff] [blame^] | 217 | //var entry = siteRows[row]['siteName']; |
| 218 | var entry = siteRows[row]; |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 219 | if (!(entry in tableData)) { |
Scott Baker | a36d77e | 2014-08-29 11:43:23 -0700 | [diff] [blame^] | 220 | //tableData[siteRows[row]['siteName']] = 0; |
| 221 | tableData[siteRows[row]] = 0; |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 222 | } |
| 223 | } |
| 224 | for (row in tableData) { |
| 225 | siteNames.push([row, tableData[row], '<a href="#" class="edit-view">Edit</a>']); |
| 226 | } |
| 227 | $("#save-btn").unbind().click(function () { |
| 228 | var newTableData = {}; |
| 229 | var newSite = $(".siteName"); |
| 230 | var newAllocated = $(".allocated"); |
| 231 | for (i = 1; i < newSite.length; i++) { |
| 232 | newTableData[$($(".siteName")[i]).text()] = parseInt($($(".allocated")[i]).text()); |
| 233 | } |
| 234 | for (newRow in newTableData) { |
| 235 | if (newTableData[newRow] > tableData[newRow]) { |
| 236 | $.ajax({ |
| 237 | url: '/tenantaddorremsliver/', |
| 238 | dataType: 'json', |
| 239 | data: { |
| 240 | siteName: newRow, |
| 241 | count: newTableData[newRow] - tableData[newRow], |
| 242 | slice: $("#advTenantSliceDropDown").val(), |
Scott Baker | a36d77e | 2014-08-29 11:43:23 -0700 | [diff] [blame^] | 243 | image: $("#adv-image-dropdown").val(), |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 244 | actionToDo: "add", |
| 245 | csrfmiddlewaretoken: "{{ csrf_token }}", // < here |
| 246 | state: "inactive" |
| 247 | }, |
| 248 | type: 'POST', |
| 249 | complete: function () { |
Scott Baker | 168b741 | 2014-05-16 14:25:41 -0700 | [diff] [blame] | 250 | //location.reload(); |
| 251 | |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 252 | } |
| 253 | }); |
| 254 | } else if (newTableData[newRow] < tableData[newRow]) { |
| 255 | $.ajax({ |
| 256 | url: '/tenantaddorremsliver/', |
| 257 | dataType: 'json', |
| 258 | data: { |
| 259 | siteName: newRow, |
| 260 | count: tableData[newRow] - newTableData[newRow], |
| 261 | slice: $("#advTenantSliceDropDown").val(), |
Scott Baker | a36d77e | 2014-08-29 11:43:23 -0700 | [diff] [blame^] | 262 | image: $("#adv-image-dropdown").val(), |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 263 | actionToDo: "rem", |
| 264 | csrfmiddlewaretoken: "{{ csrf_token }}", // < here |
| 265 | state: "inactive" |
| 266 | }, |
| 267 | type: 'POST', |
| 268 | complete: function () { |
Scott Baker | 168b741 | 2014-05-16 14:25:41 -0700 | [diff] [blame] | 269 | //location.reload(); |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 270 | } |
| 271 | }); |
| 272 | } |
| 273 | } |
| 274 | $.ajax({ |
| 275 | url: '/updateslice/', |
| 276 | dataType: 'json', |
| 277 | data: { |
| 278 | sliceName: $("#advTenantSliceDropDown").val(), |
| 279 | serviceClass: $("#adv-service-level-dropdown").val(), |
| 280 | imageName: $("#adv-image-dropdown").val(), |
Scott Baker | 4b0cedd | 2014-04-22 21:01:21 -0700 | [diff] [blame] | 281 | dataSet: $("#adv-dataset-dropdown").val(), |
Scott Baker | 9d9650d | 2014-05-23 11:50:54 -0700 | [diff] [blame] | 282 | networkPorts: $("#adv-network-value").val(), |
| 283 | privateVolume: $("#private-vol-checkbox").is(":checked"), |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 284 | actionToDo: "update", |
| 285 | csrfmiddlewaretoken: "{{ csrf_token }}", // < here |
| 286 | state: "inactive" |
| 287 | }, |
| 288 | type: 'POST', |
Scott Baker | 0486e17 | 2014-06-01 20:30:30 -0700 | [diff] [blame] | 289 | success: function () { |
Scott Baker | 168b741 | 2014-05-16 14:25:41 -0700 | [diff] [blame] | 290 | $("#tabs-5").empty(); |
| 291 | initTenant(); //location.reload(); |
Scott Baker | 0486e17 | 2014-06-01 20:30:30 -0700 | [diff] [blame] | 292 | }, |
| 293 | error:function (xhr, textStatus, thrownError){ |
| 294 | errorDialog("Error:", textStatus + " " + xhr.responseText); |
| 295 | } |
| 296 | |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 297 | }); |
| 298 | |
| 299 | }); |
| 300 | oTable = $('#advTenantSiteTableData').dataTable({ |
| 301 | "bJQueryUI": true, |
| 302 | "bFilter": false, |
| 303 | "bInfo": false, |
| 304 | "bLengthChange": false, |
| 305 | "bPaginate": false, |
| 306 | "aaData": siteNames, |
| 307 | "bStateSave": true, |
| 308 | "aoColumns": [{ |
| 309 | "sTitle": "Site Name", |
| 310 | sClass: "siteName" |
| 311 | }, { |
| 312 | "sTitle": "Allocated", |
| 313 | sClass: "alignCenter allocated" |
| 314 | }, { |
| 315 | "sTitle": "Edit", |
| 316 | sClass: "alignCenter" |
| 317 | }] |
| 318 | }); |
| 319 | editSliverAdv(); |
| 320 | $('#advTenantSliceDropDown').on('change', function () { |
Scott Baker | 168b741 | 2014-05-16 14:25:41 -0700 | [diff] [blame] | 321 | var selectedValue = $("#advTenantSliceDropDown").val(); |
| 322 | checkForBasicAdvView(selectedValue, rows,imageData,serviceLevelData,siteRows,dataSet); |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 323 | }); |
| 324 | } |
| 325 | |
Scott Baker | 168b741 | 2014-05-16 14:25:41 -0700 | [diff] [blame] | 326 | function checkForBasicAdvView(value, rows,imageData,serviceLevelData,siteRows,dataSet) { |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 327 | for (row in rows) { |
| 328 | if (rows[row]['sliceName'] == value) { |
| 329 | if (rows[row]['numOfSites'] > 1) { |
Scott Baker | 168b741 | 2014-05-16 14:25:41 -0700 | [diff] [blame] | 330 | advShowSliceData(rows,imageData,serviceLevelData,siteRows,dataSet,value); |
| 331 | downloadSliceInfo(rows,imageData,serviceLevelData,siteRows,dataSet,value); |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 332 | $("#tenantSliceDataWrapper").css("display","none"); |
| 333 | $("#advancedTenantSliceDataWrapper").css("display","block"); |
| 334 | $("#advTenantSiteTable").css("display","block"); |
| 335 | $("#tenantSiteTable").css("display","none"); |
| 336 | $("#sliver-btn").css("display","none"); |
| 337 | $("#save-btn").css("display","block"); |
| 338 | break; |
| 339 | } else if(rows[row]['numOfSites'] <= 1){ |
Scott Baker | 168b741 | 2014-05-16 14:25:41 -0700 | [diff] [blame] | 340 | showSliceData(rows,imageData,serviceLevelData,siteRows,dataSet,value); |
| 341 | downloadSliceInfo(rows,imageData,serviceLevelData,siteRows,dataSet,value); |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 342 | $("#tenantSliceDataWrapper").css("display","block"); |
| 343 | $("#advancedTenantSliceDataWrapper").css("display","none"); |
| 344 | $("#advTenantSiteTable").css("display","none"); |
| 345 | $("#tenantSiteTable").css("display","block"); |
| 346 | $("#sliver-btn").css("display","block"); |
| 347 | $("#save-btn").css("display","none"); |
| 348 | break; |
| 349 | }break; |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 350 | } |
| 351 | } |
| 352 | } |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 353 | |
Scott Baker | a36d77e | 2014-08-29 11:43:23 -0700 | [diff] [blame^] | 354 | function UserSliceTable(rows,imageData,serviceLevelData,siteRows,dataSet,siteUsers) { |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 355 | //Add check for #dynamicusersliceinfo_filter label-> input having focus here |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 356 | $("<div></div>").attr('id', 'tenantSliceDataWrapper').appendTo('#tabs-5'); |
| 357 | $("<div></div>").attr('id', 'advancedTenantSliceDataWrapper').appendTo('#tabs-5'); |
| 358 | var sliceData = ''; |
Scott Baker | 168b741 | 2014-05-16 14:25:41 -0700 | [diff] [blame] | 359 | sliceData += '<div class="tenant-row public-key-warning"><span class="summary-attr">You have not uploaded your Public Key. <a href="http://{{ request.get_host}}/admin/core/user/{{user.id}}">Click here</a> to upload it now.</span></div><div class="tenant-row"><span class="summary-attr"><b>Slice Name:</b> <span id="slice-name-value"> </span> </span><br></div><div class="tenant-row"><span class="summary-attr"><b>Service Level:</b> <span id="service-level-value"> </span> </span><br></div><div class="tenant-row"><span class="summary-attr"><b>Image:</b> <span id="slice-image-value"> </span> </span><br></div><div class="btn btn-high btn-info" id="advanced-tenant">Go to Advanced View</div>'; |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 360 | var advSliceData = ''; |
Scott Baker | a36d77e | 2014-08-29 11:43:23 -0700 | [diff] [blame^] | 361 | advSliceData += '<div class="tenant-row public-key-warning"><span class="summary-attr">You have not uploaded your Public Key. <a href="http://{{ request.get_host}}/admin/core/user/{{user.id}}">Click here</a> to upload it now.</span></div><div class="adv-tenant-row"><span class="summary-attr"><b>Slice Name:</b> <span id="adv-slice-name-value"> </span> </span><br><br></div><div class="tenant-row"><span class="summary-attr"><b>Service Level:</b> <span id="adv-service-level-value"> </span> <span class="help-inline">Changes are potentially disruptive to existing slivers</span> </span><br></div><div class="tenant-row"><span class="summary-attr"><b>Image:</b> <span id="adv-slice-image-value"> </span><span class="help-inline">Changes are potentially disruptive to existing slivers</span> </span><br></div><div class="tenant-row"><span class="summary-attr"><b>Network:</b> <input type="text" name="adv-network-value" id="adv-network-value"> <span class="help-inline">List of port ranges(if any) e.g. 1021-1026,1029</span><br></div><div class="tenant-row"><span class="summary-attr"><b>Data Set:</b> <span id="adv-slice-data-set-value"> </span> <input type="checkbox" name="checkbox" id="private-vol-checkbox" value="value"><span class="help-inline">Include Private Volume</span></span></div>'; |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 362 | $('#tenantSliceDataWrapper').append(sliceData).css("display", "none"); |
| 363 | $('#advancedTenantSliceDataWrapper').append(advSliceData); |
| 364 | $("#advancedTenantSliceDataWrapper").css("display", "none"); |
| 365 | $("<select></select>").attr('id', 'tenantSliceDropDown').appendTo('#slice-name-value'); |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 366 | for (row in rows) { |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 367 | $("#tenantSliceDropDown").append("<option>" + rows[row]['sliceName'] + "</option>"); |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 368 | } |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 369 | $("<select></select>").attr('id', 'advTenantSliceDropDown').appendTo('#adv-slice-name-value'); |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 370 | for (row in rows) { |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 371 | $("#advTenantSliceDropDown").append("<option>" + rows[row]['sliceName'] + "</option>"); |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 372 | } |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 373 | $("<div></div>").attr('id', 'tenantSiteTable').appendTo('#tabs-5').css("display","none"); |
| 374 | $("<div></div>").attr('id', 'advTenantSiteTable').appendTo('#tabs-5').css("display", "none"); |
| 375 | $('<div class="btn btn-success" id="create-slice-btn"><i class="icon-plus-sign icon-white"></i> Create New Slice</div>').appendTo("#tabs-5"); |
| 376 | $('<div class="btn btn-success" id="delete-slice-btn"><i class="icon-plus-sign icon-white"></i> Delete a Slice</div>').appendTo("#tabs-5"); |
Scott Baker | a36d77e | 2014-08-29 11:43:23 -0700 | [diff] [blame^] | 377 | $('<div class="btn btn-success" id="add-user-btn"><i class="icon-plus-sign icon-white"></i> Add User</div>').appendTo("#tabs-5"); |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 378 | $('<div class="btn btn-high btn-info" id="download-details">Download Slice Details</div>').appendTo("#tabs-5"); |
| 379 | $('<div class="btn btn-success" id="sliver-btn"><i class="icon-plus-sign icon-white"></i> Add/Remove Slivers</div>').appendTo("#tabs-5"); |
| 380 | $('<div class="btn btn-high btn-info" id="save-btn">Save</div>').appendTo("#tabs-5").css("display", "none"); |
Scott Baker | 4b0cedd | 2014-04-22 21:01:21 -0700 | [diff] [blame] | 381 | $("#advanced-tenant").unbind().click(function () { |
| 382 | var value = $("#tenantSliceDropDown").val(); |
Scott Baker | 168b741 | 2014-05-16 14:25:41 -0700 | [diff] [blame] | 383 | advShowSliceData(rows,imageData,serviceLevelData,siteRows,dataSet,value); |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 384 | $("#tenantSliceDataWrapper").css("display","none"); |
| 385 | $("#advancedTenantSliceDataWrapper").css("display","block"); |
| 386 | $("#advTenantSiteTable").css("display","block"); |
| 387 | $("#tenantSiteTable").css("display","none"); |
| 388 | $("#sliver-btn").toggle(); |
| 389 | $("#save-btn").toggle(); |
Scott Baker | 6253dfc | 2014-04-14 09:29:30 -0700 | [diff] [blame] | 390 | |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 391 | }); |
| 392 | $("#sliver-btn").click(function () { |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 393 | $("#basic-tooltip").css("display", "none"); |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 394 | $("#dialog-form").dialog({ |
| 395 | autoOpen: false, |
| 396 | height: 200, |
Scott Baker | 4b0cedd | 2014-04-22 21:01:21 -0700 | [diff] [blame] | 397 | width: 400, |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 398 | modal: true, |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 399 | dialogClass: "tenantDialog", |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 400 | buttons: { |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 401 | "Add": function () { |
| 402 | $.ajax({ |
| 403 | url: '/tenantaddorremsliver/', |
| 404 | dataType: 'json', |
| 405 | data: { |
| 406 | count: parseInt($("#numOfSlivers").val()), |
| 407 | slice: $("#tenantSliceDropDown").val(), |
Scott Baker | a36d77e | 2014-08-29 11:43:23 -0700 | [diff] [blame^] | 408 | image: $("#slice-image-value").html(), |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 409 | actionToDo: "add", |
| 410 | csrfmiddlewaretoken: "{{ csrf_token }}", // < here |
| 411 | state: "inactive" |
| 412 | }, |
| 413 | type: 'POST', |
| 414 | beforeSend: function () { |
| 415 | if (!$("#numOfSlivers").val()) { |
| 416 | $("#basic-tooltip").css("display", "block"); |
| 417 | return false; |
| 418 | } else { |
| 419 | return true; |
| 420 | } |
| 421 | }, |
Scott Baker | 168b741 | 2014-05-16 14:25:41 -0700 | [diff] [blame] | 422 | success: function () { |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 423 | location.reload(); |
Scott Baker | 168b741 | 2014-05-16 14:25:41 -0700 | [diff] [blame] | 424 | $("#dialog-form").dialog("close"); |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 425 | } |
| 426 | }); |
| 427 | }, |
| 428 | Remove: function () { |
| 429 | $.ajax({ |
| 430 | url: '/tenantaddorremsliver/', |
| 431 | dataType: 'json', |
| 432 | data: { |
| 433 | count: parseInt($("#numOfSlivers").val()), |
| 434 | slice: $("#tenantSliceDropDown").val(), |
Scott Baker | a36d77e | 2014-08-29 11:43:23 -0700 | [diff] [blame^] | 435 | image: $("#slice-image-value").html(), |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 436 | actionToDo: "rem", |
| 437 | csrfmiddlewaretoken: "{{ csrf_token }}", // < here |
| 438 | state: "inactive" |
| 439 | }, |
| 440 | type: 'POST', |
| 441 | beforeSend: function () { |
| 442 | if (!$("#numOfSlivers").val()) { |
| 443 | $("#basic-tooltip").css("display", "block"); |
| 444 | return false; |
| 445 | } else { |
| 446 | return true; |
| 447 | } |
| 448 | }, |
Scott Baker | 168b741 | 2014-05-16 14:25:41 -0700 | [diff] [blame] | 449 | success: function () { |
| 450 | $("#dialog-form").dialog("close"); |
| 451 | location.reload(); |
| 452 | |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 453 | } |
| 454 | }); |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 455 | } |
| 456 | } |
| 457 | }); |
| 458 | $("#dialog-form").dialog("open"); |
| 459 | }); |
Scott Baker | a36d77e | 2014-08-29 11:43:23 -0700 | [diff] [blame^] | 460 | $("#add-user-btn").unbind().click(function(){ |
| 461 | $("#add-slice-user").empty(); |
| 462 | for (row in siteUsers) { |
| 463 | $("#add-slice-user").append("<option>" + siteUsers[row] + "</option>"); |
| 464 | } |
| 465 | $("#add-user-form").dialog({ |
| 466 | autoOpen: false, |
| 467 | height: 200, |
| 468 | width: 350, |
| 469 | modal: true, |
| 470 | dialogClass: "tenantDialog", |
| 471 | buttons: { |
| 472 | "Submit": function () { |
| 473 | $.ajax({ |
| 474 | url: '/adduser/', |
| 475 | dataType: 'json', |
| 476 | data: { |
| 477 | sliceName: $("#advTenantSliceDropDown").val(), |
| 478 | userEmail: $("#add-slice-user").val(), |
| 479 | csrfmiddlewaretoken: "{{ csrf_token }}", // < here |
| 480 | state: "inactive" |
| 481 | }, |
| 482 | async: false, |
| 483 | type: 'POST', |
| 484 | success: function () { |
| 485 | location.reload(); |
| 486 | } |
| 487 | |
| 488 | }); |
| 489 | }, |
| 490 | Cancel: function () { |
| 491 | $(this).dialog("close"); |
| 492 | } |
| 493 | } |
| 494 | }); |
| 495 | $("#add-user-form").dialog("open"); |
| 496 | |
| 497 | |
| 498 | }); |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 499 | $("#create-slice-btn").unbind().click(function () { |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 500 | $("#new-service-class").empty(); |
| 501 | $("#new-image").empty(); |
Scott Baker | a36d77e | 2014-08-29 11:43:23 -0700 | [diff] [blame^] | 502 | $("#add-user").empty(); |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 503 | $("#mount-data-sets").empty(); |
| 504 | $("#new-network").empty(); |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 505 | for (row in serviceLevelData) { |
| 506 | $("#new-service-class").append("<option>" + serviceLevelData[row]['serviceClass'] + "</option>"); |
| 507 | } |
| 508 | for (row in imageData) { |
Scott Baker | a36d77e | 2014-08-29 11:43:23 -0700 | [diff] [blame^] | 509 | $("#new-image").append("<option>" + imageData[row] + "</option>"); |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 510 | } |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 511 | for (row in dataSet) { |
| 512 | $("#mount-data-sets").append("<option>" + dataSet[row]['DataSet'] + "</option>"); |
| 513 | } |
Scott Baker | a36d77e | 2014-08-29 11:43:23 -0700 | [diff] [blame^] | 514 | for (row in siteUsers) { |
| 515 | $("#add-user").append("<option>" + siteUsers[row] + "</option>"); |
| 516 | } |
Scott Baker | 6253dfc | 2014-04-14 09:29:30 -0700 | [diff] [blame] | 517 | var nameOfSlice = $("#new-slice-name").val(); |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 518 | var nameOfServiceClass = $("#new-service-class").val(); |
| 519 | var nameOfImage = $("#new-image").val(); |
| 520 | $("#create-slice-form").dialog({ |
Scott Baker | 6253dfc | 2014-04-14 09:29:30 -0700 | [diff] [blame] | 521 | autoOpen: false, |
Scott Baker | a36d77e | 2014-08-29 11:43:23 -0700 | [diff] [blame^] | 522 | height: 420, |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 523 | width: 400, |
Scott Baker | 6253dfc | 2014-04-14 09:29:30 -0700 | [diff] [blame] | 524 | modal: true, |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 525 | dialogClass: "tenantDialog", |
Scott Baker | 6253dfc | 2014-04-14 09:29:30 -0700 | [diff] [blame] | 526 | buttons: { |
| 527 | "Submit": function () { |
| 528 | $.ajax({ |
| 529 | url: '/createnewslice/', |
| 530 | dataType: 'json', |
| 531 | data: { |
| 532 | sliceName: $("#new-slice-name").val(), |
| 533 | serviceClass: nameOfServiceClass, |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 534 | imageName: $("#new-image").val(), |
Scott Baker | 9d9650d | 2014-05-23 11:50:54 -0700 | [diff] [blame] | 535 | network: $("#new-network").val(), |
| 536 | privateVolume: $("#private-vol").is(":checked"), |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 537 | mountDataSets: $("#mount-data-sets").val(), |
Scott Baker | a36d77e | 2014-08-29 11:43:23 -0700 | [diff] [blame^] | 538 | userEmail: $("#add-user").val(), |
Scott Baker | 6253dfc | 2014-04-14 09:29:30 -0700 | [diff] [blame] | 539 | actionToDo: "add", |
| 540 | csrfmiddlewaretoken: "{{ csrf_token }}", // < here |
| 541 | state: "inactive" |
| 542 | }, |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 543 | async: false, |
Scott Baker | 6253dfc | 2014-04-14 09:29:30 -0700 | [diff] [blame] | 544 | type: 'POST', |
| 545 | beforeSend: function () { |
| 546 | if (!$("#new-slice-name").val()) { |
| 547 | $("#tooltip").css("display", "block"); |
| 548 | return false; |
| 549 | } else { |
| 550 | return true; |
| 551 | } |
| 552 | }, |
Scott Baker | 0486e17 | 2014-06-01 20:30:30 -0700 | [diff] [blame] | 553 | success: function () { |
Scott Baker | 6253dfc | 2014-04-14 09:29:30 -0700 | [diff] [blame] | 554 | location.reload(); |
| 555 | } |
| 556 | }); |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 557 | $.ajax({ |
| 558 | url: '/tenantaddorremsliver/', |
| 559 | dataType: 'json', |
| 560 | data: { |
| 561 | count: parseInt($("#number-of-slivers").val()), |
| 562 | slice: $("#new-slice-name").val(), |
Scott Baker | a36d77e | 2014-08-29 11:43:23 -0700 | [diff] [blame^] | 563 | image: $("#new-image").val(), |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 564 | actionToDo: "add", |
| 565 | csrfmiddlewaretoken: "{{ csrf_token }}", // < here |
| 566 | state: "inactive" |
| 567 | }, |
| 568 | async: false, |
| 569 | type: 'POST', |
Scott Baker | 0486e17 | 2014-06-01 20:30:30 -0700 | [diff] [blame] | 570 | success: function () { |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 571 | location.reload(); |
| 572 | } |
| 573 | }); |
| 574 | |
Scott Baker | 6253dfc | 2014-04-14 09:29:30 -0700 | [diff] [blame] | 575 | }, |
| 576 | Cancel: function () { |
| 577 | $(this).dialog("close"); |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 578 | } |
Scott Baker | 6253dfc | 2014-04-14 09:29:30 -0700 | [diff] [blame] | 579 | } |
| 580 | }); |
| 581 | $("#create-slice-form").dialog("open"); |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 582 | }); |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 583 | $("#delete-slice-btn").unbind().click(function () { |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 584 | $("#delete-slice").empty(); |
| 585 | for (row in rows) { |
| 586 | $("#delete-slice").append("<option>" + rows[row]['sliceName'] + "</option>"); |
| 587 | } |
| 588 | $("#delete-slice-form").dialog({ |
| 589 | autoOpen: false, |
| 590 | height: 200, |
| 591 | width: 350, |
| 592 | modal: true, |
| 593 | dialogClass: "tenantDialog", |
| 594 | buttons: { |
| 595 | "Delete": function () { |
| 596 | $.ajax({ |
| 597 | url: '/tenantdeleteslice/', |
| 598 | dataType: 'json', |
| 599 | data: { |
| 600 | sliceName: $("#delete-slice").val(), |
| 601 | csrfmiddlewaretoken: "{{ csrf_token }}", // < here |
| 602 | state: "inactive" |
| 603 | }, |
| 604 | type: 'POST', |
Scott Baker | 0486e17 | 2014-06-01 20:30:30 -0700 | [diff] [blame] | 605 | success: function () { |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 606 | location.reload(); |
Scott Baker | 0486e17 | 2014-06-01 20:30:30 -0700 | [diff] [blame] | 607 | }, |
| 608 | error:function (xhr, textStatus, thrownError){ |
| 609 | errorDialog("Error:", textStatus + " " + xhr.responseText); |
| 610 | } |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 611 | }); |
| 612 | }, |
| 613 | Cancel: function () { |
| 614 | $(this).dialog("close"); |
| 615 | } |
| 616 | } |
| 617 | }); |
| 618 | $("#delete-slice-form").dialog("open"); |
| 619 | }); |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 620 | } |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 621 | |
| 622 | |
| 623 | function initTenant() { |
| 624 | jQuery.ajax({ |
| 625 | url: '/tenantview', |
| 626 | dataType: 'json', |
| 627 | success: function (data) { |
Scott Baker | 168b741 | 2014-05-16 14:25:41 -0700 | [diff] [blame] | 628 | var rows = data['userSliceInfo']['rows']; |
| 629 | var imageData = data['image']['rows']; |
| 630 | //var networkData = data['network']['rows']; |
| 631 | var serviceLevelData = data['sliceServiceClass']['rows']; |
Scott Baker | a36d77e | 2014-08-29 11:43:23 -0700 | [diff] [blame^] | 632 | //var siteRows = data['sites']['rows']; |
| 633 | var siteRows = data['availableSites']['rows']; |
Scott Baker | 168b741 | 2014-05-16 14:25:41 -0700 | [diff] [blame] | 634 | var dataSet = data['mountDataSets']['rows']; |
Scott Baker | a36d77e | 2014-08-29 11:43:23 -0700 | [diff] [blame^] | 635 | var siteUsers = data['siteUsers']; |
| 636 | UserSliceTable(rows,imageData,serviceLevelData,siteRows,dataSet,siteUsers); |
Scott Baker | 168b741 | 2014-05-16 14:25:41 -0700 | [diff] [blame] | 637 | if(!(data['publicKey'])){ |
| 638 | $(".public-key-warning").css("display","block"); |
| 639 | } |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 640 | var value = $("#tenantSliceDropDown").val(); |
Scott Baker | 168b741 | 2014-05-16 14:25:41 -0700 | [diff] [blame] | 641 | checkForBasicAdvView(value,rows,imageData,serviceLevelData,siteRows,dataSet); |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 642 | $("#tooltip").css("display", "none"); |
| 643 | $("#basic-tooltip").css("display", "none"); |
| 644 | $("#adv-tooltip").css("display", "none"); |
Scott Baker | a36d77e | 2014-08-29 11:43:23 -0700 | [diff] [blame^] | 645 | if(!(data['role']=="pi"||data['role']=="admin")){ |
| 646 | $("#create-slice-btn").off(); |
| 647 | $("#create-slice-btn").css('background','grey'); |
| 648 | $("#delete-slice-btn").off(); |
| 649 | $("#delete-slice-btn").css('background','grey'); |
| 650 | $("#add-user-btn").off(); |
| 651 | $("#add-user-btn").css('background','grey'); |
| 652 | } |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 653 | }, |
| 654 | complete: function () {} |
| 655 | }); |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 656 | } |
Scott Baker | edf2f67 | 2014-04-22 10:17:37 -0700 | [diff] [blame] | 657 | |
Scott Baker | 537d823 | 2014-04-08 23:40:56 -0700 | [diff] [blame] | 658 | initTenant(); |
| 659 | }); |
| 660 | </script> |
| 661 | |
| 662 | </html> |