implemented bulk deletion of cases

This commit is contained in:
Takeshi Kimata
2024-03-24 21:53:33 +09:00
parent a86d166d26
commit ba33af949c

View File

@@ -142,17 +142,22 @@ export default function TestCaseTable({
[] []
); );
const onDeleteCasesClick = async() => { const onDeleteCasesClick = async () => {
if (selectedKeys === "all") {
const allKeys = sortedItems.map((item) => item.id);
onDeleteCases(allKeys);
} else {
onDeleteCases([...selectedKeys]);
}
setSelectedKeys(new Set([])); setSelectedKeys(new Set([]));
onDeleteCases([...selectedKeys]) };
}
return ( return (
<> <>
<div className="border-b-1 dark:border-neutral-700 w-full p-3 flex items-center justify-between"> <div className="border-b-1 dark:border-neutral-700 w-full p-3 flex items-center justify-between">
<h3 className="font-bold">Cases</h3> <h3 className="font-bold">Cases</h3>
<div> <div>
{selectedKeys.size > 0 && ( {(selectedKeys.size > 0 || selectedKeys === "all") && (
<Button <Button
startContent={<Trash size={16} />} startContent={<Trash size={16} />}
size="sm" size="sm"