Fix: Added explicit SecretType type

This commit is contained in:
Daniel Hougaard
2024-06-21 15:23:50 +02:00
parent 9c06cab99d
commit d0f8394f50
9 changed files with 41 additions and 29 deletions
@@ -64,7 +64,7 @@ import {
} from "@app/hooks/api";
import { useUpdateFolderBatch } from "@app/hooks/api/secretFolders/queries";
import { TUpdateFolderBatchDTO } from "@app/hooks/api/secretFolders/types";
import { TSecretFolder } from "@app/hooks/api/types";
import { SecretType, TSecretFolder } from "@app/hooks/api/types";
import { ProjectVersion } from "@app/hooks/api/workspace/types";
import { FolderForm } from "../SecretMainPage/components/ActionBar/FolderForm";
@@ -320,7 +320,7 @@ export const SecretOverviewPage = () => {
secretName: key,
secretValue: value,
secretComment: "",
type: "shared",
type: SecretType.Shared,
latestFileKey: latestFileKey!
});
createNotification({
@@ -344,7 +344,13 @@ export const SecretOverviewPage = () => {
}
};
const handleSecretUpdate = async (env: string, key: string, value: string, secretId?: string) => {
const handleSecretUpdate = async (
env: string,
key: string,
value: string,
type = SecretType.Shared,
secretId?: string
) => {
try {
await updateSecretV3({
environment: env,
@@ -353,7 +359,7 @@ export const SecretOverviewPage = () => {
secretId,
secretName: key,
secretValue: value,
type: "shared",
type,
latestFileKey: latestFileKey!
});
createNotification({
@@ -377,7 +383,7 @@ export const SecretOverviewPage = () => {
secretPath,
secretName: key,
secretId,
type: "shared"
type: SecretType.Shared
});
createNotification({
type: "success",
@@ -18,7 +18,7 @@ import {
import { InfisicalSecretInput } from "@app/components/v2/InfisicalSecretInput";
import { useWorkspace } from "@app/context";
import { useCreateFolder, useCreateSecretV3, useUpdateSecretV3 } from "@app/hooks/api";
import { DecryptedSecret, UserWsKeyPair } from "@app/hooks/api/types";
import { DecryptedSecret, SecretType, UserWsKeyPair } from "@app/hooks/api/types";
const typeSchema = z
.object({
@@ -103,7 +103,7 @@ export const CreateSecretForm = ({
secretPath,
secretName: key,
secretValue: value || "",
type: "shared",
type: SecretType.Shared,
latestFileKey: decryptFileKey
});
}
@@ -115,7 +115,7 @@ export const CreateSecretForm = ({
secretName: key,
secretValue: value || "",
secretComment: "",
type: "shared",
type: SecretType.Shared,
latestFileKey: decryptFileKey
});
});
@@ -18,7 +18,7 @@ import {
} from "@app/context";
import { useToggle } from "@app/hooks";
import { useGetUserWsKey, useUpdateSecretV3 } from "@app/hooks/api";
import { DecryptedSecret } from "@app/hooks/api/types";
import { DecryptedSecret, SecretType } from "@app/hooks/api/types";
import { SecretActionType } from "@app/views/SecretMainPage/components/SecretListView/SecretListView.utils";
type Props = {
@@ -37,7 +37,6 @@ type TFormSchema = z.infer<typeof formSchema>;
function SecretRenameRow({ environments, getSecretByKey, secretKey, secretPath }: Props) {
const { currentWorkspace } = useWorkspace();
const { permission } = useProjectPermission();
const secrets = environments.map((env) => getSecretByKey(env.slug, secretKey));
@@ -113,7 +112,7 @@ function SecretRenameRow({ environments, getSecretByKey, secretKey, secretPath }
secretName: secret.key,
secretId: secret.id,
secretValue: secret.value || "",
type: "shared",
type: SecretType.Shared,
latestFileKey: decryptFileKey!,
tags: secret.tags.map((tag) => tag.id),
secretComment: secret.comment,
@@ -13,7 +13,12 @@ import {
} from "@app/context";
import { usePopUp } from "@app/hooks";
import { useDeleteFolder, useDeleteSecretBatch } from "@app/hooks/api";
import { DecryptedSecret, TDeleteSecretBatchDTO, TSecretFolder } from "@app/hooks/api/types";
import {
DecryptedSecret,
SecretType,
TDeleteSecretBatchDTO,
TSecretFolder
} from "@app/hooks/api/types";
export enum EntryType {
FOLDER = "folder",
@@ -100,7 +105,7 @@ export const SelectionPanel = ({
...accum,
{
secretName: entry.key,
type: "shared" as "shared"
type: SecretType.Shared
}
];
}