mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 08:58:41 +00:00
Website: Keep platform filter when navigating to another table page. (#8465)
This commit is contained in:
parent
7fbe394b94
commit
b0c8c451a2
2 changed files with 14 additions and 2 deletions
|
|
@ -35,6 +35,18 @@ parasails.registerPage('osquery-table-details', {
|
|||
|
||||
},
|
||||
mounted: async function() {
|
||||
|
||||
// Check the URL to see if a platformFilter was provided.
|
||||
if(window.location.search) {
|
||||
// https://caniuse.com/mdn-api_urlsearchparams_get
|
||||
let possibleSearchParamsToFilterBy = new URLSearchParams(window.location.search);
|
||||
let platformToFilterBy = possibleSearchParamsToFilterBy.get('platformFilter');
|
||||
// If the provided platform matches a key in the userFriendlyPlatformNames array, we'll set this.selectedPlatform.
|
||||
if(platformToFilterBy && this.userFriendlyPlatformNames[platformToFilterBy]){
|
||||
this.selectedPlatform = platformToFilterBy;
|
||||
}
|
||||
}
|
||||
|
||||
// sort the array of all tables
|
||||
this.allTables = this.allTables.sort((a, b)=>{
|
||||
if(a.title < b.title){
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
</div>
|
||||
<div class="d-flex d-lg-none pt-3" v-if="showTableNav">
|
||||
<div purpose="mobile-table-of-contents">
|
||||
<a class="d-block" :class="[tableToDisplay.title === table.title ? 'active' : '']" :href="table.url" v-for="table in filteredTables">{{table.title}} <span purpose="evented-table-icon" v-if="table.evented"><img alt="evented table" src="/images/icon-evented-12x12@2x.png" ></span></a>
|
||||
<a class="d-block" :class="[tableToDisplay.title === table.title ? 'active' : '']" :href="table.url+[selectedPlatform !== 'all' ? '?platformFilter='+encodeURIComponent(selectedPlatform) : '' ]" v-for="table in filteredTables">{{table.title}} <span purpose="evented-table-icon" v-if="table.evented"><img alt="evented table" src="/images/icon-evented-12x12@2x.png" ></span></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -59,7 +59,7 @@
|
|||
</div>
|
||||
<div style="position: relative;">
|
||||
<div purpose="table-of-contents">
|
||||
<a class="d-block" :class="[tableToDisplay.title === table.title ? 'active' : '']" :href="table.url" v-for="table in filteredTables">{{table.title}} <span purpose="evented-table-icon" v-if="table.evented"><img alt="evented table" src="/images/icon-evented-12x12@2x.png" ></span></a>
|
||||
<a class="d-block" :class="[tableToDisplay.title === table.title ? 'active' : '']" :href="table.url+[selectedPlatform !== 'all' ? '?platformFilter='+encodeURIComponent(selectedPlatform) : '' ]" v-for="table in filteredTables">{{table.title}} <span purpose="evented-table-icon" v-if="table.evented"><img alt="evented table" src="/images/icon-evented-12x12@2x.png" ></span></a>
|
||||
</div>
|
||||
<div purpose="overflow-shadow" class="d-none d-lg-block"></div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue