Implemented test run deletion
This commit is contained in:
@@ -39,7 +39,8 @@ export default function RunsPage({ projectId }: Props) {
|
||||
const onDeleteClick = async (runId: number) => {
|
||||
try {
|
||||
await deleteRun(runId);
|
||||
setRuns(runs.filter((run) => run.id !== runId));
|
||||
const data = await fetchRuns(projectId);
|
||||
setRuns(data);
|
||||
} catch (error) {
|
||||
console.error("Error deleting run:", error);
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ export default function RunsTable({ projectId, runs, onDeleteRun }: Props) {
|
||||
</TableColumn>
|
||||
)}
|
||||
</TableHeader>
|
||||
<TableBody emptyContent={"No cases found"} items={sortedItems}>
|
||||
<TableBody emptyContent={"No runs found"} items={sortedItems}>
|
||||
{(item) => (
|
||||
<TableRow key={item.id}>
|
||||
{(columnKey) => (
|
||||
|
||||
@@ -17,7 +17,7 @@ import { fetchRun, updateRun } from "../runsControl";
|
||||
|
||||
const defaultTestRun = {
|
||||
id: 0,
|
||||
title: "",
|
||||
name: "",
|
||||
configurations: 0,
|
||||
description: "",
|
||||
state: 0,
|
||||
@@ -31,7 +31,7 @@ type Props = {
|
||||
|
||||
export default function RunEditor({ projectId, runId }: Props) {
|
||||
const [testRun, setTestRun] = useState<RunType>(defaultTestRun);
|
||||
const [isTitleInvalid, setIsTitleInvalid] = useState<boolean>(false);
|
||||
const [isNameInvalid, setIsNameInvalid] = useState<boolean>(false);
|
||||
const [isUpdating, setIsUpdating] = useState<boolean>(false);
|
||||
const router = useRouter();
|
||||
|
||||
@@ -62,7 +62,7 @@ export default function RunEditor({ projectId, runId }: Props) {
|
||||
<ArrowLeft size={16} />
|
||||
</Button>
|
||||
</Tooltip>
|
||||
<h3 className="font-bold ms-2">{testRun.title}</h3>
|
||||
<h3 className="font-bold ms-2">{testRun.name}</h3>
|
||||
</div>
|
||||
<Button
|
||||
startContent={<Save size={16} />}
|
||||
@@ -84,12 +84,12 @@ export default function RunEditor({ projectId, runId }: Props) {
|
||||
size="sm"
|
||||
type="text"
|
||||
variant="bordered"
|
||||
label="Title"
|
||||
value={testRun.title}
|
||||
isInvalid={isTitleInvalid}
|
||||
errorMessage={isTitleInvalid ? "please enter title" : ""}
|
||||
label="Name"
|
||||
value={testRun.name}
|
||||
isInvalid={isNameInvalid}
|
||||
errorMessage={isNameInvalid ? "please enter name" : ""}
|
||||
onChange={(e) => {
|
||||
setTestRun({ ...testRun, title: e.target.value });
|
||||
setTestRun({ ...testRun, name: e.target.value });
|
||||
}}
|
||||
className="mt-3"
|
||||
/>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export type RunType = {
|
||||
id: number;
|
||||
title: string;
|
||||
name: string;
|
||||
configurations: number;
|
||||
description: string;
|
||||
state: number;
|
||||
|
||||
Reference in New Issue
Block a user