mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-05-22 10:14:19 +00:00
Button on map to show/hide console
This commit is contained in:
parent
7f30d6ddf6
commit
99df35282e
@ -192,6 +192,7 @@ import { MapSettingService } from './services/mapsettings.service';
|
|||||||
import { ProjectMapMenuComponent } from './components/project-map/project-map-menu/project-map-menu.component';
|
import { ProjectMapMenuComponent } from './components/project-map/project-map-menu/project-map-menu.component';
|
||||||
import { HelpComponent } from './components/help/help.component';
|
import { HelpComponent } from './components/help/help.component';
|
||||||
import { LogConsoleComponent } from './components/project-map/log-console/log-console.component';
|
import { LogConsoleComponent } from './components/project-map/log-console/log-console.component';
|
||||||
|
import { LogEventsDataSource } from './components/project-map/log-console/log-events-datasource';
|
||||||
|
|
||||||
if (environment.production) {
|
if (environment.production) {
|
||||||
Raven.config('https://b2b1cfd9b043491eb6b566fd8acee358@sentry.io/842726', {
|
Raven.config('https://b2b1cfd9b043491eb6b566fd8acee358@sentry.io/842726', {
|
||||||
@ -354,6 +355,7 @@ if (environment.production) {
|
|||||||
LinksDataSource,
|
LinksDataSource,
|
||||||
NodesDataSource,
|
NodesDataSource,
|
||||||
SymbolsDataSource,
|
SymbolsDataSource,
|
||||||
|
LogEventsDataSource,
|
||||||
SelectionManager,
|
SelectionManager,
|
||||||
InRectangleHelper,
|
InRectangleHelper,
|
||||||
DrawingsDataSource,
|
DrawingsDataSource,
|
||||||
|
@ -9,6 +9,7 @@ import { Drawing } from '../../../cartography/models/drawing';
|
|||||||
import { Link } from '../../../models/link';
|
import { Link } from '../../../models/link';
|
||||||
import { Node } from '../../../cartography/models/node';
|
import { Node } from '../../../cartography/models/node';
|
||||||
import { Port } from '../../../models/port';
|
import { Port } from '../../../models/port';
|
||||||
|
import { LogEventsDataSource } from './log-events-datasource';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -34,7 +35,8 @@ export class LogConsoleComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
constructor(
|
constructor(
|
||||||
private projectWebServiceHandler: ProjectWebServiceHandler,
|
private projectWebServiceHandler: ProjectWebServiceHandler,
|
||||||
private nodeService: NodeService,
|
private nodeService: NodeService,
|
||||||
private nodesDataSource: NodesDataSource
|
private nodesDataSource: NodesDataSource,
|
||||||
|
private logEventsDataSource: LogEventsDataSource
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@ -56,6 +58,7 @@ export class LogConsoleComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
|
this.console.nativeElement.innerHTML = this.logEventsDataSource.getItems()[0] ? this.logEventsDataSource.getItems()[0] : '';
|
||||||
this.console.nativeElement.scrollTop = this.console.nativeElement.scrollHeight;
|
this.console.nativeElement.scrollTop = this.console.nativeElement.scrollHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,8 +133,16 @@ export class LogConsoleComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
this.command = '';
|
this.command = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearConsole() {
|
||||||
|
this.console.nativeElement.innerHTML = '';
|
||||||
|
this.console.nativeElement.scrollTop = this.console.nativeElement.scrollHeight;
|
||||||
|
}
|
||||||
|
|
||||||
showMessage(message: string) {
|
showMessage(message: string) {
|
||||||
this.console.nativeElement.innerHTML += message += "<br />";
|
this.logEventsDataSource.clear();
|
||||||
|
this.logEventsDataSource.add(this.console.nativeElement.innerHTML + message + " <br />");
|
||||||
|
|
||||||
|
this.console.nativeElement.innerHTML += message += " <br />";
|
||||||
this.console.nativeElement.scrollTop = this.console.nativeElement.scrollHeight;
|
this.console.nativeElement.scrollTop = this.console.nativeElement.scrollHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { DataSource } from '../../../cartography/datasources/datasource';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class LogEventsDataSource extends DataSource<string> {
|
||||||
|
protected getItemKey(log: string) {
|
||||||
|
return log;
|
||||||
|
}
|
||||||
|
}
|
@ -49,7 +49,7 @@
|
|||||||
</mat-menu>
|
</mat-menu>
|
||||||
|
|
||||||
<mat-toolbar-row>
|
<mat-toolbar-row>
|
||||||
<button matTooltip="Show/hide interface labels" mat-icon-button [matMenuTriggerFor]="viewMenu"><mat-icon>view_module</mat-icon></button>
|
<button matTooltip="Map settings" mat-icon-button [matMenuTriggerFor]="viewMenu"><mat-icon>view_module</mat-icon></button>
|
||||||
</mat-toolbar-row>
|
</mat-toolbar-row>
|
||||||
|
|
||||||
<mat-menu #viewMenu="matMenu" [overlapTrigger]="false">
|
<mat-menu #viewMenu="matMenu" [overlapTrigger]="false">
|
||||||
@ -57,6 +57,9 @@
|
|||||||
<mat-checkbox [ngModel]="project.show_interface_labels" (change)="toggleShowInterfaceLabels($event.checked)">
|
<mat-checkbox [ngModel]="project.show_interface_labels" (change)="toggleShowInterfaceLabels($event.checked)">
|
||||||
Show interface labels
|
Show interface labels
|
||||||
</mat-checkbox>
|
</mat-checkbox>
|
||||||
|
<mat-checkbox [ngModel]="isConsoleVisible" (change)="toggleShowConsole($event.checked)">
|
||||||
|
Show console
|
||||||
|
</mat-checkbox>
|
||||||
</div>
|
</div>
|
||||||
</mat-menu>
|
</mat-menu>
|
||||||
|
|
||||||
@ -120,4 +123,6 @@
|
|||||||
<app-node-label-dragged [server]="server"></app-node-label-dragged>
|
<app-node-label-dragged [server]="server"></app-node-label-dragged>
|
||||||
<app-text-added [server]="server" [project]="project" (drawingSaved)="onDrawingSaved()"> </app-text-added>
|
<app-text-added [server]="server" [project]="project" (drawingSaved)="onDrawingSaved()"> </app-text-added>
|
||||||
<app-text-edited [server]="server"></app-text-edited>
|
<app-text-edited [server]="server"></app-text-edited>
|
||||||
<app-log-console [server]="server" [project]="project"></app-log-console>
|
<div [ngClass]="{ visible: !isConsoleVisible }">
|
||||||
|
<app-log-console [server]="server" [project]="project"></app-log-console>
|
||||||
|
</div>
|
||||||
|
@ -230,3 +230,7 @@ g.node text,
|
|||||||
.context-menu-items .mat-menu-item:focus {
|
.context-menu-items .mat-menu-item:focus {
|
||||||
background: none;
|
background: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.visible {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
@ -68,6 +68,7 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
|
|||||||
public server: Server;
|
public server: Server;
|
||||||
public ws: WebSocket;
|
public ws: WebSocket;
|
||||||
public isProjectMapMenuVisible: boolean = false;
|
public isProjectMapMenuVisible: boolean = false;
|
||||||
|
public isConsoleVisible: boolean = false;
|
||||||
|
|
||||||
tools = {
|
tools = {
|
||||||
selection: true,
|
selection: true,
|
||||||
@ -362,6 +363,10 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
|
|||||||
this.project.show_interface_labels = enabled;
|
this.project.show_interface_labels = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public toggleShowConsole(visible: boolean) {
|
||||||
|
this.isConsoleVisible = visible;
|
||||||
|
}
|
||||||
|
|
||||||
public hideMenu() {
|
public hideMenu() {
|
||||||
this.projectMapMenuComponent.resetDrawToolChoice()
|
this.projectMapMenuComponent.resetDrawToolChoice()
|
||||||
this.isProjectMapMenuVisible = false;
|
this.isProjectMapMenuVisible = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user