From 97910aa1784b90f11442a7d990f8abdeb33e5d5c Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Mon, 11 May 2026 16:42:18 -0500 Subject: [PATCH] fix(gaiia): correct mac_address to if_phys_address in inventory_creator Also guard against empty model_id form submission. --- lib/towerops/gaiia/inventory_creator.ex | 4 ++-- lib/towerops_web/live/org/gaiia_reconciliation_live.ex | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/towerops/gaiia/inventory_creator.ex b/lib/towerops/gaiia/inventory_creator.ex index 609e19b2..d319f8d4 100644 --- a/lib/towerops/gaiia/inventory_creator.ex +++ b/lib/towerops/gaiia/inventory_creator.ex @@ -206,8 +206,8 @@ defmodule Towerops.Gaiia.InventoryCreator do from(s in Towerops.Snmp.Interface, join: sd in SnmpDevice, on: s.snmp_device_id == sd.id, - where: sd.device_id == ^device.id and not is_nil(s.mac_address) and s.mac_address != "", - select: s.mac_address, + where: sd.device_id == ^device.id and not is_nil(s.if_phys_address) and s.if_phys_address != "", + select: s.if_phys_address, limit: 1 ) ) diff --git a/lib/towerops_web/live/org/gaiia_reconciliation_live.ex b/lib/towerops_web/live/org/gaiia_reconciliation_live.ex index a32bec46..7ec462b3 100644 --- a/lib/towerops_web/live/org/gaiia_reconciliation_live.ex +++ b/lib/towerops_web/live/org/gaiia_reconciliation_live.ex @@ -103,6 +103,10 @@ defmodule ToweropsWeb.Org.GaiiaReconciliationLive do {:noreply, socket} end + def handle_event("create_gaiia_item", %{"device_id" => _, "model_id" => ""}, socket) do + {:noreply, put_flash(socket, :warning, t("Please select a model."))} + end + def handle_event("create_gaiia_item", %{"device_id" => device_id, "model_id" => model_id}, socket) do org_id = socket.assigns.organization.id