Fix location dropdowns silently truncating at the 100-row backend cap

The backend clamps perpage to MAX_PAGE_SIZE (100), so location selectors that requested a large page received only the first page and still got a 200. Late-alphabet locations (past ~C5W) simply went missing from every module's dropdown, and no error surfaced.

Add locationsApi.listAll, which pages through the full set via fetchAllPages, matching the established machines/printers pattern, and switch every location selector consumer to it.
This commit is contained in:
benjamin.baker
2026-08-26 13:25:07 -04:00
parent 801dfd54ab
commit 3b3a7cf910
9 changed files with 24 additions and 16 deletions

View File

@@ -472,7 +472,7 @@ onMounted(async () => {
assetsApi.statuses.list(),
vendorsApi.list({ perpage: 100 }),
modelsApi.listAll({ category: 'PC' }), // backend caps perpage at 100; page through all
locationsApi.list({ perpage: 100 }),
locationsApi.listAll(), // backend caps perpage at 100; page through all
operatingsystemsApi.list({ perpage: 100 }),
computersApi.protocols.list(),
// Handles its own failure: a site without printers still gets a form.
@@ -482,7 +482,7 @@ onMounted(async () => {
statuses.value = statusRes.data.data || []
vendors.value = vendorRes.data.data || []
models.value = allModels
locations.value = locRes.data.data || []
locations.value = locRes || []
operatingsystems.value = osRes.data.data || []
protocols.value = protoRes.data.data || []

View File

@@ -512,7 +512,7 @@ onMounted(async () => {
machinesApi.types.list(),
assetsApi.statuses.list(),
vendorsApi.list({ perpage: 500 }),
locationsApi.list({ perpage: 500 }),
locationsApi.listAll(), // backend caps perpage at 100; page through all
modelsApi.listAll({ category: 'Equipment' }), // backend caps perpage at 100; page through all
businessunitsApi.list({ perpage: 500 }),
computersApi.listAll(), // backend caps perpage at 100; page through all
@@ -522,7 +522,7 @@ onMounted(async () => {
machineTypes.value = typesRes.data.data || []
statuses.value = statusRes.data.data || []
vendors.value = vendorRes.data.data || []
locations.value = locRes.data.data || []
locations.value = locRes || []
models.value = allModels
businessunits.value = buRes.data.data || []
// listAll resolves to the ARRAY, not a response: fetchAllPages already

View File

@@ -181,13 +181,13 @@ onMounted(async () => {
const [typesResponse, statusResponse, locResponse, buResponse, assetTypesResponse] = await Promise.all([
measuringtoolsApi.types.list({ perpage: 200 }),
assetsApi.statuses.list(),
locationsApi.list({ perpage: 500 }),
locationsApi.listAll(), // backend caps perpage at 100; page through all
businessunitsApi.list({ perpage: 500 }),
assetsApi.types.list(),
])
types.value = typesResponse.data.data || []
statuses.value = statusResponse.data.data || []
locations.value = locResponse.data.data || []
locations.value = locResponse || []
businessunits.value = buResponse.data.data || []
const assetType = (assetTypesResponse.data.data || []).find(a => a.assettype === 'measuring_tool')

View File

@@ -460,8 +460,8 @@ async function loadVendors() {
async function loadLocations() {
try {
const response = await locationsApi.list({ perpage: 100 })
locations.value = response.data.data || []
const items = await locationsApi.listAll() // backend caps perpage at 100; page through all
locations.value = items || []
} catch (err) {
console.error('Error loading locations:', err)
}

View File

@@ -197,8 +197,8 @@ async function loadVendors() {
async function loadLocations() {
try {
const response = await locationsApi.list({ perpage: 100 })
locations.value = response.data.data || []
const items = await locationsApi.listAll() // backend caps perpage at 100; page through all
locations.value = items || []
} catch (error) {
console.error('Error loading locations:', error)
}

View File

@@ -352,8 +352,8 @@ async function loadVLANs() {
async function loadLocations() {
try {
const response = await locationsApi.list({ perpage: 100 })
locations.value = response.data.data || []
const items = await locationsApi.listAll() // backend caps perpage at 100; page through all
locations.value = items || []
} catch (err) {
console.error('Error loading locations:', err)
}

View File

@@ -505,14 +505,14 @@ onMounted(async () => {
assetsApi.statuses.list(),
vendorsApi.list({ perpage: 100 }),
modelsApi.listAll({ category: 'Printer' }),
locationsApi.list({ perpage: 100 })
locationsApi.listAll() // backend caps perpage at 100; page through all
])
printerTypes.value = mtRes.data.data || []
statuses.value = statusRes.data.data || []
vendors.value = vendorRes.data.data || []
models.value = allModels
locations.value = locRes.data.data || []
locations.value = locRes || []
// Load printer if editing
if (isEdit.value) {