diff --git a/plugins/computers/frontend/views/PCDetail.vue b/plugins/computers/frontend/views/PCDetail.vue
index 820aa606..af6986d2 100644
--- a/plugins/computers/frontend/views/PCDetail.vue
+++ b/plugins/computers/frontend/views/PCDetail.vue
@@ -9,9 +9,9 @@
look like a peer of printing a sticker. -->
Print Label
- Edit
+ Edit
- Back to List
+ {{ returnLabel }}
@@ -376,6 +376,14 @@ const toast = useToast()
const authStore = useAuthStore()
const { isEnabled } = useIdentifierFlags()
+// Return-navigation origin. Fleet opens this page with ?from=fleet so Back,
+// Edit, and Retire all lead back to Fleet; every other entry path falls back
+// to the PCs list.
+const fromFleet = computed(() => route.query.from === 'fleet')
+const fromQuery = computed(() => (fromFleet.value ? '?from=fleet' : ''))
+const returnTo = computed(() => (fromFleet.value ? '/endpoints' : '/pcs'))
+const returnLabel = computed(() => (fromFleet.value ? 'Back to Fleet' : 'Back to List'))
+
const loading = ref(true)
const computer = ref(null)
// Liveness for the triage band. Null when the endpoints plugin is absent, or
@@ -643,7 +651,7 @@ async function confirmRetire() {
try {
await computersApi.delete(route.params.id)
toast.success(`Retired ${label}`)
- router.push('/pcs')
+ router.push(returnTo.value)
} catch (error) {
console.error('Error retiring PC:', error)
toast.error(apiError(error, 'Failed to retire PC'))
diff --git a/plugins/computers/frontend/views/PCForm.vue b/plugins/computers/frontend/views/PCForm.vue
index 0f3a0eb8..6924908f 100644
--- a/plugins/computers/frontend/views/PCForm.vue
+++ b/plugins/computers/frontend/views/PCForm.vue
@@ -353,7 +353,7 @@
- Cancel
+ Cancel
@@ -385,6 +385,11 @@ const router = useRouter()
const isEdit = computed(() => !!route.params.id)
+// Return-navigation origin, threaded through from Fleet via ?from=fleet so
+// Cancel and a successful Save land back on Fleet; every other entry path
+// falls back to the PCs list.
+const returnTo = computed(() => (route.query.from === 'fleet' ? '/endpoints' : '/pcs'))
+
// Seeded asset-type id for computers (see /api/assets/types). Custom-field
// values are keyed by the underlying asset id, captured on load / create.
const COMPUTER_ASSETTYPEID = 2
@@ -685,7 +690,7 @@ async function savePC() {
}
}
- router.push('/pcs')
+ router.push(returnTo.value)
} catch (err) {
console.error('Error saving PC:', err)
error.value = apiError(err, 'Failed to save PC')
diff --git a/plugins/endpoints/frontend/views/EndpointsList.vue b/plugins/endpoints/frontend/views/EndpointsList.vue
index 66a210a0..b7e8bb62 100644
--- a/plugins/endpoints/frontend/views/EndpointsList.vue
+++ b/plugins/endpoints/frontend/views/EndpointsList.vue
@@ -342,7 +342,9 @@ async function loadEndpoints() {
// navigates when it resolved to a computerid.
function openPc(item) {
if (item.computerid) {
- router.push(`/pcs/${item.computerid}`)
+ // Tag the origin so PC Details and the edit form return here (Fleet)
+ // instead of the PCs list. Absent for the normal PCs-list entry path.
+ router.push(`/pcs/${item.computerid}?from=fleet`)
}
}