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

added feature flag for new_ui_switch #1236

Merged
merged 1 commit into from
Jul 18, 2024
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
2 changes: 1 addition & 1 deletion UI/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
limitations under the License.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<ng-container *featureFlag="'UI_SWITCH'">
<ng-container *featureFlag="'NEW_UI_SWITCH'">
<div class="ui-switch-container"
*ngIf="router.url.indexOf('authentication') === -1 && router.url.indexOf('config') === -1">
<span class="p-mr-6"> New experience (ON) | Legacy view (OFF)</span>
Expand Down
10 changes: 7 additions & 3 deletions UI/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,15 @@ export class AppComponent implements OnInit {
authorized = <boolean>true;

newUI: boolean = false;
isNewUISwitch: boolean = false;

constructor(private router: Router, private service: SharedService, private getAuth: GetAuthService, private httpService: HttpService, private primengConfig: PrimeNGConfig,
public ga: GoogleAnalyticsService, private authorisation: GetAuthorizationService, private route: ActivatedRoute, private feature: FeatureFlagsService) {
this.authorized = this.getAuth.checkAuth();
}

ngOnInit() {
if (!this.feature.isFeatureEnabled('UI_SWITCH')) {
localStorage.removeItem('newUI');
}
this.checkNewUIFlag();

this.newUI = localStorage.getItem('newUI') ? true : false;

Expand Down Expand Up @@ -92,6 +91,11 @@ export class AppComponent implements OnInit {
});
}

async checkNewUIFlag(){
this.feature.config = this.feature.loadConfig().then((res) => res);
this.isNewUISwitch = await this.feature.isFeatureEnabled('NEW_UI_SWITCH');
}

uiSwitch(event, userChange = false) {
let isChecked = event.checked;
if (isChecked) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ public enum FeatureEnum implements Feature {
GOOGLE_ANALYTICS,

@Label("Recommendations")
RECOMMENDATIONS;
RECOMMENDATIONS,

@Label("New UI")
NEW_UI_SWITCH;

public boolean isActive() {
return FeatureContext.getFeatureManager().isActive(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,9 @@ public void testDailyStandupFeatureIsActive() {
public void testRecommendationFeatureIsActive() {
assertFalse(featureManager.isActive(FeatureEnum.RECOMMENDATIONS));
}

@Test
public void testnewUIFeatureIsActive() {
assertFalse(featureManager.isActive(FeatureEnum.NEW_UI_SWITCH));
}
}
Loading