Skip to content

Commit 73862b9

Browse files
authored
perf: TT-316 Remove technologies-report-guard/ and remove the feature toggle ui-list-technologies (#736)
* perf: TT-316 removal of ui-list-technologies toggle, technologies-report.guard and their dependants * code-smell: TT-316 remove comments and unnecessary variable assignments * code-smell: TT-316 removal of an additional unnecessary import
1 parent 607303c commit 73862b9

File tree

5 files changed

+0
-113
lines changed

5 files changed

+0
-113
lines changed

src/app/app-routing.module.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import { HomeComponent } from './modules/home/home.component';
1111
import { LoginComponent } from './modules/login/login.component';
1212
import { CustomerComponent } from './modules/customer-management/pages/customer.component';
1313
import { UsersComponent } from './modules/users/pages/users.component';
14-
import { TechnologyReportComponent } from './modules/technology-report/pages/technology-report.component';
15-
import { TechnologiesReportGuard } from './guards/technologies-report-guard/technologies-report.guard';
1614

1715
const routes: Routes = [
1816
{
@@ -26,7 +24,6 @@ const routes: Routes = [
2624
{ path: 'activities-management', component: ActivitiesManagementComponent },
2725
{ path: 'customers-management', canActivate: [AdminGuard], component: CustomerComponent },
2826
{ path: 'users', canActivate: [AdminGuard], component: UsersComponent },
29-
{ path: 'technology-report', canActivate: [AdminGuard, TechnologiesReportGuard], component: TechnologyReportComponent },
3027
{ path: '', pathMatch: 'full', redirectTo: 'time-clock' },
3128
],
3229
},

src/app/guards/technologies-report-guard/technologies-report.guard.spec.ts

Lines changed: 0 additions & 45 deletions
This file was deleted.

src/app/guards/technologies-report-guard/technologies-report.guard.ts

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/app/modules/shared/components/sidebar/sidebar.component.spec.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@ import { RouterTestingModule } from '@angular/router/testing';
55
import { Router, Routes } from '@angular/router';
66
import { TimeClockComponent } from '../../../time-clock/pages/time-clock.component';
77
import { of } from 'rxjs';
8-
import { FeatureManagerService } from '../../feature-toggles/feature-toggle-manager.service';
98
import { UserInfoService } from 'src/app/modules/user/services/user-info.service';
109

1110
describe('SidebarComponent', () => {
1211
let component: SidebarComponent;
1312
let fixture: ComponentFixture<SidebarComponent>;
1413
let azureAdB2CServiceStubInjected;
15-
let featureManagerServiceStubInjected: FeatureManagerService;
1614
let userInfoService: UserInfoService;
1715
let router;
1816
const routes: Routes = [{ path: 'time-clock', component: TimeClockComponent }];
@@ -47,7 +45,6 @@ describe('SidebarComponent', () => {
4745
beforeEach(() => {
4846
fixture = TestBed.createComponent(SidebarComponent);
4947
azureAdB2CServiceStubInjected = TestBed.inject(AzureAdB2CService);
50-
featureManagerServiceStubInjected = TestBed.inject(FeatureManagerService);
5148
userInfoService = TestBed.inject(UserInfoService);
5249
component = fixture.componentInstance;
5350
fixture.detectChanges();
@@ -86,21 +83,4 @@ describe('SidebarComponent', () => {
8683
});
8784
});
8885

89-
it('List Technologies item is added when feature flag "ui-list-technologies" is enabled for user', () => {
90-
spyOn(featureManagerServiceStubInjected, 'isToggleEnabledForUser').and.returnValue(of(true));
91-
const itemsSidebar = [];
92-
93-
component.toggleListTechnologies(itemsSidebar);
94-
95-
expect(itemsSidebar.length).toBe(1);
96-
});
97-
98-
it('List Technologies item is not added when feature flag "ui-list-technologies" is disabled for user', () => {
99-
spyOn(featureManagerServiceStubInjected, 'isToggleEnabledForUser').and.returnValue(of(false));
100-
const itemsSidebar = [];
101-
102-
component.toggleListTechnologies(itemsSidebar);
103-
104-
expect(itemsSidebar.length).toBe(0);
105-
});
10686
});

src/app/modules/shared/components/sidebar/sidebar.component.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export class SidebarComponent implements OnInit, OnDestroy {
2929
ngOnInit(): void {
3030
this.toggleSideBar();
3131
this.sidebarItems$ = this.getSidebarItems().subscribe();
32-
this.toggleListTechnologies(this.itemsSidebar);
3332
this.highlightMenuOption(this.router.routerState.snapshot.url);
3433
this.navStart.subscribe((evt) => {
3534
this.highlightMenuOption(evt.url);
@@ -68,22 +67,6 @@ export class SidebarComponent implements OnInit, OnDestroy {
6867
);
6968
}
7069

71-
toggleListTechnologies(itemsSidebar: ItemSidebar[]) {
72-
this.featureManagerService
73-
.isToggleEnabledForUser('ui-list-technologies')
74-
.subscribe((enabled) => {
75-
if (enabled === true) {
76-
const listTechnologiesItem = {
77-
route: '/technology-report',
78-
icon: 'fas fa-user',
79-
text: 'Technology Report',
80-
active: false,
81-
};
82-
itemsSidebar.push(listTechnologiesItem);
83-
}
84-
});
85-
}
86-
8770
highlightMenuOption(route) {
8871
this.itemsSidebar.map((item) => (item.active = false));
8972
this.itemsSidebar.filter((item) => item.route === route).map((item) => (item.active = true));

0 commit comments

Comments
 (0)