mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-25 23:21:29 +03:00
parent
9eda6cae10
commit
34c7d1fbb5
@ -205,7 +205,7 @@ define(function(require) {
|
||||
nicTab.fill(nicContext, nicJSON);
|
||||
|
||||
if (nicJSON.PARENT) {
|
||||
nicTab.fill_alias(nicJSON.PARENT);
|
||||
nicTab.fill_alias(nicJSON.PARENT, nicJSON.EXTERNAL);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -218,7 +218,6 @@ define(function(require) {
|
||||
$("input#" + this.nicTabId + "_interface_type", context).on("change", function(){
|
||||
var alias_on = $(this).prop("checked");
|
||||
var alias;
|
||||
var found = false;
|
||||
|
||||
$.each(that.nics, function(index, value) {
|
||||
if (value.ALIAS === ("NIC" + that.nicId)) {
|
||||
@ -233,17 +232,20 @@ define(function(require) {
|
||||
|
||||
if (that.nics.length == 1 && alias_on) {
|
||||
$("#" + that.nicTabId + "_alias_parent", context).hide();
|
||||
$("#" + that.nicTabId + "_alias_external_wrapper", context).hide();
|
||||
$(".network_selection", context).hide();
|
||||
$("#" + that.nicTabId + "_no_alias", context).html("No NIC available");
|
||||
$("#" + that.nicTabId + "_no_alias").show();
|
||||
} else {
|
||||
if(alias_on && !alias) {
|
||||
$("#" + that.nicTabId + "_alias_parent", context).show();
|
||||
$("#" + that.nicTabId + "_alias_external_wrapper", context).show();
|
||||
$("#" + that.nicTabId + "_alias_parent", context).click();
|
||||
$(".network_selection", context).hide();
|
||||
$("#" + that.nicTabId + "_no_alias").hide();
|
||||
} else if (alias_on && alias) {
|
||||
$("#" + that.nicTabId + "_alias_parent", context).hide();
|
||||
$("#" + that.nicTabId + "_alias_external_wrapper", context).hide();
|
||||
$(".network_selection", context).hide();
|
||||
$("#" + that.nicTabId + "_no_alias").show();
|
||||
} else {
|
||||
@ -257,6 +259,7 @@ define(function(require) {
|
||||
_hide_remove(that.nics);
|
||||
|
||||
$("#" + that.nicTabId + "_alias_parent", context).hide();
|
||||
$("#" + that.nicTabId + "_alias_external_wrapper", context).hide();
|
||||
$(".network_selection", context).show();
|
||||
$("#" + that.nicTabId + "_no_alias").hide();
|
||||
}
|
||||
@ -302,6 +305,7 @@ define(function(require) {
|
||||
});
|
||||
|
||||
$("#" + this.nicTabId + "_alias_parent", context).hide();
|
||||
$("#" + that.nicTabId + "_alias_external_wrapper", context).hide();
|
||||
|
||||
context.on("change", "input[name='" + that.nicTabId + "_req_select']", function() {
|
||||
if ($("input[name='" + that.nicTabId + "_req_select']:checked").val() == "vnet_select") {
|
||||
@ -371,6 +375,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")) {
|
||||
@ -519,10 +527,10 @@ define(function(require) {
|
||||
$("input#"+this.nicTabId+"_SCHED_REQUIREMENTS", context).val(req_string.join(" | "));
|
||||
};
|
||||
|
||||
function _fill_alias(nicname) {
|
||||
function _fill_alias(nicParentName, isExternal) {
|
||||
$.each(this.nics, function(index, value) {
|
||||
if (value.NAME == ("NIC" + that.nicId)) {
|
||||
value.ALIAS = nicname;
|
||||
value.ALIAS = nicParentName;
|
||||
}
|
||||
});
|
||||
|
||||
@ -530,7 +538,11 @@ define(function(require) {
|
||||
$("#" + this.nicTabId + "_alias_parent", this.context).show();
|
||||
$("#" + this.nicTabId + "_alias_parent", this.context).click();
|
||||
$("#" + this.nicTabId + "_interface_type", this.context).click();
|
||||
$("#" + this.nicTabId + "_alias_parent", this.context).val(nicname);
|
||||
$("#" + this.nicTabId + "_alias_parent", this.context).val(nicParentName);
|
||||
|
||||
if (isExternal && String(isExternal).toLowerCase() === 'yes') {
|
||||
$("#" + this.nicTabId + "_alias_external", this.context).prop('checked', 'checked');
|
||||
}
|
||||
}
|
||||
|
||||
function _hide_remove(nics) {
|
||||
|
@ -18,21 +18,35 @@
|
||||
<div class="row autoContainer">
|
||||
<fieldset id="{{nicTabId}}interface_type" class="small-12 large-6 columns">
|
||||
<legend style="margin:0px;">{{tr "Interface type"}}</legend>
|
||||
<div class="switch left">
|
||||
<input class="switch-input" id="{{nicTabId}}_interface_type" type="checkbox">
|
||||
<label class="switch-paddle" for="{{nicTabId}}_interface_type">
|
||||
<div style="min-height: 40px;">
|
||||
<div class="switch left">
|
||||
<input class="switch-input" id="{{nicTabId}}_interface_type" type="checkbox">
|
||||
<label class="switch-paddle" for="{{nicTabId}}_interface_type">
|
||||
</label>
|
||||
</div>
|
||||
<label class="left">
|
||||
|
||||
{{tr "Alias"}}
|
||||
{{{tip (tr "The NIC will be attached as an alias")}}}
|
||||
</label>
|
||||
|
||||
<span id="{{nicTabId}}_no_alias" class="radius warning label">
|
||||
<i class="fas fa-exclamation-triangle"/> {{tr "NIC has alias"}}
|
||||
</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">
|
||||
|
||||
{{tr "External"}}
|
||||
{{{tip (tr "The NIC will be attached as an external alias of the VM")}}}
|
||||
</label>
|
||||
</div>
|
||||
<label class="left">
|
||||
|
||||
{{tr "Alias"}}
|
||||
{{{tip (tr "The NIC will be attached as an alias")}}}
|
||||
</label>
|
||||
|
||||
<span id="{{nicTabId}}_no_alias" class="radius warning label">
|
||||
<i class="fas fa-exclamation-triangle"/> {{tr "NIC has alias"}}
|
||||
</span>
|
||||
<select id="{{nicTabId}}_alias_parent" style="width: 200px; margin-left: 5px"></select>
|
||||
</fieldset>
|
||||
<fieldset class="small-12 large-6 columns">
|
||||
<legend style="margin:0px;">{{tr "Network selection"}}</legend>
|
||||
|
@ -79,9 +79,11 @@ define(function(require) {
|
||||
Tips.setup(context);
|
||||
|
||||
$("#parent", context).hide();
|
||||
$(".attach_external", context).hide();
|
||||
|
||||
$("#cb_attach_alias", context).change(function() {
|
||||
$("#parent", context).toggle(this.checked);
|
||||
$(".attach_external", context).toggle(this.checked);
|
||||
});
|
||||
|
||||
$("#" + DIALOG_ID + "Form", context).submit(function() {
|
||||
@ -95,6 +97,10 @@ define(function(require) {
|
||||
if($("#cb_attach_alias", context).prop("checked")) {
|
||||
templateJSON.PARENT = $("#parent").val();
|
||||
|
||||
if ($('#cb_external').is(':checked')) {
|
||||
templateJSON.EXTERNAL = 'YES'
|
||||
}
|
||||
|
||||
var obj = {
|
||||
"NIC_ALIAS": templateJSON
|
||||
};
|
||||
|
@ -32,7 +32,13 @@
|
||||
<label style="margin-right: 10px;">
|
||||
<input type="checkbox" id="cb_attach_alias" style="margin-left: 15px"> {{tr "Attach as an alias"}}
|
||||
</label>
|
||||
<select id="parent" style="width: 200px; margin-bottom: 0;"></select><br>
|
||||
<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">
|
||||
|
@ -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 {
|
||||
} else {
|
||||
delete nic["PARENT"];
|
||||
delete nic["EXTERNAL"];
|
||||
}
|
||||
|
||||
(Boolean($("input#" + that.id + "_rdp", context).prop("checked")))
|
||||
@ -394,17 +400,20 @@ define(function(require) {
|
||||
|
||||
if (_nics.length == 1 && alias_on) {
|
||||
$("#provision_accordion_dd_" + dd_context["dd_id"] + "_alias_parent", dd_context).hide();
|
||||
$("#provision_accordion_dd_" + dd_context["dd_id"] + "_alias_external_wrapper", dd_context).hide();
|
||||
$(".network_selection", context, dd_context).hide();
|
||||
$("#provision_accordion_dd_" + dd_context["dd_id"] + "_no_alias", dd_context).html("No NIC available");
|
||||
$("#provision_accordion_dd_" + dd_context["dd_id"] + "_no_alias"), dd_context.show();
|
||||
} else {
|
||||
if(alias_on && !alias) {
|
||||
$("#provision_accordion_dd_" + dd_context["dd_id"] + "_alias_parent", dd_context).show();
|
||||
$("#provision_accordion_dd_" + dd_context["dd_id"] + "_alias_external_wrapper", dd_context).show();
|
||||
$("#provision_accordion_dd_" + dd_context["dd_id"] + "_alias_parent", dd_context).click();
|
||||
$(".network_selection", dd_context).hide();
|
||||
$("#provision_accordion_dd_" + dd_context["dd_id"] + "_no_alias", dd_context).hide();
|
||||
} else if (alias_on && alias) {
|
||||
$("#provision_accordion_dd_" + dd_context["dd_id"] + "_alias_parent", dd_context).hide();
|
||||
$("#provision_accordion_dd_" + dd_context["dd_id"] + "_alias_external_wrapper", dd_context).hide();
|
||||
$(".network_selection", dd_context).hide();
|
||||
$("#provision_accordion_dd_" + dd_context["dd_id"] + "_no_alias", dd_context).show();
|
||||
} else {
|
||||
@ -417,6 +426,7 @@ define(function(require) {
|
||||
_hide_remove();
|
||||
|
||||
$("#provision_accordion_dd_" + dd_context["dd_id"] + "_alias_parent", dd_context).hide();
|
||||
$("#provision_accordion_dd_" + dd_context["dd_id"] + "_alias_external_wrapper", dd_context).hide();
|
||||
$(".network_selection", dd_context).show();
|
||||
$("#provision_accordion_dd_" + dd_context["dd_id"] + "_no_alias", dd_context).hide();
|
||||
}
|
||||
@ -459,6 +469,7 @@ define(function(require) {
|
||||
});
|
||||
|
||||
$("#provision_accordion_dd_" + provision_nic_accordion_dd_id + "_alias_parent", dd_context).hide();
|
||||
$("#provision_accordion_dd_" + provision_nic_accordion_dd_id + "_alias_external_wrapper", dd_context).hide();
|
||||
|
||||
$("input[name='provision_accordion_dd_"+provision_nic_accordion_dd_id+"_req_select']", dd_context).on("change", function() {
|
||||
if (this.value == "vnet_select") {
|
||||
@ -534,7 +545,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
|
||||
@ -706,10 +717,10 @@ define(function(require) {
|
||||
});
|
||||
}
|
||||
|
||||
function _fill_alias(nicname) {
|
||||
function _fill_alias(nicParentName, isExternal) {
|
||||
$.each(_nics, function(index, value) {
|
||||
if (value.NAME == ("NIC" + nicId)) {
|
||||
value.ALIAS = nicname;
|
||||
value.ALIAS = nicParentName;
|
||||
}
|
||||
});
|
||||
|
||||
@ -717,7 +728,11 @@ define(function(require) {
|
||||
$("#provision_accordion_dd_" + provision_nic_accordion_dd_id + "_alias_parent", this.context).show();
|
||||
$("#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(nicname);
|
||||
$("#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() {
|
||||
|
@ -26,21 +26,35 @@
|
||||
{{#if displayType}}
|
||||
<fieldset class="small-12 large-6 columns" id="provision_accordion_dd_{{provision_nic_accordion_dd_id}}_interface_type_section">
|
||||
<legend style="margin:0px;">{{tr "Interface type"}}</legend>
|
||||
<div class="switch left">
|
||||
<input class="switch-input" id="provision_accordion_dd_{{provision_nic_accordion_dd_id}}_interface_type" type="checkbox">
|
||||
<label class="switch-paddle" for="provision_accordion_dd_{{provision_nic_accordion_dd_id}}_interface_type">
|
||||
<div style="min-height: 40px;">
|
||||
<div class="switch left">
|
||||
<input class="switch-input" id="provision_accordion_dd_{{provision_nic_accordion_dd_id}}_interface_type" type="checkbox">
|
||||
<label class="switch-paddle" for="provision_accordion_dd_{{provision_nic_accordion_dd_id}}_interface_type">
|
||||
</label>
|
||||
</div>
|
||||
<label class="left">
|
||||
|
||||
{{tr "Alias"}}
|
||||
{{{tip (tr "The NIC will be attached as an alias")}}}
|
||||
</label>
|
||||
|
||||
<span id="provision_accordion_dd_{{provision_nic_accordion_dd_id}}_no_alias" class="radius warning label">
|
||||
<i class="fas fa-exclamation-triangle"/> {{tr "NIC has alias"}}
|
||||
</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">
|
||||
|
||||
{{tr "External"}}
|
||||
{{{tip (tr "The NIC will be attached as an external alias of the VM")}}}
|
||||
</label>
|
||||
</div>
|
||||
<label class="left">
|
||||
|
||||
{{tr "Alias"}}
|
||||
{{{tip (tr "The NIC will be attached as an alias")}}}
|
||||
</label>
|
||||
|
||||
<span id="provision_accordion_dd_{{provision_nic_accordion_dd_id}}_no_alias" class="radius warning label">
|
||||
<i class="fas fa-exclamation-triangle"/> {{tr "NIC has alias"}}
|
||||
</span>
|
||||
<select id="provision_accordion_dd_{{provision_nic_accordion_dd_id}}_alias_parent" style="width: 200px; margin-left: 5px"></select>
|
||||
</fieldset>
|
||||
{{/if}}
|
||||
{{#if displaySelection}}
|
||||
|
Loading…
Reference in New Issue
Block a user