From 3ae9ffe43fcddae8572cf703c1e61efa6d396cf1 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Fri, 6 Jan 2012 12:24:40 -0800 Subject: [PATCH] cloudstack 3.0 new UI - snapshot page - from actions from listView since they are available in detailView. --- ui/scripts/storage.js | 174 +----------------------------------------- 1 file changed, 1 insertion(+), 173 deletions(-) diff --git a/ui/scripts/storage.js b/ui/scripts/storage.js index 5cbe2460857..842ad3d540c 100644 --- a/ui/scripts/storage.js +++ b/ui/scripts/storage.js @@ -893,179 +893,7 @@ intervaltype: { label: 'Interval Type' }, created: { label: 'Date', converter: cloudStack.converters.toLocalDate }, state: { label: 'State', indicator: { 'BackedUp': 'on', 'Destroyed': 'off' } } - }, - - actions: { - createTemplate: { - addRow: 'false', - label: 'Create template', - messages: { - confirm: function(args) { - return 'Are you sure you want to create template?'; - }, - notification: function(args) { - return 'Create template'; - } - }, - createForm: { - title: 'Create Template', - desc: '', - fields: { - name: { label: 'Name', validation: { required: true }}, - displayText: { label: 'Description', validation: { required: true }}, - osTypeId: { - label: 'OS Type', - select: function(args) { - $.ajax({ - url: createURL("listOsTypes"), - dataType: "json", - async: true, - success: function(json) { - var ostypes = json.listostypesresponse.ostype; - var items = []; - $(ostypes).each(function() { - items.push({id: this.id, description: this.description}); - }); - args.response.success({data: items}); - } - }); - } - }, - isPublic: { label: 'Public', isBoolean: true }, - isPasswordEnabled: { label: 'Password enabled', isBoolean: true } - } - }, - action: function(args) { - /* - var isValid = true; - isValid &= validateString("Name", $thisDialog.find("#create_template_name"), $thisDialog.find("#create_template_name_errormsg")); - isValid &= validateString("Display Text", $thisDialog.find("#create_template_desc"), $thisDialog.find("#create_template_desc_errormsg")); - if (!isValid) - return; - $thisDialog.dialog("close"); - */ - - var array1 = []; - array1.push("&name=" + todb(args.data.name)); - array1.push("&displayText=" + todb(args.data.displayText)); - array1.push("&osTypeId=" + args.data.osTypeId); - array1.push("&isPublic=" + (args.data.isPublic=="on")); - array1.push("&passwordEnabled=" + (args.data.isPasswordEnabled=="on")); - - $.ajax({ - url: createURL("createTemplate&snapshotid=" + args.context.snapshots[0].id + array1.join("")), - dataType: "json", - async: true, - success: function(json) { - var jid = json.createtemplateresponse.jobid; - args.response.success( - {_custom: - {jobId: jid, - getUpdatedItem: function(json) { - return {}; //nothing in this snapshot needs to be updated - }, - getActionFilter: function() { - return snapshotActionfilter; - } - } - } - ); - } - }); - }, - notification: { - poll: pollAsyncJobResult - } - }, - - createVolume: { - label: 'Create volume', - addRow: 'false', - messages: { - confirm: function(args) { - return 'Are you sure you want to create volume?'; - }, - notification: function(args) { - return 'Create volume'; - } - }, - createForm: { - title: 'Create volume', - desc: 'Please name your volume.', - fields: { - name: { label: 'Name', validation: { required: true }} - } - }, - action: function(args) { - /* - var isValid = true; - isValid &= validateString("Name", $thisDialog.find("#create_volume_name"), $thisDialog.find("#create_volume_name_errormsg")); - if (!isValid) - return; - */ - - var array1 = []; - array1.push("&name=" + todb(args.data.name)); - - $.ajax({ - url: createURL("createVolume&snapshotid=" + args.context.snapshots[0].id + array1.join("")), - dataType: "json", - async: true, - success: function(json) { - var jid = json.createvolumeresponse.jobid; - args.response.success( - {_custom: - {jobId: jid, - getUpdatedItem: function(json) { - return {}; //nothing in this snapshot needs to be updated - }, - getActionFilter: function() { - return snapshotActionfilter; - } - } - } - ); - } - }); - }, - notification: { - poll: pollAsyncJobResult - } - }, - - 'destroy': { - label: 'Delete snapshot', - messages: { - confirm: function(args) { - return 'Are you sure you want to delete snapshot?'; - }, - notification: function(args) { - return 'Delete snapshot'; - } - }, - action: function(args) { - $.ajax({ - url: createURL("deleteSnapshot&id=" + args.context.snapshots[0].id), - dataType: "json", - async: true, - success: function(json) { - var jid = json.deletesnapshotresponse.jobid; - args.response.success( - {_custom: - {jobId: jid - } - } - ); - } - }); - }, - notification: { - poll: function(args) {args.complete({ - data: { state: 'Destroyed' } - });} - } - } - }, + }, dataProvider: function(args) { var array1 = [];