Web console in new tab

This commit is contained in:
piotrpekala7
2020-04-01 00:07:19 +02:00
parent 2d8c5966cd
commit 48dbd7f6aa
11 changed files with 154 additions and 9 deletions

View File

@ -119,8 +119,6 @@ export class ConsoleWrapperComponent implements OnInit {
height: `${event.rectangle.height - 60}px`,
width: `${event.rectangle.width}px`
};
this.consoleService.resizeTerminal();
}
close() {

View File

@ -0,0 +1,4 @@
<button mat-menu-item (click)="openConsole()">
<mat-icon>http</mat-icon>
<span>Web console in new tab</span>
</button>

View File

@ -0,0 +1,32 @@
import { Component, OnInit, Input } from '@angular/core';
import { Node } from '../../../../../cartography/models/node';
import { Server } from '../../../../../models/server';
import { ToasterService } from '../../../../../services/toaster.service';
import { Router } from '@angular/router';
@Component({
selector: 'app-http-console-new-tab-action',
templateUrl: './http-console-new-tab-action.component.html'
})
export class HttpConsoleNewTabActionComponent implements OnInit {
@Input() server: Server;
@Input() nodes: Node[];
constructor(
private toasterService: ToasterService,
private router: Router
) { }
ngOnInit() {}
openConsole() {
this.nodes.forEach(n => {
if (n.status === 'started') {
window.open(`${this.router.url}/nodes/${n.node_id}`);
} else {
this.toasterService.error('To open console please start the node');
}
});
}
}

View File

@ -20,6 +20,11 @@
[server]="server"
[nodes]="nodes"
></app-http-console-action>
<app-http-console-new-tab-action
*ngIf="!projectService.isReadOnly(project) && nodes.length"
[server]="server"
[nodes]="nodes"
></app-http-console-new-tab-action>
<app-console-device-action
*ngIf="!projectService.isReadOnly(project) && nodes.length && isElectronApp"
[server]="server"