Skip to content

Commit

Permalink
GB3-1684: use featureFlags for koplaItem
Browse files Browse the repository at this point in the history
  • Loading branch information
TIL-EBP committed Dec 9, 2024
1 parent c75d20d commit 7e2e2f1
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,18 @@
<mat-icon>launch</mat-icon>
Geodatenshop</a
>
@if (isIntranetHost) {
<a
class="navbar__item"
href="https://gdi.zh.ch/portal/home/"
mat-button
target="_blank"
rel="noopener noreferrer"
matTooltip="Kollaborationsplattform"
>
<mat-icon>launch</mat-icon>
KoPla</a
>
}
<a
class="navbar__item"
href="https://gdi.zh.ch/portal/home/"
mat-button
target="_blank"
rel="noopener noreferrer"
matTooltip="Kollaborationsplattform"
*featureFlag="'koPlaNavItem'"
>
<mat-icon>launch</mat-icon>
KoPla</a
>
</div>
</mat-card-content>
</mat-card>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {Subscription, tap} from 'rxjs';
import {MainPage} from 'src/app/shared/enums/main-page.enum';
import {selectIsAuthenticated, selectUserName} from 'src/app/state/auth/reducers/auth-status.reducer';
import {AuthStatusActions} from '../../../../state/auth/actions/auth-status.actions';
import {ConfigService} from '../../../services/config.service';

