mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-10 14:28:35 +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) => {
|
||||
if ((newValue as SingleValue<{ id: string }>)?.id === "_create") {
|
||||
navigate({
|
||||
search: { selectedTab: "relays" }
|
||||
search: (prev) => ({ ...prev, selectedTab: "relays", action: "deploy-relay" })
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import {
|
||||
faArrowUpRightFromSquare,
|
||||
faBookOpen,
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
faTrash
|
||||
} from "@fortawesome/free-solid-svg-icons";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import { useNavigate, useSearch } from "@tanstack/react-router";
|
||||
import { formatRelative } from "date-fns";
|
||||
|
||||
import { createNotification } from "@app/components/notifications";
|
||||
@@ -36,6 +37,7 @@ import {
|
||||
Tooltip,
|
||||
Tr
|
||||
} from "@app/components/v2";
|
||||
import { ROUTE_PATHS } from "@app/const/routes";
|
||||
import {
|
||||
OrgPermissionSubjects,
|
||||
OrgRelayPermissionActions
|
||||
@@ -75,6 +77,25 @@ export const RelayTab = withPermission(
|
||||
"deployRelay"
|
||||
] 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 handleDeleteRelay = async () => {
|
||||
|
||||
@@ -5,7 +5,8 @@ import { z } from "zod";
|
||||
import { NetworkingPage } from "./NetworkingPage";
|
||||
|
||||
const NetworkingPageQueryParams = z.object({
|
||||
selectedTab: z.string().catch("gateways")
|
||||
selectedTab: z.string().catch("gateways"),
|
||||
action: z.string().optional()
|
||||
});
|
||||
|
||||
export const Route = createFileRoute(
|
||||
|
||||
Reference in New Issue
Block a user