Remediate the 2026-09-03 feature-test findings
This commit is contained in:
@@ -15,7 +15,14 @@
|
||||
placeholder="Search computers..."
|
||||
@input="debouncedSearch"
|
||||
/>
|
||||
</div>
|
||||
<!-- Retire is a soft delete and the confirm dialog promises the record
|
||||
"can be restored". The API kept that promise (?active=false lists
|
||||
them, PUT isactive restores); nothing in the UI could reach it. -->
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" v-model="showRetired" @change="loadComputers" />
|
||||
Show retired
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div v-if="loading" class="loading">Loading...</div>
|
||||
@@ -65,7 +72,15 @@
|
||||
</tr>
|
||||
<tr v-if="computers.length === 0">
|
||||
<td colspan="8" style="text-align: center; color: var(--text-light);">
|
||||
No computers found
|
||||
<!-- A 403 is not an empty result. Rendering "No computers
|
||||
found" to somebody who simply may not see them tells
|
||||
them the fleet is empty, and they go looking for the
|
||||
data rather than for the permission. -->
|
||||
<template v-if="denied">
|
||||
You do not have permission to view computers. Ask an
|
||||
administrator for the computers.view permission.
|
||||
</template>
|
||||
<template v-else>No computers found</template>
|
||||
<SearchSuggestion :suggestion="suggestion" @pick="applySuggestion" />
|
||||
</td>
|
||||
</tr>
|
||||
@@ -106,6 +121,9 @@ function applySuggestion(word) {
|
||||
setSearch(word)
|
||||
loadComputers()
|
||||
}
|
||||
const showRetired = ref(false)
|
||||
// Told apart from an empty list: see the table's empty row.
|
||||
const denied = ref(false)
|
||||
const totalPages = ref(1)
|
||||
const perPage = ref(20)
|
||||
|
||||
@@ -123,6 +141,8 @@ async function loadComputers() {
|
||||
perpage: perPage.value
|
||||
}
|
||||
if (search.value) params.search = search.value
|
||||
// active=false means "include retired", matching the API.
|
||||
if (showRetired.value) params.active = 'false'
|
||||
|
||||
const response = await computersApi.list(params)
|
||||
computers.value = response.data.data || []
|
||||
@@ -130,6 +150,7 @@ async function loadComputers() {
|
||||
totalPages.value = response.data.meta?.pagination?.totalpages || response.data.meta?.pagination?.total_pages || 1
|
||||
} catch (error) {
|
||||
console.error('Error loading computers:', error)
|
||||
denied.value = error?.response?.status === 403
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user