Vendor derived from catalog model; model type shown separately

This commit is contained in:
2026-08-05 10:00:08 -04:00
parent c51e86e686
commit 73940ae992
9 changed files with 217 additions and 4 deletions

View File

@@ -95,12 +95,22 @@
</div>
<div class="info-row">
<span class="info-label">Vendor</span>
<span class="info-value">{{ computer.computer?.vendorname || '-' }}</span>
<span class="info-value">
{{ computer.computer?.vendorname || '-' }}
<!-- Inherited from the catalog model, not stored on this record. -->
<small v-if="computer.computer?.vendorfrommodel" class="text-muted">(from model)</small>
</span>
</div>
<div class="info-row">
<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">
<span class="info-label">Model type</span>
<span class="info-value">{{ computer.computer.modeltypename }}</span>
</div>
<div class="info-row">
<span class="info-label">Operating System</span>
<span class="info-value">{{ computer.computer?.osname || '-' }}</span>

View File

@@ -138,6 +138,18 @@ class Computer(BaseModel):
result['modelname'] = self.model.modelnumber
if self.model.imageurl:
result['imageurl'] = self.model.imageurl
# The catalog model already knows its maker, so an asset that has a
# model but no vendor of its own is showing a blank the database can
# fill. Flagged rather than merged silently: the edit form still has
# an empty vendor box, and a page implying otherwise would be lying.
if not self.vendor and self.model.vendor:
result['vendorname'] = self.model.vendor.vendor
result['vendorfrommodel'] = True
# Exposed under its OWN name. modeltypes is the catalog-wide list
# covering every kind of asset, so it is not interchangeable with
# this asset's own type and must never be substituted for it.
if self.model.modeltype:
result['modeltypename'] = self.model.modeltype.modeltype
# Names of enabled remote-access protocols (for list badges)
result['accessprotocolnames'] = [

View File

@@ -114,12 +114,22 @@
</div>
<div class="info-row">
<span class="info-label">Vendor</span>
<span class="info-value">{{ machine.machine?.vendorname || '-' }}</span>
<span class="info-value">
{{ machine.machine?.vendorname || '-' }}
<!-- Inherited from the catalog model, not stored on this record. -->
<small v-if="machine.machine?.vendorfrommodel" class="text-muted">(from model)</small>
</span>
</div>
<div class="info-row">
<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">
<span class="info-label">Model type</span>
<span class="info-value">{{ machine.machine.modeltypename }}</span>
</div>
</div>
</div>

View File

@@ -123,6 +123,18 @@ class Machine(BaseModel):
result['modelname'] = self.model.modelnumber
if self.model.imageurl:
result['imageurl'] = self.model.imageurl
# The catalog model already knows its maker, so an asset that has a
# model but no vendor of its own is showing a blank the database can
# fill. Flagged rather than merged silently: the edit form still has
# an empty vendor box, and a page implying otherwise would be lying.
if not self.vendor and self.model.vendor:
result['vendorname'] = self.model.vendor.vendor
result['vendorfrommodel'] = True
# Exposed under its OWN name. modeltypes is the catalog-wide list
# covering every kind of asset, so it is not interchangeable with
# this asset's own type and must never be substituted for it.
if self.model.modeltype:
result['modeltypename'] = self.model.modeltype.modeltype
# Add controller info
if self.controllervendor:

View File

@@ -88,7 +88,21 @@
</div>
<div class="info-row">
<span class="info-label">Vendor</span>
<span class="info-value">{{ device.networkdevice?.vendorname || '-' }}</span>
<span class="info-value">
{{ device.networkdevice?.vendorname || '-' }}
<!-- Inherited from the catalog model, not stored on this record. -->
<small v-if="device.networkdevice?.vendorfrommodel" class="text-muted">(from model)</small>
</span>
</div>
<div class="info-row" v-if="device.networkdevice?.modelname">
<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">
<span class="info-label">Model type</span>
<span class="info-value">{{ device.networkdevice.modeltypename }}</span>
</div>
<div class="info-row">
<span class="info-label">Device Type</span>

View File

@@ -130,5 +130,17 @@ class NetworkDevice(BaseModel):
result['modelname'] = self.model.modelnumber
if self.model.imageurl:
result['imageurl'] = self.model.imageurl
# The catalog model already knows its maker, so an asset that has a
# model but no vendor of its own is showing a blank the database can
# fill. Flagged rather than merged silently: the edit form still has
# an empty vendor box, and a page implying otherwise would be lying.
if not self.vendor and self.model.vendor:
result['vendorname'] = self.model.vendor.vendor
result['vendorfrommodel'] = True
# Exposed under its OWN name. modeltypes is the catalog-wide list
# covering every kind of asset, so it is not interchangeable with
# this asset's own type and must never be substituted for it.
if self.model.modeltype:
result['modeltypename'] = self.model.modeltype.modeltype
return result

View File

@@ -39,12 +39,22 @@
<div class="hero-details">
<div class="hero-detail" v-if="printer.printer?.vendorname">
<span class="hero-detail-label">Vendor</span>
<span class="hero-detail-value">{{ printer.printer.vendorname }}</span>
<span class="hero-detail-value">
{{ printer.printer.vendorname }}
<!-- Inherited from the catalog model, not stored on this record. -->
<small v-if="printer.printer?.vendorfrommodel" class="text-muted">(from model)</small>
</span>
</div>
<div class="hero-detail" v-if="printer.printer?.modelname">
<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">
<span class="hero-detail-label">Model type</span>
<span class="hero-detail-value">{{ printer.printer.modeltypename }}</span>
</div>
<div class="hero-detail" v-if="printer.serialnumber">
<span class="hero-detail-label">Serial Number</span>
<span class="hero-detail-value mono">{{ printer.serialnumber }}</span>

View File

@@ -119,5 +119,17 @@ class Printer(BaseModel):
result['modelname'] = self.model.modelnumber
if self.model.imageurl:
result['imageurl'] = self.model.imageurl
# The catalog model already knows its maker, so an asset that has a
# model but no vendor of its own is showing a blank the database can
# fill. Flagged rather than merged silently: the edit form still has
# an empty vendor box, and a page implying otherwise would be lying.
if not self.vendor and self.model.vendor:
result['vendorname'] = self.model.vendor.vendor
result['vendorfrommodel'] = True
# Exposed under its OWN name. modeltypes is the catalog-wide list
# covering every kind of asset, so it is not interchangeable with
# this asset's own type and must never be substituted for it.
if self.model.modeltype:
result['modeltypename'] = self.model.modeltype.modeltype
return result