Commit 70393df3 authored by ibuler's avatar ibuler

[Update] Merge

parents 5158a36e d13ece2b
...@@ -95,3 +95,12 @@ ...@@ -95,3 +95,12 @@
cursor: default; cursor: default;
color: #c5babc; color: #c5babc;
} }
.nav ul li.disconnected {
background-color: darkgray;
}
.nav ul li.active {
box-sizing: border-box;
border-bottom: 3px solid #19aa8d !important;
}
...@@ -12,5 +12,15 @@ ...@@ -12,5 +12,15 @@
</li> </li>
</ul> </ul>
</li> </li>
<li [ngClass]="{'dropdown': true}">
<a>{{"Tab List"|trans}}</a>
<ul *ngIf="NavList.List.length>1" [ngClass]="{'dropdown-content': true}">
<ng-container *ngFor="let t of NavList.List, let idx= index" >
<li *ngIf="t.nick!=null" [ngClass]="{'active':idx==NavList.Active,'disconnected':!t.connected, 'hidden': t.closed != false}">
<a id="{{ 'tab' + idx }}" (click)="toTab(idx)">{{t.nick}}</a>
</li>
</ng-container>
</ul>
</li>
</ul> </ul>
</div> </div>
...@@ -21,6 +21,7 @@ declare let layer: any; ...@@ -21,6 +21,7 @@ declare let layer: any;
}) })
export class ElementNavComponent implements OnInit { export class ElementNavComponent implements OnInit {
DataStore = DataStore; DataStore = DataStore;
NavList = NavList;
ChangeLanWarningDialog: any; ChangeLanWarningDialog: any;
static Hide() { static Hide() {
...@@ -39,6 +40,10 @@ export class ElementNavComponent implements OnInit { ...@@ -39,6 +40,10 @@ export class ElementNavComponent implements OnInit {
ngOnInit() { ngOnInit() {
} }
toTab(idx) {
ControlComponent.active(idx);
}
click(event) { click(event) {
this._logger.debug('nav.ts:NavComponent,click', event); this._logger.debug('nav.ts:NavComponent,click', event);
switch (event) { switch (event) {
...@@ -80,11 +85,16 @@ export class ElementNavComponent implements OnInit { ...@@ -80,11 +85,16 @@ export class ElementNavComponent implements OnInit {
} else { } else {
throw new Error('不支持全屏api'); throw new Error('不支持全屏api');
} }
window.dispatchEvent(new Event('resize')); window.dispatchEvent(new Event('resize'));
break; break;
} }
case'Disconnect': { case 'Reconnect': {
if (NavList.List[NavList.Active].termComp) {
NavList.List[NavList.Active].termComp.reconnect();
}
break;
}
case 'Disconnect': {
if (!confirm('断开当前连接? (RDP暂不支持)')) { if (!confirm('断开当前连接? (RDP暂不支持)')) {
break; break;
} }
...@@ -234,6 +244,11 @@ export class ElementNavComponent implements OnInit { ...@@ -234,6 +244,11 @@ export class ElementNavComponent implements OnInit {
'click': 'DisconnectAll', 'click': 'DisconnectAll',
'name': 'Disconnect all' 'name': 'Disconnect all'
}, },
{
'id': 'Reconnect',
'click': 'Reconnect',
'name': 'Reconnect'
},
] ]
}, { }, {
'id': 'FileManager', 'id': 'FileManager',
......
import {AfterViewInit, Component, Input, OnInit, OnDestroy } from '@angular/core'; import {AfterViewInit, Component, Input, OnInit, OnDestroy} from '@angular/core';
import {Terminal} from 'xterm'; import {Terminal} from 'xterm';
import {NavList, View} from '../../pages/control/control/control.component'; import {NavList, View} from '../../pages/control/control/control.component';
import {UUIDService} from '../../app.service'; import {UUIDService} from '../../app.service';
import {CookieService} from 'ngx-cookie-service'; import {CookieService} from 'ngx-cookie-service';
import {Socket} from '../../utils/socket'; import {Socket} from '../../utils/socket';
import {getWsSocket} from '../../globals'; import {getWsSocket} from '../../globals';
import {TransPipe} from '../../pipes/trans.pipe';
@Component({ @Component({
...@@ -23,6 +24,7 @@ export class ElementSshTermComponent implements OnInit, AfterViewInit, OnDestroy ...@@ -23,6 +24,7 @@ export class ElementSshTermComponent implements OnInit, AfterViewInit, OnDestroy
ws: Socket; ws: Socket;
roomID: string; roomID: string;
view: View; view: View;
transPipe: TransPipe;
constructor(private _uuid: UUIDService, private _cookie: CookieService) { constructor(private _uuid: UUIDService, private _cookie: CookieService) {
} }
...@@ -31,6 +33,7 @@ export class ElementSshTermComponent implements OnInit, AfterViewInit, OnDestroy ...@@ -31,6 +33,7 @@ export class ElementSshTermComponent implements OnInit, AfterViewInit, OnDestroy
this.view = NavList.List[this.index]; this.view = NavList.List[this.index];
this.secret = this._uuid.gen(); this.secret = this._uuid.gen();
this.newTerm(); this.newTerm();
this.transPipe = new TransPipe();
getWsSocket().then(sock => { getWsSocket().then(sock => {
this.ws = sock; this.ws = sock;
this.connectHost(); this.connectHost();
...@@ -51,6 +54,7 @@ export class ElementSshTermComponent implements OnInit, AfterViewInit, OnDestroy ...@@ -51,6 +54,7 @@ export class ElementSshTermComponent implements OnInit, AfterViewInit, OnDestroy
} }
}); });
this.view.Term = this.term; this.view.Term = this.term;
this.view.termComp = this;
} }
changeWinSize(size: Array<number>) { changeWinSize(size: Array<number>) {
...@@ -59,7 +63,19 @@ export class ElementSshTermComponent implements OnInit, AfterViewInit, OnDestroy ...@@ -59,7 +63,19 @@ export class ElementSshTermComponent implements OnInit, AfterViewInit, OnDestroy
} }
} }
connectHost() { reconnect() {
if (NavList.List[this.index].connected === true) {
if (!confirm(this.transPipe.transform('Are you sure to reconnect it?(RDP not support)'))) {
return;
}
this.close();
}
this.secret = this._uuid.gen();
this.emitHostAndTokenData();
}
emitHostAndTokenData() {
if (this.host) { if (this.host) {
const data = { const data = {
uuid: this.host.id, uuid: this.host.id,
...@@ -77,6 +93,10 @@ export class ElementSshTermComponent implements OnInit, AfterViewInit, OnDestroy ...@@ -77,6 +93,10 @@ export class ElementSshTermComponent implements OnInit, AfterViewInit, OnDestroy
console.log('On token event trigger'); console.log('On token event trigger');
this.ws.emit('token', data); this.ws.emit('token', data);
} }
}
connectHost() {
this.emitHostAndTokenData();
this.term.on('data', data => { this.term.on('data', data => {
const d = {'data': data, 'room': this.roomID}; const d = {'data': data, 'room': this.roomID};
...@@ -107,6 +127,7 @@ export class ElementSshTermComponent implements OnInit, AfterViewInit, OnDestroy ...@@ -107,6 +127,7 @@ export class ElementSshTermComponent implements OnInit, AfterViewInit, OnDestroy
console.log('On room', data); console.log('On room', data);
this.roomID = data.room; this.roomID = data.room;
this.view.room = data.room; this.view.room = data.room;
this.view.connected = true;
} }
}); });
} }
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {TermWS} from '../../../globals'; import {TermWS} from '../../../globals';
import * as jQuery from 'jquery/dist/jquery.min';
export class View { export class View {
nick: string; nick: string;
...@@ -23,6 +24,7 @@ export class View { ...@@ -23,6 +24,7 @@ export class View {
room: string; room: string;
Rdp: any; Rdp: any;
Term: any; Term: any;
termComp: any;
} }
export let NavList: { export let NavList: {
...@@ -46,6 +48,7 @@ export class ControlComponent implements OnInit { ...@@ -46,6 +48,7 @@ export class ControlComponent implements OnInit {
v.hide = id.toString() !== k; v.hide = id.toString() !== k;
}); });
NavList.Active = id; NavList.Active = id;
jQuery('.tabs').animate({'scrollLeft': 150 * id}, 400);
} }
static TerminalDisconnect(id) { static TerminalDisconnect(id) {
......
...@@ -48,8 +48,9 @@ ...@@ -48,8 +48,9 @@
padding-right: 14px; padding-right: 14px;
line-height: 26px; line-height: 26px;
cursor: default; cursor: default;
width: 115px; /*width: 145px;*/
height: 21px; height: 26px;
display: block;
} }
.tabs ul li a.close { .tabs ul li a.close {
...@@ -72,18 +73,18 @@ ...@@ -72,18 +73,18 @@
padding-left: 12px; padding-left: 12px;
line-height: 26px; line-height: 26px;
color: white; color: white;
height: 18px; height: 26px;
} }
.tabs ul li input { .tabs ul li input {
font-family: 'Roboto', sans-serif; font-family: 'Roboto', sans-serif;
font-size: 13px; font-size: 13px;
width: 115px; width: 120px;
border: none; border: none;
background-color: inherit; background-color: inherit;
color: white; color: white;
padding: 5px 20px 4px 15px; padding: 5px 20px 4px 15px;
height: 18px; height: 26px;
} }
/* /*
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<li *ngFor="let m of NavList.List;let i = index" <li *ngFor="let m of NavList.List;let i = index"
[ngClass]="{'active':i==NavList.Active,'disconnected':!m.connected, 'hidden': m.closed != false}" [ngClass]="{'active':i==NavList.Active,'disconnected':!m.connected, 'hidden': m.closed != false}"
id="termnav-{{i}}" (click)="setActive(i)" (dblclick)="m.edit=true;setActive(i)"> id="termnav-{{i}}" (click)="setActive(i)" (dblclick)="m.edit=true;setActive(i)">
<span *ngIf="!m.edit">{{m.nick | truncatechars:25 }}</span> <span *ngIf="!m.edit" [attr.title]="m.nick">{{m.nick | truncatechars:17 }}</span>
<input *ngIf="m.edit" [(ngModel)]="m.nick" (blur)="m.edit=false" (keyup.enter)="m.edit=false" autofocus="true"/> <input *ngIf="m.edit" [(ngModel)]="m.nick" (blur)="m.edit=false" (keyup.enter)="m.edit=false" autofocus="true"/>
<a class="close" (click)="close(m,i)">&times;</a> <a class="close" (click)="close(m,i)">&times;</a>
</li> </li>
......
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