From 4b33eef8d5db0f3252205cb6e89d0489bcaddf61 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Fri, 6 Jan 2012 15:22:06 -0800 Subject: [PATCH] cloudstack 3.0 new UI - template page - from actions from listView since they are available in detailView. --- ui/scripts/templates.js | 164 +--------------------------------------- 1 file changed, 1 insertion(+), 163 deletions(-) diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js index 14964c48a8e..0c8308a77d4 100644 --- a/ui/scripts/templates.js +++ b/ui/scripts/templates.js @@ -830,169 +830,7 @@ args.complete(); } } - }, - - copyISO: { - label: 'Copy ISO', - messages: { - confirm: function(args) { - return 'Are you sure you want to copy ISO?'; - }, - notification: function(args) { - return 'Copying ISO'; - } - }, - createForm: { - title: 'Copy ISO', - desc: '', - addRow: 'false', - fields: { - destinationZoneId: { - label: 'Destination zone', - validation: { required: true }, - select: function(args) { - $.ajax({ - url: createURL("listZones&available=true"), - dataType: "json", - async: true, - success: function(json) { - var zoneObjs = json.listzonesresponse.zone; - var items = []; - $(zoneObjs).each(function() { - if(this.id != args.context.isos[0].zoneid) - items.push({id: this.id, description: this.name}); - }); - args.response.success({data: items}); - } - }); - } - } - } - }, - action: function(args) { - $.ajax({ - url: createURL("copyIso&id=" + args.context.isos[0].id + "&sourcezoneid=" + args.context.isos[0].zoneid + "&destzoneid=" + args.data.destinationZoneId), - dataType: "json", - async: true, - success: function(json) { - var jid = json.copytemplateresponse.jobid; - args.response.success( - {_custom: - {jobId: jid, - getUpdatedItem: function(json) { - return {}; //nothing in this ISO needs to be updated - }, - getActionFilter: function() { - return isoActionfilter; - } - } - } - ); - } - }); - }, - notification: { - poll: pollAsyncJobResult - } - }, - - downloadISO: { - label: 'Download ISO', - messages: { - confirm: function(args) { - return 'Are you sure you want to download ISO ?'; - }, - success: function(args) { - return 'ISO is being downloaded.'; - }, - notification: function(args) { - return 'Downloading ISO'; - }, - complete: function(args) { - var url = decodeURIComponent(args.url); - var htmlMsg = 'Please click 00000 to download ISO'; - var htmlMsg2 = htmlMsg.replace(/#/, url).replace(/00000/, url); - return htmlMsg2; - } - }, - action: function(args) { - var apiCmd = "extractIso&mode=HTTP_DOWNLOAD&id=" + args.context.isos[0].id; - if(args.context.isos[0].zoneid != null) - apiCmd += "&zoneid=" + args.context.isos[0].zoneid; - - $.ajax({ - url: createURL(apiCmd), - dataType: "json", - async: true, - success: function(json) { - var jid = json.extractisoresponse.jobid; - args.response.success( - {_custom: - {jobId: jid, - getUpdatedItem: function(json) { - return json.queryasyncjobresultresponse.jobresult.iso; - }, - getActionFilter: function() { - return isoActionfilter; - } - } - } - ); - } - }); - }, - notification: { - poll: pollAsyncJobResult - } - }, - - 'delete': { - label: 'Delete ISO', - messages: { - confirm: function(args) { - return 'Are you sure you want to delete ISO ?'; - }, - success: function(args) { - return 'ISO is being deleted.'; - }, - notification: function(args) { - return 'Deleting ISO'; - }, - complete: function(args) { - return 'ISO has been deleted.'; - } - }, - action: function(args) { - var array1 = []; - if (args.context.isos[0].zoneid != null) - array1.push("&zoneid=" + args.context.isos[0].zoneid); - - $.ajax({ - url: createURL("deleteIso&id=" + args.context.isos[0].id + array1.join("")), - dataType: "json", - async: true, - success: function(json) { - var jid = json.deleteisosresponse.jobid; - args.response.success( - {_custom: - {jobId: jid, - getUpdatedItem: function(json) { - return {}; //nothing in this ISO needs to be updated, in fact, this whole ISO has being deleted - }, - getActionFilter: function() { - return isoActionfilter; - } - } - } - ); - } - }); - }, - notification: { - poll: pollAsyncJobResult - } - } - + } }, dataProvider: function(args) {