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

This reverts commit 76ca95cc57.
This commit is contained in:
cproudlock
2026-06-26 12:25:32 -04:00
parent 76ca95cc57
commit 6f70575142
3 changed files with 26 additions and 16 deletions

View File

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

View File

@@ -24,6 +24,7 @@
<table>
<thead>
<tr>
<th>Asset Tag</th>
<th>Hostname</th>
<th>Serial Number</th>
<th>Type</th>
@@ -35,6 +36,7 @@
</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>
@@ -59,7 +61,7 @@
</td>
</tr>
<tr v-if="computers.length === 0">
<td colspan="7" style="text-align: center; color: var(--text-light);">
<td colspan="8" style="text-align: center; color: var(--text-light);">
No computers found
</td>
</tr>