diff --git a/src/app/(dashboard)/peer/page.tsx b/src/app/(dashboard)/peer/page.tsx index 490d8dca..105656c8 100644 --- a/src/app/(dashboard)/peer/page.tsx +++ b/src/app/(dashboard)/peer/page.tsx @@ -23,7 +23,6 @@ import Separator from "@components/Separator"; import FullScreenLoading from "@components/ui/FullScreenLoading"; import LoginExpiredBadge from "@components/ui/LoginExpiredBadge"; import TextWithTooltip from "@components/ui/TextWithTooltip"; -import { getOperatingSystem } from "@hooks/useOperatingSystem"; import useRedirect from "@hooks/useRedirect"; import { IconCloudLock, IconInfoCircle } from "@tabler/icons-react"; import useFetchApi from "@utils/api"; @@ -95,14 +94,6 @@ function PeerOverview() { peer, }); - /** - * Check the operating system of the peer, if it is linux, then show the routes table, otherwise hide it. - */ - const isLinux = useMemo(() => { - const operatingSystem = getOperatingSystem(peer.os); - return operatingSystem == OperatingSystem.LINUX; - }, [peer.os]); - /** * Detect if there are changes in the peer information, if there are changes, then enable the save button. */ @@ -317,7 +308,7 @@ function PeerOverview() { - {isLinux && !isUser ? ( + {!isUser ? ( <> diff --git a/src/components/PeerSelector.tsx b/src/components/PeerSelector.tsx index 8310ee60..8f1907dc 100644 --- a/src/components/PeerSelector.tsx +++ b/src/components/PeerSelector.tsx @@ -3,6 +3,7 @@ import { DropdownInput } from "@components/DropdownInput"; import { Popover, PopoverContent, PopoverTrigger } from "@components/Popover"; import TextWithTooltip from "@components/ui/TextWithTooltip"; import { VirtualScrollAreaList } from "@components/VirtualScrollAreaList"; +import { getOperatingSystem } from "@hooks/useOperatingSystem"; import { useSearch } from "@hooks/useSearch"; import useFetchApi from "@utils/api"; import { cn } from "@utils/helpers"; @@ -10,22 +11,14 @@ import { sortBy, unionBy } from "lodash"; import { ChevronsUpDown, MapPin } from "lucide-react"; import * as React from "react"; import { memo, useEffect, useState } from "react"; -import { FcLinux } from "react-icons/fc"; import { useElementSize } from "@/hooks/useElementSize"; -import { getOperatingSystem } from "@/hooks/useOperatingSystem"; import { OperatingSystem } from "@/interfaces/OperatingSystem"; import { Peer } from "@/interfaces/Peer"; +import { OSLogo } from "@/modules/peers/PeerOSCell"; const MapPinIcon = memo(() => ); MapPinIcon.displayName = "MapPinIcon"; -const LinuxIcon = memo(() => ( - - - -)); -LinuxIcon.displayName = "LinuxIcon"; - interface MultiSelectProps { value?: Peer; onChange: React.Dispatch>; @@ -63,11 +56,6 @@ export function PeerSelector({ // Sort let options = sortBy([...peers], "name") as Peer[]; - // Filter out peers that are not linux - options = options.filter((peer) => { - return getOperatingSystem(peer.os) === OperatingSystem.LINUX; - }); - // Filter out excluded peers if (excludedPeers) { options = options.filter((peer) => { @@ -128,7 +116,6 @@ export function PeerSelector({ } >
-
@@ -151,7 +138,7 @@ export function PeerSelector({ - { - "Seems like you don't have any Linux peers to assign as a routing peer." - } + {"No peers available to select."} )} @@ -187,6 +172,7 @@ export function PeerSelector({ items={filteredItems} onSelect={togglePeer} renderItem={(option) => { + const os = getOperatingSystem(option.os); return ( <>
- +
+ +
diff --git a/src/modules/exit-node/ExitNodeDropdownButton.tsx b/src/modules/exit-node/ExitNodeDropdownButton.tsx index 17a451c1..9bda3b5d 100644 --- a/src/modules/exit-node/ExitNodeDropdownButton.tsx +++ b/src/modules/exit-node/ExitNodeDropdownButton.tsx @@ -16,10 +16,9 @@ type Props = { export const ExitNodeDropdownButton = ({ peer }: Props) => { const [modal, setModal] = useState(false); - const isLinux = getOperatingSystem(peer.os) === OperatingSystem.LINUX; const hasExitNodes = useHasExitNodes(peer); - return isLinux ? ( + return ( <> setModal(true)}>
@@ -55,5 +54,5 @@ export const ExitNodeDropdownButton = ({ peer }: Props) => { )} - ) : null; + ); }; diff --git a/src/modules/networks/routing-peers/NetworkRoutingPeerModal.tsx b/src/modules/networks/routing-peers/NetworkRoutingPeerModal.tsx index 16651981..40452b47 100644 --- a/src/modules/networks/routing-peers/NetworkRoutingPeerModal.tsx +++ b/src/modules/networks/routing-peers/NetworkRoutingPeerModal.tsx @@ -122,6 +122,7 @@ function RoutingPeerModalContent({ const [enabled, setEnabled] = useState( router ? router.enabled : true, ); + const [metric, setMetric] = useState( router?.metric ? router.metric.toString() : "9999", ); @@ -244,8 +245,8 @@ function RoutingPeerModalContent({
- Assign a single or multiple Linux peers as routing peers - for the network. + Assign a single or multiple peers as routing peers for the + network.
- Assign a peer group with Linux machines to be used as - routing peers. + Assign a peer group with machines to be used as routing + peers. - You can install NetBird with a setup key on one or more Linux + You can install NetBird with a setup key on one or more machines to act as routing peers.
@@ -419,7 +420,7 @@ const InstallNetBirdWithSetupKeyButton = ({ const choice = await confirm({ title: `Create a Setup Key?`, description: - "If you continue, a one-off setup key will be automatically created and you will be able to install NetBird on a Linux machine.", + "If you continue, a one-off setup key will be automatically created and you will be able to install NetBird.", confirmText: "Continue", cancelText: "Cancel", type: "default", diff --git a/src/modules/routes/RouteModal.tsx b/src/modules/routes/RouteModal.tsx index 123d6f68..3245292e 100644 --- a/src/modules/routes/RouteModal.tsx +++ b/src/modules/routes/RouteModal.tsx @@ -611,7 +611,7 @@ export function RouteModalContent({
- Assign a peer group with Linux machines to be used as + Assign a peer group with machines to be used as {exitNode ? " exit nodes." : " routing peers."} - Assign a peer group with Linux machines to be used as + Assign a peer group with machines to be used as {isExitNode ? " exit nodes." : " routing peers."} ) { +export default function MacOSTab({ + setupKey, + showSetupKeyInfo, +}: Readonly) { return ( @@ -104,7 +111,11 @@ export default function MacOSTab({ setupKey }: Readonly) { {setupKey ? ( -

Open Terminal and run NetBird

+

+ Open Terminal and run NetBird{" "} + {showSetupKeyInfo && } +

+ {getNetBirdUpCommand()} @@ -143,7 +154,10 @@ export default function MacOSTab({ setupKey }: Readonly) {
-

Run NetBird {!setupKey && "and log in the browser"}

+

+ Run NetBird {!setupKey && "and log in the browser"} + {showSetupKeyInfo && } +

{getNetBirdUpCommand()} @@ -200,7 +214,10 @@ export default function MacOSTab({ setupKey }: Readonly) {
-

Run NetBird {!setupKey && "and log in the browser"}

+

+ Run NetBird {!setupKey && "and log in the browser"} + {showSetupKeyInfo && } +

{getNetBirdUpCommand()} diff --git a/src/modules/setup-netbird-modal/SetupModal.tsx b/src/modules/setup-netbird-modal/SetupModal.tsx index 99923104..ead19bb9 100644 --- a/src/modules/setup-netbird-modal/SetupModal.tsx +++ b/src/modules/setup-netbird-modal/SetupModal.tsx @@ -115,26 +115,22 @@ export function SetupModalContent({ Linux - {!showOnlyRoutingPeerOS && ( - <> - - - Windows - - - - macOS - - - )} + + + Windows + + + + macOS + {!setupKey && ( <> @@ -171,8 +167,14 @@ export function SetupModalContent({ setupKey={setupKey} showSetupKeyInfo={showOnlyRoutingPeerOS} /> - - + + {!setupKey && ( <> diff --git a/src/modules/setup-netbird-modal/WindowsTab.tsx b/src/modules/setup-netbird-modal/WindowsTab.tsx index 1a6a01ba..3bf07c55 100644 --- a/src/modules/setup-netbird-modal/WindowsTab.tsx +++ b/src/modules/setup-netbird-modal/WindowsTab.tsx @@ -7,13 +7,20 @@ import { DownloadIcon, PackageOpenIcon } from "lucide-react"; import Link from "next/link"; import React from "react"; import { OperatingSystem } from "@/interfaces/OperatingSystem"; -import { SetupKeyParameter } from "@/modules/setup-netbird-modal/SetupModal"; +import { + RoutingPeerSetupKeyInfo, + SetupKeyParameter, +} from "@/modules/setup-netbird-modal/SetupModal"; type Props = { setupKey?: string; + showSetupKeyInfo?: boolean; }; -export default function WindowsTab({ setupKey }: Readonly) { +export default function WindowsTab({ + setupKey, + showSetupKeyInfo, +}: Readonly) { return ( @@ -51,7 +58,11 @@ export default function WindowsTab({ setupKey }: Readonly) { {setupKey ? ( -

Open Command-line and run NetBird

+

+ Open Command-line and run NetBird{" "} + {showSetupKeyInfo && } +

+ {getNetBirdUpCommand()}