mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge pull request #1101 from ustcweizhou/add-select-template-dropdown
[4.6] Add select template dropdown when reinstall VM * pr/1101: Add select template dropdown when reinstall VM Signed-off-by: Remi Bergsma <github@remi.nl>
This commit is contained in:
commit
399d052f8d
@ -858,10 +858,56 @@
|
||||
return null;
|
||||
}
|
||||
},
|
||||
createForm: {
|
||||
title: 'label.reinstall.vm',
|
||||
desc: 'message.reinstall.vm',
|
||||
isWarning: true,
|
||||
fields: {
|
||||
template: {
|
||||
label: 'label.select.a.template',
|
||||
select: function(args) {
|
||||
var data = {
|
||||
templatefilter: 'featured'
|
||||
};
|
||||
$.ajax({
|
||||
url: createURL('listTemplates'),
|
||||
data: data,
|
||||
async: false,
|
||||
success: function(json) {
|
||||
var templates = json.listtemplatesresponse.template;
|
||||
var items = [{
|
||||
id: -1,
|
||||
description: ''
|
||||
}];
|
||||
$(templates).each(function() {
|
||||
items.push({
|
||||
id: this.id,
|
||||
description: this.name
|
||||
});
|
||||
});
|
||||
args.response.success({
|
||||
data: items
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
action: function(args) {
|
||||
var dataObj = {
|
||||
virtualmachineid: args.context.instances[0].id
|
||||
};
|
||||
if (args.data.template != -1) {
|
||||
$.extend(dataObj, {
|
||||
templateid: args.data.template
|
||||
});
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: createURL("restoreVirtualMachine&virtualmachineid=" + args.context.instances[0].id),
|
||||
url: createURL("restoreVirtualMachine"),
|
||||
data: dataObj,
|
||||
dataType: "json",
|
||||
async: true,
|
||||
success: function(json) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user