Skip to content
Snippets Groups Projects
Commit 08e115f5 authored by Reid Givens's avatar Reid Givens
Browse files

SSA-6493: make the title tag hostname aware

parent dd7b8ec9
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,8 @@ import {
faToggleOn
} from "@fortawesome/free-solid-svg-icons";
import {DOCUMENT} from "@angular/common";
import {WINDOW} from "./env/window.provider";
import {Title} from "@angular/platform-browser";
@Component({
selector: 'app-root',
......@@ -42,13 +44,35 @@ export class AppComponent {
public darkMode = false;
constructor(
private titleService: Title,
private authService: AuthService,
private storageService: StorageService,
private router: Router,
private route: ActivatedRoute,
private alertService: AlertService,
@Inject(DOCUMENT) document
@Inject(DOCUMENT) document,
@Inject(WINDOW) private window: Window
) {
// set the title based on the host
let title = 'VLASS Manager'
switch (this.window.location.hostname) {
case 'archive-test.nrao.edu':
title = 'TEST | ' + title;
break;
case 'archive-new.nrao.edu':
// leave the title alone
break;
case 'webtest.aoc.nrao.edu':
title = 'DEV | ' + title;
break;
case 'localhost':
title = 'LOCAL | ' + title;
break;
default:
title = '~?~ | ' + title
break;
}
this.titleService.setTitle(title);
/*
this.route.queryParams.subscribe(params => {
if (params.hasOwnProperty('ticket')) {
......
import {BrowserModule} from '@angular/platform-browser';
import {BrowserModule, Title} from '@angular/platform-browser';
import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
import {APP_INITIALIZER, NgModule} from '@angular/core';
import {NgbModule} from "@ng-bootstrap/ng-bootstrap";
......@@ -36,6 +36,7 @@ import {ExecutionDetailComponent} from './executions/execution/execution-detail/
import {FontAwesomeModule} from "@fortawesome/angular-fontawesome";
import {LoadingComponent} from './loading/loading.component';
import {QueueSettingsComponent} from './settings/queue-settings/queue-settings.component';
import {WINDOW_PROVIDERS} from "./env/window.provider";
/*
We will 'provide' this function below to load and set the global configuration from the
......@@ -91,7 +92,7 @@ export function init_app(configService: ConfigurationService) {
useFactory: init_app,
deps: [ConfigurationService],
multi: true
}],
}, Title, WINDOW_PROVIDERS],
bootstrap: [AppComponent]
})
export class AppModule {
......
import {FactoryProvider, InjectionToken} from '@angular/core';
export const WINDOW = new InjectionToken<Window>('window');
const windowProvider: FactoryProvider = {
provide: WINDOW,
useFactory: () => window
};
export const WINDOW_PROVIDERS = [
windowProvider
]
......@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>VlassMngr2</title>
<title>VLASS Manager</title>
<base href="./">
<meta name="viewport" content="width=device-width, initial-scale=1">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment