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-card">
<div class="hero-content"> <div class="hero-content">
<div class="hero-title"> <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> <span v-if="identifierflags.fqdn && computer.computer?.hostname" class="hero-alias">{{ computer.computer.hostname }}</span>
</div> </div>
<div class="hero-meta"> <div class="hero-meta">

View File

@@ -10,36 +10,15 @@
<form v-else @submit.prevent="savePC"> <form v-else @submit.prevent="savePC">
<div class="form-row"> <div class="form-row">
<div class="form-group"> <div class="form-group">
<label for="machinenumber">PC Number *</label> <label for="hostname">Hostname *</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>
<input <input
id="hostname" id="hostname"
v-model="form.hostname" v-model="form.hostname"
type="text" type="text"
class="form-control" class="form-control"
required
/> />
<small class="form-hint">Primary identifier for the PC</small>
</div> </div>
<div class="form-group"> <div class="form-group">
@@ -53,6 +32,18 @@
</div> </div>
</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-row">
<div class="form-group"> <div class="form-group">
<label for="machinetypeid">PC Type *</label> <label for="machinetypeid">PC Type *</label>
@@ -402,9 +393,10 @@ async function savePC() {
try { try {
// One payload for the computers plugin (asset core + computer extension + // 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 = { const payload = {
assetnumber: form.value.machinenumber, assetnumber: form.value.hostname || form.value.serialnumber,
hostname: form.value.hostname || null, hostname: form.value.hostname || null,
serialnumber: form.value.serialnumber || null, serialnumber: form.value.serialnumber || null,
computertypeid: form.value.machinetypeid || null, computertypeid: form.value.machinetypeid || null,

View File

@@ -24,7 +24,6 @@
<table> <table>
<thead> <thead>
<tr> <tr>
<th>Asset Tag</th>
<th>Hostname</th> <th>Hostname</th>
<th>Serial Number</th> <th>Serial Number</th>
<th>Type</th> <th>Type</th>
@@ -36,7 +35,6 @@
</thead> </thead>
<tbody> <tbody>
<tr v-for="item in computers" :key="item.assetid"> <tr v-for="item in computers" :key="item.assetid">
<td>{{ item.assetnumber }}</td>
<td>{{ item.computer?.hostname || '-' }}</td> <td>{{ item.computer?.hostname || '-' }}</td>
<td class="mono">{{ item.serialnumber || '-' }}</td> <td class="mono">{{ item.serialnumber || '-' }}</td>
<td>{{ item.computer?.computertypename || '-' }}</td> <td>{{ item.computer?.computertypename || '-' }}</td>
@@ -61,7 +59,7 @@
</td> </td>
</tr> </tr>
<tr v-if="computers.length === 0"> <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 No computers found
</td> </td>
</tr> </tr>