feat: select all on page for secrets tables and fix multipage select behavior for actions

This commit is contained in:
Scott Wilson
2024-10-17 10:17:23 -07:00
parent f95957d534
commit d94b4b2a3c
8 changed files with 356 additions and 220 deletions
@@ -54,7 +54,7 @@ import {
import { usePopUp } from "@app/hooks";
import { useCreateFolder, useDeleteSecretBatch, useMoveSecrets } from "@app/hooks/api";
import { fetchProjectSecrets } from "@app/hooks/api/secrets/queries";
import { SecretType, SecretV3RawSanitized, WsTag } from "@app/hooks/api/types";
import { SecretType, WsTag } from "@app/hooks/api/types";
import {
PopUpNames,
@@ -69,8 +69,7 @@ import { FolderForm } from "./FolderForm";
import { MoveSecretsModal } from "./MoveSecretsModal";
type Props = {
secrets?: SecretV3RawSanitized[];
// swtich the secrets type as it gets decrypted after api call
// switch the secrets type as it gets decrypted after api call
environment: string;
// @depreciated will be moving all these details to zustand
workspaceId: string;
@@ -89,7 +88,6 @@ type Props = {
};
export const ActionBar = ({
secrets = [],
environment,
workspaceId,
projectSlug,
@@ -202,7 +200,7 @@ export const ActionBar = ({
};
const handleSecretBulkDelete = async () => {
const bulkDeletedSecrets = secrets.filter(({ id }) => Boolean(selectedSecrets?.[id]));
const bulkDeletedSecrets = Object.values(selectedSecrets);
try {
await deleteBatchSecretV3({
secretPath,
@@ -235,7 +233,7 @@ export const ActionBar = ({
shouldOverwrite: boolean;
}) => {
try {
const secretsToMove = secrets.filter(({ id }) => Boolean(selectedSecrets?.[id]));
const secretsToMove = Object.values(selectedSecrets);
const { isDestinationUpdated, isSourceUpdated } = await moveSecrets({
projectSlug,
shouldOverwrite,