Skip to content

Commit

Permalink
fix app title logic (#371)
Browse files Browse the repository at this point in the history
  • Loading branch information
illfixit authored Nov 25, 2024
1 parent bb6b794 commit e332338
Show file tree
Hide file tree
Showing 20 changed files with 150 additions and 34 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ please see [changelog_updates.md](docs/dev/changelog_updates.md).
- Fixed Confirm and Delete buttons' behavior in confirmation modals ([#304](https://github.com/sovity/authority-portal/issues/304))
- Fixed final step not showing when registering a central component ([#305](https://github.com/sovity/authority-portal/issues/305))
- Fixed My Organization page not updated when switching between environments ([#255](https://github.com/sovity/authority-portal/issues/255))
- Fixed Website title not updating in some scenarios [#237](https://github.com/sovity/authority-portal/issues/237)
- Fixed security vulnerabilities

### Known issues
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
* sovity GmbH - initial implementation
*/
import {Component, OnDestroy, OnInit} from '@angular/core';
import {Title} from '@angular/platform-browser';
import {Subject, interval} from 'rxjs';
import {takeUntil} from 'rxjs/operators';
import {Store} from '@ngxs/store';
import {ConnectorOverviewEntryDto} from '@sovity.de/authority-portal-client';
import {GlobalStateUtils} from 'src/app/core/global-state/global-state-utils';
import {ActiveFeatureSet} from 'src/app/core/services/config/active-feature-set';
import {SlideOverService} from 'src/app/core/services/slide-over.service';
import {sliderOverNavigation} from 'src/app/core/utils/helper';
import {getConnectorsTypeClasses} from 'src/app/core/utils/ui-utils';
Expand Down Expand Up @@ -60,7 +62,13 @@ export class AuthorityConnectorListPageComponent implements OnInit, OnDestroy {
private store: Store,
private globalStateUtils: GlobalStateUtils,
private slideOverService: SlideOverService,
) {}
private titleService: Title,
private activeFeatureSet: ActiveFeatureSet,
) {
this.activeFeatureSet.usesMdsId()
? this.titleService.setTitle('MDS Connectors')
: this.titleService.setTitle('All Connectors');
}

ngOnInit() {
this.initializeHeaderBar();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
import {Component, OnDestroy, OnInit} from '@angular/core';
import {MatDialog} from '@angular/material/dialog';
import {Title} from '@angular/platform-browser';
import {Subject} from 'rxjs';
import {takeUntil} from 'rxjs/operators';
import {Store} from '@ngxs/store';
Expand All @@ -20,6 +21,7 @@ import {
OrganizationRegistrationStatusDto,
UserRoleDto,
} from '@sovity.de/authority-portal-client';
import {ActiveFeatureSet} from 'src/app/core/services/config/active-feature-set';
import {SlideOverService} from 'src/app/core/services/slide-over.service';
import {sliderOverNavigation} from 'src/app/core/utils/helper';
import {getOrganizationRegistrationStatusClasses} from 'src/app/core/utils/ui-utils';
Expand Down Expand Up @@ -73,7 +75,13 @@ export class AuthorityOrganizationListPageComponent
public dialog: MatDialog,
private slideOverService: SlideOverService,
private globalStateUtils: GlobalStateUtils,
) {}
private titleService: Title,
private activeFeatureSet: ActiveFeatureSet,
) {
this.activeFeatureSet.usesMdsId()
? this.titleService.setTitle('MDS Organizations')
: this.titleService.setTitle('Participant Management');
}

ngOnInit() {
this.initializeHeaderBar();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
} from '@angular/core';
import {FormControl} from '@angular/forms';
import {PageEvent} from '@angular/material/paginator';
import {Title} from '@angular/platform-browser';
import {ActivatedRoute, Router} from '@angular/router';
import {Subject, distinctUntilChanged, of, switchMap, tap} from 'rxjs';
import {finalize, map, take, takeUntil} from 'rxjs/operators';
Expand Down Expand Up @@ -66,6 +67,8 @@ export class CatalogPageComponent implements OnInit, OnDestroy {
// only tracked to prevent the component from resetting
expandedFilterId = '';

catalogType = this.route.snapshot.data.catalogType;

catalogSpelling = this.activeFeatureSet.usesBritishCatalogue()
? 'Catalogue'
: 'Catalog';
Expand All @@ -78,7 +81,10 @@ export class CatalogPageComponent implements OnInit, OnDestroy {
private globalStateUtils: GlobalStateUtils,
private deploymentEnvironmentUrlSyncService: DeploymentEnvironmentUrlSyncService,
private activeFeatureSet: ActiveFeatureSet,
) {}
private titleService: Title,
) {
this.setTitle();
}

ngOnInit(): void {
this.deploymentEnvironmentUrlSyncService.updateFromUrlOnce(
Expand Down Expand Up @@ -181,6 +187,7 @@ export class CatalogPageComponent implements OnInit, OnDestroy {
.pipe(
finalize(() => {
this.changeUrlToCatalogRoot();
this.setTitle();
}),
)
.subscribe();
Expand Down Expand Up @@ -270,4 +277,15 @@ export class CatalogPageComponent implements OnInit, OnDestroy {
headerActions: [],
};
}

private setTitle() {
let title;
this.catalogType === 'my-data-offers'
? this.titleService.setTitle('My Data Offers')
: this.titleService.setTitle(
`${this.activeFeatureSet.usesMdsId() ? 'MDS ' : ''}${
this.catalogSpelling
}`,
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
import {Component, HostBinding, OnDestroy, OnInit} from '@angular/core';
import {MatDialog} from '@angular/material/dialog';
import {Title} from '@angular/platform-browser';
import {Router} from '@angular/router';
import {Subject} from 'rxjs';
import {filter, takeUntil} from 'rxjs/operators';
Expand All @@ -21,6 +22,7 @@ import {
UserRoleDto,
} from '@sovity.de/authority-portal-client';
import {GlobalStateUtils} from 'src/app/core/global-state/global-state-utils';
import {ActiveFeatureSet} from 'src/app/core/services/config/active-feature-set';
import {HeaderBarConfig} from 'src/app/shared/common/header-bar/header-bar.model';
import {ConfirmationDialogComponent} from '../../../shared/common/confirmation-dialog/confirmation-dialog.component';
import {ConfirmationDialog} from '../../../shared/common/confirmation-dialog/confirmation-dialog.model';
Expand Down Expand Up @@ -54,7 +56,13 @@ export class CentralComponentListPageComponent implements OnInit, OnDestroy {
private globalStateUtils: GlobalStateUtils,
private router: Router,
private dialog: MatDialog,
) {}
private titleService: Title,
private activeFeatureSet: ActiveFeatureSet,
) {
this.activeFeatureSet.usesMdsId()
? this.titleService.setTitle('MDS Central Components')
: this.titleService.setTitle('Central Components');
}

ngOnInit() {
this.refresh();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
* sovity GmbH - initial implementation
*/
import {Component, OnDestroy, OnInit} from '@angular/core';
import {Title} from '@angular/platform-browser';
import {ActivatedRoute} from '@angular/router';
import {Subject, takeUntil} from 'rxjs';
import {Store} from '@ngxs/store';
import {ActiveFeatureSet} from 'src/app/core/services/config/active-feature-set';
import {Reset} from '../state/control-center-organization-member-detail-page-action';
import {
ControlCenterOrganizationMemberDetailPageState,
Expand All @@ -32,7 +34,16 @@ export class ControlCenterOrganizationMemberDetailPageComponent
state: ControlCenterOrganizationMemberDetailPageState =
DEFAULT_CONTROL_CENTER_ORGANIZATION_MEMBER_DETAIL_PAGE_STATE;

constructor(private store: Store, private activatedRoute: ActivatedRoute) {}
constructor(
private store: Store,
private activatedRoute: ActivatedRoute,
private titleService: Title,
private activeFeatureSet: ActiveFeatureSet,
) {
this.activeFeatureSet.usesMdsId()
? this.titleService.setTitle('MDS Member Details')
: this.titleService.setTitle('Member Details');
}

ngOnInit(): void {
this.startRefreshingOnRouteChanges();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
* sovity GmbH - initial implementation
*/
import {Component, OnDestroy, OnInit} from '@angular/core';
import {Title} from '@angular/platform-browser';
import {Router} from '@angular/router';
import {Subject, takeUntil} from 'rxjs';
import {Store} from '@ngxs/store';
import {MemberInfo} from '@sovity.de/authority-portal-client';
import {GlobalStateUtils} from 'src/app/core/global-state/global-state-utils';
import {ActiveFeatureSet} from 'src/app/core/services/config/active-feature-set';
import {BreadcrumbService} from '../../../shared/common/portal-layout/breadcrumb/breadcrumb.service';
import {Reset} from './state/control-center-organization-members-page-action';
import {
Expand All @@ -39,7 +41,13 @@ export class ControlCenterOrganizationMembersPageComponent
private router: Router,
private breadcrumbService: BreadcrumbService,
private globalStateUtils: GlobalStateUtils,
) {}
private titleService: Title,
private activeFeatureSet: ActiveFeatureSet,
) {
this.activeFeatureSet.usesMdsId()
? this.titleService.setTitle('MDS Users and Roles')
: this.titleService.setTitle('Users and Roles');
}

ngOnInit(): void {
this.refresh();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
* sovity GmbH - initial implementation
*/
import {Component, OnDestroy, OnInit} from '@angular/core';
import {Title} from '@angular/platform-browser';
import {Subject, takeUntil} from 'rxjs';
import {Store} from '@ngxs/store';
import {GlobalStateUtils} from 'src/app/core/global-state/global-state-utils';
import {ActiveFeatureSet} from 'src/app/core/services/config/active-feature-set';
import {Reset} from '../state/control-center-organization-profile-page-action';
import {
ControlCenterOrganizationProfilePageState,
Expand All @@ -34,7 +36,13 @@ export class ControlCenterOrganizationProfilePageComponent
constructor(
private store: Store,
private globalStateUtils: GlobalStateUtils,
) {}
private titleService: Title,
private activeFeatureSet: ActiveFeatureSet,
) {
this.activeFeatureSet.usesMdsId()
? this.titleService.setTitle('MDS My Organization')
: this.titleService.setTitle('My Organization');
}

ngOnInit(): void {
this.refresh();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
* sovity GmbH - initial implementation
*/
import {Component, OnDestroy, OnInit} from '@angular/core';
import {Title} from '@angular/platform-browser';
import {Subject, takeUntil} from 'rxjs';
import {Store} from '@ngxs/store';
import {GlobalStateUtils} from 'src/app/core/global-state/global-state-utils';
import {ActiveFeatureSet} from 'src/app/core/services/config/active-feature-set';
import {Reset} from '../state/control-center-user-profile-page-action';
import {
ControlCenterUserProfilePageState,
Expand All @@ -34,7 +36,13 @@ export class ControlCenterUserProfilePageComponent
constructor(
private store: Store,
private globalStateUtils: GlobalStateUtils,
) {}
private titleService: Title,
private activeFeatureSet: ActiveFeatureSet,
) {
this.activeFeatureSet.usesMdsId()
? this.titleService.setTitle('MDS My Profile')
: this.titleService.setTitle('My Profile');
}

ngOnInit(): void {
this.refresh();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* sovity GmbH - initial implementation
*/
import {Component, Inject, OnDestroy, OnInit} from '@angular/core';
import {Title} from '@angular/platform-browser';
import {Subject} from 'rxjs';
import {map, switchMap, takeUntil} from 'rxjs/operators';
import {
Expand All @@ -19,6 +20,7 @@ import {
} from '@sovity.de/authority-portal-client';
import {ApiService} from 'src/app/core/api/api.service';
import {GlobalStateUtils} from 'src/app/core/global-state/global-state-utils';
import {ActiveFeatureSet} from 'src/app/core/services/config/active-feature-set';
import {APP_CONFIG, AppConfig} from 'src/app/core/services/config/app-config';
import {Fetched} from 'src/app/core/utils/fetched';
import {HeaderBarConfig} from 'src/app/shared/common/header-bar/header-bar.model';
Expand All @@ -43,7 +45,13 @@ export class DashboardPageComponent implements OnInit, OnDestroy {
@Inject(APP_CONFIG) public appConfig: AppConfig,
private globalStateUtils: GlobalStateUtils,
private apiService: ApiService,
) {}
private titleService: Title,
private activeFeatureSet: ActiveFeatureSet,
) {
this.activeFeatureSet.usesMdsId()
? this.titleService.setTitle('MDS Dashboard')
: this.titleService.setTitle('Dashboard');
}

ngOnInit(): void {
this.fetchDashboardPageData();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* sovity GmbH - initial implementation
*/
import {Component, OnDestroy, OnInit} from '@angular/core';
import {Title} from '@angular/platform-browser';
import {Subject} from 'rxjs';
import {Store} from '@ngxs/store';
import {GlobalState} from 'src/app/core/global-state/global-state';
Expand All @@ -25,7 +26,9 @@ export class LoadingPageComponent implements OnInit, OnDestroy {

private ngOnDestroy$ = new Subject();

constructor(private store: Store) {}
constructor(private store: Store, private titleService: Title) {
this.titleService.setTitle('Error');
}

ngOnInit() {
this.startListeningToGlobalState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@
* sovity GmbH - initial implementation
*/
import {Component} from '@angular/core';
import {Title} from '@angular/platform-browser';

@Component({
selector: 'app-page-not-found',
templateUrl: './page-not-found-page.component.html',
})
export class PageNotFoundPageComponent {}
export class PageNotFoundPageComponent {
constructor(private titleService: Title) {
this.titleService.setTitle('404 - Page Not Found');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,20 @@
* sovity GmbH - initial implementation
*/
import {Component, Inject} from '@angular/core';
import {Title} from '@angular/platform-browser';
import {APP_CONFIG, AppConfig} from 'src/app/core/services/config/app-config';

@Component({
selector: 'app-unauthenticated-page',
templateUrl: './unauthenticated-page.component.html',
})
export class UnauthenticatedPageComponent {
constructor(@Inject(APP_CONFIG) public appConfig: AppConfig) {}
constructor(
@Inject(APP_CONFIG) public appConfig: AppConfig,
private titleService: Title,
) {
this.titleService.setTitle('Unauthenticated');
}

get loginUrl(): string {
const url = new URL(this.appConfig.loginUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* sovity GmbH - initial implementation
*/
import {Component, OnDestroy, OnInit} from '@angular/core';
import {Title} from '@angular/platform-browser';
import {Router} from '@angular/router';
import {Subject, interval} from 'rxjs';
import {takeUntil} from 'rxjs/operators';
Expand All @@ -20,6 +21,7 @@ import {
UserRoleDto,
} from '@sovity.de/authority-portal-client';
import {GlobalStateUtils} from 'src/app/core/global-state/global-state-utils';
import {ActiveFeatureSet} from 'src/app/core/services/config/active-feature-set';
import {SlideOverService} from 'src/app/core/services/slide-over.service';
import {sliderOverNavigation} from 'src/app/core/utils/helper';
import {getConnectorsTypeClasses} from 'src/app/core/utils/ui-utils';
Expand Down Expand Up @@ -69,7 +71,13 @@ export class ParticipantOwnConnectorListPageComponent
private globalStateUtils: GlobalStateUtils,
private router: Router,
private slideOverService: SlideOverService,
) {}
private titleService: Title,
private activeFeatureSet: ActiveFeatureSet,
) {
this.activeFeatureSet.usesMdsId()
? this.titleService.setTitle('MDS Connectors')
: this.titleService.setTitle('Connectors');
}

ngOnInit() {
this.initializeHeaderBar();
Expand Down
Loading

0 comments on commit e332338

Please sign in to comment.