Commit 768c90a9 authored by liuzheng712's avatar liuzheng712

feat: update

parent a8d78e55
......@@ -41,7 +41,6 @@ class SSHws(Namespace):
"room": str(uuid.uuid4()),
"chan": None
}
print(self.clients[request.sid]["room"])
join_room(self.clients[request.sid]["room"])
self.socketio.start_background_task(self.send_data, self)
......@@ -56,13 +55,22 @@ class SSHws(Namespace):
print(message, self.clients[request.sid]["room"])
def on_resize(self, message):
print(message)
self.clients[request.sid]["cols"] = message.get('cols', 80)
self.clients[request.sid]["rows"] = message.get('rows', 24)
self.clients[request.sid]["chan"].resize_pty(width=self.clients[request.sid]["rows"],
height=self.clients[request.sid]["rows"], width_pixels=1,
height_pixels=1)
def on_room(self, sessionid):
if sessionid not in self.clients.keys():
self.emit('error', "no such session", room=self.clients[request.sid]["room"])
else:
self.emit('room', self.clients[sessionid]["room"], room=self.clients[request.sid]["room"])
def on_join(self, room):
self.leave_room(room=self.clients[request.sid]["room"])
join_room(room)
def on_disconnect(self):
print("disconnect")
pass
......
......@@ -30,6 +30,18 @@ export let Video: {
totalTime: 0,
};
export let Monitor: {
sessionid: string,
room: string,
type: string,
socket: any,
} = {
sessionid: '',
room: '',
type: 'term',
socket: io.connect(),
};
export class Group {
id: string;
name: string;
......
import {Component, OnInit} from '@angular/core';
import {Monitor, term} from '../../globals';
import * as io from 'socket.io-client';
declare let jQuery: any;
declare let Terminal: any;
@Component({
selector: 'app-monitor-linux',
......@@ -14,7 +15,18 @@ export class LinuxComponent implements OnInit {
}
ngOnInit() {
Monitor.socket = io.connect('/ssh');
Monitor.socket.on('connect', function () {
Monitor.socket.emit('room', Monitor.sessionid);
Monitor.socket.on('room', function (room) {
Monitor.room = room;
Monitor.socket.emit('join', room);
console.log(Monitor);
});
Monitor.socket.on('data', function (data) {
term.term.write(data);
});
});
}
......
import {Component, OnInit} from '@angular/core';
import {ActivatedRoute, Params} from '@angular/router';
import {DataStore} from '../globals';
import {DataStore, Monitor} from '../globals';
@Component({
selector: 'app-monitor-page',
......@@ -14,9 +14,10 @@ export class MonitorPageComponent implements OnInit {
}
ngOnInit() {
let token: string;
this.activatedRoute.params.subscribe((params: Params) => {
token = params['token'];
Monitor.sessionid = params['token'];
Monitor.type = 'term';
console.log(Monitor);
});
}
......
......@@ -49,7 +49,6 @@ export class JsonComponent implements OnInit {
}
pause() {
console.log(Video.timelist);
if (this.toggle) {
clearInterval(this.timer);
this.toggle = !this.toggle;
......
......@@ -10,8 +10,6 @@ import {Video, DataStore} from '../globals';
styleUrls: ['./replay-page.component.css']
})
export class ReplayPageComponent implements OnInit {
Video = Video;
constructor(private activatedRoute: ActivatedRoute,
private _http: HttpService,
private _logger: Logger) {
......@@ -29,13 +27,13 @@ export class ReplayPageComponent implements OnInit {
.map(res => res.json())
.subscribe(
data => {
this.Video.type = 'json';
this.Video.json = data;
this.Video.timelist = Object.keys(this.Video.json).map(Number);
this.Video.timelist = this.Video.timelist.sort(function (a, b) {
Video.type = 'json';
Video.json = data;
Video.timelist = Object.keys(Video.json).map(Number);
Video.timelist = Video.timelist.sort(function (a, b) {
return a - b;
});
this.Video.totalTime = Video.timelist[Video.timelist.length - 1] * 1000;
Video.totalTime = Video.timelist[Video.timelist.length - 1] * 1000;
},
err => {
this._logger.error(err);
......
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