Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions ui/scripts/sharedFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2841,6 +2841,7 @@ cloudStack.createTemplateMethod = function (isSnapshot){
isChecked: false
}
}

},
action: function(args) {
var data = {
Expand Down Expand Up @@ -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){
if (value != null && value.length > 0) {
Expand Down
2 changes: 1 addition & 1 deletion ui/scripts/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -1960,7 +1960,7 @@
detailView: {
name: 'Snapshot detail',
actions: {
createTemplate: cloudStack.createTemplateMethod(true),
createTemplate: cloudStack.createTemplateFromSnapshotMethod(),

createVolume: {
label: 'label.action.create.volume',
Expand Down