mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-10 01:28:16 -06:00
Fixed linter issues in savedFiltersSelect.ts
This commit is contained in:
parent
02e62b4248
commit
d26c08cb4b
BIN
netbox/project-static/dist/netbox.js
vendored
BIN
netbox/project-static/dist/netbox.js
vendored
Binary file not shown.
BIN
netbox/project-static/dist/netbox.js.map
vendored
BIN
netbox/project-static/dist/netbox.js.map
vendored
Binary file not shown.
@ -1,4 +1,4 @@
|
||||
import {isTruthy} from "./util";
|
||||
import { isTruthy } from '../util';
|
||||
|
||||
/**
|
||||
* Handle saved filter change event.
|
||||
@ -7,21 +7,22 @@ import {isTruthy} from "./util";
|
||||
*/
|
||||
function handleSavedFilterChange(event: Event): void {
|
||||
const savedFilter = event.currentTarget as HTMLSelectElement;
|
||||
let baseUrl = savedFilter.baseURI.split("?")[0];
|
||||
let preFilter = "?";
|
||||
let baseUrl = savedFilter.baseURI.split('?')[0];
|
||||
const preFilter = '?';
|
||||
|
||||
const selectedOptions = Array.from(savedFilter.options)
|
||||
.filter(option => option.selected)
|
||||
.map(option => `filter_id=${option.value}`)
|
||||
.join("&");
|
||||
.join('&');
|
||||
|
||||
baseUrl += `${preFilter}${selectedOptions}`;
|
||||
document.location.href = baseUrl;
|
||||
}
|
||||
|
||||
export function initSavedFilterSelect(): void {
|
||||
const savedFilterSelect = document.getElementById("id_filter_id");
|
||||
const savedFilterSelect = document.getElementById('id_filter_id');
|
||||
|
||||
if (isTruthy(savedFilterSelect)) {
|
||||
savedFilterSelect.addEventListener("change", handleSavedFilterChange);
|
||||
savedFilterSelect.addEventListener('change', handleSavedFilterChange);
|
||||
}
|
||||
}
|
||||
}
|
@ -13,7 +13,7 @@ import { initSideNav } from './sidenav';
|
||||
import { initDashboard } from './dashboard';
|
||||
import { initRackElevation } from './racks';
|
||||
import { initHtmx } from './htmx';
|
||||
import {initSavedFilterSelect} from "./savedFiltersSelect";
|
||||
import { initSavedFilterSelect } from "./forms/savedFiltersSelect";
|
||||
|
||||
function initDocument(): void {
|
||||
for (const init of [
|
||||
|
Loading…
Reference in New Issue
Block a user