diff --git a/apps/web/src/app/workspaces/components/active-capability-requests/active-capability-requests.component.ts b/apps/web/src/app/workspaces/components/active-capability-requests/active-capability-requests.component.ts index 448be25131801a7a6ecad40df9a1967b13f5e6ae..0d14a02f53a0b2da47018c7d292264d408d06d1d 100644 --- a/apps/web/src/app/workspaces/components/active-capability-requests/active-capability-requests.component.ts +++ b/apps/web/src/app/workspaces/components/active-capability-requests/active-capability-requests.component.ts @@ -35,6 +35,7 @@ import {StorageService} from "../../../shared/storage/storage.service"; import { Filter } from "./components/filter-menu/filter-menu.component"; import { FormControl } from "@angular/forms"; import { PageEvent } from '@angular/material/paginator'; +import { WsHeaderComponent } from "../../ws-header/ws-header.component"; export const defaultSortOrder = "desc" @@ -385,6 +386,9 @@ export class ActiveCapabilityRequestsComponent implements OnInit, OnDestroy { }), ); + // Store the current capability selection so the header can access it + this.storageService.saveSession(WsHeaderComponent.previousCapabilityKey, this.capabilityName) + // update query parameters to new capabilityName this.router.navigate(["."], { relativeTo: this.route, diff --git a/apps/web/src/app/workspaces/ws-header/ws-header.component.html b/apps/web/src/app/workspaces/ws-header/ws-header.component.html index 1a6e9cc6d580e951d2600ed27ea384df3c77fcf1..c59dc205bbe90149f65673e2867b6402e7d58201 100644 --- a/apps/web/src/app/workspaces/ws-header/ws-header.component.html +++ b/apps/web/src/app/workspaces/ws-header/ws-header.component.html @@ -7,7 +7,7 @@ <a [routerLink]="['/', 'workspaces']" routerLinkActive="active" class="btn btn-outline-light" [routerLinkActiveOptions]="{exact: true}">Home?</a> <a [routerLink]="'analyst-board'" routerLinkActive="active" class="btn btn-outline-light">Analyst Board</a> - <a [routerLink]="'active-requests'" routerLinkActive="active" class="btn btn-outline-light">Active Requests</a> + <a [routerLink]="'active-requests'" routerLinkActive="active" class="btn btn-outline-light" (click)="goToActiveRequestsPage()" >Active Requests</a> <a [routerLink]="'jobs'" routerLinkActive="active" class="btn btn-outline-light">Jobs</a> <a [routerLink]="'email-templates'" routerLinkActive="active" class="btn btn-outline-light">Email Templates</a> </div> diff --git a/apps/web/src/app/workspaces/ws-header/ws-header.component.ts b/apps/web/src/app/workspaces/ws-header/ws-header.component.ts index 85f610f0d37cf9ad90b685c7d76a579609ca2a6b..6278c3faa6e0c6879dce37e7a3c23aed4a130129 100644 --- a/apps/web/src/app/workspaces/ws-header/ws-header.component.ts +++ b/apps/web/src/app/workspaces/ws-header/ws-header.component.ts @@ -1,5 +1,6 @@ import {Component, OnInit} from '@angular/core'; -import {ActivatedRoute} from "@angular/router"; +import {Router} from "@angular/router"; +import {StorageService} from "../../shared/storage/storage.service"; @Component({ selector: 'app-ws-header', @@ -8,8 +9,22 @@ import {ActivatedRoute} from "@angular/router"; }) export class WsHeaderComponent implements OnInit { - constructor(private route: ActivatedRoute) { + private activeRequestsPageDefaultUrl: string = "/workspaces/active-requests" + static previousCapabilityKey: string = "previousCapability" + constructor( + private router: Router, + private storageService: StorageService + ) { + } + + public goToActiveRequestsPage() { + // Set the previous capability as selected if it's found in storage + const activeRequestsPageUrl = (this.storageService.getSession(WsHeaderComponent.previousCapabilityKey)) ? + `${this.activeRequestsPageDefaultUrl}?capability=${this.storageService.getSession(WsHeaderComponent.previousCapabilityKey)}` : + `${this.activeRequestsPageDefaultUrl}` + + this.router.navigateByUrl(activeRequestsPageUrl) } ngOnInit(): void {