Show the model's type only when it differs from the asset's own
Some checks failed
CI / backend (push) Failing after 7s
CI / naming (push) Successful in 2s
CI / frontend (push) Successful in 9s
CI / migrations-mysql (push) Failing after 7s

Adding a "Model type" row next to "Type" put two rows in the Hardware section
that read identically. They come from different tables - modeltypes is the
catalog-wide list spanning every kind of asset, machinetypes is machine-only -
but the names line up in practice: all 262 machines in the development database
match exactly, which is the same fact that makes the type backfill safe.

So the row now appears only when the two disagree, which is the case worth
seeing: a model catalogued as one thing fitted to an asset recorded as another.
When they agree it says nothing and is hidden. Applied to machines, PCs,
printers and network devices, each compared against its own type table.
This commit is contained in:
cproudlock
2026-08-05 10:16:21 -04:00
parent 58b460fe3d
commit 24266146d8
4 changed files with 22 additions and 12 deletions

View File

@@ -105,9 +105,13 @@
<span class="info-label">Model</span>
<span class="info-value">{{ computer.computer?.modelname || '-' }}</span>
</div>
<!-- The catalog model's own type. Kept separate from this
asset's type: modeltypes spans every kind of asset. -->
<div class="info-row" v-if="computer.computer?.modeltypename">
<!-- Only when it DIFFERS from this asset's own type. The two are
separate tables - modeltypes spans every kind of asset - but
they carry the same names in practice, so showing both
always put two identical Type rows in one section. Worth
seeing only when they disagree. -->
<div class="info-row"
v-if="computer.computer?.modeltypename && computer.computer.modeltypename !== computer.computer?.computertypename">
<span class="info-label">Model type</span>
<span class="info-value">{{ computer.computer.modeltypename }}</span>
</div>

View File

@@ -124,9 +124,13 @@
<span class="info-label">Model</span>
<span class="info-value">{{ machine.machine?.modelname || '-' }}</span>
</div>
<!-- The catalog model's own type. Kept separate from this
asset's type: modeltypes spans every kind of asset. -->
<div class="info-row" v-if="machine.machine?.modeltypename">
<!-- Only when it DIFFERS from this asset's own type. The two are
separate tables - modeltypes spans every kind of asset - but
they carry the same names in practice, so showing both
always put two identical Type rows in one section. Worth
seeing only when they disagree. -->
<div class="info-row"
v-if="machine.machine?.modeltypename && machine.machine.modeltypename !== machine.machine?.machinetypename">
<span class="info-label">Model type</span>
<span class="info-value">{{ machine.machine.modeltypename }}</span>
</div>

View File

@@ -98,9 +98,10 @@
<span class="info-label">Model</span>
<span class="info-value">{{ device.networkdevice.modelname }}</span>
</div>
<!-- The catalog model's own type, kept separate from the device
type: modeltypes spans every kind of asset. -->
<div class="info-row" v-if="device.networkdevice?.modeltypename">
<!-- Only when it DIFFERS from the device's own type: the two are
separate tables but carry the same names in practice. -->
<div class="info-row"
v-if="device.networkdevice?.modeltypename && device.networkdevice.modeltypename !== device.networkdevice?.networkdevicetypename">
<span class="info-label">Model type</span>
<span class="info-value">{{ device.networkdevice.modeltypename }}</span>
</div>

View File

@@ -49,9 +49,10 @@
<span class="hero-detail-label">Model</span>
<span class="hero-detail-value">{{ printer.printer.modelname }}</span>
</div>
<!-- The catalog model's own type, kept separate from the printer's
type: modeltypes spans every kind of asset. -->
<div class="hero-detail" v-if="printer.printer?.modeltypename">
<!-- Only when it DIFFERS from the printer's own type: the two are
separate tables but carry the same names in practice. -->
<div class="hero-detail"
v-if="printer.printer?.modeltypename && printer.printer.modeltypename !== printer.printer?.printertypename">
<span class="hero-detail-label">Model type</span>
<span class="hero-detail-value">{{ printer.printer.modeltypename }}</span>
</div>