From dba8fc607145669a05c19c2aa03fca5262c00a4d Mon Sep 17 00:00:00 2001 From: cproudlock Date: Wed, 26 Aug 2026 13:51:16 -0400 Subject: [PATCH] Let somebody retire an asset without an API call Five of the seven asset types had no way to take a record out of ShopDB from the interface. Network devices and 3D printed parts had a button; machines, PCs, printers and measuring tools did not, so a scrapped tool stayed in every list and report until somebody went to the API. The endpoints were already there and already correct. Every one of these DELETEs sets asset.isactive = False and nothing more, so the record leaves the lists while its calibration history, backups and relationships stay exactly where they were. Called "Retire" rather than "Delete" for that reason: the two existing buttons say Delete, which reads as destruction of a record that is in fact kept and can be restored by setting isactive back. The confirm says so too, because the question somebody needs answered before clicking is whether the history goes with it. The button is guarded on the record having loaded, on the two pages whose action row renders before the fetch resolves - measuring tools showed Retire beside a hidden Edit while the tool was still loading, which would have called delete with an undefined id. printersApi had no delete method at all; added. USB is deliberately left out. It retires through a status column in the external CMMC database rather than isactive, has its own /retire endpoint, and needs its own decision about what retiring means there. --- frontend/src/api/index.js | 5 ++++ plugins/computers/frontend/views/PCDetail.vue | 24 ++++++++++++++++++- .../machines/frontend/views/MachineDetail.vue | 24 ++++++++++++++++++- .../frontend/views/MeasuringToolDetail.vue | 24 ++++++++++++++++++- .../printers/frontend/views/PrinterDetail.vue | 24 ++++++++++++++++++- 5 files changed, 97 insertions(+), 4 deletions(-) diff --git a/frontend/src/api/index.js b/frontend/src/api/index.js index 0e9e54bb..d6bb4013 100644 --- a/frontend/src/api/index.js +++ b/frontend/src/api/index.js @@ -343,6 +343,11 @@ export const printersApi = { update(id, data) { return api.put(`/printers/${id}`, data) }, + // Soft delete: the server deactivates the asset, so the printer leaves every + // list while its history and relationships stay intact. + remove(id) { + return api.delete(`/printers/${id}`) + }, updateExtension(id, data) { return api.put(`/printers/${id}/printerdata`, data) }, diff --git a/plugins/computers/frontend/views/PCDetail.vue b/plugins/computers/frontend/views/PCDetail.vue index 09f7a0ba..b288c17c 100644 --- a/plugins/computers/frontend/views/PCDetail.vue +++ b/plugins/computers/frontend/views/PCDetail.vue @@ -5,6 +5,7 @@
Print Label Edit + Back to List
@@ -254,7 +255,7 @@