Merge pull request #535 from GNS3/Support-for-layers

Support for layers
This commit is contained in:
piotrpekala7
2019-10-23 13:22:38 +02:00
committed by GitHub
6 changed files with 105 additions and 3 deletions

View File

@ -90,6 +90,9 @@
<mat-checkbox [ngModel]="notificationsVisibility" (change)="toggleNotifications($event.checked)">
Show notifications
</mat-checkbox>
<mat-checkbox [ngModel]="layersVisibility" (change)="toggleLayers($event.checked)">
Show layers
</mat-checkbox>
</div>
</mat-menu>

View File

@ -83,6 +83,7 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
public isTopologySummaryVisible: boolean = false;
public isInterfaceLabelVisible: boolean = false;
public notificationsVisibility: boolean = false;
public layersVisibility: boolean = false;
tools = {
selection: true,
@ -238,6 +239,7 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
}));
this.notificationsVisibility = localStorage.getItem('notificationsVisibility') === 'true' ? true : false;
this.layersVisibility = localStorage.getItem('layersVisibility') === 'true' ? true : false;
this.addKeyboardListeners();
}
@ -479,6 +481,17 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
}
}
public toggleLayers(visible: boolean) {
this.layersVisibility = visible;
this.mapSettingsService.toggleLayers(visible);
if (this.layersVisibility) {
localStorage.setItem('layersVisibility', 'true');
} else {
localStorage.removeItem('layersVisibility')
}
this.mapChild.applyMapSettingsChanges();
}
private showMessage(msg) {
if (this.notificationsVisibility) {
if (msg.type === 'error') this.toasterService.error(msg.message);