mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-10 16:28:40 +00:00
make "deploy new relay" open the modal
This commit is contained in:
+1
-1
@@ -166,7 +166,7 @@ export const DeployGatewayModal = ({ isOpen, onOpenChange }: Props) => {
|
|||||||
onChange={(newValue) => {
|
onChange={(newValue) => {
|
||||||
if ((newValue as SingleValue<{ id: string }>)?.id === "_create") {
|
if ((newValue as SingleValue<{ id: string }>)?.id === "_create") {
|
||||||
navigate({
|
navigate({
|
||||||
search: { selectedTab: "relays" }
|
search: (prev) => ({ ...prev, selectedTab: "relays", action: "deploy-relay" })
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import {
|
import {
|
||||||
faArrowUpRightFromSquare,
|
faArrowUpRightFromSquare,
|
||||||
faBookOpen,
|
faBookOpen,
|
||||||
@@ -12,6 +12,7 @@ import {
|
|||||||
faTrash
|
faTrash
|
||||||
} from "@fortawesome/free-solid-svg-icons";
|
} from "@fortawesome/free-solid-svg-icons";
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
|
import { useNavigate, useSearch } from "@tanstack/react-router";
|
||||||
import { formatRelative } from "date-fns";
|
import { formatRelative } from "date-fns";
|
||||||
|
|
||||||
import { createNotification } from "@app/components/notifications";
|
import { createNotification } from "@app/components/notifications";
|
||||||
@@ -36,6 +37,7 @@ import {
|
|||||||
Tooltip,
|
Tooltip,
|
||||||
Tr
|
Tr
|
||||||
} from "@app/components/v2";
|
} from "@app/components/v2";
|
||||||
|
import { ROUTE_PATHS } from "@app/const/routes";
|
||||||
import {
|
import {
|
||||||
OrgPermissionSubjects,
|
OrgPermissionSubjects,
|
||||||
OrgRelayPermissionActions
|
OrgRelayPermissionActions
|
||||||
@@ -75,6 +77,25 @@ export const RelayTab = withPermission(
|
|||||||
"deployRelay"
|
"deployRelay"
|
||||||
] as const);
|
] as const);
|
||||||
|
|
||||||
|
const action = useSearch({
|
||||||
|
from: ROUTE_PATHS.Organization.NetworkingPage.id,
|
||||||
|
select: (s) => s.action
|
||||||
|
});
|
||||||
|
|
||||||
|
const navigate = useNavigate({
|
||||||
|
from: ROUTE_PATHS.Organization.NetworkingPage.path
|
||||||
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (action === "deploy-relay") {
|
||||||
|
handlePopUpOpen("deployRelay");
|
||||||
|
navigate({
|
||||||
|
search: (prev) => ({ ...prev, action: undefined }),
|
||||||
|
replace: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [action]);
|
||||||
|
|
||||||
const deleteRelayById = useDeleteRelayById();
|
const deleteRelayById = useDeleteRelayById();
|
||||||
|
|
||||||
const handleDeleteRelay = async () => {
|
const handleDeleteRelay = async () => {
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import { z } from "zod";
|
|||||||
import { NetworkingPage } from "./NetworkingPage";
|
import { NetworkingPage } from "./NetworkingPage";
|
||||||
|
|
||||||
const NetworkingPageQueryParams = z.object({
|
const NetworkingPageQueryParams = z.object({
|
||||||
selectedTab: z.string().catch("gateways")
|
selectedTab: z.string().catch("gateways"),
|
||||||
|
action: z.string().optional()
|
||||||
});
|
});
|
||||||
|
|
||||||
export const Route = createFileRoute(
|
export const Route = createFileRoute(
|
||||||
|
|||||||
Reference in New Issue
Block a user