1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

clean up typescript initialization

This commit is contained in:
checktheroads
2021-04-20 09:34:12 -07:00
parent 0aa8fc2fc2
commit 99f0e31810
26 changed files with 312 additions and 414 deletions

View File

@ -8,7 +8,7 @@ function isSearchButton(el: any): el is SearchFilterButton {
return el?.dataset?.searchValue ?? null !== null;
}
export function initSearchBar() {
function initSearchBar() {
const dropdown = document.getElementById('object-type-selector');
const selectedValue = document.getElementById('selected-value') as HTMLSpanElement;
const selectedType = document.getElementById('search-obj-type') as HTMLInputElement;
@ -41,7 +41,7 @@ export function initSearchBar() {
/**
* Initialize Interface Table Filter Elements.
*/
export function initInterfaceFilter() {
function initInterfaceFilter() {
for (const element of getElements<HTMLInputElement>('input.interface-filter')) {
/**
* Filter on-page table by input text.
@ -79,3 +79,9 @@ export function initInterfaceFilter() {
element.addEventListener('keyup', handleInput);
}
}
export function initSearch() {
for (const func of [initSearchBar, initInterfaceFilter]) {
func();
}
}