warranty: show the machine a covered PC drives, with a map on hover
A shopfloor PC is bought, warranted and replaced as a PC, but it is FOUND by the machine it drives - nobody walks the floor looking for an asset number. The warranty tables listed the covered asset and left the reader to work out where that is. Both tables gain a Machine # column. The payload resolves it by walking the asset relationship graph in BOTH directions: the canonical edge is PC --controls--> machine, but a dual-bay pair carries controls on both bays and hand-made links are not reliably oriented. Hovering the chip shows the floor map with the machine marked, so the row answers "where do I go" without opening anything. The blueprint follows the viewer's theme and the marker is placed from mapx/mapy as a percentage of the configured map dimensions, since the preview is a few hundred pixels wide rather than the full plan. It renders only while hovered, so a long table does not build a blueprint per row. A machine with no map position still gets its chip and says so, rather than being dropped: against real data 142 PCs resolve to a machine and 125 of those are placed, so 17 rows would otherwise have silently lost their number. The chip is deliberately not a link. /machines/:id is keyed by machineid, not assetid, and resolving one to the other here would make the warranty plugin import the machines plugin (ADR-014). Worth noting separately: the existing assetLink() in these tables already sends machine-type assets to /machines/<assetid>, which is that same mismatch and predates this change.
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
<th>Service Level</th>
|
||||
<th>Ends</th>
|
||||
<th>Covers</th>
|
||||
<th>Machine #</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -53,6 +54,12 @@
|
||||
<span v-if="!w.assets.length" class="muted">-</span>
|
||||
<router-link v-for="a in w.assets" :key="a.assetid" :to="assetLink(a)" class="asset-chip" :title="a.name || a.assetnumber">{{ a.assetnumber }}</router-link>
|
||||
</td>
|
||||
<td>
|
||||
<template v-for="a in w.assets" :key="`m-${a.assetid}`">
|
||||
<MachineMapChip v-if="a.machine" :machine="a.machine" />
|
||||
</template>
|
||||
<span v-if="!w.assets.some(a => a.machine)" class="muted">-</span>
|
||||
</td>
|
||||
<td class="actions">
|
||||
<button v-if="w.provider !== 'manual'" class="btn btn-secondary btn-sm" @click="refresh(w)">Refresh</button>
|
||||
<button class="btn btn-secondary btn-sm" @click="openModal(w)">Edit</button>
|
||||
@@ -163,6 +170,7 @@ import { colorStyle } from '@/utils/colorStyle'
|
||||
import { warrantyApi, assetsApi, vendorsApi } from '@/api'
|
||||
import { useToast } from '@/composables/toast'
|
||||
import { apiError } from '@/utils/apiError'
|
||||
import MachineMapChip from '../components/MachineMapChip.vue'
|
||||
|
||||
const toast = useToast()
|
||||
const route = useRoute()
|
||||
@@ -390,7 +398,7 @@ async function refresh(w) {
|
||||
.asset-search { position: relative; }
|
||||
.asset-results {
|
||||
position: absolute; z-index: 10; left: 0; right: 0; margin: 2px 0 0;
|
||||
padding: 0; list-style: none; background: var(--bg-card);
|
||||
padding: 0; list-style: none; background: var(--bg-card-solid);
|
||||
border: 1px solid var(--border); border-radius: 6px; max-height: 200px; overflow-y: auto;
|
||||
}
|
||||
.asset-results li { padding: 0.45rem 0.6rem; cursor: pointer; }
|
||||
|
||||
Reference in New Issue
Block a user