1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-25 06:03:36 +03:00

B #5918: Fix VM instantiation with user inputs (#2235)

This commit is contained in:
Frederick Borges 2022-07-14 17:39:02 +02:00 committed by GitHub
parent a2fa0b65b2
commit 2f52827b56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 66 additions and 113 deletions

View File

@ -244,8 +244,6 @@ define(function(require) {
contextJSON[key] = "$" + name;
});
var userInputsOrder = UserInputs.retrieveOrder();
var start_script = WizardFields.retrieveInput($(".START_SCRIPT", context));
if (start_script != "") {
if ($(".ENCODE_START_SCRIPT", context).is(":checked")) {
@ -257,7 +255,6 @@ define(function(require) {
if (!$.isEmptyObject(contextJSON)) { templateJSON["CONTEXT"] = contextJSON; };
if (!$.isEmptyObject(userInputsJSON)) { templateJSON["USER_INPUTS"] = userInputsJSON; };
templateJSON["INPUTS_ORDER"] = userInputsOrder;
}
return templateJSON;
@ -305,7 +302,6 @@ define(function(require) {
}
delete templateJSON["USER_INPUTS"];
delete templateJSON["INPUTS_ORDER"];
}
if (contextJSON) {

View File

@ -147,22 +147,9 @@ define(function(require) {
function _fill(context, templateJSON){
var userInputsJSON = templateJSON["USER_INPUTS"];
if(!templateJSON["INPUTS_ORDER"]){
var inputsOrderString = "";
$.each(userInputsJSON, function(key, value){
inputsOrderString += key + ",";
});
templateJSON["INPUTS_ORDER"] = inputsOrderString.slice(0,-1);
}
var order = templateJSON["INPUTS_ORDER"];
var orderJSON = order.split(",");
if(userInputsJSON){
$.each(orderJSON, function(key, value){
var nameOrder = value;
$.each(userInputsJSON, function(key, value) {
if(nameOrder == key){
$(".add_user_input_attr", context).trigger("click");
var trcontext = $(".user_input_attrs tbody tr", context).last();
@ -222,8 +209,6 @@ define(function(require) {
$("."+attr.type+" input.user_input_initial", trcontext).val(attr.initial);
break;
}
}
});
});
}
}
@ -502,13 +487,8 @@ define(function(require) {
html += "</fieldset>";
div.append(html);
html = "";
if(opts.defaults && opts.defaults.INPUTS_ORDER){
var order = opts.defaults.INPUTS_ORDER;
var orderJSON = order.split(",");
$.each(orderJSON, function(key, value){
var orderValue = value;
$.each(custom_attrs, function(index, custom_attr) {
if (custom_attr.name == orderValue){
$.each(custom_attrs, function(_, custom_attr) {
var tooltip = "";
if (custom_attr.type === "list-multiple"){
tooltip = " <span class=\"tip\">" + Locale.tr("Use ctrl key for multiple selection") + "</span>";
@ -523,30 +503,7 @@ define(function(require) {
"</label>" +
"</div>" +
"</div>");
}
});
});
} else {
$.each(custom_attrs, function(index, custom_attr) {
var tooltip = "";
if(custom_attr && custom_attr.description){
if (custom_attr.type === "list-multiple"){
tooltip = " <span class=\"tip\">" + Locale.tr("Use ctrl key for multiple selection") + "</span>";
}
$("."+custom_attr_class, div).append(
"<div class=\"row\">" +
"<div class=\"large-12 large-centered columns\">" +
"<label>" +
TemplateUtils.htmlEncode(custom_attr.description) +
tooltip +
_attributeInput(custom_attr) +
"</label>" +
"</div>" +
"</div>"
);
}
});
}
}
//render Vmgroups_attr_values