Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
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
  • Loading branch information
bytesantiago authored Aug 30, 2021
commit 73862b944fbc4b871416e6cbbcd720623e4f11eb
3 changes: 0 additions & 3 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import { HomeComponent } from './modules/home/home.component';
import { LoginComponent } from './modules/login/login.component';
import { CustomerComponent } from './modules/customer-management/pages/customer.component';
import { UsersComponent } from './modules/users/pages/users.component';
import { TechnologyReportComponent } from './modules/technology-report/pages/technology-report.component';
import { TechnologiesReportGuard } from './guards/technologies-report-guard/technologies-report.guard';

const routes: Routes = [
{
Expand All @@ -26,7 +24,6 @@ const routes: Routes = [
{ path: 'activities-management', component: ActivitiesManagementComponent },
{ path: 'customers-management', canActivate: [AdminGuard], component: CustomerComponent },
{ path: 'users', canActivate: [AdminGuard], component: UsersComponent },
{ path: 'technology-report', canActivate: [AdminGuard, TechnologiesReportGuard], component: TechnologyReportComponent },
{ path: '', pathMatch: 'full', redirectTo: 'time-clock' },
],
},
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ import { RouterTestingModule } from '@angular/router/testing';
import { Router, Routes } from '@angular/router';
import { TimeClockComponent } from '../../../time-clock/pages/time-clock.component';
import { of } from 'rxjs';
import { FeatureManagerService } from '../../feature-toggles/feature-toggle-manager.service';
import { UserInfoService } from 'src/app/modules/user/services/user-info.service';

describe('SidebarComponent', () => {
let component: SidebarComponent;
let fixture: ComponentFixture<SidebarComponent>;
let azureAdB2CServiceStubInjected;
let featureManagerServiceStubInjected: FeatureManagerService;
let userInfoService: UserInfoService;
let router;
const routes: Routes = [{ path: 'time-clock', component: TimeClockComponent }];
Expand Down Expand Up @@ -47,7 +45,6 @@ describe('SidebarComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(SidebarComponent);
azureAdB2CServiceStubInjected = TestBed.inject(AzureAdB2CService);
featureManagerServiceStubInjected = TestBed.inject(FeatureManagerService);
userInfoService = TestBed.inject(UserInfoService);
component = fixture.componentInstance;
fixture.detectChanges();
Expand Down Expand Up @@ -86,21 +83,4 @@ describe('SidebarComponent', () => {
});
});

it('List Technologies item is added when feature flag "ui-list-technologies" is enabled for user', () => {
spyOn(featureManagerServiceStubInjected, 'isToggleEnabledForUser').and.returnValue(of(true));
const itemsSidebar = [];

component.toggleListTechnologies(itemsSidebar);

expect(itemsSidebar.length).toBe(1);
});

it('List Technologies item is not added when feature flag "ui-list-technologies" is disabled for user', () => {
spyOn(featureManagerServiceStubInjected, 'isToggleEnabledForUser').and.returnValue(of(false));
const itemsSidebar = [];

component.toggleListTechnologies(itemsSidebar);

expect(itemsSidebar.length).toBe(0);
});
});
17 changes: 0 additions & 17 deletions src/app/modules/shared/components/sidebar/sidebar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export class SidebarComponent implements OnInit, OnDestroy {
ngOnInit(): void {
this.toggleSideBar();
this.sidebarItems$ = this.getSidebarItems().subscribe();
this.toggleListTechnologies(this.itemsSidebar);
this.highlightMenuOption(this.router.routerState.snapshot.url);
this.navStart.subscribe((evt) => {
this.highlightMenuOption(evt.url);
Expand Down Expand Up @@ -68,22 +67,6 @@ export class SidebarComponent implements OnInit, OnDestroy {
);
}

toggleListTechnologies(itemsSidebar: ItemSidebar[]) {
this.featureManagerService
.isToggleEnabledForUser('ui-list-technologies')
.subscribe((enabled) => {
if (enabled === true) {
const listTechnologiesItem = {
route: '/technology-report',
icon: 'fas fa-user',
text: 'Technology Report',
active: false,
};
itemsSidebar.push(listTechnologiesItem);
}
});
}

highlightMenuOption(route) {
this.itemsSidebar.map((item) => (item.active = false));
this.itemsSidebar.filter((item) => item.route === route).map((item) => (item.active = true));
Expand Down