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

This commit is contained in:
Jessica Wang 2012-01-06 12:24:40 -08:00
parent 2a7121c1a0
commit 3ae9ffe43f

View File

@ -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 = [];