Project name as page title

This commit is contained in:
piotrpekala7 2020-02-17 11:48:25 +01:00
parent e11281ddf6
commit 2e851cd6d2
2 changed files with 8 additions and 3 deletions

View File

@ -1,5 +1,5 @@
import * as Raven from 'raven-js';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserModule, Title } from '@angular/platform-browser';
import { NgModule, ErrorHandler } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { CdkTableModule } from '@angular/cdk/table';
@ -538,7 +538,8 @@ if (environment.production) {
NotificationService,
Gns3vmService,
ThemeService,
GoogleAnalyticsService
GoogleAnalyticsService,
Title
],
entryComponents: [
AddServerDialogComponent,

View File

@ -66,6 +66,7 @@ import { ConfirmationBottomSheetComponent } from '../projects/confirmation-botto
import { NodeAddedEvent } from '../template/template-list-dialog/template-list-dialog.component';
import { NotificationService } from '../../services/notification.service';
import { ThemeService } from '../../services/theme.service';
import { Title } from '@angular/platform-browser';
@Component({
@ -153,7 +154,8 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
private serialLinkWidget: SerialLinkWidget,
private bottomSheet: MatBottomSheet,
private notificationService: NotificationService,
private themeService: ThemeService
private themeService: ThemeService,
private title: Title
) {}
ngOnInit() {
@ -178,6 +180,7 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
}),
mergeMap((project: Project) => {
this.project = project;
this.title.setTitle(this.project.name);
if (this.mapSettingsService.interfaceLabels.has(project.project_id)) {
this.isInterfaceLabelVisible = this.mapSettingsService.interfaceLabels.get(project.project_id);
@ -819,6 +822,7 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
}
public ngOnDestroy() {
this.title.setTitle('GNS3 Web UI');
this.drawingsDataSource.clear();
this.nodesDataSource.clear();
this.linksDataSource.clear();