mirror of https://github.com/jetkvm/kvm.git
fix hostname
This commit is contained in:
parent
579345e5b4
commit
fe074b2253
|
|
@ -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"`
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ export default function SettingsNetworkRoute() {
|
|||
<SettingsItem title="Hostname" description="Set the device hostname">
|
||||
<InputField
|
||||
size="SM"
|
||||
placeholder="jetkvm"
|
||||
placeholder={networkState?.hostname || "jetkvm"}
|
||||
{...register("hostname")}
|
||||
error={formState.errors.hostname?.message}
|
||||
/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue