Commit e016ab9d authored by ibuler's avatar ibuler

[Update] 增加确认窗

parent 9acf0ceb
...@@ -13,7 +13,6 @@ import {DataStore, i18n} from '../../globals'; ...@@ -13,7 +13,6 @@ import {DataStore, i18n} from '../../globals';
import * as jQuery from 'jquery/dist/jquery.min.js'; import * as jQuery from 'jquery/dist/jquery.min.js';
import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from '@angular/material'; import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from '@angular/material';
import {FormControl, Validators} from '@angular/forms'; import {FormControl, Validators} from '@angular/forms';
// import * as layer from 'layui-layer/src/layer.js';
declare let layer: any; declare let layer: any;
@Component({ @Component({
...@@ -66,6 +65,9 @@ export class ElementNavComponent implements OnInit { ...@@ -66,6 +65,9 @@ export class ElementNavComponent implements OnInit {
break; break;
} }
case'Disconnect': { case'Disconnect': {
if (!confirm('断开当前连接? (RDP暂不支持)')) {
break;
}
switch (NavList.List[NavList.Active].type) { switch (NavList.List[NavList.Active].type) {
case 'ssh': { case 'ssh': {
ControlComponent.TerminalDisconnect(NavList.Active); ControlComponent.TerminalDisconnect(NavList.Active);
...@@ -83,6 +85,9 @@ export class ElementNavComponent implements OnInit { ...@@ -83,6 +85,9 @@ export class ElementNavComponent implements OnInit {
break; break;
} }
case'DisconnectAll': { case'DisconnectAll': {
if (!confirm('断开所有连接? (RDP暂不支持)')) {
break;
}
ControlComponent.DisconnectAll(); ControlComponent.DisconnectAll();
break; break;
} }
...@@ -255,12 +260,8 @@ export class ElementNavComponent implements OnInit { ...@@ -255,12 +260,8 @@ export class ElementNavComponent implements OnInit {
'href': '', 'href': '',
'name': 'Share session (read/write)', 'name': 'Share session (read/write)',
'disable': true 'disable': true
}, }
{ ]
'id': 'Settings',
'click': 'Settings',
'name': 'Settings'
}]
}, { }, {
'id': 'Help', 'id': 'Help',
'name': 'Help', 'name': 'Help',
......
...@@ -54,7 +54,8 @@ export class ElementSshTermComponent implements OnInit, AfterViewInit { ...@@ -54,7 +54,8 @@ export class ElementSshTermComponent implements OnInit, AfterViewInit {
}); });
ws.on('data', data => { ws.on('data', data => {
if (data['room'] === NavList.List[that.index].room) { const view = NavList.List[that.index];
if (view && data['room'] === view.room) {
that.term.write(data['data']); that.term.write(data['data']);
} }
}); });
...@@ -62,11 +63,13 @@ export class ElementSshTermComponent implements OnInit, AfterViewInit { ...@@ -62,11 +63,13 @@ export class ElementSshTermComponent implements OnInit, AfterViewInit {
ws.on('disconnect', () => { ws.on('disconnect', () => {
that.disconnect(); that.disconnect();
}); });
ws.on('logout', (data) => { ws.on('logout', (data) => {
if (data['room'] === NavList.List[that.index].room) { if (data['room'] === NavList.List[that.index].room) {
NavList.List[that.index].connected = false; NavList.List[that.index].connected = false;
} }
}); });
ws.on('room', data => { ws.on('room', data => {
if (data['secret'] === this.secret) { if (data['secret'] === this.secret) {
NavList.List[that.index].room = data['room']; NavList.List[that.index].room = data['room'];
...@@ -75,9 +78,12 @@ export class ElementSshTermComponent implements OnInit, AfterViewInit { ...@@ -75,9 +78,12 @@ export class ElementSshTermComponent implements OnInit, AfterViewInit {
} }
disconnect() { disconnect() {
const view = NavList.List[this.index];
if (view) {
NavList.List[this.index].connected = false; NavList.List[this.index].connected = false;
ws.emit('logout', NavList.List[this.index].room); ws.emit('logout', NavList.List[this.index].room);
} }
}
active() { active() {
this.term.focus(); this.term.focus();
......
...@@ -48,9 +48,6 @@ export class ElementTermComponent implements OnInit, AfterViewInit { ...@@ -48,9 +48,6 @@ export class ElementTermComponent implements OnInit, AfterViewInit {
const row = Math.floor((contentElement.height() - 30) / markerElement.height()); const row = Math.floor((contentElement.height() - 30) / markerElement.height());
this.col = col > 80 ? col : 80; this.col = col > 80 ? col : 80;
this.row = row > 24 ? row : 24; this.row = row > 24 ? row : 24;
console.log('Box size: ', contentElement.width(), '*', contentElement.height());
console.log('Mark size: ', markerElement.width(), '*', markerElement.height());
console.log('Resize term size: ', this.col, this.row);
this.term.resize(this.col, this.row); this.term.resize(this.col, this.row);
this.winSizeChangeTrigger.emit([this.col, this.row]); this.winSizeChangeTrigger.emit([this.col, this.row]);
} }
......
...@@ -69,7 +69,6 @@ export class ControlComponent implements OnInit { ...@@ -69,7 +69,6 @@ export class ControlComponent implements OnInit {
} }
static DisconnectAll() { static DisconnectAll() {
alert('DisconnectAll');
for (let i = 0; i < NavList.List.length; i++) { for (let i = 0; i < NavList.List.length; i++) {
ControlComponent.TerminalDisconnect(i); ControlComponent.TerminalDisconnect(i);
} }
......
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