From fe074b22530b491bd6ff237f5451f46afa105442 Mon Sep 17 00:00:00 2001 From: Siyuan Date: Fri, 10 Oct 2025 13:39:33 +0000 Subject: [PATCH] fix hostname --- internal/network/types/interface.go | 1 + pkg/nmlite/manager.go | 1 + ui/src/hooks/stores.ts | 1 + ui/src/routes/devices.$id.settings.network.tsx | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/network/types/interface.go b/internal/network/types/interface.go index 07ae12d5..cea9620b 100644 --- a/internal/network/types/interface.go +++ b/internal/network/types/interface.go @@ -10,6 +10,7 @@ import ( // InterfaceState represents the current state of a network interface type InterfaceState struct { InterfaceName string `json:"interface_name"` + Hostname string `json:"hostname"` MACAddress string `json:"mac_address"` Up bool `json:"up"` Online bool `json:"online"` diff --git a/pkg/nmlite/manager.go b/pkg/nmlite/manager.go index 2c69534a..35b8224d 100644 --- a/pkg/nmlite/manager.go +++ b/pkg/nmlite/manager.go @@ -78,6 +78,7 @@ func (nm *NetworkManager) AddInterface(iface string, config *types.NetworkConfig // Set up callbacks im.SetOnStateChange(func(state types.InterfaceState) { if nm.onInterfaceStateChange != nil { + state.Hostname = nm.Hostname() nm.onInterfaceStateChange(iface, state) } }) diff --git a/ui/src/hooks/stores.ts b/ui/src/hooks/stores.ts index 1b8dae1b..5dcfb8e5 100644 --- a/ui/src/hooks/stores.ts +++ b/ui/src/hooks/stores.ts @@ -720,6 +720,7 @@ export interface NetworkState { ipv6_link_local?: string; ipv6_gateway?: string; dhcp_lease?: DhcpLease; + hostname?: string; setNetworkState: (state: NetworkState) => void; setDhcpLease: (lease: NetworkState["dhcp_lease"]) => void; diff --git a/ui/src/routes/devices.$id.settings.network.tsx b/ui/src/routes/devices.$id.settings.network.tsx index 621ff59c..b0e4487b 100644 --- a/ui/src/routes/devices.$id.settings.network.tsx +++ b/ui/src/routes/devices.$id.settings.network.tsx @@ -253,7 +253,7 @@ export default function SettingsNetworkRoute() {