mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
* B #1747: VM template wizard resets CPU_MODEL * B #1747: Solved conflict create and update
This commit is contained in:
parent
5e1843e0d5
commit
9c417fca27
@ -19,145 +19,146 @@ define(function(require) {
|
||||
DEPENDENCIES
|
||||
*/
|
||||
|
||||
// require('foundation.tab');
|
||||
var Config = require('sunstone-config');
|
||||
var Locale = require('utils/locale');
|
||||
var Tips = require('utils/tips');
|
||||
var WizardFields = require('utils/wizard-fields');
|
||||
var FilesTable = require('tabs/files-tab/datatable');
|
||||
var UniqueId = require('utils/unique-id');
|
||||
var OpenNebulaHost = require('opennebula/host');
|
||||
// require('foundation.tab');
|
||||
var Config = require("sunstone-config");
|
||||
var Locale = require("utils/locale");
|
||||
var Tips = require("utils/tips");
|
||||
var WizardFields = require("utils/wizard-fields");
|
||||
var FilesTable = require("tabs/files-tab/datatable");
|
||||
var UniqueId = require("utils/unique-id");
|
||||
var OpenNebulaHost = require("opennebula/host");
|
||||
|
||||
/*
|
||||
TEMPLATES
|
||||
*/
|
||||
|
||||
var TemplateHTML = require('hbs!./os/html');
|
||||
var TemplateHTML = require("hbs!./os/html");
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
*/
|
||||
|
||||
var WIZARD_TAB_ID = require('./os/wizardTabId');
|
||||
var WIZARD_TAB_ID = require("./os/wizardTabId");
|
||||
var GUESTOS = [
|
||||
'asianux3_64Guest',
|
||||
'asianux3Guest',
|
||||
'asianux4_64Guest',
|
||||
'asianux4Guest',
|
||||
'centos64Guest',
|
||||
'centosGuest',
|
||||
'darwin64Guest',
|
||||
'darwinGuest',
|
||||
'debian4_64Guest',
|
||||
'debian4Guest',
|
||||
'debian5_64Guest',
|
||||
'debian5Guest',
|
||||
'dosGuest',
|
||||
'eComStationGuest',
|
||||
'freebsd64Guest',
|
||||
'freebsdGuest',
|
||||
'mandriva64Guest',
|
||||
'mandrivaGuest',
|
||||
'netware4Guest',
|
||||
'netware5Guest',
|
||||
'netware6Guest',
|
||||
'nld9Guest',
|
||||
'oesGuest',
|
||||
'openServer5Guest',
|
||||
'openServer6Guest',
|
||||
'oracleLinux64Guest',
|
||||
'oracleLinuxGuest',
|
||||
'os2Guest',
|
||||
'other24xLinux64Guest',
|
||||
'other24xLinuxGuest',
|
||||
'other26xLinux64Guest',
|
||||
'other26xLinuxGuest',
|
||||
'otherGuest',
|
||||
'otherGuest64',
|
||||
'otherLinux64Guest',
|
||||
'otherLinuxGuest',
|
||||
'redhatGuest',
|
||||
'rhel2Guest',
|
||||
'rhel3_64Guest',
|
||||
'rhel3Guest',
|
||||
'rhel4_64Guest',
|
||||
'rhel4Guest',
|
||||
'rhel5_64Guest',
|
||||
'rhel5Guest',
|
||||
'rhel6_64Guest',
|
||||
'rhel6Guest',
|
||||
'sjdsGuest',
|
||||
'sles10_64Guest',
|
||||
'sles10Guest',
|
||||
'sles11_64Guest',
|
||||
'sles11Guest',
|
||||
'sles64Guest',
|
||||
'slesGuest',
|
||||
'solaris10_64Guest',
|
||||
'solaris10Guest',
|
||||
'solaris6Guest',
|
||||
'solaris7Guest',
|
||||
'solaris8Guest',
|
||||
'solaris9Guest',
|
||||
'suse64Guest',
|
||||
'suseGuest',
|
||||
'turboLinux64Guest',
|
||||
'turboLinuxGuest',
|
||||
'ubuntu64Guest',
|
||||
'ubuntuGuest',
|
||||
'unixWare7Guest',
|
||||
'win2000AdvServGuest',
|
||||
'win2000ProGuest',
|
||||
'win2000ServGuest',
|
||||
'win31Guest',
|
||||
'win95Guest',
|
||||
'win98Guest',
|
||||
'windows7_64Guest',
|
||||
'windows7Guest',
|
||||
'windows7Server64Guest',
|
||||
'winLonghorn64Guest',
|
||||
'winLonghornGuest',
|
||||
'winMeGuest',
|
||||
'winNetBusinessGuest',
|
||||
'winNetDatacenter64Guest',
|
||||
'winNetDatacenterGuest',
|
||||
'winNetEnterprise64Guest',
|
||||
'winNetEnterpriseGuest',
|
||||
'winNetStandard64Guest',
|
||||
'winNetStandardGuest',
|
||||
'winNetWebGuest',
|
||||
'winNTGuest',
|
||||
'winVista64Guest',
|
||||
'winVistaGuest',
|
||||
'winXPHomeGuest',
|
||||
'winXPPro64Guest',
|
||||
'winXPProGues'
|
||||
]
|
||||
"asianux3_64Guest",
|
||||
"asianux3Guest",
|
||||
"asianux4_64Guest",
|
||||
"asianux4Guest",
|
||||
"centos64Guest",
|
||||
"centosGuest",
|
||||
"darwin64Guest",
|
||||
"darwinGuest",
|
||||
"debian4_64Guest",
|
||||
"debian4Guest",
|
||||
"debian5_64Guest",
|
||||
"debian5Guest",
|
||||
"dosGuest",
|
||||
"eComStationGuest",
|
||||
"freebsd64Guest",
|
||||
"freebsdGuest",
|
||||
"mandriva64Guest",
|
||||
"mandrivaGuest",
|
||||
"netware4Guest",
|
||||
"netware5Guest",
|
||||
"netware6Guest",
|
||||
"nld9Guest",
|
||||
"oesGuest",
|
||||
"openServer5Guest",
|
||||
"openServer6Guest",
|
||||
"oracleLinux64Guest",
|
||||
"oracleLinuxGuest",
|
||||
"os2Guest",
|
||||
"other24xLinux64Guest",
|
||||
"other24xLinuxGuest",
|
||||
"other26xLinux64Guest",
|
||||
"other26xLinuxGuest",
|
||||
"otherGuest",
|
||||
"otherGuest64",
|
||||
"otherLinux64Guest",
|
||||
"otherLinuxGuest",
|
||||
"redhatGuest",
|
||||
"rhel2Guest",
|
||||
"rhel3_64Guest",
|
||||
"rhel3Guest",
|
||||
"rhel4_64Guest",
|
||||
"rhel4Guest",
|
||||
"rhel5_64Guest",
|
||||
"rhel5Guest",
|
||||
"rhel6_64Guest",
|
||||
"rhel6Guest",
|
||||
"sjdsGuest",
|
||||
"sles10_64Guest",
|
||||
"sles10Guest",
|
||||
"sles11_64Guest",
|
||||
"sles11Guest",
|
||||
"sles64Guest",
|
||||
"slesGuest",
|
||||
"solaris10_64Guest",
|
||||
"solaris10Guest",
|
||||
"solaris6Guest",
|
||||
"solaris7Guest",
|
||||
"solaris8Guest",
|
||||
"solaris9Guest",
|
||||
"suse64Guest",
|
||||
"suseGuest",
|
||||
"turboLinux64Guest",
|
||||
"turboLinuxGuest",
|
||||
"ubuntu64Guest",
|
||||
"ubuntuGuest",
|
||||
"unixWare7Guest",
|
||||
"win2000AdvServGuest",
|
||||
"win2000ProGuest",
|
||||
"win2000ServGuest",
|
||||
"win31Guest",
|
||||
"win95Guest",
|
||||
"win98Guest",
|
||||
"windows7_64Guest",
|
||||
"windows7Guest",
|
||||
"windows7Server64Guest",
|
||||
"winLonghorn64Guest",
|
||||
"winLonghornGuest",
|
||||
"winMeGuest",
|
||||
"winNetBusinessGuest",
|
||||
"winNetDatacenter64Guest",
|
||||
"winNetDatacenterGuest",
|
||||
"winNetEnterprise64Guest",
|
||||
"winNetEnterpriseGuest",
|
||||
"winNetStandard64Guest",
|
||||
"winNetStandardGuest",
|
||||
"winNetWebGuest",
|
||||
"winNTGuest",
|
||||
"winVista64Guest",
|
||||
"winVistaGuest",
|
||||
"winXPHomeGuest",
|
||||
"winXPPro64Guest",
|
||||
"winXPProGues"
|
||||
];
|
||||
|
||||
/*
|
||||
CONSTRUCTOR
|
||||
*/
|
||||
|
||||
function WizardTab(opts) {
|
||||
if (!Config.isTemplateCreationTabEnabled(opts.tabId, 'os_booting')) {
|
||||
if (!Config.isTemplateCreationTabEnabled(opts.tabId, "os_booting")) {
|
||||
throw "Wizard Tab not enabled";
|
||||
}
|
||||
|
||||
this.wizardTabId = WIZARD_TAB_ID + UniqueId.id();
|
||||
this.icon = 'fa-power-off';
|
||||
this.icon = "fa-power-off";
|
||||
this.title = Locale.tr("OS & CPU");
|
||||
this.classes = "hypervisor only_kvm"
|
||||
this.classes = "hypervisor only_kvm";
|
||||
|
||||
this.kernelFilesTable = new FilesTable(
|
||||
this.wizardTabId + UniqueId.id(),
|
||||
{ 'select': true,
|
||||
'selectOptions': {
|
||||
{ "select": true,
|
||||
"selectOptions": {
|
||||
"filter_fn": function(file) { return file.TYPE == 3; } // KERNEL
|
||||
}
|
||||
});
|
||||
this.initrdFilesTable = new FilesTable(
|
||||
this.wizardTabId + UniqueId.id(),
|
||||
{ 'select': true,
|
||||
'selectOptions': {
|
||||
{ "select": true,
|
||||
"selectOptions": {
|
||||
"filter_fn": function(file) { return file.TYPE == 4; } // RAMDISK
|
||||
}
|
||||
});
|
||||
@ -179,10 +180,10 @@ define(function(require) {
|
||||
|
||||
function _html() {
|
||||
return TemplateHTML({
|
||||
'uniqueId': UniqueId.id(),
|
||||
'guestOS': GUESTOS,
|
||||
'kernelFilesTableHTML': this.kernelFilesTable.dataTableHTML,
|
||||
'initrdFilesTableHTML': this.initrdFilesTable.dataTableHTML
|
||||
"uniqueId": UniqueId.id(),
|
||||
"guestOS": GUESTOS,
|
||||
"kernelFilesTableHTML": this.kernelFilesTable.dataTableHTML,
|
||||
"initrdFilesTableHTML": this.initrdFilesTable.dataTableHTML
|
||||
});
|
||||
}
|
||||
|
||||
@ -191,7 +192,7 @@ define(function(require) {
|
||||
|
||||
function _setup(context) {
|
||||
var that = this;
|
||||
Foundation.reflow(context, 'tabs');
|
||||
Foundation.reflow(context, "tabs");
|
||||
|
||||
context.on("click", "button.boot-order-up", function(){
|
||||
var tr = $(this).closest("tr");
|
||||
@ -218,39 +219,39 @@ define(function(require) {
|
||||
var kernelDSContext = $(".kernel_ds", context);
|
||||
var kernelDSInputsContext = $("#kernel_path_inputs", context);
|
||||
$("input[name='kernel_type']", context).change(function() {
|
||||
if ($("input[name='kernel_type']:checked", context).val() == "kernel_ds") {
|
||||
if ($("input[name='kernel_type']:checked", context).val() === "kernel_ds") {
|
||||
kernelDSContext.toggle();
|
||||
kernelDSInputsContext.hide();
|
||||
$("[wizard_field]", kernelDSContext).prop('wizard_field_disabled', false);
|
||||
$("[wizard_field]", kernelDSInputsContext).prop('wizard_field_disabled', true);
|
||||
$("[wizard_field]", kernelDSContext).prop("wizard_field_disabled", false);
|
||||
$("[wizard_field]", kernelDSInputsContext).prop("wizard_field_disabled", true);
|
||||
} else {
|
||||
kernelDSContext.hide();
|
||||
kernelDSInputsContext.toggle();
|
||||
$("[wizard_field]", kernelDSInputsContext).prop('wizard_field_disabled', false);
|
||||
$("[wizard_field]", kernelDSContext).prop('wizard_field_disabled', true);
|
||||
$("[wizard_field]", kernelDSInputsContext).prop("wizard_field_disabled", false);
|
||||
$("[wizard_field]", kernelDSContext).prop("wizard_field_disabled", true);
|
||||
}
|
||||
});
|
||||
|
||||
var initrdDSContext = $(".initrd_ds", context);
|
||||
var initrdDSInputsContext = $("#initrd_path_inputs", context);
|
||||
$("input[name='initrd_type']", context).change(function() {
|
||||
if ($("input[name='initrd_type']:checked", context).val() == "initrd_ds") {
|
||||
if ($("input[name='initrd_type']:checked", context).val() === "initrd_ds") {
|
||||
initrdDSContext.toggle();
|
||||
initrdDSInputsContext.hide();
|
||||
$("[wizard_field]", initrdDSContext).prop('wizard_field_disabled', false);
|
||||
$("[wizard_field]", initrdDSInputsContext).prop('wizard_field_disabled', true);
|
||||
$("[wizard_field]", initrdDSContext).prop("wizard_field_disabled", false);
|
||||
$("[wizard_field]", initrdDSInputsContext).prop("wizard_field_disabled", true);
|
||||
} else {
|
||||
initrdDSContext.hide();
|
||||
initrdDSInputsContext.toggle();
|
||||
$("[wizard_field]", initrdDSInputsContext).prop('wizard_field_disabled', false);
|
||||
$("[wizard_field]", initrdDSContext).prop('wizard_field_disabled', true);
|
||||
$("[wizard_field]", initrdDSInputsContext).prop("wizard_field_disabled", false);
|
||||
$("[wizard_field]", initrdDSContext).prop("wizard_field_disabled", true);
|
||||
}
|
||||
});
|
||||
|
||||
that.kernelFilesTable.initialize({
|
||||
'selectOptions': {
|
||||
'select_callback': function(aData, options) {
|
||||
$('#KERNEL_DS', context).val("$FILE[IMAGE_ID="+ aData[options.id_index] +"]");
|
||||
"selectOptions": {
|
||||
"select_callback": function(aData, options) {
|
||||
$("#KERNEL_DS", context).val("$FILE[IMAGE_ID="+ aData[options.id_index] +"]");
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -258,51 +259,50 @@ define(function(require) {
|
||||
|
||||
|
||||
that.initrdFilesTable.initialize({
|
||||
'selectOptions': {
|
||||
'select_callback': function(aData, options) {
|
||||
$('#INITRD_DS', context).val("$FILE[IMAGE_ID="+ aData[options.id_index] +"]");
|
||||
"selectOptions": {
|
||||
"select_callback": function(aData, options) {
|
||||
$("#INITRD_DS", context).val("$FILE[IMAGE_ID="+ aData[options.id_index] +"]");
|
||||
}
|
||||
}
|
||||
});
|
||||
that.initrdFilesTable.refreshResourceTableSelect();
|
||||
|
||||
fillMachineTypesAndCPUModel();
|
||||
|
||||
}
|
||||
|
||||
function fillMachineTypesAndCPUModel(){
|
||||
function fillMachineTypesAndCPUModel(cpuModel, machineType){
|
||||
OpenNebulaHost.kvmInfo({
|
||||
data : {},
|
||||
timeout: true,
|
||||
success: function (request, kvmInfo){
|
||||
var m = $("#machine-type").html();
|
||||
if (m === undefined){
|
||||
if ($("#model-cpu").html() === undefined){
|
||||
machines = kvmInfo[0].set_kvm_machines;
|
||||
cpus = kvmInfo[0].set_cpu_models;
|
||||
|
||||
var html = "<select id=\"machine-type\" wizard_field=\"MACHINE\">";
|
||||
html += '<option value="">' + " " + '</option>';
|
||||
|
||||
html += "<option value=\"\">" + " " + "</option>";
|
||||
$.each(machines, function(i, machine){
|
||||
html += "<option value='" + machine + "'>" + machine + "</option>";
|
||||
});
|
||||
|
||||
html += '</select>';
|
||||
|
||||
html += "</select>";
|
||||
$("#kvm-info").append(html);
|
||||
|
||||
var html = "<select wizard_field=\"MODEL\">";
|
||||
html += '<option value="">' + " " + '</option>';
|
||||
html += '<option value="host-passthrough">host-passthrough</option>';
|
||||
|
||||
var html = "<select id=\"model-cpu\" wizard_field=\"MODEL\">";
|
||||
html += "<option value=\"\">" + " " + "</option>";
|
||||
html += "<option value=\"host-passthrough\">host-passthrough</option>";
|
||||
$.each(cpus, function(i, cpu){
|
||||
html += "<option value='" + cpu + "'>" + cpu + "</option>";
|
||||
});
|
||||
html += '</select>';
|
||||
html += "</select>";
|
||||
$("#cpu-model").append(html);
|
||||
}
|
||||
|
||||
if (machineType && machineType.MACHINE){ $("#machine-type").val(machineType.MACHINE); }
|
||||
if (cpuModel){ $("#model-cpu").val(cpuModel.MODEL); }
|
||||
},
|
||||
error: function(request, error_json){
|
||||
console.error("There was an error requesting the KVM info: "+
|
||||
console.error("There was an error requesting the KVM info: " +
|
||||
error_json.error.message);
|
||||
}
|
||||
});
|
||||
@ -310,10 +310,10 @@ 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));
|
||||
var osJSON = {};
|
||||
$.extend(osJSON, WizardFields.retrieve(".bootTab", context));
|
||||
$.extend(osJSON, WizardFields.retrieve(".kernelTab", context));
|
||||
$.extend(osJSON, WizardFields.retrieve(".ramdiskTab", context));
|
||||
|
||||
var boot = _retrieveBootValue(context);
|
||||
|
||||
@ -323,49 +323,47 @@ 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;
|
||||
}
|
||||
|
||||
function _fill(context, templateJSON) {
|
||||
var osJSON = templateJSON['OS'];
|
||||
var osJSON = templateJSON["OS"];
|
||||
var modelJSON = templateJSON["CPU_MODEL"];
|
||||
if (osJSON) {
|
||||
|
||||
if (osJSON['KERNEL_DS'] == undefined && osJSON['KERNEL'] != undefined){
|
||||
$('input[value="kernel_path"]', context).click();
|
||||
if (osJSON["KERNEL_DS"] === undefined && osJSON["KERNEL"] !== undefined){
|
||||
$("input[value=\"kernel_path\"]", context).click();
|
||||
}
|
||||
|
||||
if (osJSON['INITRD_DS'] == undefined && osJSON['INITRD'] != undefined){
|
||||
$('input[value="initrd_path"]', context).click();
|
||||
if (osJSON["INITRD_DS"] === undefined && osJSON["INITRD"] !== undefined){
|
||||
$("input[value=\"initrd_path\"]", context).click();
|
||||
}
|
||||
|
||||
WizardFields.fill(context, osJSON);
|
||||
|
||||
if (osJSON && osJSON['BOOT']) {
|
||||
_fillBootValue(context, osJSON['BOOT']);
|
||||
if (osJSON && osJSON["BOOT"]) {
|
||||
_fillBootValue(context, osJSON["BOOT"]);
|
||||
}
|
||||
|
||||
delete templateJSON['OS'];
|
||||
}
|
||||
|
||||
var featuresJSON = templateJSON['FEATURES'];
|
||||
var featuresJSON = templateJSON["FEATURES"];
|
||||
if (featuresJSON) {
|
||||
WizardFields.fill(context, featuresJSON);
|
||||
delete templateJSON['FEATURES'];
|
||||
delete templateJSON["FEATURES"];
|
||||
}
|
||||
|
||||
var cpuModelJSON = templateJSON['CPU_MODEL'];
|
||||
if (cpuModelJSON) {
|
||||
WizardFields.fill(context, cpuModelJSON);
|
||||
delete templateJSON['CPU_MODEL'];
|
||||
}
|
||||
fillMachineTypesAndCPUModel(modelJSON, osJSON);
|
||||
|
||||
delete templateJSON["OS"];
|
||||
delete templateJSON["CPU_MODEL"];
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@ -391,20 +389,20 @@ define(function(require) {
|
||||
}
|
||||
});
|
||||
|
||||
table.attr("value", devices.join(','));
|
||||
table.attr("value", devices.join(","));
|
||||
}
|
||||
|
||||
function _addBootRow(context, value, label) {
|
||||
$("table.boot-order tbody", context).append(
|
||||
'<tr value="'+value+'">'+
|
||||
'<td><input type="checkbox"/></td>'+
|
||||
'<td>'+value+'</td>'+
|
||||
'<td><label>'+label+'</label></td>'+
|
||||
'<td>'+
|
||||
'<button class="boot-order-up button radius tiny secondary"><i class="fa fa-lg fa-arrow-up" aria-hidden="true"></i></button>'+
|
||||
'<button class="boot-order-down button radius tiny secondary"><i class="fa fa-lg fa-arrow-down" aria-hidden="true"></i></button>'+
|
||||
'</td>'+
|
||||
'</tr>');
|
||||
"<tr value=\""+value+"\">"+
|
||||
"<td><input type=\"checkbox\"/></td>"+
|
||||
"<td>"+value+"</td>"+
|
||||
"<td><label>"+label+"</label></td>"+
|
||||
"<td>"+
|
||||
"<button class=\"boot-order-up button radius tiny secondary\"><i class=\"fa fa-lg fa-arrow-up\" aria-hidden=\"true\"></i></button>"+
|
||||
"<button class=\"boot-order-down button radius tiny secondary\"><i class=\"fa fa-lg fa-arrow-down\" aria-hidden=\"true\"></i></button>"+
|
||||
"</td>"+
|
||||
"</tr>");
|
||||
}
|
||||
|
||||
function _notify(context, templateJSON) {
|
||||
@ -413,7 +411,7 @@ define(function(require) {
|
||||
|
||||
$("table.boot-order tbody", context).html("");
|
||||
|
||||
if (templateJSON.DISK != undefined){
|
||||
if (templateJSON.DISK !== undefined){
|
||||
var disks = templateJSON.DISK;
|
||||
|
||||
if (!$.isArray(disks)){
|
||||
@ -421,60 +419,60 @@ define(function(require) {
|
||||
}
|
||||
|
||||
$.each(disks, function(i,disk){
|
||||
var label = '<i class="fa fa-fw fa-lg fa-tasks"></i> ';
|
||||
var disk_name = 'disk';
|
||||
var label = "<i class=\"fa fa-fw fa-lg fa-tasks\"></i> ";
|
||||
var disk_name = "disk";
|
||||
|
||||
if (disk.IMAGE != undefined){
|
||||
if (disk.IMAGE !== undefined){
|
||||
label += disk.IMAGE;
|
||||
} else if (disk.IMAGE_ID != undefined){
|
||||
} else if (disk.IMAGE_ID !== undefined){
|
||||
label += Locale.tr("Image ID") + " " + disk.IMAGE_ID;
|
||||
} else {
|
||||
label += Locale.tr("Volatile");
|
||||
}
|
||||
|
||||
if (disk.DISK_ID == undefined){
|
||||
disk_name += i;
|
||||
} else {
|
||||
disk_name += disk.DISK_ID;
|
||||
}
|
||||
if (disk.DISK_ID === undefined){
|
||||
disk_name += i;
|
||||
} else {
|
||||
disk_name += disk.DISK_ID;
|
||||
}
|
||||
|
||||
_addBootRow(context, disk_name, label);
|
||||
});
|
||||
}
|
||||
|
||||
if (templateJSON.NIC != undefined){
|
||||
if (templateJSON.NIC !== undefined){
|
||||
var nics = templateJSON.NIC;
|
||||
|
||||
if (!$.isArray(nics)){
|
||||
nics = [nics];
|
||||
}
|
||||
$.each(nics, function(i,nic){
|
||||
var label = '<i class="fa fa-fw fa-lg fa-globe"></i> ';
|
||||
$.each(nics, function(i, nic){
|
||||
var label = "<i class=\"fa fa-fw fa-lg fa-globe\"></i> ";
|
||||
|
||||
if (nic.NETWORK != undefined){
|
||||
if (nic.NETWORK !== undefined){
|
||||
label += nic.NETWORK;
|
||||
} else if (nic.NETWORK_ID != undefined){
|
||||
} else if (nic.NETWORK_ID !== undefined){
|
||||
label += Locale.tr("Network ID") + " " + nic.NETWORK_ID;
|
||||
} else {
|
||||
label += Locale.tr("Manual settings");
|
||||
}
|
||||
|
||||
_addBootRow(context, 'nic'+i, label);
|
||||
_addBootRow(context, "nic"+i, label);
|
||||
});
|
||||
}
|
||||
|
||||
if (templateJSON.DISK == undefined && templateJSON.NIC == undefined){
|
||||
if (templateJSON.DISK === undefined && templateJSON.NIC === undefined){
|
||||
$("table.boot-order tbody", context).append(
|
||||
'<tr>\
|
||||
<td>'+Locale.tr("Disks and NICs will appear here")+'</td>\
|
||||
</tr>');
|
||||
"<tr>\
|
||||
<td>" + Locale.tr("Disks and NICs will appear here") + "</td>\
|
||||
</tr>");
|
||||
}
|
||||
|
||||
if (prev_value.length > 0){
|
||||
var pos = 0;
|
||||
|
||||
$.each(prev_value.split(','), function(i,device){
|
||||
var tr = $('tr[value="'+device+'"]', table);
|
||||
$.each(prev_value.split(","), function(i,device){
|
||||
var tr = $("tr[value=\"" + device + "\"]", table);
|
||||
|
||||
if(tr.length > 0){
|
||||
$($("tr", table)[pos]).before(tr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user