mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
create template from snapshot regression (partly reverted) (#3767)
This commit is contained in:
parent
c75c228c2d
commit
5afff61e6f
@ -2841,6 +2841,7 @@ cloudStack.createTemplateMethod = function (isSnapshot){
|
|||||||
isChecked: false
|
isChecked: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
action: function(args) {
|
action: function(args) {
|
||||||
var data = {
|
var data = {
|
||||||
@ -2898,6 +2899,107 @@ cloudStack.createTemplateMethod = function (isSnapshot){
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
cloudStack.createTemplateFromSnapshotMethod = function (){
|
||||||
|
return {
|
||||||
|
label: 'label.create.template',
|
||||||
|
messages: {
|
||||||
|
confirm: function(args) {
|
||||||
|
return 'message.create.template';
|
||||||
|
},
|
||||||
|
notification: function(args) {
|
||||||
|
return 'label.create.template';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
createForm: {
|
||||||
|
title: 'label.create.template',
|
||||||
|
desc: '',
|
||||||
|
|
||||||
|
|
||||||
|
fields: {
|
||||||
|
name: {
|
||||||
|
label: 'label.name',
|
||||||
|
validation: {
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
displayText: {
|
||||||
|
label: 'label.description',
|
||||||
|
validation: {
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
osTypeId: {
|
||||||
|
label: '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: 'label.public',
|
||||||
|
isBoolean: true
|
||||||
|
},
|
||||||
|
isPasswordEnabled: {
|
||||||
|
label: 'label.password.enabled',
|
||||||
|
isBoolean: true
|
||||||
|
},
|
||||||
|
isdynamicallyscalable: {
|
||||||
|
label: 'label.dynamically.scalable',
|
||||||
|
isBoolean: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
action: function(args) {
|
||||||
|
var data = {
|
||||||
|
snapshotid: args.context.snapshots[0].id,
|
||||||
|
name: args.data.name,
|
||||||
|
displayText: args.data.displayText,
|
||||||
|
osTypeId: args.data.osTypeId,
|
||||||
|
isPublic: (args.data.isPublic == "on"),
|
||||||
|
passwordEnabled: (args.data.isPasswordEnabled == "on"),
|
||||||
|
isdynamicallyscalable: (args.data.isdynamicallyscalable == "on")
|
||||||
|
};
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: createURL('createTemplate'),
|
||||||
|
data: data,
|
||||||
|
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
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
cloudStack.addParameterToCommandUrlParameterArrayIfValueIsNotEmpty = function(array, parameterName, value){
|
cloudStack.addParameterToCommandUrlParameterArrayIfValueIsNotEmpty = function(array, parameterName, value){
|
||||||
if (value != null && value.length > 0) {
|
if (value != null && value.length > 0) {
|
||||||
|
|||||||
@ -1960,7 +1960,7 @@
|
|||||||
detailView: {
|
detailView: {
|
||||||
name: 'Snapshot detail',
|
name: 'Snapshot detail',
|
||||||
actions: {
|
actions: {
|
||||||
createTemplate: cloudStack.createTemplateMethod(true),
|
createTemplate: cloudStack.createTemplateFromSnapshotMethod(),
|
||||||
|
|
||||||
createVolume: {
|
createVolume: {
|
||||||
label: 'label.action.create.volume',
|
label: 'label.action.create.volume',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user