mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-09 02:28:18 +00:00
Reviews
This commit is contained in:
@@ -115,6 +115,7 @@ export const useTriggerSecretScanningDataSource = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// If possible, use useUpdateMultipleSecretScanningFinding instead.
|
||||||
export const useUpdateSecretScanningFinding = () => {
|
export const useUpdateSecretScanningFinding = () => {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
return useMutation({
|
return useMutation({
|
||||||
|
|||||||
+1
@@ -418,6 +418,7 @@ export const SecretScanningFindingsTable = ({ findings }: Props) => {
|
|||||||
<SecretScanningUpdateFindingModal
|
<SecretScanningUpdateFindingModal
|
||||||
isOpen={popUp.updateFinding.isOpen}
|
isOpen={popUp.updateFinding.isOpen}
|
||||||
onOpenChange={(isOpen) => handlePopUpToggle("updateFinding", isOpen)}
|
onOpenChange={(isOpen) => handlePopUpToggle("updateFinding", isOpen)}
|
||||||
|
onComplete={() => setSelectedRows([])}
|
||||||
findings={popUp.updateFinding.data}
|
findings={popUp.updateFinding.data}
|
||||||
/>
|
/>
|
||||||
{selectedRows.length > 0 && (
|
{selectedRows.length > 0 && (
|
||||||
|
|||||||
+25
-13
@@ -17,14 +17,14 @@ import { SECRET_SCANNING_FINDING_STATUS_ICON_MAP } from "@app/helpers/secretScan
|
|||||||
import {
|
import {
|
||||||
SecretScanningFindingStatus,
|
SecretScanningFindingStatus,
|
||||||
TSecretScanningFinding,
|
TSecretScanningFinding,
|
||||||
useUpdateMultipleSecretScanningFinding,
|
useUpdateMultipleSecretScanningFinding
|
||||||
useUpdateSecretScanningFinding
|
|
||||||
} from "@app/hooks/api/secretScanningV2";
|
} from "@app/hooks/api/secretScanningV2";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
findings?: TSecretScanningFinding[];
|
findings?: TSecretScanningFinding[];
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
onOpenChange: (isOpen: boolean) => void;
|
onOpenChange: (isOpen: boolean) => void;
|
||||||
|
onComplete?: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const FormSchema = z.object({
|
const FormSchema = z.object({
|
||||||
@@ -40,7 +40,6 @@ type ContentProps = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const Content = ({ findings, onComplete }: ContentProps) => {
|
const Content = ({ findings, onComplete }: ContentProps) => {
|
||||||
const updateFinding = useUpdateSecretScanningFinding();
|
|
||||||
const updateMultipleFindings = useUpdateMultipleSecretScanningFinding();
|
const updateMultipleFindings = useUpdateMultipleSecretScanningFinding();
|
||||||
|
|
||||||
const single = findings.length === 1;
|
const single = findings.length === 1;
|
||||||
@@ -67,12 +66,14 @@ const Content = ({ findings, onComplete }: ContentProps) => {
|
|||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
await updateFinding.mutateAsync({
|
await updateMultipleFindings.mutateAsync([
|
||||||
...data,
|
{
|
||||||
status: data.status,
|
...data,
|
||||||
findingId: findings[0].id,
|
status: data.status,
|
||||||
projectId: findings[0].projectId
|
findingId: findings[0].id,
|
||||||
});
|
projectId: findings[0].projectId
|
||||||
|
}
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
createNotification({
|
createNotification({
|
||||||
@@ -135,8 +136,8 @@ const Content = ({ findings, onComplete }: ContentProps) => {
|
|||||||
<div className="flex w-full flex-row-reverse justify-between gap-4 pt-4">
|
<div className="flex w-full flex-row-reverse justify-between gap-4 pt-4">
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
isLoading={updateFinding.isPending}
|
isLoading={updateMultipleFindings.isPending}
|
||||||
isDisabled={updateFinding.isPending}
|
isDisabled={updateMultipleFindings.isPending}
|
||||||
colorSchema="secondary"
|
colorSchema="secondary"
|
||||||
>
|
>
|
||||||
Update Status
|
Update Status
|
||||||
@@ -149,7 +150,12 @@ const Content = ({ findings, onComplete }: ContentProps) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SecretScanningUpdateFindingModal = ({ findings, isOpen, onOpenChange }: Props) => {
|
export const SecretScanningUpdateFindingModal = ({
|
||||||
|
findings,
|
||||||
|
isOpen,
|
||||||
|
onOpenChange,
|
||||||
|
onComplete
|
||||||
|
}: Props) => {
|
||||||
if (!findings?.length) return null;
|
if (!findings?.length) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -158,7 +164,13 @@ export const SecretScanningUpdateFindingModal = ({ findings, isOpen, onOpenChang
|
|||||||
title={`Update Finding${findings.length === 1 ? "" : "s"}`}
|
title={`Update Finding${findings.length === 1 ? "" : "s"}`}
|
||||||
subTitle="Update the status or leave remarks"
|
subTitle="Update the status or leave remarks"
|
||||||
>
|
>
|
||||||
<Content findings={findings} onComplete={() => onOpenChange(false)} />
|
<Content
|
||||||
|
findings={findings}
|
||||||
|
onComplete={() => {
|
||||||
|
onOpenChange(false);
|
||||||
|
if (onComplete) onComplete();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user