1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-30 22:50:10 +03:00

Bug #4547: Add dropdown with automatic vlan options

This commit is contained in:
Carlos Martín 2016-06-13 14:59:17 +02:00
parent 1c4d9e3c89
commit c0f57bf055
4 changed files with 37 additions and 3 deletions

View File

@ -177,8 +177,17 @@ define(function(require) {
$('div.network_mode_description[value="' + $(this).val() + '"]').show();
});
$('select[wizard_field=AUTOMATIC_VLAN_ID]', context).change(function(){
if($(this).val() != "") {
$('input[wizard_field="VLAN_ID"]', context).hide().prop('wizard_field_disabled', true);
} else {
$('input[wizard_field="VLAN_ID"]', context).show().prop('wizard_field_disabled', false);
}
});
//Initialize shown options
$('#network_mode', context).trigger("change");
$('select[wizard_field=AUTOMATIC_VLAN_ID]', context).trigger("change");
this.securityGroupsTable.initialize();
@ -330,6 +339,14 @@ define(function(require) {
WizardFields.fillInput($('input#vn_mad', context), element.TEMPLATE["VN_MAD"]);
if (element.VLAN_ID_AUTOMATIC == 1){
$('select[wizard_field=AUTOMATIC_VLAN_ID]', context).val("YES").
attr('disabled', 'disabled').trigger("change");
} else {
$('select[wizard_field=AUTOMATIC_VLAN_ID]', context).val("").
attr('disabled', 'disabled').trigger("change");
}
WizardFields.fill($("#vnetCreateGeneralTab", context), element.TEMPLATE);
WizardFields.fill($("#vnetCreateBridgeTab", context), element.TEMPLATE);
WizardFields.fill($("#vnetCreateContextTab", context), element.TEMPLATE);

View File

@ -135,10 +135,15 @@
</div>
<div class="row">
<div class="medium-3 columns left mode_param 8021Q vxlan ovswitch custom">
<label for="vlan_id">
<label>
{{tr "VLAN ID"}}
<select wizard_field="AUTOMATIC_VLAN_ID">
<option value="YES">{{tr "Automatic VLAN ID"}}</option>
<option value="NO">{{tr "No VLAN network"}}</option>
<option value="">{{tr "Manual VLAN ID"}}</option>
</select>
<input type="number" wizard_field="VLAN_ID"/>
</label>
<input type="text" wizard_field="VLAN_ID" name="vlan_id" id="vlan_id" />
</div>
<div class="medium-3 columns left mode_param 8021Q vxlan custom">
<label for="phydev">

View File

@ -30,6 +30,11 @@
</tr>
{{{renameTrHTML}}}
{{{reservationTrHTML}}}
<tr>
<td class="key_td">{{tr "VLAN ID"}}</td>
<td class="value_td">{{valOrDefault element.VLAN_ID "--"}}</td>
<td></td>
</tr>
<tbody>
</table>
</div>

View File

@ -19,7 +19,14 @@ define(function(require) {
var Locale = require('utils/locale');
var valOrDefault = function(value, defaultValue, options) {
var out = value || defaultValue;
var out;
if (value == undefined || ($.isPlainObject(value) && $.isEmptyObject(value))){
out = defaultValue;
} else {
out = value;
}
return new Handlebars.SafeString(out);
};