From 414b3870a600d5172041d140aaa271f0143b068a Mon Sep 17 00:00:00 2001 From: Pavel Strunkin Date: Fri, 9 Jul 2021 15:17:33 +0300 Subject: [PATCH 1/2] Clean up old test variations https://github.com/Visual-Regression-Tracker/Visual-Regression-Tracker/issues/275 --- src/components/ProjectForm/ProjectForm.tsx | 20 ++++++++++++++++++++ src/constants/project.ts | 1 + src/types/project.ts | 1 + 3 files changed, 22 insertions(+) diff --git a/src/components/ProjectForm/ProjectForm.tsx b/src/components/ProjectForm/ProjectForm.tsx index 09c00dfa..c167ba58 100644 --- a/src/components/ProjectForm/ProjectForm.tsx +++ b/src/components/ProjectForm/ProjectForm.tsx @@ -94,6 +94,26 @@ export const ProjectForm: React.FunctionComponent = () => { }); }} /> + { + const value = (event.target as HTMLInputElement).value; + setProjectEditState(projectDispatch, { + ...project, + maxBranchLifetime: parseInt(value), + }); + }} + /> ; From f2ea778bd8fe5219c684d3e91dc240e8e84bb4b0 Mon Sep 17 00:00:00 2001 From: Pavel Strunkin Date: Fri, 9 Jul 2021 17:44:17 +0300 Subject: [PATCH 2/2] Clean up old test variations https://github.com/Visual-Regression-Tracker/Visual-Regression-Tracker/issues/275 --- src/components/TestDetailsModal.tsx | 62 +++++++++++++++++------------ 1 file changed, 37 insertions(+), 25 deletions(-) diff --git a/src/components/TestDetailsModal.tsx b/src/components/TestDetailsModal.tsx index 3cc2a2ec..e90d7871 100644 --- a/src/components/TestDetailsModal.tsx +++ b/src/components/TestDetailsModal.tsx @@ -17,10 +17,7 @@ import { import { ToggleButton } from "@material-ui/lab"; import { useHotkeys } from "react-hotkeys-hook"; import { TestRun } from "../types"; -import { - testRunService, - staticService, -} from "../services"; +import { testRunService, staticService } from "../services"; import { TestStatus } from "../types/testStatus"; import { useHistory, Prompt } from "react-router-dom"; import { IgnoreArea, UpdateIgnoreAreaDto } from "../types/ignoreArea"; @@ -173,9 +170,9 @@ const TestDetailsModal: React.FunctionComponent<{ const fitStageToScreen = () => { const scale = image ? Math.min( - stageWidth < image.width ? stageWidth / image.width : 1, - stageHeigth < image.height ? stageHeigth / image.height : 1 - ) + stageWidth < image.width ? stageWidth / image.width : 1, + stageHeigth < image.height ? stageHeigth / image.height : 1 + ) : 1; setStageScale(scale); resetPositioin(); @@ -190,23 +187,36 @@ const TestDetailsModal: React.FunctionComponent<{ let newIgnoreArea = ignoreAreas.find((area) => selectedRectId! === area.id); if (newIgnoreArea) { setProcessing(true); - testRunService.getList(testRun.buildId).then( - (testRuns: TestRun[]) => { + testRunService + .getList(testRun.buildId) + .then((testRuns: TestRun[]) => { let allIds = testRuns.map((item) => item.id); - let data: UpdateIgnoreAreaDto = { ids: allIds, ignoreAreas: [newIgnoreArea!] }; + let data: UpdateIgnoreAreaDto = { + ids: allIds, + ignoreAreas: [newIgnoreArea!], + }; testRunService.addIgnoreAreas(data).then(() => { setProcessing(false); setSelectedRectId(undefined); - enqueueSnackbar("Ignore areas are updated in all images in this build.", { - variant: "success", - }); + enqueueSnackbar( + "Ignore areas are updated in all images in this build.", + { + variant: "success", + } + ); + }); + }) + .catch((error) => { + enqueueSnackbar("There was an error : " + error, { + variant: "error", }); - }).catch((error) => { - enqueueSnackbar("There was an error : " + error, { variant: "error" }); setProcessing(false); }); } else { - enqueueSnackbar("There was an error determining which ignore area to apply.", { variant: "error" }); + enqueueSnackbar( + "There was an error determining which ignore area to apply.", + { variant: "error" } + ); } }; @@ -265,10 +275,10 @@ const TestDetailsModal: React.FunctionComponent<{ )} {(testRun.status === TestStatus.unresolved || testRun.status === TestStatus.new) && ( - - - - )} + + + + )} @@ -277,7 +287,7 @@ const TestDetailsModal: React.FunctionComponent<{ - {(processing) && } + {processing && } @@ -349,13 +359,14 @@ const TestDetailsModal: React.FunctionComponent<{ - + - applyIgnoreArea() - } + onClick={() => applyIgnoreArea()} > @@ -374,6 +385,7 @@ const TestDetailsModal: React.FunctionComponent<{