Skip to content

Commit

Permalink
Move nrced link feature behind feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
sggerard committed Nov 25, 2024
1 parent e28eaad commit cbe86e1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</div>

<h3>Inspections &amp; Orders</h3>
<p>
<p *ngIf="NRCEDLinkEnabled">
<button class="btn hero-btn content-btn-alt fixed-r-btn" (click)="openNRCED()" (keydown)="openNRCED()" tabIndex={0} role="button">
<div class="center">
<span>NRCED</span><i class="material-icons">link</i>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export class ComplianceTabContentComponent implements OnInit, OnDestroy {
// private fields
private sub: Subscription;

NRCEDLinkEnabled: boolean;

constructor(private route: ActivatedRoute, private logger: LoggerService, private configService: ConfigService) { }

ngOnInit(): void {
Expand All @@ -34,6 +36,7 @@ export class ComplianceTabContentComponent implements OnInit, OnDestroy {
error => this.logger.log(error),
() => this.loading = false
);
this.NRCEDLinkEnabled = this.configService.checkFeatureFlag("nrced-link","true");
}

parseData(data: {project: Project}): void {
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/app/services/config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,8 @@ export class ConfigService {
public editConfigData(configData, configId, application, pathAPI: string) {
return this.httpClient.put(`${pathAPI}/config/${application}/${configId}`, configData, {});
}

public checkFeatureFlag(flag: string, expected: string): boolean{
return this.configuration["FEATURE_FLAG"] && this.configuration["FEATURE_FLAG"][flag] === expected;
}
}

0 comments on commit cbe86e1

Please sign in to comment.