62 lines
1.8 KiB
TypeScript
62 lines
1.8 KiB
TypeScript
import {Component, OnDestroy, OnInit} from '@angular/core';
|
|
import {Router, RouterLink, RouterLinkActive, RouterOutlet} from '@angular/router';
|
|
import {FaIconComponent} from '@fortawesome/angular-fontawesome';
|
|
import {faBars, faBookmark as faBookmarkSolid, faGears} from '@fortawesome/free-solid-svg-icons';
|
|
import {MenuService} from './menu-service';
|
|
import {Location} from './location/Location';
|
|
import {LocationService} from './location/location-service';
|
|
import {WebsocketService} from './common';
|
|
import {faBookmark as faBookmarkRegular, faHome} from '@fortawesome/free-regular-svg-icons';
|
|
import {ConfigService} from './config.service';
|
|
|
|
@Component({
|
|
selector: 'app-root',
|
|
imports: [RouterOutlet, FaIconComponent, RouterLinkActive, RouterLink],
|
|
templateUrl: './app.html',
|
|
styleUrl: './app.less'
|
|
})
|
|
export class App implements OnInit, OnDestroy {
|
|
|
|
protected readonly faHome = faHome;
|
|
|
|
protected readonly location = location;
|
|
|
|
protected readonly faBookmarkRegular = faBookmarkRegular;
|
|
|
|
protected readonly faBookmarkSolid = faBookmarkSolid;
|
|
|
|
protected readonly faGears = faGears;
|
|
|
|
protected readonly faBars = faBars;
|
|
|
|
protected showDrawer: boolean = false;
|
|
|
|
protected locationList: Location[] = [];
|
|
|
|
constructor(
|
|
readonly locationService: LocationService,
|
|
readonly configService: ConfigService,
|
|
readonly menuService: MenuService,
|
|
readonly router: Router,
|
|
readonly ws: WebsocketService,
|
|
) {
|
|
//
|
|
}
|
|
|
|
ngOnInit(): void {
|
|
this.locationService.findAll(list => this.locationList = list);
|
|
this.menuService.title = "Orte";
|
|
}
|
|
|
|
ngOnDestroy(): void {
|
|
this.menuService.title = "";
|
|
}
|
|
|
|
navigate(url: string): void {
|
|
this.router.navigateByUrl('/', {skipLocationChange: true}).then(() => {
|
|
this.router.navigate([url]);
|
|
})
|
|
}
|
|
|
|
}
|