feat: resolving some bugs

This commit is contained in:
=
2025-01-06 14:56:50 +05:30
parent 808a901aee
commit 0ac7ec460b
17 changed files with 87 additions and 33 deletions
@@ -3,7 +3,6 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request"; import { apiRequest } from "@app/config/request";
import { workspaceKeys } from "../workspace"; import { workspaceKeys } from "../workspace";
import { ProjectType } from "../workspace/types";
export const useImportEnvKey = () => { export const useImportEnvKey = () => {
const queryClient = useQueryClient(); const queryClient = useQueryClient();
@@ -35,7 +34,7 @@ export const useImportEnvKey = () => {
}, },
onSuccess: () => { onSuccess: () => {
queryClient.invalidateQueries({ queryClient.invalidateQueries({
queryKey: workspaceKeys.getAllUserWorkspace(ProjectType.SecretManager) queryKey: workspaceKeys.getAllUserWorkspace()
}); });
} }
}); });
@@ -42,7 +42,7 @@ export const organizationKeys = {
[...organizationKeys.getOrgIdentityMemberships(orgId), params] as const, [...organizationKeys.getOrgIdentityMemberships(orgId), params] as const,
getOrgGroups: (orgId: string) => [{ orgId }, "organization-groups"] as const, getOrgGroups: (orgId: string) => [{ orgId }, "organization-groups"] as const,
getOrgIntegrationAuths: (orgId: string) => [{ orgId }, "integration-auths"] as const, getOrgIntegrationAuths: (orgId: string) => [{ orgId }, "integration-auths"] as const,
getOrgById: (orgId: string) => ["org-by-id", { orgId }] getOrgById: (orgId: string) => ["organization", { orgId }]
}; };
export const fetchOrganizations = async () => { export const fetchOrganizations = async () => {
@@ -4,7 +4,7 @@ import { apiRequest } from "@app/config/request";
import { userKeys } from "../users/query-keys"; import { userKeys } from "../users/query-keys";
import { workspaceKeys } from "./query-keys"; import { workspaceKeys } from "./query-keys";
import { ProjectType, TUpdateWorkspaceGroupRoleDTO } from "./types"; import { TUpdateWorkspaceGroupRoleDTO } from "./types";
export const useAddGroupToWorkspace = () => { export const useAddGroupToWorkspace = () => {
const queryClient = useQueryClient(); const queryClient = useQueryClient();
@@ -102,7 +102,7 @@ export const useMigrateProjectToV3 = () => {
}, },
onSuccess: () => { onSuccess: () => {
queryClient.invalidateQueries({ queryClient.invalidateQueries({
queryKey: workspaceKeys.getAllUserWorkspace(ProjectType.SecretManager) queryKey: workspaceKeys.getAllUserWorkspace()
}); });
} }
}); });
+11 -11
View File
@@ -86,7 +86,7 @@ export const useUpgradeProject = () => {
}, },
onSuccess: () => { onSuccess: () => {
queryClient.invalidateQueries({ queryClient.invalidateQueries({
queryKey: workspaceKeys.getAllUserWorkspace(ProjectType.SecretManager) queryKey: workspaceKeys.getAllUserWorkspace()
}); });
} }
}); });
@@ -151,7 +151,7 @@ export const useGetUserWorkspaces = ({
type?: ProjectType | "all"; type?: ProjectType | "all";
} = {}) => } = {}) =>
useQuery({ useQuery({
queryKey: workspaceKeys.getAllUserWorkspace(type || ""), queryKey: workspaceKeys.getAllUserWorkspace(),
queryFn: () => fetchUserWorkspaces(includeRoles, type) queryFn: () => fetchUserWorkspaces(includeRoles, type)
}); });
@@ -261,8 +261,8 @@ export const useUpdateProject = () => {
); );
return data.workspace; return data.workspace;
}, },
onSuccess: (dto) => { onSuccess: () => {
queryClient.invalidateQueries({ queryKey: workspaceKeys.getAllUserWorkspace(dto.type) }); queryClient.invalidateQueries({ queryKey: workspaceKeys.getAllUserWorkspace() });
} }
}); });
}; };
@@ -280,8 +280,8 @@ export const useToggleAutoCapitalization = () => {
); );
return data.workspace; return data.workspace;
}, },
onSuccess: (dto) => { onSuccess: () => {
queryClient.invalidateQueries({ queryKey: workspaceKeys.getAllUserWorkspace(dto.type) }); queryClient.invalidateQueries({ queryKey: workspaceKeys.getAllUserWorkspace() });
} }
}); });
}; };
@@ -296,8 +296,8 @@ export const useUpdateWorkspaceVersionLimit = () => {
}); });
return data.workspace; return data.workspace;
}, },
onSuccess: (dto) => { onSuccess: () => {
queryClient.invalidateQueries({ queryKey: workspaceKeys.getAllUserWorkspace(dto.type) }); queryClient.invalidateQueries({ queryKey: workspaceKeys.getAllUserWorkspace() });
} }
}); });
}; };
@@ -350,7 +350,7 @@ export const useCreateWsEnvironment = () => {
}, },
onSuccess: () => { onSuccess: () => {
queryClient.invalidateQueries({ queryClient.invalidateQueries({
queryKey: workspaceKeys.getAllUserWorkspace(ProjectType.SecretManager) queryKey: workspaceKeys.getAllUserWorkspace()
}); });
} }
}); });
@@ -369,7 +369,7 @@ export const useUpdateWsEnvironment = () => {
}, },
onSuccess: () => { onSuccess: () => {
queryClient.invalidateQueries({ queryClient.invalidateQueries({
queryKey: workspaceKeys.getAllUserWorkspace(ProjectType.SecretManager) queryKey: workspaceKeys.getAllUserWorkspace()
}); });
} }
}); });
@@ -384,7 +384,7 @@ export const useDeleteWsEnvironment = () => {
}, },
onSuccess: () => { onSuccess: () => {
queryClient.invalidateQueries({ queryClient.invalidateQueries({
queryKey: workspaceKeys.getAllUserWorkspace(ProjectType.SecretManager) queryKey: workspaceKeys.getAllUserWorkspace()
}); });
} }
}); });
@@ -3,7 +3,7 @@ import { TListProjectIdentitiesDTO } from "@app/hooks/api/workspace/types";
import type { CaStatus } from "../ca"; import type { CaStatus } from "../ca";
export const workspaceKeys = { export const workspaceKeys = {
getWorkspaceById: (workspaceId: string) => [{ workspaceId }, "workspace"] as const, getWorkspaceById: (workspaceId: string) => ["workspaces", { workspaceId }] as const,
getWorkspaceSecrets: (workspaceId: string) => [{ workspaceId }, "workspace-secrets"] as const, getWorkspaceSecrets: (workspaceId: string) => [{ workspaceId }, "workspace-secrets"] as const,
getWorkspaceIndexStatus: (workspaceId: string) => getWorkspaceIndexStatus: (workspaceId: string) =>
[{ workspaceId }, "workspace-index-status"] as const, [{ workspaceId }, "workspace-index-status"] as const,
@@ -12,7 +12,7 @@ export const workspaceKeys = {
getWorkspaceAuthorization: (workspaceId: string) => [{ workspaceId }, "workspace-authorizations"], getWorkspaceAuthorization: (workspaceId: string) => [{ workspaceId }, "workspace-authorizations"],
getWorkspaceIntegrations: (workspaceId: string) => [{ workspaceId }, "workspace-integrations"], getWorkspaceIntegrations: (workspaceId: string) => [{ workspaceId }, "workspace-integrations"],
getAllUserWorkspace: (type?: string) => getAllUserWorkspace: (type?: string) =>
type ? ["workspaces", { type }] : (["workspace"] as const), type ? ["workspaces", { type }] : (["workspaces"] as const),
getWorkspaceAuditLogs: (workspaceId: string) => getWorkspaceAuditLogs: (workspaceId: string) =>
[{ workspaceId }, "workspace-audit-logs"] as const, [{ workspaceId }, "workspace-audit-logs"] as const,
getWorkspaceUsers: (workspaceId: string) => [{ workspaceId }, "workspace-users"] as const, getWorkspaceUsers: (workspaceId: string) => [{ workspaceId }, "workspace-users"] as const,
@@ -42,7 +42,14 @@ export const CliRedirectPage = () => {
</Helmet> </Helmet>
<div className="flex h-screen w-screen flex-col items-center justify-center space-y-4 text-gray-200"> <div className="flex h-screen w-screen flex-col items-center justify-center space-y-4 text-gray-200">
<div className="mb-4 flex justify-center"> <div className="mb-4 flex justify-center">
<img src="/images/gradientLogo.svg" height={90} width={120} alt="Infisical Logo" /> <img
src="/images/gradientLogo.svg"
style={{
height: "90px",
width: "120px"
}}
alt="Infisical Logo"
/>
</div> </div>
{cliToken ? ( {cliToken ? (
<> <>
@@ -72,7 +72,14 @@ export const LoginLdapPage = () => {
</Helmet> </Helmet>
<Link to="/"> <Link to="/">
<div className="mb-4 mt-20 flex justify-center"> <div className="mb-4 mt-20 flex justify-center">
<img src="/images/gradientLogo.svg" height={90} width={120} alt="Infisical logo" /> <img
src="/images/gradientLogo.svg"
style={{
height: "90px",
width: "120px"
}}
alt="Infisical logo"
/>
</div> </div>
</Link> </Link>
<div className="mx-auto w-full max-w-md md:px-6"> <div className="mx-auto w-full max-w-md md:px-6">
@@ -70,7 +70,14 @@ export const LoginPage = () => {
</Helmet> </Helmet>
<Link to="/"> <Link to="/">
<div className="mb-4 mt-20 flex justify-center"> <div className="mb-4 mt-20 flex justify-center">
<img src="/images/gradientLogo.svg" height={90} width={120} alt="Infisical logo" /> <img
src="/images/gradientLogo.svg"
style={{
height: "90px",
width: "120px"
}}
alt="Infisical logo"
/>
</div> </div>
</Link> </Link>
<div className="pb-28">{renderView()}</div>; <div className="pb-28">{renderView()}</div>;
@@ -154,7 +154,11 @@ export const PasswordResetPage = () => {
<p className="mb-8 flex justify-center bg-gradient-to-br from-sky-400 to-primary bg-clip-text text-center text-4xl font-semibold text-transparent"> <p className="mb-8 flex justify-center bg-gradient-to-br from-sky-400 to-primary bg-clip-text text-center text-4xl font-semibold text-transparent">
Confirm your email Confirm your email
</p> </p>
<img src="/images/envelope.svg" height={262} width={410} alt="verify email" /> <img
src="/images/envelope.svg"
style={{ height: "262px", width: "410px" }}
alt="verify email"
/>
<div className="mx-auto mb-2 mt-4 flex max-h-24 max-w-md flex-col items-center justify-center px-4 text-lg md:p-2"> <div className="mx-auto mb-2 mt-4 flex max-h-24 max-w-md flex-col items-center justify-center px-4 text-lg md:p-2">
<Button <Button
onClick={async () => { onClick={async () => {
@@ -226,7 +226,14 @@ export const SelectOrganizationPage = () => {
<div className="mx-auto mt-20 w-fit rounded-lg border-2 border-mineshaft-500 p-10 shadow-lg"> <div className="mx-auto mt-20 w-fit rounded-lg border-2 border-mineshaft-500 p-10 shadow-lg">
<Link href="/"> <Link href="/">
<div className="mb-4 flex justify-center"> <div className="mb-4 flex justify-center">
<img src="/images/gradientLogo.svg" height={90} width={120} alt="Infisical logo" /> <img
src="/images/gradientLogo.svg"
style={{
height: "90px",
width: "120px"
}}
alt="Infisical logo"
/>
</div> </div>
</Link> </Link>
<form className="mx-auto flex w-full flex-col items-center justify-center"> <form className="mx-auto flex w-full flex-col items-center justify-center">
@@ -227,7 +227,11 @@ export const SignupInvitePage = () => {
<p className="mb-6 flex justify-center text-center text-4xl font-semibold text-primary-100"> <p className="mb-6 flex justify-center text-center text-4xl font-semibold text-primary-100">
Confirm your email Confirm your email
</p> </p>
<img src="/images/dragon-signupinvite.svg" height={262} width={410} alt="verify email" /> <img
src="/images/dragon-signupinvite.svg"
style={{ height: "262px", width: "410px" }}
alt="verify email"
/>
<div className="mx-auto mb-2 mt-10 flex max-h-24 max-w-md flex-col items-center justify-center px-4 text-lg md:p-2"> <div className="mx-auto mb-2 mt-10 flex max-h-24 max-w-md flex-col items-center justify-center px-4 text-lg md:p-2">
<Button <Button
onClick={async () => { onClick={async () => {
@@ -80,7 +80,14 @@ export const SignupSsoPage = () => {
<meta name="og:description" content={t("signup.og-description") as string} /> <meta name="og:description" content={t("signup.og-description") as string} />
</Helmet> </Helmet>
<div className="mb-4 mt-20 flex justify-center"> <div className="mb-4 mt-20 flex justify-center">
<img src="/images/gradientLogo.svg" height={90} width={120} alt="Infisical Logo" /> <img
src="/images/gradientLogo.svg"
style={{
height: "90px",
width: "120px"
}}
alt="Infisical Logo"
/>
</div> </div>
<div>{renderView()}</div>; <div>{renderView()}</div>;
</div> </div>
@@ -53,7 +53,14 @@ export const VerifyEmailPage = () => {
</Helmet> </Helmet>
<Link to="/"> <Link to="/">
<div className="mb-8 mt-20 flex cursor-pointer justify-center"> <div className="mb-8 mt-20 flex cursor-pointer justify-center">
<img src="/images/biglogo.png" height={90} width={120} alt="long logo" /> <img
src="/images/biglogo.png"
style={{
height: "90px",
width: "120px"
}}
alt="long logo"
/>
</div> </div>
</Link> </Link>
{step === 1 && ( {step === 1 && (
@@ -33,8 +33,10 @@ export const AppConnectionsSelect = ({ onSelect }: Props) => {
> >
<img <img
src={`/images/integrations/${APP_CONNECTION_MAP[option.app].image}`} src={`/images/integrations/${APP_CONNECTION_MAP[option.app].image}`}
height={50} style={{
width={50} height: "50px",
width: "50px"
}}
className="mt-auto" className="mt-auto"
alt={`${APP_CONNECTION_MAP[option.app].name} logo`} alt={`${APP_CONNECTION_MAP[option.app].name} logo`}
/> />
@@ -1,14 +1,17 @@
import { createFileRoute } from "@tanstack/react-router"; import { createFileRoute, stripSearchParams } from "@tanstack/react-router";
import { zodValidator } from "@tanstack/zod-adapter"; import { zodValidator } from "@tanstack/zod-adapter";
import { z } from "zod"; import { z } from "zod";
import { ViewSharedSecretByIDPage } from "./ViewSharedSecretByIDPage"; import { ViewSharedSecretByIDPage } from "./ViewSharedSecretByIDPage";
const SharedSecretByIDPageQuerySchema = z.object({ const SharedSecretByIDPageQuerySchema = z.object({
key: z.string() key: z.string().catch("")
}); });
export const Route = createFileRoute("/shared/secret/$secretId")({ export const Route = createFileRoute("/shared/secret/$secretId")({
component: ViewSharedSecretByIDPage, component: ViewSharedSecretByIDPage,
validateSearch: zodValidator(SharedSecretByIDPageQuerySchema) validateSearch: zodValidator(SharedSecretByIDPageQuerySchema),
search: {
middlewares: [stripSearchParams({ key: "" })]
}
}); });
@@ -78,7 +78,7 @@ export const CopySecretsFromBoard = ({
const selectedEnvSlug = watch("environment"); const selectedEnvSlug = watch("environment");
const [debouncedEnvCopySecretPath] = useDebounce(envCopySecPath); const [debouncedEnvCopySecretPath] = useDebounce(envCopySecPath);
const { data: secrets, isLoading: isSecretsLoading } = useGetProjectSecrets({ const { data: secrets, isPending: isSecretsLoading } = useGetProjectSecrets({
workspaceId, workspaceId,
environment: selectedEnvSlug.slug, environment: selectedEnvSlug.slug,
secretPath: debouncedEnvCopySecretPath, secretPath: debouncedEnvCopySecretPath,
@@ -10,7 +10,7 @@ export const AzureAppConfigurationOauthCallbackPage = () => {
const { mutateAsync } = useAuthorizeIntegration(); const { mutateAsync } = useAuthorizeIntegration();
const { code, state } = useSearch({ const { code, state } = useSearch({
from: ROUTE_PATHS.SecretManager.Integratons.HerokuOauthCallbackPage.id from: ROUTE_PATHS.SecretManager.Integratons.AzureAppConfigurationsOauthCallbackPage.id
}); });
const { currentWorkspace } = useWorkspace(); const { currentWorkspace } = useWorkspace();