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

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

This commit is contained in:
Sergio Betanzos 2020-07-28 19:32:07 +02:00 committed by GitHub
parent 98da0503ab
commit 7ebb3c362b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 9 deletions

View File

@ -690,6 +690,7 @@ define(function(require) {
"isConnectionSupported": isConnectionSupported,
"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">