Skip to content

Commit 451e922

Browse files
committed
Remove linux router restriction
1 parent c8e3b50 commit 451e922

File tree

4 files changed

+7
-36
lines changed

4 files changed

+7
-36
lines changed

src/app/(dashboard)/peer/page.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import Separator from "@components/Separator";
2323
import FullScreenLoading from "@components/ui/FullScreenLoading";
2424
import LoginExpiredBadge from "@components/ui/LoginExpiredBadge";
2525
import TextWithTooltip from "@components/ui/TextWithTooltip";
26-
import { getOperatingSystem } from "@hooks/useOperatingSystem";
2726
import useRedirect from "@hooks/useRedirect";
2827
import { IconCloudLock, IconInfoCircle } from "@tabler/icons-react";
2928
import useFetchApi from "@utils/api";
@@ -95,14 +94,6 @@ function PeerOverview() {
9594
peer,
9695
});
9796

98-
/**
99-
* Check the operating system of the peer, if it is linux, then show the routes table, otherwise hide it.
100-
*/
101-
const isLinux = useMemo(() => {
102-
const operatingSystem = getOperatingSystem(peer.os);
103-
return operatingSystem == OperatingSystem.LINUX;
104-
}, [peer.os]);
105-
10697
/**
10798
* Detect if there are changes in the peer information, if there are changes, then enable the save button.
10899
*/
@@ -317,7 +308,7 @@ function PeerOverview() {
317308
</div>
318309
</div>
319310

320-
{isLinux && !isUser ? (
311+
{!isUser ? (
321312
<>
322313
<Separator />
323314
<PeerNetworkRoutesSection peer={peer} />

src/components/PeerSelector.tsx

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,12 @@ import { sortBy, unionBy } from "lodash";
1010
import { ChevronsUpDown, MapPin } from "lucide-react";
1111
import * as React from "react";
1212
import { memo, useEffect, useState } from "react";
13-
import { FcLinux } from "react-icons/fc";
1413
import { useElementSize } from "@/hooks/useElementSize";
15-
import { getOperatingSystem } from "@/hooks/useOperatingSystem";
16-
import { OperatingSystem } from "@/interfaces/OperatingSystem";
1714
import { Peer } from "@/interfaces/Peer";
1815

1916
const MapPinIcon = memo(() => <MapPin size={12} />);
2017
MapPinIcon.displayName = "MapPinIcon";
2118

22-
const LinuxIcon = memo(() => (
23-
<span className={"grayscale brightness-[100%] contrast-[40%]"}>
24-
<FcLinux className={"text-white text-lg min-w-[20px] brightness-150"} />
25-
</span>
26-
));
27-
LinuxIcon.displayName = "LinuxIcon";
28-
2919
interface MultiSelectProps {
3020
value?: Peer;
3121
onChange: React.Dispatch<React.SetStateAction<Peer | undefined>>;
@@ -63,11 +53,6 @@ export function PeerSelector({
6353
// Sort
6454
let options = sortBy([...peers], "name") as Peer[];
6555

66-
// Filter out peers that are not linux
67-
options = options.filter((peer) => {
68-
return getOperatingSystem(peer.os) === OperatingSystem.LINUX;
69-
});
70-
7156
// Filter out excluded peers
7257
if (excludedPeers) {
7358
options = options.filter((peer) => {
@@ -128,7 +113,6 @@ export function PeerSelector({
128113
}
129114
>
130115
<div className={"flex items-center gap-2.5 text-sm"}>
131-
<LinuxIcon />
132116
<TextWithTooltip text={value.name} maxChars={20} />
133117
</div>
134118

@@ -151,7 +135,7 @@ export function PeerSelector({
151135
</PopoverTrigger>
152136
<PopoverContent
153137
hideWhenDetached={false}
154-
className="w-full p-0 shadow-sm shadow-nb-gray-950"
138+
className="w-full p-0 shadow-sm shadow-nb-gray-950"
155139
style={{
156140
width: width,
157141
}}
@@ -169,9 +153,7 @@ export function PeerSelector({
169153
{unfilteredItems.length == 0 && !search && (
170154
<div className={"max-w-xs mx-auto"}>
171155
<DropdownInfoText>
172-
{
173-
"Seems like you don't have any Linux peers to assign as a routing peer."
174-
}
156+
{"No peers available to select."}
175157
</DropdownInfoText>
176158
</div>
177159
)}
@@ -197,7 +179,6 @@ export function PeerSelector({
197179
: "text-nb-gray-300",
198180
)}
199181
>
200-
<LinuxIcon />
201182
<TextWithTooltip text={option.name} maxChars={20} />
202183
</div>
203184

@@ -221,4 +202,4 @@ export function PeerSelector({
221202
</PopoverContent>
222203
</Popover>
223204
);
224-
}
205+
}

src/modules/exit-node/ExitNodeDropdownButton.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ type Props = {
1616

1717
export const ExitNodeDropdownButton = ({ peer }: Props) => {
1818
const [modal, setModal] = useState(false);
19-
const isLinux = getOperatingSystem(peer.os) === OperatingSystem.LINUX;
2019
const hasExitNodes = useHasExitNodes(peer);
2120

22-
return isLinux ? (
21+
return (
2322
<>
2423
<DropdownMenuItem onClick={() => setModal(true)}>
2524
<div className={"flex gap-3 items-center w-full"}>
@@ -55,5 +54,5 @@ export const ExitNodeDropdownButton = ({ peer }: Props) => {
5554
)}
5655
</Modal>
5756
</>
58-
) : null;
57+
);
5958
};

src/modules/routes/RouteModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ export function RouteModalContent({
611611
<SegmentedTabs.Content value={"peer-group"}>
612612
<div>
613613
<HelpText>
614-
Assign a peer group with Linux machines to be used as
614+
Assign a peer group with machines to be used as
615615
{exitNode ? " exit nodes." : " routing peers."}
616616
</HelpText>
617617
<PeerGroupSelector

0 commit comments

Comments
 (0)