Filter pagination reset; catalog model retype tool
This commit is contained in:
@@ -33,13 +33,13 @@
|
||||
placeholder="Search by hostname, asset #, serial..."
|
||||
@input="debouncedSearch"
|
||||
/>
|
||||
<select v-model="vendorFilter" class="form-control" @change="loadDevices">
|
||||
<select v-model="vendorFilter" class="form-control" @change="applyFilter">
|
||||
<option value="">All Vendors</option>
|
||||
<option v-for="v in vendors" :key="v.vendorid" :value="v.vendorid">
|
||||
{{ v.vendor }}
|
||||
</option>
|
||||
</select>
|
||||
<select v-model="locationFilter" class="form-control" @change="loadDevices">
|
||||
<select v-model="locationFilter" class="form-control" @change="applyFilter">
|
||||
<option value="">All Locations</option>
|
||||
<option v-for="loc in locations" :key="loc.locationid" :value="loc.locationid">
|
||||
{{ loc.locationname }}
|
||||
@@ -193,6 +193,19 @@ async function loadLocations() {
|
||||
}
|
||||
}
|
||||
|
||||
// A filter change must go back to page 1. Selecting a filter while on page 5
|
||||
// asked the server for page 5 of a result set that now has one page, and the
|
||||
// list came back empty as though the filter matched nothing.
|
||||
//
|
||||
// setPage(1) writes the URL, which the composable's watcher picks up and
|
||||
// answers with onChange - so calling the loader as well would fetch twice.
|
||||
// Load directly only when already on page 1, where nothing changes and the
|
||||
// watcher stays silent.
|
||||
function applyFilter() {
|
||||
if (page.value > 1) setPage(1)
|
||||
else loadDevices()
|
||||
}
|
||||
|
||||
async function loadDevices() {
|
||||
loading.value = true
|
||||
try {
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
placeholder="Search subnets..."
|
||||
@input="debouncedSearch"
|
||||
/>
|
||||
<select v-model="vlanFilter" class="form-control" @change="loadSubnets">
|
||||
<select v-model="vlanFilter" class="form-control" @change="applyFilter">
|
||||
<option value="">All VLANs</option>
|
||||
<option v-for="vlan in vlans" :key="vlan.vlanid" :value="vlan.vlanid">
|
||||
VLAN {{ vlan.vlannumber }} - {{ vlan.name }}
|
||||
</option>
|
||||
</select>
|
||||
<select v-model="typeFilter" class="form-control" @change="loadSubnets">
|
||||
<select v-model="typeFilter" class="form-control" @change="applyFilter">
|
||||
<option value="">All Types</option>
|
||||
<option value="ipv4">IPv4</option>
|
||||
<option value="ipv6">IPv6</option>
|
||||
@@ -359,6 +359,19 @@ async function loadLocations() {
|
||||
}
|
||||
}
|
||||
|
||||
// A filter change must go back to page 1. Selecting a filter while on page 5
|
||||
// asked the server for page 5 of a result set that now has one page, and the
|
||||
// list came back empty as though the filter matched nothing.
|
||||
//
|
||||
// setPage(1) writes the URL, which the composable's watcher picks up and
|
||||
// answers with onChange - so calling the loader as well would fetch twice.
|
||||
// Load directly only when already on page 1, where nothing changes and the
|
||||
// watcher stays silent.
|
||||
function applyFilter() {
|
||||
if (page.value > 1) setPage(1)
|
||||
else loadSubnets()
|
||||
}
|
||||
|
||||
async function loadSubnets() {
|
||||
loading.value = true
|
||||
try {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
placeholder="Search VLANs..."
|
||||
@input="debouncedSearch"
|
||||
/>
|
||||
<select v-model="typeFilter" class="form-control" @change="loadVLANs">
|
||||
<select v-model="typeFilter" class="form-control" @change="applyFilter">
|
||||
<option value="">All Types</option>
|
||||
<option value="data">Data</option>
|
||||
<option value="voice">Voice</option>
|
||||
@@ -220,6 +220,19 @@ onMounted(() => {
|
||||
loadVLANs()
|
||||
})
|
||||
|
||||
// A filter change must go back to page 1. Selecting a filter while on page 5
|
||||
// asked the server for page 5 of a result set that now has one page, and the
|
||||
// list came back empty as though the filter matched nothing.
|
||||
//
|
||||
// setPage(1) writes the URL, which the composable's watcher picks up and
|
||||
// answers with onChange - so calling the loader as well would fetch twice.
|
||||
// Load directly only when already on page 1, where nothing changes and the
|
||||
// watcher stays silent.
|
||||
function applyFilter() {
|
||||
if (page.value > 1) setPage(1)
|
||||
else loadVLANs()
|
||||
}
|
||||
|
||||
async function loadVLANs() {
|
||||
loading.value = true
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user