Fix for console start

This commit is contained in:
piotrpekala7 2020-08-31 17:21:37 +02:00
parent 696a708930
commit c732ed5a72
3 changed files with 35 additions and 8 deletions

View File

@ -24,12 +24,13 @@ export class ConsoleWrapperComponent implements OnInit {
public style: object = {};
public styleInside: object = { height: `120px` };
public isDraggingEnabled: boolean = false;
public isLightThemeEnabled: boolean = false;
public isMinimized: boolean = false;
public resizedWidth: number = 720;
public resizedHeight: number = 480;
constructor(
private consoleService: NodeConsoleService,
private themeService: ThemeService
@ -55,9 +56,9 @@ export class ConsoleWrapperComponent implements OnInit {
minimize(value: boolean) {
this.isMinimized = value;
if (!value) {
this.style = { bottom: '20px', left: '20px', width: '720px', height: '460px'};
this.style = { bottom: '20px', left: '20px', width: `${this.resizedWidth}px`, height: `${this.resizedHeight}px`}
} else {
this.style = { bottom: '20px', left: '20px', width: '720px', height: '56px'};
this.style = { bottom: '20px', left: '20px', width: `${this.resizedWidth}px`, height: '56px'};
}
}
@ -138,7 +139,10 @@ export class ConsoleWrapperComponent implements OnInit {
this.consoleService.consoleResized.next({
width: event.rectangle.width,
height: event.rectangle.height - 53
})
});
this.resizedWidth = event.rectangle.width;
this.resizedHeight = event.rectangle.height;
}
close() {

View File

@ -34,8 +34,15 @@ export class WebConsoleComponent implements OnInit, AfterViewInit {
let numberOfColumns = Math.floor(ev.width / 9);
let numberOfRows = Math.floor(ev.height / 17);
this.consoleService.setNumberOfColumns(numberOfColumns);
this.consoleService.setNumberOfRows(numberOfRows);
this.term.resize(numberOfColumns, numberOfRows);
});
if (this.consoleService.getNumberOfColumns() && this.consoleService.getNumberOfRows()){
this.term.resize(this.consoleService.getNumberOfColumns(), this.consoleService.getNumberOfRows());
}
}
ngAfterViewInit() {
@ -64,9 +71,6 @@ export class WebConsoleComponent implements OnInit, AfterViewInit {
}
return true;
});
// probably we need to take initial values of console wrapper and
// this.term.resize(80, 1);
}
getUrl() {

View File

@ -15,8 +15,27 @@ export class NodeConsoleService {
public readonly defaultNumberOfColumns = 80;
public readonly defaultNumberOfRows = 24;
private lastNumberOfColumns: number;
private lastNumberOfRows: number;
constructor() {}
getNumberOfColumns() {
return this.lastNumberOfColumns;
}
getNumberOfRows() {
return this.lastNumberOfRows;
}
setNumberOfColumns(value: number) {
this.lastNumberOfColumns = value;
}
setNumberOfRows(value: number) {
this.lastNumberOfRows = value;
}
openConsoleForNode(node: Node) {
this.nodeConsoleTrigger.emit(node);
}