Commit e016ab9d authored by ibuler's avatar ibuler

[Update] 增加确认窗

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