fix: page past the 100-row cap in batch label sheets and asset pickers
Follow-up to the application-picker fix. Three of these were already wrong on data that exists today, not merely latent. Batch label printing is the worst of them: AssetLabelBatch asked for 500 machines or PCs, got 100, and printed a sheet that looked complete. With 262 machines and 290 PCs in the catalogue that is a physically short run with no error anywhere - the operator finds out at the label printer, or later at the bay with no label on it. PrinterQRBatch, USBLabelBatch and PrintedPartsLabels had the same shape and are fixed alongside it, before their tables cross 100 too. MachineForm's "controls" PC dropdown offered the first 100 of 290, so a machine could not be linked to a PC sorting late in the list. NetworkDeviceForm had it for models, which are already past 100 - and the same file already called modelsApi.listAll() correctly two lines away. Adds listAll() to the machines, computers, printers, network, measuring-tools, USB and printed-parts APIs, all delegating to fetchAllPages(). Still outstanding: callers of vendors, locations, business units and the type catalogues that ask for more than 100. Those tables are all well under the cap today, so they are correct for now and wrong the day they are not.
This commit is contained in:
@@ -101,6 +101,13 @@ export const machinesApi = {
|
|||||||
list(params = {}) {
|
list(params = {}) {
|
||||||
return api.get('/machines', { params })
|
return api.get('/machines', { params })
|
||||||
},
|
},
|
||||||
|
// Every machine, paged past the backend's 100-row cap. Batch label printing
|
||||||
|
// and "pick any record" dropdowns must use this: list() with a large
|
||||||
|
// perpage is clamped to 100 and still returns a success response, so
|
||||||
|
// the tail simply goes missing.
|
||||||
|
listAll(params = {}) {
|
||||||
|
return fetchAllPages('/machines', params)
|
||||||
|
},
|
||||||
get(id) {
|
get(id) {
|
||||||
return api.get(`/machines/${id}`)
|
return api.get(`/machines/${id}`)
|
||||||
},
|
},
|
||||||
@@ -144,6 +151,13 @@ export const computersApi = {
|
|||||||
list(params = {}) {
|
list(params = {}) {
|
||||||
return api.get('/computers', { params })
|
return api.get('/computers', { params })
|
||||||
},
|
},
|
||||||
|
// Every PC, paged past the backend's 100-row cap. Batch label printing
|
||||||
|
// and "pick any record" dropdowns must use this: list() with a large
|
||||||
|
// perpage is clamped to 100 and still returns a success response, so
|
||||||
|
// the tail simply goes missing.
|
||||||
|
listAll(params = {}) {
|
||||||
|
return fetchAllPages('/computers', params)
|
||||||
|
},
|
||||||
displayKiosks() {
|
displayKiosks() {
|
||||||
return api.get('/computers/display-kiosks')
|
return api.get('/computers/display-kiosks')
|
||||||
},
|
},
|
||||||
@@ -292,6 +306,13 @@ export const printersApi = {
|
|||||||
list(params = {}) {
|
list(params = {}) {
|
||||||
return api.get('/printers', { params })
|
return api.get('/printers', { params })
|
||||||
},
|
},
|
||||||
|
// Every printer, paged past the backend's 100-row cap. Batch label printing
|
||||||
|
// and "pick any record" dropdowns must use this: list() with a large
|
||||||
|
// perpage is clamped to 100 and still returns a success response, so
|
||||||
|
// the tail simply goes missing.
|
||||||
|
listAll(params = {}) {
|
||||||
|
return fetchAllPages('/printers', params)
|
||||||
|
},
|
||||||
get(id) {
|
get(id) {
|
||||||
return api.get(`/printers/${id}`)
|
return api.get(`/printers/${id}`)
|
||||||
},
|
},
|
||||||
@@ -732,6 +753,13 @@ export const usbApi = {
|
|||||||
list(params = {}) {
|
list(params = {}) {
|
||||||
return api.get('/usb', { params })
|
return api.get('/usb', { params })
|
||||||
},
|
},
|
||||||
|
// Every USB device, paged past the backend's 100-row cap. Batch label printing
|
||||||
|
// and "pick any record" dropdowns must use this: list() with a large
|
||||||
|
// perpage is clamped to 100 and still returns a success response, so
|
||||||
|
// the tail simply goes missing.
|
||||||
|
listAll(params = {}) {
|
||||||
|
return fetchAllPages('/usb', params)
|
||||||
|
},
|
||||||
get(id) {
|
get(id) {
|
||||||
return api.get(`/usb/${id}`)
|
return api.get(`/usb/${id}`)
|
||||||
},
|
},
|
||||||
@@ -1065,6 +1093,13 @@ export const networkApi = {
|
|||||||
list(params = {}) {
|
list(params = {}) {
|
||||||
return api.get('/network', { params })
|
return api.get('/network', { params })
|
||||||
},
|
},
|
||||||
|
// Every network device, paged past the backend's 100-row cap. Batch label
|
||||||
|
// printing and "pick any record" dropdowns must use this: list() with a
|
||||||
|
// large perpage is clamped to 100 and still returns a success response, so
|
||||||
|
// the tail simply goes missing.
|
||||||
|
listAll(params = {}) {
|
||||||
|
return fetchAllPages('/network', params)
|
||||||
|
},
|
||||||
get(id) {
|
get(id) {
|
||||||
return api.get(`/network/${id}`)
|
return api.get(`/network/${id}`)
|
||||||
},
|
},
|
||||||
@@ -1211,6 +1246,13 @@ export const measuringtoolsApi = {
|
|||||||
list(params = {}) {
|
list(params = {}) {
|
||||||
return api.get('/measuringtools', { params })
|
return api.get('/measuringtools', { params })
|
||||||
},
|
},
|
||||||
|
// Every measuring tool, paged past the backend's 100-row cap. Batch label printing
|
||||||
|
// and "pick any record" dropdowns must use this: list() with a large
|
||||||
|
// perpage is clamped to 100 and still returns a success response, so
|
||||||
|
// the tail simply goes missing.
|
||||||
|
listAll(params = {}) {
|
||||||
|
return fetchAllPages('/measuringtools', params)
|
||||||
|
},
|
||||||
get(id) {
|
get(id) {
|
||||||
return api.get(`/measuringtools/${id}`)
|
return api.get(`/measuringtools/${id}`)
|
||||||
},
|
},
|
||||||
@@ -1254,6 +1296,11 @@ export const printedpartsApi = {
|
|||||||
list(params = {}) {
|
list(params = {}) {
|
||||||
return api.get('/printedparts/items', { params })
|
return api.get('/printedparts/items', { params })
|
||||||
},
|
},
|
||||||
|
// Every printed item, paged past the backend's 100-row cap. The label sheet
|
||||||
|
// must print the whole selection, not the first page of it.
|
||||||
|
listAll(params = {}) {
|
||||||
|
return fetchAllPages('/printedparts/items', params)
|
||||||
|
},
|
||||||
get(printeditemid) {
|
get(printeditemid) {
|
||||||
return api.get(`/printedparts/items/${printeditemid}`)
|
return api.get(`/printedparts/items/${printeditemid}`)
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -295,8 +295,10 @@ onMounted(async () => {
|
|||||||
codetype.value = (await getSetting('label_default_codetype', 'qr')) === 'barcode' ? 'barcode' : 'qr'
|
codetype.value = (await getSetting('label_default_codetype', 'qr')) === 'barcode' ? 'barcode' : 'qr'
|
||||||
encodes.value = await resolveDefaultEncodes(assettype)
|
encodes.value = await resolveDefaultEncodes(assettype)
|
||||||
try {
|
try {
|
||||||
const response = await config.api.list({ perpage: 500 })
|
// listAll, not list: perpage is clamped to 100 server-side, so a batch
|
||||||
assets.value = response.data.data || []
|
// sheet built from list() silently omitted every asset past the first
|
||||||
|
// 100 and printed a short run that looked complete.
|
||||||
|
assets.value = await config.api.listAll()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error loading assets:', err)
|
console.error('Error loading assets:', err)
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -469,7 +469,7 @@ onMounted(async () => {
|
|||||||
locationsApi.list({ perpage: 500 }),
|
locationsApi.list({ perpage: 500 }),
|
||||||
modelsApi.listAll(), // backend caps perpage at 100; page through all
|
modelsApi.listAll(), // backend caps perpage at 100; page through all
|
||||||
businessunitsApi.list({ perpage: 500 }),
|
businessunitsApi.list({ perpage: 500 }),
|
||||||
computersApi.list({ perpage: 500 }),
|
computersApi.listAll(), // backend caps perpage at 100; page through all
|
||||||
assetsApi.types.list() // Used for relationship types, will fix below
|
assetsApi.types.list() // Used for relationship types, will fix below
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|||||||
@@ -428,8 +428,9 @@ async function loadVendors() {
|
|||||||
try {
|
try {
|
||||||
const response = await vendorsApi.list({ perpage: 100 })
|
const response = await vendorsApi.list({ perpage: 100 })
|
||||||
vendors.value = response.data.data || []
|
vendors.value = response.data.data || []
|
||||||
const modelResponse = await modelsApi.list({ perpage: 500 })
|
// listAll: the models catalogue is already past the backend's 100-row
|
||||||
models.value = modelResponse.data.data || []
|
// cap, so list() left the tail of it unselectable.
|
||||||
|
models.value = await modelsApi.listAll()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error loading vendors:', err)
|
console.error('Error loading vendors:', err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,8 +78,9 @@ function labelText(item) {
|
|||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
const response = await printedpartsApi.list({ perpage: 500 })
|
// listAll: perpage is clamped to 100, and a label sheet must cover every
|
||||||
items.value = response.data.data || []
|
// item, not the first page of them.
|
||||||
|
items.value = await printedpartsApi.listAll()
|
||||||
// ?item=<id> preselects one part (the Detail-page print button)
|
// ?item=<id> preselects one part (the Detail-page print button)
|
||||||
const preselect = new URLSearchParams(window.location.search).get('item')
|
const preselect = new URLSearchParams(window.location.search).get('item')
|
||||||
if (preselect) {
|
if (preselect) {
|
||||||
|
|||||||
@@ -91,8 +91,9 @@ const pages = computed(() => {
|
|||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
const response = await printersApi.list({ perpage: 500 })
|
// listAll: perpage is clamped to 100, and a batch sheet must cover every
|
||||||
printers.value = response.data.data || []
|
// printer, not the first page of them.
|
||||||
|
printers.value = await printersApi.listAll()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error loading printers:', error)
|
console.error('Error loading printers:', error)
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -145,8 +145,9 @@ const sheetPages = computed(() => {
|
|||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
labelStyle.value = (await getSetting('usb_label_style', 'barcode')) === 'qr' ? 'qr' : 'barcode'
|
labelStyle.value = (await getSetting('usb_label_style', 'barcode')) === 'qr' ? 'qr' : 'barcode'
|
||||||
try {
|
try {
|
||||||
const response = await usbApi.list({ perpage: 500 })
|
// listAll: perpage is clamped to 100, and a batch sheet must cover every
|
||||||
devices.value = response.data.data || []
|
// device, not the first page of them.
|
||||||
|
devices.value = await usbApi.listAll()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error loading USB devices:', error)
|
console.error('Error loading USB devices:', error)
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user