mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-05 16:26:37 +00:00
fix: resolved v2 secret update bug and object returning in import secret empty
This commit is contained in:
@@ -108,7 +108,7 @@ export const getAllSecretsFromImport = async (req: Request, res: Response) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!importSecDoc) {
|
if (!importSecDoc) {
|
||||||
return res.status(200).json({ secrets: {} });
|
return res.status(200).json({ secrets: [] });
|
||||||
}
|
}
|
||||||
|
|
||||||
const secrets = await getAllImportedSecrets(workspaceId, environment, folderId);
|
const secrets = await getAllImportedSecrets(workspaceId, environment, folderId);
|
||||||
|
|||||||
@@ -346,6 +346,7 @@ export const createSecretHelper = async ({
|
|||||||
workspace: new Types.ObjectId(workspaceId),
|
workspace: new Types.ObjectId(workspaceId),
|
||||||
folder: folderId,
|
folder: folderId,
|
||||||
type,
|
type,
|
||||||
|
environment,
|
||||||
...(type === SECRET_PERSONAL ? getAuthDataPayloadUserObj(authData) : {})
|
...(type === SECRET_PERSONAL ? getAuthDataPayloadUserObj(authData) : {})
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -362,6 +363,7 @@ export const createSecretHelper = async ({
|
|||||||
secretBlindIndex,
|
secretBlindIndex,
|
||||||
folder: folderId,
|
folder: folderId,
|
||||||
workspace: new Types.ObjectId(workspaceId),
|
workspace: new Types.ObjectId(workspaceId),
|
||||||
|
environment,
|
||||||
type: SECRET_SHARED
|
type: SECRET_SHARED
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable no-param-reassign */
|
/* eslint-disable no-param-reassign */
|
||||||
import { useCallback } from "react";
|
import { useCallback } from "react";
|
||||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
import { useMutation, useQueries, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
decryptAssymmetric,
|
decryptAssymmetric,
|
||||||
@@ -15,7 +15,8 @@ import {
|
|||||||
EncryptedSecret,
|
EncryptedSecret,
|
||||||
EncryptedSecretVersion,
|
EncryptedSecretVersion,
|
||||||
GetProjectSecretsDTO,
|
GetProjectSecretsDTO,
|
||||||
GetSecretVersionsDTO
|
GetSecretVersionsDTO,
|
||||||
|
TGetProjectSecretsAllEnvDTO
|
||||||
} from "./types";
|
} from "./types";
|
||||||
|
|
||||||
export const secretKeys = {
|
export const secretKeys = {
|
||||||
@@ -160,6 +161,21 @@ export const useGetProjectSecrets = ({
|
|||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const useGetProjectSecretsAllEnv = ({
|
||||||
|
workspaceId,
|
||||||
|
envs,
|
||||||
|
decryptFileKey,
|
||||||
|
folderId,
|
||||||
|
secretPath
|
||||||
|
}: TGetProjectSecretsAllEnvDTO) =>
|
||||||
|
useQueries({
|
||||||
|
queries: envs.map((env) => ({
|
||||||
|
queryKey: secretKeys.getProjectSecret(workspaceId, env, secretPath || folderId),
|
||||||
|
enabled: Boolean(decryptFileKey && workspaceId && env),
|
||||||
|
queryFn: () => fetchProjectEncryptedSecrets(workspaceId, env, folderId, secretPath)
|
||||||
|
}))
|
||||||
|
});
|
||||||
|
|
||||||
export const useGetProjectSecretsByKey = ({
|
export const useGetProjectSecretsByKey = ({
|
||||||
workspaceId,
|
workspaceId,
|
||||||
env,
|
env,
|
||||||
|
|||||||
@@ -103,6 +103,15 @@ export type GetProjectSecretsDTO = {
|
|||||||
onSuccess?: (data: DecryptedSecret[]) => void;
|
onSuccess?: (data: DecryptedSecret[]) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type TGetProjectSecretsAllEnvDTO = {
|
||||||
|
workspaceId: string;
|
||||||
|
envs: string[];
|
||||||
|
decryptFileKey: UserWsKeyPair;
|
||||||
|
folderId?: string;
|
||||||
|
secretPath?: string;
|
||||||
|
isPaused?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
export type GetSecretVersionsDTO = {
|
export type GetSecretVersionsDTO = {
|
||||||
secretId: string;
|
secretId: string;
|
||||||
limit: number;
|
limit: number;
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import Head from "next/head";
|
||||||
|
|
||||||
|
import { SecretOverviewPage } from "@app/views/SecretOverviewPage";
|
||||||
|
|
||||||
|
const Dashboard = () => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Head>
|
||||||
|
<title>{t("common.head-title", { title: t("dashboard.title") })}</title>
|
||||||
|
<link rel="icon" href="/infisical.ico" />
|
||||||
|
<meta property="og:image" content="/images/message.png" />
|
||||||
|
<meta property="og:title" content={String(t("dashboard.og-title"))} />
|
||||||
|
<meta name="og:description" content={String(t("dashboard.og-description"))} />
|
||||||
|
</Head>
|
||||||
|
<div className="h-full">
|
||||||
|
<SecretOverviewPage />
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Dashboard;
|
||||||
|
|
||||||
|
Dashboard.requireAuth = true;
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import { useState } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
|
import { useOrganization, useWorkspace } from "@app/context";
|
||||||
|
import { useGetUserWsKey } from "@app/hooks/api";
|
||||||
|
|
||||||
|
export const SecretOverviewPage = () => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
const { currentWorkspace, isLoading } = useWorkspace();
|
||||||
|
const { currentOrg } = useOrganization();
|
||||||
|
const workspaceId = currentWorkspace?._id as string;
|
||||||
|
const { data: latestFileKey } = useGetUserWsKey(workspaceId);
|
||||||
|
const [searchFilter, setSearchFilter] = useState("");
|
||||||
|
const secretPath = router.query?.secretPath as string;
|
||||||
|
return <div>Secret overview page</div>;
|
||||||
|
};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export { SecretOverviewPage } from "./SecretOverviewPage";
|
||||||
Reference in New Issue
Block a user