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-card">
<div class="hero-content"> <div class="hero-content">
<div class="hero-title"> <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> <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,22 +10,21 @@
<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="hostname">Hostname *</label> <label for="machinenumber">PC Number *</label>
<input <input
id="hostname" id="machinenumber"
v-model="form.hostname" v-model="form.machinenumber"
type="text" type="text"
class="form-control" class="form-control"
required required
/> />
<small class="form-hint">Primary identifier for the PC</small>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="serialnumber">Serial Number</label> <label for="alias">Alias</label>
<input <input
id="serialnumber" id="alias"
v-model="form.serialnumber" v-model="form.alias"
type="text" type="text"
class="form-control" class="form-control"
/> />
@@ -33,11 +32,21 @@
</div> </div>
<div class="form-row"> <div class="form-row">
<div class="form-group"> <div class="form-group" v-if="identifierflags.fqdn">
<label for="alias">Alias</label> <label for="hostname">Hostname</label>
<input <input
id="alias" id="hostname"
v-model="form.alias" 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" type="text"
class="form-control" class="form-control"
/> />
@@ -393,10 +402,9 @@ 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). PCs are identified by hostname (fall back to serial), which // primary IP). "PC Number" is the business identifier (assetnumber).
// also seeds the required unique assetnumber.
const payload = { const payload = {
assetnumber: form.value.hostname || form.value.serialnumber, assetnumber: form.value.machinenumber,
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,6 +24,7 @@
<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>
@@ -35,6 +36,7 @@
</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>
@@ -59,7 +61,7 @@
</td> </td>
</tr> </tr>
<tr v-if="computers.length === 0"> <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 No computers found
</td> </td>
</tr> </tr>