mirror of
https://github.com/netbirdio/dashboard.git
synced 2026-01-26 01:21:04 +00:00
Fix toggle for p2p policies (#501)
This commit is contained in:
@@ -1,13 +1,14 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import Breadcrumbs from "@components/Breadcrumbs";
|
import Breadcrumbs from "@components/Breadcrumbs";
|
||||||
|
import { Callout } from "@components/Callout";
|
||||||
import InlineLink from "@components/InlineLink";
|
import InlineLink from "@components/InlineLink";
|
||||||
import Paragraph from "@components/Paragraph";
|
import Paragraph from "@components/Paragraph";
|
||||||
import SkeletonTable from "@components/skeletons/SkeletonTable";
|
import SkeletonTable from "@components/skeletons/SkeletonTable";
|
||||||
import { RestrictedAccess } from "@components/ui/RestrictedAccess";
|
import { RestrictedAccess } from "@components/ui/RestrictedAccess";
|
||||||
import { usePortalElement } from "@hooks/usePortalElement";
|
import { usePortalElement } from "@hooks/usePortalElement";
|
||||||
import useFetchApi from "@utils/api";
|
import useFetchApi from "@utils/api";
|
||||||
import { ExternalLinkIcon } from "lucide-react";
|
import { ArrowUpRightIcon, ExternalLinkIcon } from "lucide-react";
|
||||||
import React, { lazy, Suspense } from "react";
|
import React, { lazy, Suspense } from "react";
|
||||||
import NetworkRoutesIcon from "@/assets/icons/NetworkRoutesIcon";
|
import NetworkRoutesIcon from "@/assets/icons/NetworkRoutesIcon";
|
||||||
import PeersProvider from "@/contexts/PeersProvider";
|
import PeersProvider from "@/contexts/PeersProvider";
|
||||||
@@ -59,6 +60,17 @@ export default function NetworkRoutes() {
|
|||||||
</InlineLink>
|
</InlineLink>
|
||||||
in our documentation.
|
in our documentation.
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
|
|
||||||
|
<Callout className={"max-w-xl mt-3"} variant={"warning"}>
|
||||||
|
<span>
|
||||||
|
We recommend using the new Networks concept to easier visualise
|
||||||
|
and manage access to your resources.{" "}
|
||||||
|
<InlineLink href={"/networks"}>
|
||||||
|
Go to Networks
|
||||||
|
<ArrowUpRightIcon size={14} />
|
||||||
|
</InlineLink>
|
||||||
|
</span>
|
||||||
|
</Callout>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<RestrictedAccess hasAccess={permission.routes.read}>
|
<RestrictedAccess hasAccess={permission.routes.read}>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export default function RDPPage() {
|
|||||||
} = useFetchApi<Peer>(`/peers/${peerId}`, true, false, !!peerId);
|
} = useFetchApi<Peer>(`/peers/${peerId}`, true, false, !!peerId);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={"w-screen h-screen overflow-hidden"}>
|
<div className={"w-screen h-screen overflow-hidden fixed inset-0"}>
|
||||||
{peerId && peer && !isLoading ? (
|
{peerId && peer && !isLoading ? (
|
||||||
<RDPSession key={peer.id} peer={peer} />
|
<RDPSession key={peer.id} peer={peer} />
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ export default function AccessControlActiveCell({ policy }: Readonly<Props>) {
|
|||||||
if (rule.destinationResource) {
|
if (rule.destinationResource) {
|
||||||
rule.destinations = null;
|
rule.destinations = null;
|
||||||
}
|
}
|
||||||
|
if (rule.sourceResource) {
|
||||||
|
rule.sources = null;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
updatePolicy(
|
updatePolicy(
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ export default function AccessControlDirectionCell({
|
|||||||
}, [policy]);
|
}, [policy]);
|
||||||
|
|
||||||
const bidirectional = firstRule ? firstRule.bidirectional : false;
|
const bidirectional = firstRule ? firstRule.bidirectional : false;
|
||||||
const isSingleResource = !!firstRule?.destinationResource;
|
const isSingleResource =
|
||||||
|
!!firstRule?.destinationResource &&
|
||||||
|
firstRule?.destinationResource?.type !== "peer";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={"flex h-full"}>
|
<div className={"flex h-full"}>
|
||||||
|
|||||||
@@ -72,6 +72,8 @@ export default function useGroupHelper({ initial = [], peer }: Props) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const removePeerFromGroup = async (g: Group) => {
|
const removePeerFromGroup = async (g: Group) => {
|
||||||
|
if (g.name === "All") return Promise.resolve(g);
|
||||||
|
|
||||||
const newPeerGroups = g.peers?.filter((p) => {
|
const newPeerGroups = g.peers?.filter((p) => {
|
||||||
const groupPeer = p as GroupPeer;
|
const groupPeer = p as GroupPeer;
|
||||||
return groupPeer.id !== peer?.id;
|
return groupPeer.id !== peer?.id;
|
||||||
|
|||||||
@@ -181,6 +181,7 @@ export const useNetBirdClient = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
await netBirdClient.current.start();
|
await netBirdClient.current.start();
|
||||||
|
(window as any).netbird = netBirdClient.current;
|
||||||
netBirdStore.setState({ status: NetBirdStatus.CONNECTED });
|
netBirdStore.setState({ status: NetBirdStatus.CONNECTED });
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -203,6 +204,7 @@ export const useNetBirdClient = () => {
|
|||||||
netBirdStore.setState({ status: NetBirdStatus.DISCONNECTED });
|
netBirdStore.setState({ status: NetBirdStatus.DISCONNECTED });
|
||||||
await netBirdClient.current.stop();
|
await netBirdClient.current.stop();
|
||||||
netBirdClient.current = null;
|
netBirdClient.current = null;
|
||||||
|
delete (window as any).netbird;
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
@@ -79,23 +79,13 @@ export default function MacOSTab({
|
|||||||
</div>
|
</div>
|
||||||
<div className={"flex gap-4 mt-1 flex-wrap"}>
|
<div className={"flex gap-4 mt-1 flex-wrap"}>
|
||||||
<Link
|
<Link
|
||||||
href={"https://pkgs.netbird.io/macos/arm64"}
|
href={"https://pkgs.netbird.io/macos/universal"}
|
||||||
passHref
|
passHref
|
||||||
target={"_blank"}
|
target={"_blank"}
|
||||||
>
|
>
|
||||||
<Button variant={"primary"}>
|
<Button variant={"primary"}>
|
||||||
<DownloadIcon size={14} />
|
<DownloadIcon size={14} />
|
||||||
Download for Apple Silicon
|
Download NetBird
|
||||||
</Button>
|
|
||||||
</Link>
|
|
||||||
<Link
|
|
||||||
href={"https://pkgs.netbird.io/macos/amd64"}
|
|
||||||
passHref
|
|
||||||
target={"_blank"}
|
|
||||||
>
|
|
||||||
<Button variant={"outline"}>
|
|
||||||
<DownloadIcon size={14} />
|
|
||||||
Download for Intel
|
|
||||||
</Button>
|
</Button>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user