cloudstack 3.0 new UI - template page - from actions from listView since they are available in detailView.

This commit is contained in:
Jessica Wang 2012-01-06 15:22:06 -08:00
parent 8f96a8539c
commit 4b33eef8d5
1 changed files with 1 additions and 163 deletions

View File

@ -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 <a href="#">00000</a> 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) {