1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-12 09:17:41 +03:00

B #5659: Reintroduce NIC external attribute (#2571)

Even if it is deprecated in OneProvision, it is still needed in the VNF appliance.

 * Re-added to Sunstone
 * More descriptive and specific name and hint
This commit is contained in:
Frederick Borges 2023-04-04 14:18:43 +02:00 committed by GitHub
parent c8943e8b83
commit 9cbf09e122
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 50 additions and 3 deletions

View File

@ -204,7 +204,7 @@ define(function(require) {
nicTab.fill(nicContext, nicJSON);
if (nicJSON.PARENT) {
nicTab.fill_alias(nicJSON.PARENT);
nicTab.fill_alias(nicJSON.PARENT, nicJSON.EXTERNAL);
}
});

View File

@ -449,6 +449,10 @@ define(function(require) {
delete nicJSON["PARENT"];
} else {
nicJSON["PARENT"] = $("#" + this.nicTabId + "_alias_parent", context).val();
if ($("#" + this.nicTabId + "_alias_external", context).is(':checked')) {
nicJSON["EXTERNAL"] = 'YES';
}
}
if($("input#" + this.nicTabId + "_rdp", context).prop("checked")) {

View File

@ -35,6 +35,18 @@
</span>
<select id="{{nicTabId}}_alias_parent" style="width: 200px; margin-left: 5px"></select>
</div>
<div id="{{nicTabId}}_alias_external_wrapper" style="min-height: 40px;">
<div class="switch left">
<input class="switch-input" id="{{nicTabId}}_alias_external" type="checkbox">
<label class="switch-paddle" for="{{nicTabId}}_alias_external">
</label>
</div>
<label class="left">
&nbsp;&nbsp;
{{tr "Skip network contextualizacion"}}
{{{tip (tr "A virtual router can be configured to route SDNAT traffic for this NIC IP address")}}}
</label>
</div>
</fieldset>
<fieldset class="small-12 large-6 columns">
<legend style="margin:0px;">{{tr "Network selection"}}</legend>

View File

@ -108,6 +108,10 @@ define(function(require) {
else{
if($("#cb_attach_alias", context).prop("checked")) {
templateJSON.PARENT = $("#parent").val();
if ($('#cb_external').is(':checked')) {
templateJSON.EXTERNAL = 'YES'
}
obj = {
"NIC_ALIAS": templateJSON

View File

@ -35,6 +35,11 @@
<select id="parent" style="width: 200px; margin-bottom: 0;"></select>
<br>
</div>
<div class="attach_external" style="min-height: 50px;">
<label>
<input type="checkbox" id="cb_external" style="margin-left: 15px"> {{tr "External"}}
</label>
</div>
{{{nicTabHTML}}}
<div class="reveal-footer">
<div class="form_buttons">

View File

@ -171,11 +171,17 @@ define(function(require) {
if($("input#" + that.id + "_interface_type", context).prop("checked")) {
if ($("#" + that.id + "_alias_parent", context).val() != "INVALID") {
nic["PARENT"] = $("#" + that.id + "_alias_parent", context).val();
if ($("#" + that.id + "_alias_external", context).is(':checked')) {
nic["EXTERNAL"] = 'YES';
}
} else {
delete nic["PARENT"];
delete nic["EXTERNAL"];
}
} else {
delete nic["PARENT"];
delete nic["EXTERNAL"];
}
(Boolean($("input#" + that.id + "_rdp", context).prop("checked")))
@ -555,7 +561,7 @@ define(function(require) {
Foundation.reInit(context);
if(options.nic && options.nic.PARENT) {
_fill_alias(options.nic.PARENT);
_fill_alias(options.nic.PARENT, options.nic.EXTERNAL);
}
// fill rdp connection
@ -722,7 +728,7 @@ define(function(require) {
}
}
function _fill_alias(nicParentName) {
function _fill_alias(nicParentName, isExternal) {
$.each(_nics, function(_, value) {
if (value.NAME === ("NIC" + nicId)) {
value.ALIAS = nicParentName;
@ -734,6 +740,10 @@ define(function(require) {
$("#provision_accordion_dd_" + provision_nic_accordion_dd_id + "_alias_parent", this.context).click();
$("#provision_accordion_dd_" + provision_nic_accordion_dd_id + "_interface_type", this.context).click();
$("#provision_accordion_dd_" + provision_nic_accordion_dd_id + "_alias_parent", this.context).val(nicParentName);
if (isExternal && String(isExternal).toLowerCase() === 'yes') {
$("#provision_accordion_dd_" + provision_nic_accordion_dd_id + "_alias_external", this.context).prop('checked', 'checked');
}
}
function _hide_remove() {

View File

@ -43,6 +43,18 @@
</span>
<select id="provision_accordion_dd_{{provision_nic_accordion_dd_id}}_alias_parent" style="width: 200px; margin-left: 5px"></select>
</div>
<div id="provision_accordion_dd_{{provision_nic_accordion_dd_id}}_alias_external_wrapper" style="min-height: 40px;">
<div class="switch left">
<input class="switch-input" id="provision_accordion_dd_{{provision_nic_accordion_dd_id}}_alias_external" type="checkbox">
<label class="switch-paddle" for="provision_accordion_dd_{{provision_nic_accordion_dd_id}}_alias_external">
</label>
</div>
<label class="left">
&nbsp;&nbsp;
{{tr "Skip network contextualizacion"}}
{{{tip (tr "A virtual router can be configured to route SDNAT traffic for this NIC IP address")}}}
</label>
</div>
</fieldset>
{{/if}}
{{#if displaySelection}}