Skip to content

Commit

Permalink
added mobile deployment type filter button. added ability to link dir…
Browse files Browse the repository at this point in the history
…ectly to filtered results via query params
  • Loading branch information
joshsjurik committed Jan 6, 2025
1 parent f775477 commit d40ee94
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ <h3 class="card-title col-12 mb-0">
<!-- Filters -->
<div class="mx-auto">
<span class="my-auto mr-3">Filter Buttons:</span>
<button role="button" name="itMobileBttn" class="btn btn-primary"
(click)="changeFilter('DeploymentType', 'Mobile')">Mobile</button>
<button role="button" name="itDesktopBttn" class="btn btn-primary"
(click)="changeFilter('DeploymentType', 'Desktop')">Desktop</button>
<button role="button" name="itServerBttn" class="btn btn-primary"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,13 @@ export class ItStandardsComponent implements OnInit {
});
}
});

this.route.queryParamMap.subscribe(param => {
param.keys.forEach(key => {
let capKey = key[0].toUpperCase() + key.slice(1);
this.changeFilter(capKey, param.get(key), true);
});
});
}

// Create new IT Standard when in GEAR Manager mode
Expand All @@ -323,7 +330,10 @@ export class ItStandardsComponent implements OnInit {
}

// Update table from filter buttons
changeFilter(field: string, term: string) {
changeFilter(field: string, term: string, paramAlreadySet = false) {
if(!paramAlreadySet){
this.setQueryParams(field, term);
}
this.sharedService.disableStickyHeader("itStandardsTable");
this.filteredTable = true; // Filters are on, expose main table button
var filter = {};
Expand All @@ -344,6 +354,7 @@ export class ItStandardsComponent implements OnInit {
}

backToMainIT() {
this.removeQueryParams();
this.sharedService.disableStickyHeader("itStandardsTable");
this.filteredTable = false; // Hide main button

Expand All @@ -366,4 +377,21 @@ export class ItStandardsComponent implements OnInit {
}
return '';
}

removeQueryParams() {
const queryParms = {
queryParams: {}
}
this.router.navigate([], queryParms);
}

setQueryParams(key: string, value: any): void {
this.removeQueryParams();
this.router.navigate([], {
relativeTo: this.route,
queryParams: { [key]: value },
queryParamsHandling: 'merge' // Preserve existing query params
});
//}
}
}

0 comments on commit d40ee94

Please sign in to comment.