Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
perf: TT-316 removal of ui-list-technologies toggle, technologies-rep…
…ort.guard and their dependants
  • Loading branch information
bytesantiago committed Aug 24, 2021
commit a4d5745488ba787c1c0b7256bdbc35d5d297253d
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 @@ -86,21 +86,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);
});
});
18 changes: 1 addition & 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,7 @@ export class SidebarComponent implements OnInit, OnDestroy {
ngOnInit(): void {
this.toggleSideBar();
this.sidebarItems$ = this.getSidebarItems().subscribe();
this.toggleListTechnologies(this.itemsSidebar);
// 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 +68,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