Merge pull request #496 from GNS3/Web-console-support

Support for default telnet console - basic implementation as agreed
This commit is contained in:
piotrpekala7 2019-09-02 14:44:53 +02:00 committed by GitHub
commit 998889b721
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 1 deletions

View File

@ -197,6 +197,7 @@ import { ShowNodeActionComponent } from './components/project-map/context-menu/a
import { InfoDialogComponent } from './components/project-map/info-dialog/info-dialog.component';
import { InfoService } from './services/info.service';
import { BringToFrontActionComponent } from './components/project-map/context-menu/actions/bring-to-front-action/bring-to-front-action.component';
import { ConsoleDeviceActionBrowserComponent } from './components/project-map/context-menu/actions/console-device-action-browser/console-device-action-browser.component';
if (environment.production) {
Raven.config('https://b2b1cfd9b043491eb6b566fd8acee358@sentry.io/842726', {
@ -323,7 +324,8 @@ if (environment.production) {
SaveProjectDialogComponent,
TopologySummaryComponent,
InfoDialogComponent,
BringToFrontActionComponent
BringToFrontActionComponent,
ConsoleDeviceActionBrowserComponent
],
imports: [
BrowserModule,

View File

@ -0,0 +1,4 @@
<button mat-menu-item (click)="openConsole()">
<mat-icon>web_asset</mat-icon>
<span>Console</span>
</button>

View File

@ -0,0 +1,23 @@
import { Component, Input } from '@angular/core';
import { Node } from '../../../../../cartography/models/node';
import { ToasterService } from '../../../../../services/toaster.service';
@Component({
selector: 'app-console-device-action-browser',
templateUrl: './console-device-action-browser.component.html'
})
export class ConsoleDeviceActionBrowserComponent {
@Input() node: Node;
constructor(
private toasterService: ToasterService
) {}
openConsole() {
if(this.node.status !== "started") {
this.toasterService.error("This node must be started before a console can be opened");
} else {
location.assign(`telnet://${this.node.console_host}:${this.node.console}/`);
}
}
}

View File

@ -12,6 +12,10 @@
[server]="server"
[nodes]="nodes"
></app-console-device-action>
<app-console-device-action-browser
*ngIf="!projectService.isReadOnly(project) && nodes.length===1 && !isElectronApp && nodes[0].console_type!=='none'"
[node]="nodes[0]"
></app-console-device-action-browser>
<app-duplicate-action *ngIf="drawings.length>0 || nodes.length>0"
[server]="server"
[project]="project"