mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-13 02:58:17 -06:00
Linter Issues
This commit is contained in:
parent
bd11411c28
commit
f573ec4244
BIN
netbox/project-static/dist/netbox.js.map
vendored
BIN
netbox/project-static/dist/netbox.js.map
vendored
Binary file not shown.
@ -7,12 +7,12 @@ import { isTruthy } from './util';
|
|||||||
*/
|
*/
|
||||||
function quickSearchEventHandler(event: Event): void {
|
function quickSearchEventHandler(event: Event): void {
|
||||||
const quicksearch = event.currentTarget as HTMLInputElement;
|
const quicksearch = event.currentTarget as HTMLInputElement;
|
||||||
const clearbtn = document.getElementById("quicksearch_clear") as HTMLAnchorElement;
|
const clearbtn = document.getElementById('quicksearch_clear') as HTMLAnchorElement;
|
||||||
if (isTruthy(clearbtn)) {
|
if (isTruthy(clearbtn)) {
|
||||||
if (quicksearch.value === "") {
|
if (quicksearch.value === '') {
|
||||||
clearbtn.classList.add("invisible");
|
clearbtn.classList.add('invisible');
|
||||||
} else {
|
} else {
|
||||||
clearbtn.classList.remove("invisible");
|
clearbtn.classList.remove('invisible');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -21,9 +21,9 @@ function quickSearchEventHandler(event: Event): void {
|
|||||||
* Clear the existing search parameters in the link to export Current View.
|
* Clear the existing search parameters in the link to export Current View.
|
||||||
*/
|
*/
|
||||||
function clearLinkParams(): void {
|
function clearLinkParams(): void {
|
||||||
const link = document.getElementById("export_current_view") as HTMLLinkElement;
|
const link = document.getElementById('export_current_view') as HTMLLinkElement;
|
||||||
let linkUpdated = link?.href.split("&")[0];
|
const linkUpdated = link?.href.split('&')[0];
|
||||||
link.setAttribute("href", linkUpdated);
|
link.setAttribute('href', linkUpdated);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,38 +37,41 @@ function handleQuickSearchParams(event: Event): void {
|
|||||||
clearLinkParams();
|
clearLinkParams();
|
||||||
|
|
||||||
if (quickSearchParameters != null) {
|
if (quickSearchParameters != null) {
|
||||||
const link = document.getElementById("export_current_view") as HTMLLinkElement;
|
const link = document.getElementById('export_current_view') as HTMLLinkElement;
|
||||||
const search_parameter = `q=${quickSearchParameters.value}`;
|
const search_parameter = `q=${quickSearchParameters.value}`;
|
||||||
const linkUpdated = link?.href + "&" + search_parameter;
|
const linkUpdated = link?.href + '&' + search_parameter;
|
||||||
link.setAttribute("href", linkUpdated);
|
link.setAttribute('href', linkUpdated);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize Quicksearch Event listener/handlers.
|
* Initialize Quicksearch Event listener/handlers.
|
||||||
*/
|
*/
|
||||||
export function initQuickSearch(): void {
|
export function initQuickSearch(): void {
|
||||||
const quicksearch = document.getElementById("quicksearch") as HTMLInputElement;
|
const quicksearch = document.getElementById('quicksearch') as HTMLInputElement;
|
||||||
const clearbtn = document.getElementById("quicksearch_clear") as HTMLAnchorElement;
|
const clearbtn = document.getElementById('quicksearch_clear') as HTMLAnchorElement;
|
||||||
if (isTruthy(quicksearch)) {
|
if (isTruthy(quicksearch)) {
|
||||||
quicksearch.addEventListener("keyup", quickSearchEventHandler, {
|
quicksearch.addEventListener('keyup', quickSearchEventHandler, {
|
||||||
passive: true
|
passive: true,
|
||||||
});
|
});
|
||||||
quicksearch.addEventListener("search", quickSearchEventHandler, {
|
quicksearch.addEventListener('search', quickSearchEventHandler, {
|
||||||
passive: true
|
passive: true,
|
||||||
});
|
});
|
||||||
quicksearch.addEventListener("change", handleQuickSearchParams);
|
quicksearch.addEventListener('change', handleQuickSearchParams);
|
||||||
|
|
||||||
if (isTruthy(clearbtn)) {
|
if (isTruthy(clearbtn)) {
|
||||||
clearbtn.addEventListener("click", async () => {
|
clearbtn.addEventListener(
|
||||||
const search = new Event('search');
|
'click',
|
||||||
quicksearch.value = '';
|
async () => {
|
||||||
await new Promise(f => setTimeout(f, 100));
|
const search = new Event('search');
|
||||||
quicksearch.dispatchEvent(search);
|
quicksearch.value = '';
|
||||||
}, {
|
await new Promise(f => setTimeout(f, 100));
|
||||||
passive: true
|
quicksearch.dispatchEvent(search);
|
||||||
})
|
},
|
||||||
|
{
|
||||||
|
passive: true,
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user