mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-01-20 11:38:59 +00:00
Update for map settings service
This commit is contained in:
parent
a1f6be337a
commit
76dbcc0782
@ -89,8 +89,14 @@ export class D3MapComponent implements OnInit, OnChanges, OnDestroy {
|
||||
|
||||
@Input('show-interface-labels')
|
||||
set showInterfaceLabels(value) {
|
||||
this.settings.show_interface_labels = value;
|
||||
this.interfaceLabelWidget.setEnabled(value);
|
||||
if (value && !this.mapSettingsService.integrateLinkLabelsToLinks) {
|
||||
this.settings.show_interface_labels = true;
|
||||
this.interfaceLabelWidget.setEnabled(true);
|
||||
} else {
|
||||
this.settings.show_interface_labels = false;
|
||||
this.interfaceLabelWidget.setEnabled(false);
|
||||
}
|
||||
|
||||
this.mapChangeDetectorRef.detectChanges();
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ export class InterfaceStatusWidget implements Widget {
|
||||
link_group
|
||||
.selectAll<SVGTextElement, LinkStatus>('text.status_suspended_label').remove();
|
||||
|
||||
if (self.mapSettingsService.integrateLinkLabelsToLinks && !l.isMultiplied) {
|
||||
if (self.mapSettingsService.showInterfaceLabels && self.mapSettingsService.integrateLinkLabelsToLinks && !l.isMultiplied) {
|
||||
const status_started = link_group
|
||||
.selectAll<SVGRectElement, LinkStatus>('rect.status_started')
|
||||
.data(statuses.filter((link_status: LinkStatus) => link_status.status === 'started'));
|
||||
|
@ -109,11 +109,8 @@
|
||||
|
||||
<mat-menu #viewMenu="matMenu" [overlapTrigger]="false">
|
||||
<div class="options-item">
|
||||
<mat-checkbox [ngModel]="mapSettingsService.integrateLinkLabelsToLinks" (change)="toggleIntegrateLinkLabelsToLinks($event.checked)">
|
||||
Integrate link labels to links
|
||||
</mat-checkbox>
|
||||
<mat-checkbox [ngModel]="isInterfaceLabelVisible" (change)="toggleShowInterfaceLabels($event.checked)">
|
||||
Show interface labels separately
|
||||
Show interface labels
|
||||
</mat-checkbox><br/>
|
||||
<mat-checkbox [ngModel]="isConsoleVisible" (change)="toggleShowConsole($event.checked)">
|
||||
Show console
|
||||
|
@ -258,12 +258,7 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
|
||||
this.projectService.open(this.server, this.project.project_id);
|
||||
this.title.setTitle(this.project.name);
|
||||
|
||||
// old settings
|
||||
// if (this.mapSettingsService.interfaceLabels.has(project.project_id)) {
|
||||
// this.isInterfaceLabelVisible = this.mapSettingsService.interfaceLabels.get(project.project_id);
|
||||
// } else {
|
||||
// this.isInterfaceLabelVisible = this.project.show_interface_labels;
|
||||
// }
|
||||
this.isInterfaceLabelVisible = this.mapSettingsService.showInterfaceLabels;
|
||||
|
||||
this.recentlyOpenedProjectService.setServerId(this.server.id.toString());
|
||||
this.recentlyOpenedProjectService.setProjectId(this.project.project_id);
|
||||
@ -675,17 +670,7 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
|
||||
|
||||
public toggleShowInterfaceLabels(enabled: boolean) {
|
||||
this.isInterfaceLabelVisible = enabled;
|
||||
this.mapSettingsService.toggleShowInterfaceLabels(this.project.project_id, this.isInterfaceLabelVisible);
|
||||
|
||||
this.mapSettingsService.integrateLinkLabelsToLinks = false;
|
||||
this.mapSettingsService.mapRenderedEmitter.emit(true);
|
||||
}
|
||||
|
||||
public toggleIntegrateLinkLabelsToLinks(enabled: boolean) {
|
||||
this.isInterfaceLabelVisible = false;
|
||||
this.mapSettingsService.toggleShowInterfaceLabels(this.project.project_id, this.isInterfaceLabelVisible);
|
||||
|
||||
this.mapSettingsService.integrateLinkLabelsToLinks = enabled;
|
||||
this.mapSettingsService.toggleShowInterfaceLabels(this.isInterfaceLabelVisible);
|
||||
this.mapSettingsService.mapRenderedEmitter.emit(true);
|
||||
}
|
||||
|
||||
|
@ -7,11 +7,11 @@ export class MapSettingsService {
|
||||
public isTopologySummaryVisible: boolean = true;
|
||||
public isLogConsoleVisible: boolean = false;
|
||||
public isLayerNumberVisible: boolean = false;
|
||||
public interfaceLabels: Map<string, boolean> = new Map<string, boolean>();
|
||||
public logConsoleSubject = new Subject<boolean>();
|
||||
public mapRenderedEmitter = new EventEmitter<boolean>();
|
||||
|
||||
public integrateLinkLabelsToLinks: boolean = true;
|
||||
public showInterfaceLabels: boolean = true;
|
||||
public integrateLinkLabelsToLinks: boolean = false;
|
||||
|
||||
constructor() {
|
||||
this.isLayerNumberVisible = localStorage.getItem('layersVisibility') === 'true' ? true : false;
|
||||
@ -33,7 +33,11 @@ export class MapSettingsService {
|
||||
this.isLayerNumberVisible = value;
|
||||
}
|
||||
|
||||
toggleShowInterfaceLabels(projectId: string, value: boolean) {
|
||||
this.interfaceLabels.set(projectId, value);
|
||||
toggleShowInterfaceLabels(value: boolean) {
|
||||
this.showInterfaceLabels = value;
|
||||
}
|
||||
|
||||
toggleIntegrateInterfaceLabels(value: boolean) {
|
||||
this.integrateLinkLabelsToLinks = value;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user