Commit a3a0e3fa authored by liuzheng712's avatar liuzheng712

publish

parent fe0df9c8
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
"../node_modules/jquery-sparkline/jquery.sparkline.js", "../node_modules/jquery-sparkline/jquery.sparkline.js",
"../node_modules/tether/dist/js/tether.min.js", "../node_modules/tether/dist/js/tether.min.js",
"../node_modules/bootstrap/dist/js/bootstrap.min.js", "../node_modules/bootstrap/dist/js/bootstrap.min.js",
"../node_modules/xterm/dist/xterm.js", "../node_modules/term.js/src/term.js",
"../node_modules/tty.js/static/tty.js",
"../node_modules/layui-layer/dist/layer.js", "../node_modules/layui-layer/dist/layer.js",
"../node_modules/socket.io-client/dist/socket.io.js", "../node_modules/socket.io-client/dist/socket.io.js",
"./assets/js/mstsc.js", "./assets/js/mstsc.js",
......
This diff is collapsed.
...@@ -40,12 +40,15 @@ ...@@ -40,12 +40,15 @@
"ng2-charts": "^1.5.0", "ng2-charts": "^1.5.0",
"ng2-cookies": "^1.0.12", "ng2-cookies": "^1.0.12",
"ngx-bootstrap": "^1.6.6", "ngx-bootstrap": "^1.6.6",
"npm": "^5.5.1", "npm": "^5.6.0",
"peity": "^3.2.1", "peity": "^3.2.1",
"roboto-fontface": "^0.8.0",
"rxjs": "^5.4.2", "rxjs": "^5.4.2",
"socket.io": "^2.0.3", "socket.io": "^2.0.3",
"socket.io-client": "^2.0.4",
"ssh-keygen": "^0.4.1", "ssh-keygen": "^0.4.1",
"tether": "^1.4.0", "tether": "^1.4.0",
"tty.js": "^0.2.15",
"xterm": "^2.9.2", "xterm": "^2.9.2",
"zone.js": "^0.8.14" "zone.js": "^0.8.14"
}, },
...@@ -67,7 +70,6 @@ ...@@ -67,7 +70,6 @@
"karma-jasmine-html-reporter": "^0.2.2", "karma-jasmine-html-reporter": "^0.2.2",
"node-sass": "^4.7.2", "node-sass": "^4.7.2",
"protractor": "~5.1.2", "protractor": "~5.1.2",
"pty.js": "^0.3.1",
"ts-node": "~3.2.0", "ts-node": "~3.2.0",
"tslint": "~5.3.2", "tslint": "~5.3.2",
"typescript": "~2.3.3" "typescript": "~2.3.3"
......
{ {
"/api": { "/api": {
"target": "http://localhost:3000", "target": "http://localhost:5000",
"secure": false "secure": false
}, },
"/socket.io/": { "/socket.io/": {
"target": "http://127.0.0.1:3000", "target": "http://127.0.0.1:5000",
"secure": false "secure": false
}, },
"/rdp/socket.io/": { "/rdp/socket.io/": {
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
<input type="checkbox" id="hostgroup-{{i}}"> <input type="checkbox" id="hostgroup-{{i}}">
<label for="hostgroup-{{i}}">{{hostGroup.name}}</label> <label for="hostgroup-{{i}}">{{hostGroup.name}}</label>
<ul> <ul>
<li *ngFor="let host of hostGroup.assets | SearchFilter: q" (click)="Connect(host)"> <li *ngFor="let host of hostGroup.assets_granted | SearchFilter: q" (click)="Connect(host)">
<i class="fa" [ngClass]="'fa-'+host.system" id="rdp-{{i}}"></i> <i class="fa" [ngClass]="'fa-'+host.system" id="fa-{{i}}"></i>
{{host.hostname}} {{host.hostname}}
</li> </li>
</ul> </ul>
......
...@@ -20,13 +20,13 @@ declare let jQuery: any; ...@@ -20,13 +20,13 @@ declare let jQuery: any;
export class HostGroup { export class HostGroup {
name: string; name: string;
id: number; id: string;
children: Array<Host>; children: Array<Host>;
} }
export class Host { export class Host {
name: string; name: string;
uuid: string; id: string;
type: string; type: string;
} }
...@@ -95,9 +95,9 @@ export class CleftbarComponent implements OnInit { ...@@ -95,9 +95,9 @@ export class CleftbarComponent implements OnInit {
Connect(host) { Connect(host) {
console.log(host); console.log(host);
let username: string; let username: string;
if (host.system_users.length > 1) { if (host.system_users_granted.length > 1) {
let options = ''; 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>'; options += '<option value="' + u.username + '">' + u.username + '</option>';
} }
layer.open({ layer.open({
...@@ -118,12 +118,15 @@ export class CleftbarComponent implements OnInit { ...@@ -118,12 +118,15 @@ export class CleftbarComponent implements OnInit {
// return false 开启该代码可禁止点击该按钮关闭 // return false 开启该代码可禁止点击该按钮关闭
} }
}); });
} else if (host.system_users.length === 1) { } else if (host.system_users_granted.length === 1) {
username = host.system_users[0].username; username = host.system_users_granted[0].username;
} }
if (username === '') { if (username === '') {
return; return;
} }
jQuery('app-ssh').show();
jQuery('app-rdp').hide();
this._term.TerminalConnect(host, username);
if (host.system === 'linux') { if (host.system === 'linux') {
jQuery('app-ssh').show(); jQuery('app-ssh').show();
jQuery('app-rdp').hide(); jQuery('app-rdp').hide();
......
...@@ -49,6 +49,7 @@ export class SshComponent implements OnInit { ...@@ -49,6 +49,7 @@ export class SshComponent implements OnInit {
} }
TerminalConnect(host, username) { TerminalConnect(host, username) {
console.log(host,username);
const socket = io.connect('/ssh'); const socket = io.connect('/ssh');
let cols = '80'; let cols = '80';
let rows = '24'; let rows = '24';
...@@ -69,7 +70,7 @@ export class SshComponent implements OnInit { ...@@ -69,7 +70,7 @@ export class SshComponent implements OnInit {
NavList.List[id].closed = false; NavList.List[id].closed = false;
NavList.List[id].type = 'ssh'; NavList.List[id].type = 'ssh';
NavList.List[id].Term = new Term; 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.socket = socket;
NavList.List[id].Term.term = new Terminal({ NavList.List[id].Term.term = new Terminal({
cols: cols, cols: cols,
...@@ -98,7 +99,7 @@ export class SshComponent implements OnInit { ...@@ -98,7 +99,7 @@ export class SshComponent implements OnInit {
NavList.List[id].Term.term.write('\x1b[31mWelcome to Jumpserver!\x1b[m\r\n'); NavList.List[id].Term.term.write('\x1b[31mWelcome to Jumpserver!\x1b[m\r\n');
socket.on('connect', function () { 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) { NavList.List[id].Term.term.on('data', function (data) {
socket.emit('data', data); socket.emit('data', data);
...@@ -110,7 +111,7 @@ export class SshComponent implements OnInit { ...@@ -110,7 +111,7 @@ export class SshComponent implements OnInit {
}); });
socket.on('disconnect', function () { socket.on('disconnect', function () {
this.TerminalDisconnect(id); this.TerminalDisconnect(NavList.List[id]);
// TermStore.term[id]["term"].destroy(); // TermStore.term[id]["term"].destroy();
// TermStore.term[id]["connected"] = false; // TermStore.term[id]["connected"] = false;
}); });
...@@ -122,10 +123,10 @@ export class SshComponent implements OnInit { ...@@ -122,10 +123,10 @@ export class SshComponent implements OnInit {
let cols = 80; let cols = 80;
if (Cookie.get('rows')) { if (Cookie.get('rows')) {
rows = parseInt(Cookie.get('rows')); rows = parseInt(Cookie.get('rows'), 10);
} }
if (Cookie.get('cols')) { if (Cookie.get('cols')) {
cols = parseInt(Cookie.get('cols')); cols = parseInt(Cookie.get('cols'), 10);
} }
if (col < 80) { if (col < 80) {
col = 80; col = 80;
......
...@@ -18,14 +18,14 @@ declare let jQuery: any; ...@@ -18,14 +18,14 @@ declare let jQuery: any;
import * as io from 'socket.io-client'; import * as io from 'socket.io-client';
export class Group { export class Group {
id: number; id: string;
name: string; name: string;
membercount: number; membercount: number;
comment: string; comment: string;
} }
export let User: { export let User: {
id: number; id: string;
name: string; name: string;
username: string; username: string;
password: string; password: string;
...@@ -39,7 +39,7 @@ export let User: { ...@@ -39,7 +39,7 @@ export let User: {
groups: Array<Group>; groups: Array<Group>;
logined: boolean; logined: boolean;
} = { } = {
id: 0, id: '',
name: 'nobody', name: 'nobody',
username: '', username: '',
password: '', password: '',
......
...@@ -30,7 +30,9 @@ app-root { ...@@ -30,7 +30,9 @@ app-root {
padding-bottom: 16px !important; padding-bottom: 16px !important;
font-family: 'Monaco', iosevka !important; font-family: 'Monaco', iosevka !important;
} }
.terminal{
white-space: nowrap;
}
.terminal, .terminal .xterm-viewport { .terminal, .terminal .xterm-viewport {
background-color: inherit; 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