gns3-web-ui/src/app/services/mapsettings.service.ts

74 lines
2.4 KiB
TypeScript
Raw Normal View History

2019-10-25 05:19:30 -07:00
import { Injectable, EventEmitter } from "@angular/core";
2019-06-24 06:24:38 -07:00
import { Subject } from 'rxjs';
2020-11-09 13:50:24 +01:00
@Injectable({
providedIn: 'root'
})
2019-08-21 06:32:44 -07:00
export class MapSettingsService {
2020-09-30 12:11:49 +02:00
public isScrollDisabled = new Subject<boolean>();
2019-06-24 06:24:38 -07:00
public isMapLocked = new Subject<boolean>();
2019-10-22 04:57:13 -07:00
public isTopologySummaryVisible: boolean = true;
2020-04-15 11:57:04 +02:00
public isLogConsoleVisible: boolean = false;
2019-10-23 03:00:40 -07:00
public isLayerNumberVisible: boolean = false;
2020-04-30 16:33:20 +02:00
public logConsoleSubject = new Subject<boolean>();
2019-10-25 05:19:30 -07:00
public mapRenderedEmitter = new EventEmitter<boolean>();
2019-06-24 06:24:38 -07:00
2020-08-06 15:20:28 +02:00
public showInterfaceLabels: boolean = true;
2020-08-06 19:40:51 +02:00
public integrateLinkLabelsToLinks: boolean = true;
2020-10-22 00:18:56 +02:00
public openReadme: boolean = true;
2020-07-13 17:28:35 +02:00
2019-10-23 03:00:40 -07:00
constructor() {
this.isLayerNumberVisible = localStorage.getItem('layersVisibility') === 'true' ? true : false;
2020-08-06 19:40:51 +02:00
if (localStorage.getItem('integrateLinkLabelsToLinks')) this.integrateLinkLabelsToLinks = localStorage.getItem('integrateLinkLabelsToLinks') === 'true' ? true : false;
2020-10-22 00:18:56 +02:00
if (localStorage.getItem('openReadme')) this.openReadme = localStorage.getItem('openReadme') === 'true' ? true : false;
2019-10-23 03:00:40 -07:00
}
2019-06-24 06:24:38 -07:00
changeMapLockValue(value: boolean) {
this.isMapLocked.next(value);
}
2019-08-21 06:32:44 -07:00
2020-09-22 18:01:31 +02:00
setConsoleContextMenuAction(action: string) {
localStorage.setItem('consoleContextMenu', action);
}
getConsoleContextManuAction(): string {
return localStorage.getItem('consoleContextMenu');
}
2019-08-21 06:32:44 -07:00
toggleTopologySummary(value: boolean) {
this.isTopologySummaryVisible = value;
}
2019-08-26 05:17:50 -07:00
toggleLogConsole(value: boolean) {
this.isLogConsoleVisible = value;
}
2019-10-23 03:00:40 -07:00
toggleLayers(value: boolean) {
this.isLayerNumberVisible = value;
}
2020-08-06 15:20:28 +02:00
toggleShowInterfaceLabels(value: boolean) {
this.showInterfaceLabels = value;
}
toggleIntegrateInterfaceLabels(value: boolean) {
this.integrateLinkLabelsToLinks = value;
2020-08-06 19:40:51 +02:00
localStorage.removeItem('integrateLinkLabelsToLinks');
if (value) {
localStorage.setItem('integrateLinkLabelsToLinks', 'true');
} else {
localStorage.setItem('integrateLinkLabelsToLinks', 'false');
}
}
2020-10-22 00:18:56 +02:00
toggleOpenReadme(value: boolean) {
this.openReadme = value;
localStorage.removeItem('openReadme');
if (value) {
localStorage.setItem('openReadme', 'true');
} else {
localStorage.setItem('openReadme', 'false');
}
}
2019-06-24 06:24:38 -07:00
}