fix: update

parent b19fb134
...@@ -116,7 +116,7 @@ export class CleftbarComponent implements OnInit { ...@@ -116,7 +116,7 @@ export class CleftbarComponent implements OnInit {
Connect(host) { Connect(host) {
// console.log(host); // console.log(host);
let userid: string; let user: any;
const that = this; const that = this;
if (host.system_users_granted.length > 1) { if (host.system_users_granted.length > 1) {
let options = ''; let options = '';
...@@ -131,8 +131,14 @@ export class CleftbarComponent implements OnInit { ...@@ -131,8 +131,14 @@ export class CleftbarComponent implements OnInit {
btn: ['确定', '取消'], btn: ['确定', '取消'],
content: '<select id="selectuser">' + options + '</select>', content: '<select id="selectuser">' + options + '</select>',
yes: function (index, layero) { yes: function (index, layero) {
userid = jQuery('#selectuser').val(); let userid = jQuery('#selectuser').val();
that.login(host, userid); for (let i of host.system_users_granted) {
if (i.id === userid) {
user = i;
break;
}
}
that.login(host, user);
layer.close(index); layer.close(index);
}, },
btn2: function (index, layero) { btn2: function (index, layero) {
...@@ -143,28 +149,38 @@ export class CleftbarComponent implements OnInit { ...@@ -143,28 +149,38 @@ export class CleftbarComponent implements OnInit {
} }
}); });
} else if (host.system_users_granted.length === 1) { } else if (host.system_users_granted.length === 1) {
userid = host.system_users_granted[0].id; user = host.system_users_granted[0];
this.login(host, userid); this.login(host, user);
} }
} }
login(host, userid) { login(host, user) {
if (userid === '') { if (user) {
return; if (user.procotol === 'ssh') {
} jQuery('app-ssh').show();
if (host.plantform.toLowerCase() === 'linux') { jQuery('app-rdp').hide();
jQuery('app-ssh').show(); this._term.TerminalConnect(host, user.id);
jQuery('app-rdp').hide(); } else if (user.procotol === 'rdp') {
this._term.TerminalConnect(host, userid); jQuery('app-ssh').hide();
} else if (host.plantform.toLowerCase() === 'windows') { jQuery('app-rdp').show();
jQuery('app-ssh').hide(); this._rdp.Connect(host, user.id);
jQuery('app-rdp').show(); }
this._rdp.Connect(host, userid);
} else {
jQuery('app-ssh').show();
jQuery('app-rdp').hide();
this._term.TerminalConnect(host, userid);
} }
// if (host.plantform) {
// if (host.plantform.toLowerCase() === 'linux') {
// jQuery('app-ssh').show();
// jQuery('app-rdp').hide();
// this._term.TerminalConnect(host, user.id);
// } else if (host.plantform.toLowerCase() === 'windows') {
// jQuery('app-ssh').hide();
// jQuery('app-rdp').show();
// this._rdp.Connect(host, user.id);
// } else {
// jQuery('app-ssh').show();
// jQuery('app-rdp').hide();
// this._term.TerminalConnect(host, user.id);
// }
// }
} }
Search(q) { Search(q) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment