Localize LLDP card

This commit is contained in:
Marc Brooks 2025-11-10 19:18:10 +00:00
parent fe74d8f0e0
commit af8bfc702c
4 changed files with 24 additions and 19 deletions

View File

@ -634,10 +634,19 @@
"network_ipv6_mode_title": "IPv6 Mode", "network_ipv6_mode_title": "IPv6 Mode",
"network_ipv6_prefix": "IP Prefix", "network_ipv6_prefix": "IP Prefix",
"network_ipv6_prefix_invalid": "Prefix must be between 0 and 128", "network_ipv6_prefix_invalid": "Prefix must be between 0 and 128",
"network_ll_dp_chassis_id": "Chassis ID",
"network_ll_dp_description": "Control which TLVs will be sent over Link Layer Discovery Protocol", "network_ll_dp_description": "Control which TLVs will be sent over Link Layer Discovery Protocol",
"network_ll_dp_disabled": "Disabled", "network_ll_dp_disabled": "Disabled",
"network_ll_dp_mac_address": "MAC Address",
"network_ll_dp_management_address": "Management Address",
"network_ll_dp_neighbors": "LLDP Neighbors",
"network_ll_dp_port_description": "Port Description",
"network_ll_dp_port_id": "Port ID",
"network_ll_dp_rx_and_tx": "Receive and transmit", "network_ll_dp_rx_and_tx": "Receive and transmit",
"network_ll_dp_rx_only": "Receive only", "network_ll_dp_rx_only": "Receive only",
"network_ll_dp_source": "Source",
"network_ll_dp_system_description": "System Description",
"network_ll_dp_system_name": "System Name",
"network_ll_dp_title": "LLDP", "network_ll_dp_title": "LLDP",
"network_ll_dp_tx_only": "Transmit only", "network_ll_dp_tx_only": "Transmit only",
"network_mac_address_copy_error": "Failed to copy MAC address", "network_mac_address_copy_error": "Failed to copy MAC address",

View File

