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

F one#3969: Add rdp in attach nic dialog (#126)

(cherry picked from commit 7ebb3c362b570854ad18a2e86236419b4f3e4f1a)
This commit is contained in:
Sergio Betanzos 2020-07-28 19:32:07 +02:00 committed by Tino Vazquez
parent 73448eeeb4
commit c2999a12be
No known key found for this signature in database
GPG Key ID: 2FE9C32E94AEABBE
3 changed files with 31 additions and 9 deletions

View File

@ -682,6 +682,7 @@ define(function(require) {
"isRDPSupported": isRDPSupported,
"isSPICESupported": isSPICESupported,
"isWFileSupported": isWFileSupported,
"hasConnection": hasConnection,
"buttonVnc": buttonVnc,
"buttonSpice": buttonSpice,
"buttonWFile": buttonWFile,

View File

@ -19,6 +19,7 @@ define(function(require) {
DEPENDENCIES
*/
var OpennebulaVM = require('opennebula/vm');
var BaseDialog = require('utils/dialogs/dialog');
var TemplateHTML = require('hbs!./attach-nic/html');
var Sunstone = require('sunstone');
@ -79,18 +80,18 @@ define(function(require) {
$("#parent", context).hide();
$("#attach_alias", context).change(function() {
if(this.checked) {
$("#parent", context).show();
} else {
$("#parent", context).hide();
}
$("#cb_attach_alias", context).change(function() {
$("#parent", context).toggle(this.checked);
});
$('#' + DIALOG_ID + 'Form', context).submit(function() {
var templateJSON = that.nicTab.retrieve(context);
if($("#attach_alias", context).prop("checked")) {
if($("#cb_attach_rdp", context).prop("checked")) {
templateJSON.RDP = "YES";
}
if($("#cb_attach_alias", context).prop("checked")) {
templateJSON.PARENT = $("#parent").val();
var obj = {
@ -116,6 +117,17 @@ define(function(require) {
this.setNames( {tabId: TAB_ID} );
this.nicTab.onShow(context);
$('#cb_attach_alias').prop('checked', false).change();
var showRdp = false, template = this.element.TEMPLATE
if (template.NIC) {
showRdp = OpennebulaVM.hasConnection(template.NIC, "rdp");
if (!showRdp && template.NIC_ALIAS) {
showRdp = OpennebulaVM.hasConnection(template.NIC_ALIAS, "rdp");
}
}
$(".attach_rdp").toggle(!showRdp);
return false;
}

View File

@ -23,8 +23,17 @@
<div class="confirm-resources-header"></div>
<div class="reveal-body">
<form id="{{dialogId}}Form" action="">
<input type="checkbox" id="attach_alias" style="margin-left: 15px"> Attach as an alias
<select id="parent" style="width: 200px"></select><br>
<div class="attach_rdp">
<label>
<input type="checkbox" id="cb_attach_rdp" style="margin-left: 15px"> {{tr "RDP"}}
</label>
</div>
<div class="attach_alias" style="display: flex; align-items: center; min-height: 50px;">
<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>
</div>
{{{nicTabHTML}}}
<div class="reveal-footer">
<div class="form_buttons">