mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-12 10:38: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.
|
* Handle saved filter change event.
|
||||||
@ -7,21 +7,22 @@ import {isTruthy} from "./util";
|
|||||||
*/
|
*/
|
||||||
function handleSavedFilterChange(event: Event): void {
|
function handleSavedFilterChange(event: Event): void {
|
||||||
const savedFilter = event.currentTarget as HTMLSelectElement;
|
const savedFilter = event.currentTarget as HTMLSelectElement;
|
||||||
let baseUrl = savedFilter.baseURI.split("?")[0];
|
let baseUrl = savedFilter.baseURI.split('?')[0];
|
||||||
let preFilter = "?";
|
const preFilter = '?';
|
||||||
|
|
||||||
const selectedOptions = Array.from(savedFilter.options)
|
const selectedOptions = Array.from(savedFilter.options)
|
||||||
.filter(option => option.selected)
|
.filter(option => option.selected)
|
||||||
.map(option => `filter_id=${option.value}`)
|
.map(option => `filter_id=${option.value}`)
|
||||||
.join("&");
|
.join('&');
|
||||||
|
|
||||||
baseUrl += `${preFilter}${selectedOptions}`;
|
baseUrl += `${preFilter}${selectedOptions}`;
|
||||||
document.location.href = baseUrl;
|
document.location.href = baseUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function initSavedFilterSelect(): void {
|
export function initSavedFilterSelect(): void {
|
||||||
const savedFilterSelect = document.getElementById("id_filter_id");
|
const savedFilterSelect = document.getElementById('id_filter_id');
|
||||||
|
|
||||||
if (isTruthy(savedFilterSelect)) {
|
if (isTruthy(savedFilterSelect)) {
|
||||||
savedFilterSelect.addEventListener("change", handleSavedFilterChange);
|
savedFilterSelect.addEventListener('change', handleSavedFilterChange);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -13,7 +13,7 @@ import { initSideNav } from './sidenav';
|
|||||||
import { initDashboard } from './dashboard';
|
import { initDashboard } from './dashboard';
|
||||||
import { initRackElevation } from './racks';
|
import { initRackElevation } from './racks';
|
||||||
import { initHtmx } from './htmx';
|
import { initHtmx } from './htmx';
|
||||||
import {initSavedFilterSelect} from "./savedFiltersSelect";
|
import { initSavedFilterSelect } from "./forms/savedFiltersSelect";
|
||||||
|
|
||||||
function initDocument(): void {
|
function initDocument(): void {
|
||||||
for (const init of [
|
for (const init of [
|
||||||
|
Loading…
Reference in New Issue
Block a user