Give a network device somewhere to put its IP

The network device form had no IP field, so the one thing people look up a
switch for could not be entered. The API had accepted an ipaddress since the
legacy import work - create, update and every read already carried it - but
nothing in the UI ever sent one, which also left the device off the "Devices on
this network" list, since that matches on the IP a device does not have.

The field sits next to Hostname and round-trips through the Communication row
the platform keeps IPs in, the same way the PC and printer forms do.

Clearing it now clears the stored address. The upsert helper returned early on a
blank value despite a docstring promising it cleared - harmless while no form
could submit one, wrong the moment this field existed.
This commit is contained in:
cproudlock
2026-08-07 10:30:38 -04:00
parent 76c184fe91
commit ed9c91c47d
3 changed files with 54 additions and 2 deletions

View File

@@ -112,6 +112,16 @@
placeholder="e.g., sw-bldg1-floor2"
/>
</div>
<div class="form-group">
<label for="ipaddress">IP Address</label>
<input
id="ipaddress"
v-model="form.ipaddress"
type="text"
class="form-control"
placeholder="e.g., 192.168.1.10"
/>
</div>
<div class="form-group">
<label for="networkdevicetypeid">Device Type</label>
<select id="networkdevicetypeid" v-model="form.networkdevicetypeid" class="form-control">
@@ -318,6 +328,7 @@ const form = ref({
locationid: '',
businessunitid: '',
hostname: '',
ipaddress: '',
networkdevicetypeid: '',
vendorid: '',
modelnumberid: '',
@@ -419,6 +430,9 @@ async function loadDevice() {
form.value.mapx = data.mapx
form.value.mapy = data.mapy
form.value.notes = data.notes || ''
// The IP lives in a Communication row, not on the extension table; the API
// flattens it onto the response as ipaddress.
form.value.ipaddress = data.ipaddress || ''
// Network device specific
if (data.networkdevice) {
@@ -453,6 +467,7 @@ async function submitForm() {
locationid: form.value.locationid || null,
businessunitid: form.value.businessunitid || null,
hostname: form.value.hostname || null,
ipaddress: form.value.ipaddress || null,
networkdevicetypeid: form.value.networkdevicetypeid || null,
vendorid: form.value.vendorid || null,
modelnumberid: form.value.modelnumberid || null,