@ -1,9 +1,7 @@
import { LLDPNeighbor } from "@hooks/stores";
import { GridCard } from "@components/Card";
import { cx } from "@/cva.config"; import { cx } from "@/cva.config";
import { m } from "@localizations/messages";
import { LLDPNeighbor } from "../hooks/stores";
import { GridCard } from "./Card";
interface LLDPDataLineProps { interface LLDPDataLineProps {
label: string; label: string;
@ -31,7 +29,7 @@ export default function LLDPNeighborsCard({
<div className="animate-fadeIn p-4 text-black opacity-0 animation-duration-500 dark:text-white"> <div className="animate-fadeIn p-4 text-black opacity-0 animation-duration-500 dark:text-white">
<div className="space-y-4"> <div className="space-y-4">
<h3 className="text-base font-bold text-slate-900 dark:text-white"> <h3 className="text-base font-bold text-slate-900 dark:text-white">
LLDP Neighbors {m.network_ll_dp_neighbors()}
</h3> </h3>
<div className="space-y-3 pt-2"> <div className="space-y-3 pt-2">
@ -46,37 +44,37 @@ export default function LLDPNeighborsCard({
<div className="grid grid-cols-2 gap-x-8 gap-y-4"> <div className="grid grid-cols-2 gap-x-8 gap-y-4">
{neighbor.system_name && ( {neighbor.system_name && (
<LLDPDataLine label="System Name" value={neighbor.system_name} /> <LLDPDataLine label={m.network_ll_dp_system_name()} value={neighbor.system_name} />
)} )}
{neighbor.system_description && ( {neighbor.system_description && (
<LLDPDataLine label="System Description" value={neighbor.system_description} className="col-span-2" /> <LLDPDataLine label={m.network_ll_dp_system_description()} value={neighbor.system_description} className="col-span-2" />
)} )}
{neighbor.chassis_id && ( {neighbor.chassis_id && (
<LLDPDataLine label="Chassis ID" value={neighbor.chassis_id} /> <LLDPDataLine label={m.network_ll_dp_chassis_id()} value={neighbor.chassis_id} />
)} )}
{neighbor.port_id && ( {neighbor.port_id && (
<LLDPDataLine label="Port ID" value={neighbor.port_id} /> <LLDPDataLine label={m.network_ll_dp_port_id()} value={neighbor.port_id} />
)} )}
{neighbor.port_description && ( {neighbor.port_description && (
<LLDPDataLine label="Port Description" value={neighbor.port_description} /> <LLDPDataLine label={m.network_ll_dp_port_description()} value={neighbor.port_description} />
)} )}
{neighbor.management_addresses && neighbor.management_addresses.length > 0 && ( {neighbor.management_addresses && neighbor.management_addresses.length > 0 && (
neighbor.management_addresses.map((address, index) => ( neighbor.management_addresses.map((address, index) => (
<LLDPDataLine label="Management Address" value={address.address} key={index} /> <LLDPDataLine label={m.network_ll_dp_management_address()} value={address.address} key={index} />
)) ))
)} )}
{neighbor.mac && ( {neighbor.mac && (
<LLDPDataLine label="MAC Address" value={neighbor.mac} className="font-mono" /> <LLDPDataLine label={m.network_ll_dp_mac_address()} value={neighbor.mac} className="font-mono" />
)} )}
{neighbor.source && ( {neighbor.source && (
<LLDPDataLine label="Source" value={neighbor.source} /> <LLDPDataLine label={m.network_ll_dp_source()} value={neighbor.source} />
)} )}
</div> </div>
</div> </div>

View File

@ -835,8 +835,6 @@ export const useNetworkStateStore = create<NetworkState>((set, get) => ({
}, },
})); }));
export interface LLDPNeighborsState { export interface LLDPNeighborsState {
neighbors: LLDPNeighbor[]; neighbors: LLDPNeighbor[];
setNeighbors: (neighbors: LLDPNeighbor[]) => void; setNeighbors: (neighbors: LLDPNeighbor[]) => void;

View File

@ -16,9 +16,10 @@ import EmptyCard from "@components/EmptyCard";
import { GridCard } from "@components/Card"; import { GridCard } from "@components/Card";
import InputField, { InputFieldWithLabel } from "@components/InputField"; import InputField, { InputFieldWithLabel } from "@components/InputField";
import Ipv6NetworkCard from "@components/Ipv6NetworkCard"; import Ipv6NetworkCard from "@components/Ipv6NetworkCard";
import { SelectMenuBasic } from "@/components/SelectMenuBasic"; import LLDPNeighborsCard from "@components/LLDPNeighborsCard";
import { SelectMenuBasic } from "@components/SelectMenuBasic";
import { SettingsItem } from "@components/SettingsItem"; import { SettingsItem } from "@components/SettingsItem";
import { SettingsPageHeader } from "@/components/SettingsPageheader"; import { SettingsPageHeader } from "@components/SettingsPageheader";
import StaticIpv4Card from "@components/StaticIpv4Card"; import StaticIpv4Card from "@components/StaticIpv4Card";
import StaticIpv6Card from "@components/StaticIpv6Card"; import StaticIpv6Card from "@components/StaticIpv6Card";
import { useCopyToClipboard } from "@components/useCopyToClipBoard"; import { useCopyToClipboard } from "@components/useCopyToClipBoard";
@ -26,7 +27,6 @@ import { netMaskFromCidr4 } from "@/utils/ip";
import { getNetworkSettings, getNetworkState, getLLDPNeighbors } from "@/utils/jsonrpc"; import { getNetworkSettings, getNetworkState, getLLDPNeighbors } from "@/utils/jsonrpc";
import notifications from "@/notifications"; import notifications from "@/notifications";
import { m } from "@localizations/messages"; import { m } from "@localizations/messages";
import LLDPNeighborsCard from "@components/LLDPNeighborsCard";
dayjs.extend(relativeTime); dayjs.extend(relativeTime);