update runCase at once
This commit is contained in:
@@ -21,18 +21,11 @@ import {
|
||||
import { Save, ArrowLeft, Folder, ChevronDown, CopyPlus, CopyMinus, RotateCw } from 'lucide-react';
|
||||
import RunProgressChart from './RunPregressDonutChart';
|
||||
import TestCaseSelector from './TestCaseSelector';
|
||||
import { testRunStatus } from '@/config/selection';
|
||||
import { testRunCaseStatus, testRunStatus } from '@/config/selection';
|
||||
import { RunType, RunStatusCountType, RunMessages } from '@/types/run';
|
||||
import { CaseType } from '@/types/case';
|
||||
import { FolderType } from '@/types/folder';
|
||||
import {
|
||||
fetchRun,
|
||||
updateRun,
|
||||
updateRunCases,
|
||||
processRunCases,
|
||||
fetchProjectCases,
|
||||
processTestCases,
|
||||
} from '../runsControl';
|
||||
import { fetchRun, updateRun, updateRunCases, fetchProjectCases, processTestCases } from '../runsControl';
|
||||
import { fetchFolders } from '../../folders/foldersControl';
|
||||
import { TokenContext } from '@/utils/TokenProvider';
|
||||
import { useTheme } from 'next-themes';
|
||||
@@ -122,14 +115,13 @@ export default function RunEditor({ projectId, runId, messages, locale }: Props)
|
||||
|
||||
const handleChangeStatus = async (changeCaseId: number, status: number) => {
|
||||
setIsDirty(true);
|
||||
setTestCases((prevTestCases) => {
|
||||
return prevTestCases.map((testCase) => {
|
||||
if (testCase.id === changeCaseId) {
|
||||
return { ...testCase, runStatus: status, editState: 'changed' };
|
||||
}
|
||||
return testCase;
|
||||
});
|
||||
});
|
||||
const newTestCases = [...testCases];
|
||||
const found = newTestCases.find((testCase) => testCase.id === changeCaseId);
|
||||
if (found && found.RunCases && testRunCaseStatus.length > 0) {
|
||||
found.RunCases[0].status = status;
|
||||
found.RunCases[0].editState = 'changed';
|
||||
}
|
||||
setTestCases(newTestCases);
|
||||
};
|
||||
|
||||
const handleIncludeExcludeCase = async (isInclude: boolean, clickedTestCaseId: number) => {
|
||||
|
||||
@@ -156,7 +156,7 @@ export default function TestCaseSelector({
|
||||
startContent={renderStatusIcon(runCaseStatus.uid)}
|
||||
onPress={() => onStatusChange(testCase.id, index)}
|
||||
>
|
||||
{messages[runStatus.uid]}
|
||||
{messages[runCaseStatus.uid]}
|
||||
</DropdownItem>
|
||||
))}
|
||||
</DropdownMenu>
|
||||
@@ -250,12 +250,14 @@ export default function TestCaseSelector({
|
||||
</TableColumn>
|
||||
)}
|
||||
</TableHeader>
|
||||
<TableBody emptyContent={messages.noCasesFound} items={sortedItems}>
|
||||
{(item) => (
|
||||
<TableBody emptyContent={messages.noCasesFound}>
|
||||
{sortedItems.map((item) => (
|
||||
<TableRow key={item.id} className={isCaseIncluded(item) ? '' : notIncludedCaseClass}>
|
||||
{(columnKey) => <TableCell key={`${item.id} + ${columnKey}`}>{renderCell(item, columnKey)}</TableCell>}
|
||||
{headerColumns.map((column) => (
|
||||
<TableCell key={column.uid}>{renderCell(item, column.uid)}</TableCell>
|
||||
))}
|
||||
</TableRow>
|
||||
)}
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user