PCs: identify by hostname/serial, drop the PC Number field

PCs are identified by hostname (the primary identifier) with serial as the
fallback; the assetnumber is seeded from hostname rather than a separate
"PC Number" field. PC list shows Hostname/Serial (Asset Tag column removed),
PC detail title leads with hostname.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
cproudlock
2026-06-26 12:23:37 -04:00
parent c095270d06
commit 76ca95cc57
3 changed files with 20 additions and 30 deletions

View File

@@ -15,7 +15,7 @@
<div class="hero-card">
<div class="hero-content">
<div class="hero-title">
<h1>{{ computer.assetnumber }}</h1>
<h1>{{ computer.computer?.hostname || computer.serialnumber || computer.assetnumber }}</h1>
<span v-if="identifierflags.fqdn && computer.computer?.hostname" class="hero-alias">{{ computer.computer.hostname }}</span>
</div>
<div class="hero-meta">

View File

@@ -10,36 +10,15 @@
<form v-else @submit.prevent="savePC">
<div class="form-row">
<div class="form-group">
<label for="machinenumber">PC Number *</label>
<input
id="machinenumber"
v-model="form.machinenumber"
type="text"
class="form-control"
required
/>
</div>
<div class="form-group">
<label for="alias">Alias</label>
<input
id="alias"
v-model="form.alias"
type="text"
class="form-control"
/>
</div>
</div>
<div class="form-row">
<div class="form-group" v-if="identifierflags.fqdn">
<label for="hostname">Hostname</label>
<label for="hostname">Hostname *</label>
<input
id="hostname"
v-model="form.hostname"
type="text"
class="form-control"
required
/>
<small class="form-hint">Primary identifier for the PC</small>
</div>
<div class="form-group">
@@ -53,6 +32,18 @@
</div>
</div>
<div class="form-row">
<div class="form-group">
<label for="alias">Alias</label>
<input
id="alias"
v-model="form.alias"
type="text"
class="form-control"
/>
</div>
</div>
<div class="form-row">
<div class="form-group">
<label for="machinetypeid">PC Type *</label>
@@ -402,9 +393,10 @@ async function savePC() {
try {
// One payload for the computers plugin (asset core + computer extension +
// primary IP). "PC Number" is the business identifier (assetnumber).
// primary IP). PCs are identified by hostname (fall back to serial), which
// also seeds the required unique assetnumber.
const payload = {
assetnumber: form.value.machinenumber,
assetnumber: form.value.hostname || form.value.serialnumber,
hostname: form.value.hostname || null,
serialnumber: form.value.serialnumber || null,
computertypeid: form.value.machinetypeid || null,

View File

@@ -24,7 +24,6 @@
<table>
<thead>
<tr>
<th>Asset Tag</th>
<th>Hostname</th>
<th>Serial Number</th>
<th>Type</th>
@@ -36,7 +35,6 @@
</thead>
<tbody>
<tr v-for="item in computers" :key="item.assetid">
<td>{{ item.assetnumber }}</td>
<td>{{ item.computer?.hostname || '-' }}</td>
<td class="mono">{{ item.serialnumber || '-' }}</td>
<td>{{ item.computer?.computertypename || '-' }}</td>
@@ -61,7 +59,7 @@
</td>
</tr>
<tr v-if="computers.length === 0">
<td colspan="8" style="text-align: center; color: var(--text-light);">
<td colspan="7" style="text-align: center; color: var(--text-light);">
No computers found
</td>
</tr>