Remediate the 2026-09-03 feature-test findings
This commit is contained in:
@@ -10,11 +10,21 @@
|
||||
<div class="header-actions">
|
||||
<router-link :to="`/print/asset-label/computer/${$route.params.id}`" class="btn btn-secondary" target="_blank">Print Label</router-link>
|
||||
<router-link :to="`/pcs/${$route.params.id}/edit${fromQuery}`" class="btn btn-primary">Edit</router-link>
|
||||
<button @click="confirmRetire" class="btn btn-danger">Retire</button>
|
||||
<button v-if="!isRetired" @click="confirmRetire" class="btn btn-danger">Retire</button>
|
||||
<!-- A retired record offered Edit and Retire exactly like a live
|
||||
one, and nothing said it was retired. Restoring it was possible
|
||||
through the API and nowhere in the product. -->
|
||||
<button v-if="isRetired" @click="restore" class="btn btn-primary">Restore</button>
|
||||
<router-link :to="returnTo" class="btn btn-secondary">{{ returnLabel }}</router-link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="computer && computer.isactive === false" class="retired-banner card">
|
||||
<strong>This PC is retired.</strong>
|
||||
It stays out of every list and report, and its history and relationships
|
||||
are intact. Restore puts it back.
|
||||
</div>
|
||||
|
||||
<div v-if="loading" class="loading">Loading...</div>
|
||||
|
||||
<template v-else-if="computer">
|
||||
@@ -644,6 +654,21 @@ async function confirmRestart() {
|
||||
// Retire, not delete: the server deactivates the asset, so the PC
|
||||
// leaves every list and report while its history and relationships stay put.
|
||||
// Reversible by an admin setting isactive back to true.
|
||||
const isRetired = computed(() => computer.value?.isactive === false)
|
||||
|
||||
async function restore() {
|
||||
const label = computer.value?.assetnumber || computer.value?.name || 'this PC'
|
||||
try {
|
||||
await computersApi.update(route.params.id, { isactive: true })
|
||||
toast.success(`Restored ${label}`)
|
||||
const response = await computersApi.get(route.params.id)
|
||||
computer.value = response.data.data
|
||||
} catch (error) {
|
||||
console.error('Error restoring:', error)
|
||||
toast.error(apiError(error, 'Failed to restore'))
|
||||
}
|
||||
}
|
||||
|
||||
async function confirmRetire() {
|
||||
const label = computer.value?.assetnumber || computer.value?.name || 'this PC'
|
||||
if (!confirm(`Retire ${label}?\n\nIt will no longer appear in ShopDB. `
|
||||
@@ -660,6 +685,10 @@ async function confirmRetire() {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.retired-banner {
|
||||
border-left: 3px solid var(--warning);
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
.portal-link {
|
||||
font-size: 0.78rem;
|
||||
margin-left: 0.5rem;
|
||||
|
||||
Reference in New Issue
Block a user