|
239 | 239 | }, |
240 | 240 |
|
241 | 241 | action: function(args) { |
242 | | - var array1 = []; |
243 | | - array1.push("&name=" + todb(args.data.name)); |
244 | | - array1.push("&zoneId=" + args.data.availabilityZone); |
245 | | - array1.push("&format=" + args.data.format); |
246 | | - array1.push("&url=" + todb(args.data.url)); |
247 | | - if(args.data.checksum != null && args.data.checksum.length > 0) |
248 | | - array1.push("&checksum=" + todb(args.data.checksum)); |
| 242 | + var data = { |
| 243 | + name: args.data.name, |
| 244 | + zoneId: args.data.availabilityZone, |
| 245 | + format: args.data.format, |
| 246 | + url: args.data.url |
| 247 | + }; |
| 248 | + |
| 249 | + if(args.data.checksum != null && args.data.checksum.length > 0) { |
| 250 | + $.extend(data, { |
| 251 | + checksum: args.data.checksum |
| 252 | + }); |
| 253 | + } |
249 | 254 |
|
250 | 255 | $.ajax({ |
251 | | - url: createURL("uploadVolume" + array1.join("")), |
252 | | - dataType: "json", |
253 | | - async: true, |
| 256 | + url: createURL('uploadVolume'), |
| 257 | + data: data, |
254 | 258 | success: function(json) { |
255 | 259 | var jid = json.uploadvolumeresponse.jobid; |
256 | 260 | args.response.success( |
|
874 | 878 | } |
875 | 879 | }, |
876 | 880 | action: function(args) { |
877 | | - /* |
878 | | - var isValid = true; |
879 | | - isValid &= validateString("Name", $thisDialog.find("#create_template_name"), $thisDialog.find("#create_template_name_errormsg")); |
880 | | - isValid &= validateString("Display Text", $thisDialog.find("#create_template_desc"), $thisDialog.find("#create_template_desc_errormsg")); |
881 | | - if (!isValid) |
882 | | - return; |
883 | | - $thisDialog.dialog("close"); |
884 | | - */ |
885 | | - |
886 | | - var array1 = []; |
887 | | - array1.push("&name=" + todb(args.data.name)); |
888 | | - array1.push("&displayText=" + todb(args.data.displayText)); |
889 | | - array1.push("&osTypeId=" + args.data.osTypeId); |
890 | | - array1.push("&isPublic=" + (args.data.isPublic=="on")); |
891 | | - array1.push("&passwordEnabled=" + (args.data.isPasswordEnabled=="on")); |
892 | | - if(args.$form.find('.form-item[rel=isFeatured]').css("display") != "none") |
893 | | - array1.push("&isfeatured=" + (args.data.isFeatured == "on")); |
| 881 | + var data = { |
| 882 | + volumeId: args.context.volumes[0].id, |
| 883 | + name: args.data.name, |
| 884 | + displayText: args.data.displayText, |
| 885 | + osTypeId: args.data.osTypeId, |
| 886 | + isPublic: (args.data.isPublic=="on"), |
| 887 | + passwordEnabled: (args.data.isPasswordEnabled=="on") |
| 888 | + }; |
| 889 | + |
| 890 | + if(args.$form.find('.form-item[rel=isFeatured]').css("display") != "none") { |
| 891 | + $.extend(data, { |
| 892 | + isfeatured: (args.data.isFeatured == "on") |
| 893 | + }); |
| 894 | + } |
894 | 895 |
|
895 | 896 | $.ajax({ |
896 | | - url: createURL("createTemplate&volumeId=" + args.context.volumes[0].id + array1.join("")), |
897 | | - dataType: "json", |
898 | | - async: true, |
| 897 | + url: createURL('createTemplate'), |
| 898 | + data: data, |
899 | 899 | success: function(json) { |
900 | 900 | var jid = json.createtemplateresponse.jobid; |
901 | 901 | args.response.success( |
|
1251 | 1251 | } |
1252 | 1252 | }, |
1253 | 1253 | action: function(args) { |
1254 | | - /* |
1255 | | - var isValid = true; |
1256 | | - isValid &= validateString("Name", $thisDialog.find("#create_template_name"), $thisDialog.find("#create_template_name_errormsg")); |
1257 | | - isValid &= validateString("Display Text", $thisDialog.find("#create_template_desc"), $thisDialog.find("#create_template_desc_errormsg")); |
1258 | | - if (!isValid) |
1259 | | - return; |
1260 | | - $thisDialog.dialog("close"); |
1261 | | - */ |
1262 | | - |
1263 | | - var array1 = []; |
1264 | | - array1.push("&name=" + todb(args.data.name)); |
1265 | | - array1.push("&displayText=" + todb(args.data.displayText)); |
1266 | | - array1.push("&osTypeId=" + args.data.osTypeId); |
1267 | | - array1.push("&isPublic=" + (args.data.isPublic=="on")); |
1268 | | - array1.push("&passwordEnabled=" + (args.data.isPasswordEnabled=="on")); |
1269 | | - |
| 1254 | + var data = { |
| 1255 | + snapshotid: args.context.snapshots[0].id, |
| 1256 | + name: args.data.name, |
| 1257 | + displayText: args.data.displayText, |
| 1258 | + osTypeId: args.data.osTypeId, |
| 1259 | + isPublic: (args.data.isPublic=="on"), |
| 1260 | + passwordEnabled: (args.data.isPasswordEnabled=="on") |
| 1261 | + }; |
| 1262 | + |
1270 | 1263 | $.ajax({ |
1271 | | - url: createURL("createTemplate&snapshotid=" + args.context.snapshots[0].id + array1.join("")), |
1272 | | - dataType: "json", |
1273 | | - async: true, |
| 1264 | + url: createURL('createTemplate'), |
| 1265 | + data: data, |
1274 | 1266 | success: function(json) { |
1275 | 1267 | var jid = json.createtemplateresponse.jobid; |
1276 | 1268 | args.response.success( |
|
1316 | 1308 | } |
1317 | 1309 | }, |
1318 | 1310 | action: function(args) { |
1319 | | - var array1 = []; |
1320 | | - array1.push("&name=" + todb(args.data.name)); |
| 1311 | + var data = { |
| 1312 | + snapshotid: args.context.snapshots[0].id, |
| 1313 | + name: args.data.name |
| 1314 | + }; |
1321 | 1315 |
|
1322 | 1316 | $.ajax({ |
1323 | | - url: createURL("createVolume&snapshotid=" + args.context.snapshots[0].id + array1.join("")), |
1324 | | - dataType: "json", |
1325 | | - async: true, |
| 1317 | + url: createURL('createVolume'), |
| 1318 | + data: data, |
1326 | 1319 | success: function(json) { |
1327 | 1320 | var jid = json.createvolumeresponse.jobid; |
1328 | 1321 | args.response.success( |
|
1464 | 1457 | } |
1465 | 1458 | } |
1466 | 1459 | } |
| 1460 | + allowedActions.push("createTemplate"); |
1467 | 1461 | return allowedActions; |
1468 | 1462 | }; |
1469 | 1463 |
|
|
1480 | 1474 | allowedActions.push("createVolume"); |
1481 | 1475 | } |
1482 | 1476 | allowedActions.push("remove"); |
| 1477 | + |
| 1478 | + allowedActions.push("createVolume"); |
| 1479 | + allowedActions.push("createTemplate"); |
1483 | 1480 | return allowedActions; |
1484 | 1481 | } |
1485 | 1482 |
|
|
0 commit comments