mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-04-16 14:38:52 +00:00
Resize evnt added
This commit is contained in:
parent
4402a53ae0
commit
43787e94e8
@ -119,6 +119,8 @@ export class ConsoleWrapperComponent implements OnInit {
|
||||
height: `${event.rectangle.height - 60}px`,
|
||||
width: `${event.rectangle.width}px`
|
||||
};
|
||||
|
||||
this.consoleService.resizeTerminal();
|
||||
}
|
||||
|
||||
close() {
|
||||
|
@ -9,7 +9,7 @@ import { NodeConsoleService } from '../../../services/nodeConsole.service';
|
||||
|
||||
|
||||
@Component({
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
encapsulation: ViewEncapsulation.ShadowDom,
|
||||
selector: 'app-web-console',
|
||||
templateUrl: './web-console.component.html',
|
||||
styleUrls: ['../../../../../node_modules/xterm/css/xterm.css']
|
||||
@ -18,17 +18,23 @@ export class WebConsoleComponent implements OnInit, AfterViewInit {
|
||||
@Input() server: Server;
|
||||
@Input() project: Project;
|
||||
@Input() node: Node;
|
||||
public term: Terminal;
|
||||
|
||||
public term: Terminal = new Terminal();
|
||||
public fitAddon: FitAddon = new FitAddon();
|
||||
|
||||
@ViewChild('terminal', {static: false}) terminal: ElementRef;
|
||||
|
||||
constructor(
|
||||
private consoleService: NodeConsoleService
|
||||
) {}
|
||||
|
||||
ngOnInit() {}
|
||||
ngOnInit() {
|
||||
this.consoleService.consoleResized.subscribe(ev => {
|
||||
this.fitAddon.fit();
|
||||
});
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.term = new Terminal();
|
||||
setTimeout(() => {
|
||||
this.term.open(this.terminal.nativeElement);
|
||||
const socket = new WebSocket(this.getUrl());
|
||||
@ -44,9 +50,10 @@ export class WebConsoleComponent implements OnInit, AfterViewInit {
|
||||
this.term.loadAddon(attachAddon);
|
||||
this.term.setOption('cursorBlink', true);
|
||||
|
||||
const fitAddon = new FitAddon();
|
||||
this.term.loadAddon(fitAddon);
|
||||
fitAddon.activate(this.term);
|
||||
this.term.loadAddon(this.fitAddon);
|
||||
this.fitAddon.activate(this.term);
|
||||
|
||||
this.term.focus();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ import { Subject } from 'rxjs';
|
||||
export class NodeConsoleService {
|
||||
public nodeConsoleTrigger = new EventEmitter<Node>();
|
||||
public closeNodeConsoleTrigger = new Subject<Node>();
|
||||
public consoleResized = new Subject<boolean>();
|
||||
|
||||
constructor() {}
|
||||
|
||||
@ -14,6 +15,10 @@ export class NodeConsoleService {
|
||||
}
|
||||
|
||||
closeConsoleForNode(node: Node) {
|
||||
this.closeNodeConsoleTrigger.next(node)
|
||||
this.closeNodeConsoleTrigger.next(node);
|
||||
}
|
||||
|
||||
resizeTerminal() {
|
||||
this.consoleResized.next(true);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user