Commit 2a926e18 authored by liuzheng712's avatar liuzheng712

feat: ok ok

parent 36603617
This diff is collapsed.
......@@ -40,7 +40,7 @@
"ng2-charts": "^1.5.0",
"ng2-cookies": "^1.0.12",
"ngx-bootstrap": "^1.6.6",
"npm": "^5.5.1",
"npm": "^5.6.0",
"peity": "^3.2.1",
"roboto-fontface": "^0.8.0",
"rxjs": "^5.4.2",
......
......@@ -9,8 +9,8 @@
<input type="checkbox" id="hostgroup-{{i}}">
<label for="hostgroup-{{i}}">{{hostGroup.name}}</label>
<ul>
<li *ngFor="let host of hostGroup.assets | SearchFilter: q" (click)="Connect(host)">
<i class="fa" [ngClass]="'fa-'+host.system" id="rdp-{{i}}"></i>
<li *ngFor="let host of hostGroup.assets_granted | SearchFilter: q" (click)="Connect(host)">
<i class="fa" [ngClass]="'fa-'+host.system" id="fa-{{i}}"></i>
{{host.hostname}}
</li>
</ul>
......
......@@ -20,13 +20,13 @@ declare let jQuery: any;
export class HostGroup {
name: string;
id: number;
id: string;
children: Array<Host>;
}
export class Host {
name: string;
uuid: string;
id: string;
type: string;
}
......@@ -95,9 +95,9 @@ export class CleftbarComponent implements OnInit {
Connect(host) {
console.log(host);
let username: string;
if (host.system_users.length > 1) {
if (host.system_users_granted.length > 1) {
let options = '';
for (let u of host.system_users) {
for (let u of host.system_users_granted) {
options += '<option value="' + u.username + '">' + u.username + '</option>';
}
layer.open({
......@@ -118,12 +118,15 @@ export class CleftbarComponent implements OnInit {
// return false 开启该代码可禁止点击该按钮关闭
}
});
} else if (host.system_users.length === 1) {
username = host.system_users[0].username;
} else if (host.system_users_granted.length === 1) {
username = host.system_users_granted[0].username;
}
if (username === '') {
return;
}
jQuery('app-ssh').show();
jQuery('app-rdp').hide();
this._term.TerminalConnect(host, username);
if (host.system === 'linux') {
jQuery('app-ssh').show();
jQuery('app-rdp').hide();
......
......@@ -49,6 +49,7 @@ export class SshComponent implements OnInit {
}
TerminalConnect(host, username) {
console.log(host,username);
const socket = io.connect('/ssh');
let cols = '80';
let rows = '24';
......@@ -69,7 +70,7 @@ export class SshComponent implements OnInit {
NavList.List[id].closed = false;
NavList.List[id].type = 'ssh';
NavList.List[id].Term = new Term;
NavList.List[id].Term.machine = host.uuid;
NavList.List[id].Term.machine = host.id;
NavList.List[id].Term.socket = socket;
NavList.List[id].Term.term = new Terminal({
cols: cols,
......@@ -98,7 +99,7 @@ export class SshComponent implements OnInit {
NavList.List[id].Term.term.write('\x1b[31mWelcome to Jumpserver!\x1b[m\r\n');
socket.on('connect', function () {
socket.emit('host', {'uuid': host.uuid, 'user': username});
socket.emit('host', {'uuid': host.id, 'user': username});
NavList.List[id].Term.term.on('data', function (data) {
socket.emit('data', data);
......
......@@ -18,14 +18,14 @@ declare let jQuery: any;
import * as io from 'socket.io-client';
export class Group {
id: number;
id: string;
name: string;
membercount: number;
comment: string;
}
export let User: {
id: number;
id: string;
name: string;
username: string;
password: string;
......@@ -39,7 +39,7 @@ export let User: {
groups: Array<Group>;
logined: boolean;
} = {
id: 0,
id: '',
name: 'nobody',
username: '',
password: '',
......
......@@ -30,7 +30,9 @@ app-root {
padding-bottom: 16px !important;
font-family: 'Monaco', iosevka !important;
}
.terminal{
white-space: nowrap;
}
.terminal, .terminal .xterm-viewport {
background-color: inherit;
}
......
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