Skip to content
Snippets Groups Projects
Commit 57680c9c authored by Daniel Nemergut's avatar Daniel Nemergut
Browse files

WS-1267 Storing and retrieving the previously selected capability from the session

parent 2cdefc16
No related branches found
No related tags found
1 merge request!1117WS-1267 Storing and retrieving the previously selected capability from the session
Pipeline #7165 passed
......@@ -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,
......
......@@ -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>
......
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 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment