Per-type board rows with shared categories, a network device IP field, and two dark-mode dialogs
This commit is contained in:
@@ -24,9 +24,13 @@ def _upsert_primary_ip(asset, ip):
|
||||
"""Create/update/clear the asset's primary IP Communication from an
|
||||
ipaddress string. No-op if the IP CommunicationType is not seeded."""
|
||||
ip = (ip or '').strip()
|
||||
if not ip:
|
||||
return
|
||||
comm = Communication.query.filter_by(assetid=asset.assetid, isprimary=True).first()
|
||||
if not ip:
|
||||
# Clearing the field clears the row's IP - it used to return early, so
|
||||
# an address could be typed but never taken back out.
|
||||
if comm:
|
||||
comm.ipaddress = None
|
||||
return
|
||||
if comm:
|
||||
comm.ipaddress = ip
|
||||
return
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user