1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-25 23:21:29 +03:00

B #3858: Update CPU model VM (#3895)

Signed-off-by: Jorge Lobo <jlobo@opennebula.systems>
This commit is contained in:
Jorge Lobo 2019-10-31 18:09:14 +01:00 committed by Tino Vázquez
parent 1cd286d4c8
commit 936df07fbd
3 changed files with 41 additions and 19 deletions

View File

@ -322,9 +322,15 @@ define(function(require) {
function _retrieve(context) {
var templateJSON = {};
var osJSON = {};
$.extend(osJSON, WizardFields.retrieve(".bootTab", context));
$.extend(osJSON, WizardFields.retrieve(".kernelTab", context));
$.extend(osJSON, WizardFields.retrieve(".ramdiskTab", context));
$.extend(osJSON, WizardFields.retrieve(
$(".bootTab", context)
));
$.extend(osJSON, WizardFields.retrieve(
$(".kernelTab", context)
));
$.extend(osJSON, WizardFields.retrieve(
$(".ramdiskTab", context)
));
var boot = _retrieveBootValue(context);
@ -334,13 +340,24 @@ define(function(require) {
osJSON["BOOT"] = "";
}
if (!$.isEmptyObject(osJSON)) { templateJSON["OS"] = osJSON; };
if (!$.isEmptyObject(osJSON)) {
templateJSON["OS"] = osJSON;
}
var featuresJSON = WizardFields.retrieve(".featuresTab", context);
if (!$.isEmptyObject(featuresJSON)) { templateJSON["FEATURES"] = featuresJSON; };
var featuresJSON = WizardFields.retrieve(
$(".featuresTab", context)
);
if (!$.isEmptyObject(featuresJSON)) {
templateJSON["FEATURES"] = featuresJSON;
}
var cpuModelJSON = WizardFields.retrieve(".cpuTab", context);
if (!$.isEmptyObject(cpuModelJSON)) { templateJSON["CPU_MODEL"] = cpuModelJSON; };
var cpuModelJSON = WizardFields.retrieve(
$(".cpuTab", context)
);
if (!$.isEmptyObject(cpuModelJSON)) {
templateJSON["CPU_MODEL"] = cpuModelJSON;
}
return templateJSON;
}

View File

@ -127,12 +127,18 @@ define(function(require) {
});
}
function _submitWizard(context) {
var templateJSON = {}
function _submitWizard() {
var context = ".sunstone-content > #vms-tab #vms-tab-wizardForms.is-active";
var templateJSON = {};
$.each(this.wizardTabs, function(index, wizardTab) {
$.extend(true, templateJSON, wizardTab.retrieve($('#' + wizardTab.wizardTabId, context)));
$.extend(
true,
templateJSON,
wizardTab.retrieve(
$('#' + wizardTab.wizardTabId, context)
)
);
});
Sunstone.runAction("VM.updateconf", this.resourceId, TemplateUtils.templateToString(templateJSON));
return false;

View File

@ -35,13 +35,13 @@ define(function(require) {
fields.each(function() {
var field = $(this);
if (field.prop('wizard_field_disabled') != true &&
field.val() != null && field.val().length &&
(field.attr("type") != "checkbox" || field.prop("checked")) &&
(field.attr("type") != "radio" || field.prop("checked"))) {
if(
field.prop('wizard_field_disabled') != true &&
field.val() != null && field.val().length &&
(field.attr("type") != "checkbox" || field.prop("checked")) &&
(field.attr("type") != "radio" || field.prop("checked"))
) {
var field_name = field.attr('wizard_field');
if (field.attr('wizard_field_64') == "true"){
templateJSON[field_name] = btoa(field.val());
} else {
@ -49,7 +49,6 @@ define(function(require) {
}
}
});
return templateJSON;
}