From 41bcd653332dbdeb7e5812d73520c430c7fb78a2 Mon Sep 17 00:00:00 2001 From: ievavold <ievavold@wisc.edu> Date: Mon, 20 May 2019 11:38:09 -0500 Subject: [PATCH] add DARS view feature flag --- src/app/core/header/header.component.html | 26 ++++++++++++++----- src/app/core/header/header.component.ts | 3 +++ .../core/navigation/navigation.component.html | 8 +++++- .../core/navigation/navigation.component.ts | 9 ++++--- src/environments/environment.ts | 1 + 5 files changed, 36 insertions(+), 11 deletions(-) diff --git a/src/app/core/header/header.component.html b/src/app/core/header/header.component.html index 3f42f79..703a17f 100644 --- a/src/app/core/header/header.component.html +++ b/src/app/core/header/header.component.html @@ -33,13 +33,25 @@ aria-label="degree planner" href="/degree-planner"> </myuw-drawer-link> - <myuw-drawer-link - slot="myuw-drawer-links" - name="Degree Audit (DARS)" - icon="" - aria-label="degree audit" - href="/dars"> - </myuw-drawer-link> + <ng-container *ngIf="useNewDARSView; then linkToNewDARSView else linkToOldDARSView"></ng-container> + <ng-template #linkToNewDARSView> + <myuw-drawer-link + slot="myuw-drawer-links" + name="Degree Audit (DARS)" + icon="" + aria-label="degree audit" + href="/degree-planner/dars"> + </myuw-drawer-link> + </ng-template> + <ng-template #linkToOldDARSView> + <myuw-drawer-link + slot="myuw-drawer-links" + name="Degree Audit (DARS)" + icon="" + aria-label="degree audit" + href="/dars"> + </myuw-drawer-link> + </ng-template> </myuw-drawer> <myuw-help diff --git a/src/app/core/header/header.component.ts b/src/app/core/header/header.component.ts index 5119f7c..da8eacd 100644 --- a/src/app/core/header/header.component.ts +++ b/src/app/core/header/header.component.ts @@ -13,6 +13,7 @@ import { AddAcademicYear, } from '@app/degree-planner/store/actions/ui.actions'; import { MediaMatcher } from '@angular/cdk/layout'; +import { environment } from './../../../environments/environment'; const isntUndefined = <T>(anything: T | undefined): anything is T => { return anything !== undefined; @@ -27,6 +28,7 @@ export class HeaderComponent implements OnInit { public activeRoadmapId$: Observable<number>; public mobileView: MediaQueryList; public isSidenavOpen$: Observable<boolean>; + public useNewDARSView?: boolean; constructor( private store: Store<GlobalState>, @@ -35,6 +37,7 @@ export class HeaderComponent implements OnInit { public mediaMatcher: MediaMatcher, ) { this.mobileView = mediaMatcher.matchMedia('(max-width: 959px)'); + this.useNewDARSView = environment['useNewDARSView'] === true; } ngOnInit() { diff --git a/src/app/core/navigation/navigation.component.html b/src/app/core/navigation/navigation.component.html index d2a9e1f..28eac68 100644 --- a/src/app/core/navigation/navigation.component.html +++ b/src/app/core/navigation/navigation.component.html @@ -4,7 +4,13 @@ <a mat-tab-link href="/my-courses">My Courses</a> <a mat-tab-link href="/scheduler">Scheduler</a> <a mat-tab-link class="active" href="/degree-planner">Degree Planner</a> - <a mat-tab-link href="/dars">Degree Audit (DARS)</a> + <ng-container *ngIf="useNewDARSView; then linkToNewDARSView else linkToOldDARSView"></ng-container> + <ng-template #linkToNewDARSView> + <a mat-tab-link href="/degree-planner/dars">Degree Audit (DARS)</a> + </ng-template> + <ng-template #linkToOldDARSView> + <a mat-tab-link href="/dars">Degree Audit (DARS)</a> + </ng-template> </nav> <button class="btn-feedback" aria-describedby="feedback-dialog" (click)="onFeedbackClick()">Feedback</button> </div> diff --git a/src/app/core/navigation/navigation.component.ts b/src/app/core/navigation/navigation.component.ts index 7fad9c3..eeb4257 100644 --- a/src/app/core/navigation/navigation.component.ts +++ b/src/app/core/navigation/navigation.component.ts @@ -1,6 +1,6 @@ import { Component } from '@angular/core'; import { MatDialog } from '@angular/material'; - +import { environment } from './../../../environments/environment'; import { FeedbackDialogComponent } from '@app/degree-planner/dialogs/feedback-dialog/feedback-dialog.component'; @Component({ @@ -9,9 +9,12 @@ import { FeedbackDialogComponent } from '@app/degree-planner/dialogs/feedback-di styleUrls: ['./navigation.component.scss'], }) export class NavigationComponent { - current = false; + public useNewDARSView?: boolean; + + constructor(public dialog: MatDialog) { + this.useNewDARSView = environment['useNewDARSView'] === true; + } - constructor(public dialog: MatDialog) {} public onFeedbackClick() { this.dialog.open(FeedbackDialogComponent, { closeOnNavigation: true, diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 8af2633..1c8984d 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -10,6 +10,7 @@ export const environment = { apiSearchUrl: '/api/search/v1', apiEnrollUrl: '/api/enroll/v1', snackbarDuration: 4000, + useNewDARSView: true, }; /* -- GitLab