From 4a4288d47ab64b4e7d08d7ae3fb732315c389bf9 Mon Sep 17 00:00:00 2001 From: Takeshi Kimata <117462761+kimatata@users.noreply.github.com> Date: Sun, 14 Apr 2024 22:43:55 +0900 Subject: [PATCH] Implemented test run editor's test case selection --- .../[projectId]/runs/[runId]/RunEditor.tsx | 1 - .../runs/[runId]/TestCaseSelector.tsx | 63 ++++++++++--------- frontend/config/selection.ts | 1 - 3 files changed, 32 insertions(+), 33 deletions(-) diff --git a/frontend/app/projects/[projectId]/runs/[runId]/RunEditor.tsx b/frontend/app/projects/[projectId]/runs/[runId]/RunEditor.tsx index 170d1ac..95f9291 100644 --- a/frontend/app/projects/[projectId]/runs/[runId]/RunEditor.tsx +++ b/frontend/app/projects/[projectId]/runs/[runId]/RunEditor.tsx @@ -263,7 +263,6 @@ export default function RunEditor({ projectId, runId }: Props) {
>; }; export default function TestCaseSelector({ - projectId, cases, selectedKeys, onSelectionChange, @@ -56,27 +52,21 @@ export default function TestCaseSelector({ return sortDescriptor.direction === "descending" ? -cmp : cmp; }); }, [sortDescriptor, cases]); + + const notIncludedCaseClass = "text-neutral-200 dark:text-neutral-600"; + const chipBaseClass = "border-none gap-1 text-default-600"; + const renderCell = useCallback((testCase: CaseType, columnKey: Key) => { const cellValue = testCase[columnKey as keyof CaseType]; - // console.log(columnKey, cellValue) + const isIncluded = testCase.isIncluded; switch (columnKey) { - case "id": - return {cellValue}; - case "title": - return ( - - {cellValue} - - ); case "priority": return ( ); - case "isIncluded": - const flag = cellValue ? "true" : "false" - return {flag}; case "runStatus": return ( - - {testRunCaseStatus[cellValue].name} - + + + + + + {testRunCaseStatus.map((runCaseStatus, index) => ( + {}}> + {testRunCaseStatus[index].name} + + ))} + + ); case "actions": return ( @@ -167,7 +165,10 @@ export default function TestCaseSelector({ {(item) => ( - + {(columnKey) => ( {renderCell(item, columnKey)} )} diff --git a/frontend/config/selection.ts b/frontend/config/selection.ts index c72c9f6..872506e 100644 --- a/frontend/config/selection.ts +++ b/frontend/config/selection.ts @@ -43,7 +43,6 @@ const testRunStatus = [ ] const testRunCaseStatus = [ - { name: "Not included", uid: "notincluded", color: "primary" }, { name: "Untested", uid: "untested", color: "primary" }, { name: "Passed", uid: "passed", color: "success" }, { name: "Failed", uid: "untested", color: "danger" },