diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index d3526d8416..f12d446ef0 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -56,4 +56,3 @@ volumes: networks: infisical: - diff --git a/frontend/src/hooks/api/admin/index.ts b/frontend/src/hooks/api/admin/index.ts index 69f6731877..5405878c7c 100644 --- a/frontend/src/hooks/api/admin/index.ts +++ b/frontend/src/hooks/api/admin/index.ts @@ -1,9 +1,7 @@ export { useAdminDeleteUser, useCreateAdminUser, - useSetupInstanceGatewayConfig, useUpdateAdminSlackConfig, - useUpdateInstanceGatewayConfig, useUpdateServerConfig, useUpdateServerEncryptionStrategy } from "./mutation"; diff --git a/frontend/src/hooks/api/admin/mutation.ts b/frontend/src/hooks/api/admin/mutation.ts index 3bb1bfb2ac..c68760fa48 100644 --- a/frontend/src/hooks/api/admin/mutation.ts +++ b/frontend/src/hooks/api/admin/mutation.ts @@ -9,7 +9,6 @@ import { AdminSlackConfig, RootKeyEncryptionStrategy, TCreateAdminUserDTO, - TDisableInstanceGatewayConfigDTO, TServerConfig, TUpdateAdminSlackConfigDTO } from "./types"; @@ -99,27 +98,3 @@ export const useUpdateServerEncryptionStrategy = () => { } }); }; - -export const useSetupInstanceGatewayConfig = () => { - const queryClient = useQueryClient(); - return useMutation({ - mutationFn: async () => { - await apiRequest.post("/api/v1/admin/gateway"); - }, - onSuccess: () => { - queryClient.invalidateQueries(adminQueryKeys.getInstanceGatewayConfig()); - } - }); -}; - -export const useUpdateInstanceGatewayConfig = () => { - const queryClient = useQueryClient(); - return useMutation({ - mutationFn: async (dto: TDisableInstanceGatewayConfigDTO) => { - await apiRequest.patch("/api/v1/admin/gateway", dto); - }, - onSuccess: () => { - queryClient.invalidateQueries(adminQueryKeys.getInstanceGatewayConfig()); - } - }); -}; diff --git a/frontend/src/hooks/api/admin/queries.ts b/frontend/src/hooks/api/admin/queries.ts index afcbd31fbb..12ae1cf646 100644 --- a/frontend/src/hooks/api/admin/queries.ts +++ b/frontend/src/hooks/api/admin/queries.ts @@ -1,5 +1,4 @@ -import { queryOptions, useInfiniteQuery, useQuery, UseQueryOptions } from "@tanstack/react-query"; -import { AxiosError } from "axios"; +import { useInfiniteQuery, useQuery, UseQueryOptions } from "@tanstack/react-query"; import { apiRequest } from "@app/config/request"; @@ -8,7 +7,6 @@ import { AdminGetUsersFilters, AdminSlackConfig, TGetServerRootKmsEncryptionDetails, - TInstanceGatewayConfig, TServerConfig } from "./types"; @@ -20,21 +18,7 @@ export const adminQueryKeys = { serverConfig: () => ["server-config"] as const, getUsers: (filters: AdminGetUsersFilters) => [adminStandaloneKeys.getUsers, { filters }] as const, getAdminSlackConfig: () => ["admin-slack-config"] as const, - getServerEncryptionStrategies: () => ["server-encryption-strategies"] as const, - - getInstanceGatewayConfig: () => - queryOptions({ - queryKey: ["instance-gateway-config"], - queryFn: async () => { - const { data } = await apiRequest - .get<{ gateway: TInstanceGatewayConfig }>("/api/v1/admin/gateway") - .catch((err: AxiosError) => { - if (err.response?.status === 404) return { data: { gateway: false as const } }; - throw err; - }); - return data.gateway; - } - }) + getServerEncryptionStrategies: () => ["server-encryption-strategies"] as const }; export const fetchServerConfig = async () => { diff --git a/frontend/src/hooks/api/admin/types.ts b/frontend/src/hooks/api/admin/types.ts index 282af07a20..60fa3ab988 100644 --- a/frontend/src/hooks/api/admin/types.ts +++ b/frontend/src/hooks/api/admin/types.ts @@ -66,14 +66,3 @@ export enum RootKeyEncryptionStrategy { Software = "SOFTWARE", HSM = "HSM" } - -export type TInstanceGatewayConfig = { - isDisabled: boolean; - infisicalClientCaIssuedAt: string; - infisicalClientCaSerialNumber: string; - caKeyAlgorithm: string; -}; - -export type TDisableInstanceGatewayConfigDTO = { - isDisabled?: boolean; -}; diff --git a/frontend/src/hooks/api/gateways/mutation.tsx b/frontend/src/hooks/api/gateways/mutation.tsx index 858d8fa8ad..1d1fa63d9e 100644 --- a/frontend/src/hooks/api/gateways/mutation.tsx +++ b/frontend/src/hooks/api/gateways/mutation.tsx @@ -1,5 +1,7 @@ -import { apiRequest } from "@app/config/request"; import { useMutation, useQueryClient } from "@tanstack/react-query"; + +import { apiRequest } from "@app/config/request"; + import { gatewaysQueryKeys } from "./queries"; export const useDeleteGateway = () => { diff --git a/frontend/src/hooks/api/gateways/queries.tsx b/frontend/src/hooks/api/gateways/queries.tsx index e41e5d8718..bb05b17a46 100644 --- a/frontend/src/hooks/api/gateways/queries.tsx +++ b/frontend/src/hooks/api/gateways/queries.tsx @@ -1,5 +1,7 @@ -import { apiRequest } from "@app/config/request"; import { queryOptions } from "@tanstack/react-query"; + +import { apiRequest } from "@app/config/request"; + import { TGateway } from "./types"; export const gatewaysQueryKeys = { diff --git a/frontend/src/pages/admin/OverviewPage/GatewayPanel.tsx b/frontend/src/pages/admin/OverviewPage/GatewayPanel.tsx deleted file mode 100644 index 8590bee477..0000000000 --- a/frontend/src/pages/admin/OverviewPage/GatewayPanel.tsx +++ /dev/null @@ -1,114 +0,0 @@ -import { useQuery } from "@tanstack/react-query"; -import { format } from "date-fns"; - -import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal"; -import { createNotification } from "@app/components/notifications"; -import { Button, EmptyState, Tooltip } from "@app/components/v2"; -import { useSubscription } from "@app/context"; -import { usePopUp } from "@app/hooks"; -import { useSetupInstanceGatewayConfig, useUpdateInstanceGatewayConfig } from "@app/hooks/api"; -import { adminQueryKeys } from "@app/hooks/api/admin/queries"; - -export const GatewayPanel = () => { - const { subscription } = useSubscription(); - const { data } = useQuery(adminQueryKeys.getInstanceGatewayConfig()); - const { handlePopUpToggle, popUp, handlePopUpOpen } = usePopUp(["upgradePlan"] as const); - - const setupInstanceConfig = useSetupInstanceGatewayConfig(); - const updateInstanceConfig = useUpdateInstanceGatewayConfig(); - - const handleSetupInstance = () => { - if (!subscription.gateway) { - handlePopUpOpen("upgradePlan"); - return; - } - - if (!setupInstanceConfig.isPending) { - setupInstanceConfig.mutate(undefined, { - onSuccess: () => { - createNotification({ - type: "success", - text: "Instance gateway setup completed" - }); - } - }); - } - }; - - const handleUpdateGatewayStatus = ({ isDisabled }: { isDisabled?: boolean }) => { - if (!updateInstanceConfig.isPending) { - updateInstanceConfig.mutate( - { isDisabled }, - { - onSuccess: () => { - createNotification({ - type: "success", - text: "Instance gateway updated" - }); - } - } - ); - } - }; - - if (!data) { - return ( -