Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reflect app title in setup screens #4090

Merged
merged 1 commit into from
Jan 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/frontend/packages/core/src/core/core.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import { TruncatePipe } from './truncate.pipe';
import { UserService } from './user.service';
import { UtilsService } from './utils.service';
import { WindowRef } from './window-ref/window-ref.service';
import { APP_TITLE, appTitleFactory } from './core.types';
import { Title } from '@angular/platform-browser';

@NgModule({
imports: [
Expand Down Expand Up @@ -72,7 +74,12 @@ import { WindowRef } from './window-ref/window-ref.service';
EndpointsService,
UserService,
EntityServiceFactory,
CurrentUserPermissionsService
CurrentUserPermissionsService,
{
provide: APP_TITLE,
useFactory: appTitleFactory,
deps: [Title]
}
],
declarations: [
StatefulIconComponent,
Expand Down
9 changes: 9 additions & 0 deletions src/frontend/packages/core/src/core/core.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { InjectionToken } from '@angular/core';

import { Title } from '@angular/platform-browser';

export const APP_TITLE = new InjectionToken<string>('appTitle');

export const appTitleFactory = (titleService: Title) => {
return titleService.getTitle();
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="page-container">
<app-page-header hideMenu="true" [showHistory]="false">
<h1>Stratos Setup with Local Admin Account</h1>
<h1>{{title}} Setup with Local Admin Account</h1>
</app-page-header>
<app-show-page-header></app-show-page-header>
<div class="local-setup-wizard">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, Inject } from '@angular/core';
import { FormGroup, FormControl, Validators, ValidatorFn, AbstractControl } from '@angular/forms';
import { Observable, BehaviorSubject, of as obsof } from 'rxjs';
import { StepOnNextFunction } from '../../../shared/components/stepper/step/step.component';
Expand All @@ -9,6 +9,7 @@ import { UAASetupState, LocalAdminSetupData } from '../../../../../store/src/typ
import { AuthState } from '../../../../../store/src/reducers/auth.reducer';
import { VerifySession } from '../../../../../store/src/actions/auth.actions';
import { SetupSaveConfig } from '../../../../../store/src/actions/setup.actions';
import { APP_TITLE } from '../../../core/core.types';

@Component({
selector: 'app-local-account-wizard',
Expand All @@ -21,7 +22,7 @@ export class LocalAccountWizardComponent implements OnInit {
validateLocalAuthForm: Observable<boolean>;
applyingSetup$ = new BehaviorSubject<boolean>(false);

constructor(private store: Store<Pick<InternalAppState, 'uaaSetup' | 'auth'>>) { }
constructor(private store: Store<Pick<InternalAppState, 'uaaSetup' | 'auth'>>, @Inject(APP_TITLE) public title: string) { }

ngOnInit() {
this.passwordForm = new FormGroup({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="page-container">
<app-page-header hideMenu="true" [showHistory]="false">
<h1>Stratos Setup</h1>
<h1>{{title}} Setup</h1>
</app-page-header>
<app-show-page-header></app-show-page-header>
<div class="setup">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component } from '@angular/core';
import { APP_TITLE } from './../../../core/core.types';
import { Component, Inject } from '@angular/core';
import { Store } from '@ngrx/store';

import { RouterNav } from '../../../../../store/src/actions/router.actions';
Expand Down Expand Up @@ -33,7 +34,7 @@ export class SetupWelcomeComponent {

];

constructor(private store: Store<GeneralEntityAppState>) { }
constructor(private store: Store<GeneralEntityAppState>, @Inject(APP_TITLE) public title: string) { }

public selectionChange(tile: ITileConfig<ITileData>) {
if (tile) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="page-container">
<app-page-header hideMenu="true" [showHistory]="false">
<h1>Stratos Setup with Cloud Foundry UAA</h1>
<h1>{{title}} Setup with Cloud Foundry UAA</h1>
</app-page-header>
<app-show-page-header></app-show-page-header>
<div class="uaa-wizard">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { Component, OnInit, ViewEncapsulation, Inject } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { Store } from '@ngrx/store';
import { BehaviorSubject, Observable } from 'rxjs';
import { delay, filter, map, skipWhile, take } from 'rxjs/operators';
Expand All @@ -11,6 +10,7 @@ import { AuthState } from '../../../../../store/src/reducers/auth.reducer';
import { UAASetupState } from '../../../../../store/src/types/uaa-setup.types';
import { StepOnNextFunction } from '../../../shared/components/stepper/step/step.component';
import { SetupConsoleGetScopes, SetupSaveConfig } from '../../../../../store/src/actions/setup.actions';
import { APP_TITLE } from '../../../core/core.types';

@Component({
selector: 'app-console-uaa-wizard',
Expand All @@ -22,7 +22,8 @@ export class ConsoleUaaWizardComponent implements OnInit {

private clientRedirectURI: string;

constructor(private store: Store<Pick<InternalAppState, 'uaaSetup' | 'auth'>>, private router: Router) {
constructor(
private store: Store<Pick<InternalAppState, 'uaaSetup' | 'auth'>>, @Inject(APP_TITLE) public title: string) {
// Client Redirect URI for SSO
this.clientRedirectURI = window.location.protocol + '//' + window.location.hostname +
(window.location.port ? ':' + window.location.port : '') + '/pp/v1/auth/sso_login_callback';
Expand Down