@Component({
selector: 'navbar-mobile-dialog',
Expand All @@ -16,7 +15,6 @@ export class NavbarMobileDialogComponent implements OnInit, OnDestroy {
protected readonly mainPageEnum = MainPage;
public isAuthenticated: boolean = false;
public userName?: string;
public isIntranetHost: boolean = false;

private readonly subscriptions = new Subscription();
private readonly userName$ = this.store.select(selectUserName);
Expand All @@ -25,10 +23,7 @@ export class NavbarMobileDialogComponent implements OnInit, OnDestroy {
constructor(
private readonly dialogRef: MatDialogRef<NavbarMobileDialogComponent>,
private readonly store: Store,
private readonly configService: ConfigService,
) {
this.isIntranetHost = this.configService.isIntranetHost();
}
) {}

public ngOnInit() {
this.initSubscriptions();
Expand Down
25 changes: 12 additions & 13 deletions src/app/shared/components/navbar/navbar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,18 @@
<mat-icon>launch</mat-icon>
Geodatenshop
</a>
@if (isIntranetHost) {
<a
class="navbar__item"
href="https://gdi.zh.ch/portal/home/"
mat-button
target="_blank"
rel="noopener noreferrer"
matTooltip="Kollaborationsplattform"
>
<mat-icon>launch</mat-icon>
KoPla
</a>
}
<a
class="navbar__item"
href="https://gdi.zh.ch/portal/home/"
mat-button
target="_blank"
rel="noopener noreferrer"
matTooltip="Kollaborationsplattform"
*featureFlag="'koPlaNavItem'"
>
<mat-icon>launch</mat-icon>
KoPla
</a>
<mat-divider class="navbar__divider" vertical></mat-divider>
@if (!isAuthenticated) {
<button (click)="startLogin()" class="navbar__item navbar__item--button" mat-button>
Expand Down
7 changes: 1 addition & 6 deletions src/app/shared/components/navbar/navbar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {ScreenMode} from '../../types/screen-size.type';
import {NavbarMobileDialogComponent} from '../navbar-mobile/navbar-mobile-dialog/navbar-mobile-dialog.component';
import {PanelClass} from '../../enums/panel-class.enum';
import {MatDialog} from '@angular/material/dialog';
import {ConfigService} from '../../services/config.service';

@Component({
selector: 'navbar',
Expand All @@ -23,7 +22,6 @@ export class NavbarComponent implements OnInit, OnDestroy {
public userName?: string;
public scrollbarWidth: number = 0;
public screenMode: ScreenMode = 'regular';
public isIntranetHost: boolean = false;

protected readonly mainPageEnum = MainPage;

Expand All @@ -36,10 +34,7 @@ export class NavbarComponent implements OnInit, OnDestroy {
constructor(
private readonly store: Store,
private readonly dialog: MatDialog,
private readonly configService: ConfigService,
) {
this.isIntranetHost = this.configService.isIntranetHost();
}
) {}

public ngOnInit() {
this.initSubscriptions();
Expand Down
1 change: 1 addition & 0 deletions src/app/shared/configs/feature-flags.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export const defaultFeatureFlags: FeatureFlags = {
oerebExtract: false,
ownershipInformation: false,
iframeShareLink: true,
koPlaNavItem: false,
};
4 changes: 3 additions & 1 deletion src/app/shared/configs/runtime.prod.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ export const defaultRuntimeConfig: RuntimeConfig[] = [
clientId: 'gb3',
issuer: 'https://web.maps.zh.ch/',
},
featureFlags: {},
featureFlags: {
koPlaNavItem: true,
},
overrides: {},
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ export const defaultRuntimeConfig: RuntimeConfig[] = [
clientId: 'gb3',
issuer: 'https://web.maps.zh.ch/',
},
featureFlags: {},
featureFlags: {
koPlaNavItem: true,
},
overrides: {
overrideWmsUrl: 'https://web.wms.zh.ch',
},
Expand Down
4 changes: 3 additions & 1 deletion src/app/shared/configs/runtime.staging.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ export const defaultRuntimeConfig: RuntimeConfig[] = [
clientId: 'gb3',
issuer: 'https://testmaps.kt.ktzh.ch/',
},
featureFlags: {},
featureFlags: {
koPlaNavItem: true,
},
overrides: {
overrideWmsUrl: 'http://testwms.kt.ktzh.ch',
},
Expand Down
1 change: 1 addition & 0 deletions src/app/shared/configs/runtime.uat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export const defaultRuntimeConfig: RuntimeConfig[] = [
},
featureFlags: {
iframeShareLink: true,
koPlaNavItem: true,
},
overrides: {
overrideWmsUrl: 'http://uatwms.kt.ktzh.ch',
Expand Down
1 change: 1 addition & 0 deletions src/app/shared/interfaces/feature-flags.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export interface FeatureFlags {
oerebExtract: boolean;
ownershipInformation: boolean;
iframeShareLink: boolean;
koPlaNavItem: boolean;
}
4 changes: 0 additions & 4 deletions src/app/shared/services/config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,6 @@ export class ConfigService {
return this.searchIndexConfig.filter((searchIndex) => searchIndexTypes.includes(searchIndex.indexType));
}

public isIntranetHost(): boolean {
return this.document.location.host.includes('ktzh');
}

/**
* Extracts the hostname from Document.location, also removing any port mappings.
*
Expand Down
3 changes: 2 additions & 1 deletion src/app/shared/shared.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {LayerTooltipPipe} from './pipes/layer-tooltip.pipe';
import {Gb2ExitButtonComponent} from './components/external-link-button/gb2-exit-button.component';
import {TypedTourAnchorDirective} from './directives/typed-tour-anchor.directive';
import {ClickOnSpaceBarDirective} from './directives/click-on-spacebar.directive';
import {FeatureFlagDirective} from './directives/feature-flag.directive';

@NgModule({
declarations: [
Expand Down Expand Up @@ -72,7 +73,7 @@ import {ClickOnSpaceBarDirective} from './directives/click-on-spacebar.directive
Gb2ExitButtonComponent,
TypedTourAnchorDirective,
],
imports: [MaterialModule, RouterModule, CommonModule, ResizableModule, ClickOnSpaceBarDirective, NgOptimizedImage],
imports: [MaterialModule, RouterModule, CommonModule, ResizableModule, ClickOnSpaceBarDirective, NgOptimizedImage, FeatureFlagDirective],
exports: [
MaterialModule,
ResizableModule,
Expand Down

0 comments on commit 7e2e2f1

Please sign in to comment.