diff --git a/src/_helpers/route.helpers.ts b/src/_helpers/route.helpers.ts
index 1d7e65dd..620e45a5 100644
--- a/src/_helpers/route.helpers.ts
+++ b/src/_helpers/route.helpers.ts
@@ -1,9 +1,15 @@
-import { TestRun, TestVariation } from "../types"
-import { routes } from "../constants"
+import { TestRun, TestVariation } from "../types";
+import { routes } from "../constants";
-export const buildTestRunUrl = (testVariation: TestVariation, testRun: TestRun) =>
- `${routes.HOME}${testVariation.projectId}?buildId=${testRun.buildId}&testId=${testRun.id}`
+export const buildTestRunUrl = (
+ testVariation: TestVariation,
+ testRun: TestRun
+) =>
+ `${routes.HOME}${testVariation.projectId}?buildId=${testRun.buildId}&testId=${testRun.id}`;
export const buildTestRunLocation = (testRun: TestRun) => ({
- search: `buildId=${testRun.buildId}&testId=${testRun.id}`,
-})
\ No newline at end of file
+ search: `buildId=${testRun.buildId}&testId=${testRun.id}`,
+});
+
+export const buildBuildPageUrl = (projectId: string, buildId: string) =>
+ `${routes.HOME}${projectId}?buildId=${buildId}`;
diff --git a/src/components/TestDetailsModal.tsx b/src/components/TestDetailsModal.tsx
index 45a3129c..380a0f10 100644
--- a/src/components/TestDetailsModal.tsx
+++ b/src/components/TestDetailsModal.tsx
@@ -10,6 +10,8 @@ import {
Paper,
Box,
makeStyles,
+ Chip,
+ Tooltip,
} from "@material-ui/core";
import { ToggleButton } from "@material-ui/lab";
import { TestRun } from "../types";
@@ -154,26 +156,45 @@ const TestDetailsModal: React.FunctionComponent<{
{(testRun.status === TestStatus.unresolved ||
testRun.status === TestStatus.new) && (
-
-
+
+ {testRun.merge && (
+
+
+
+
+
+ )}
+
+
+
+
+
+
+
)}
@@ -213,8 +234,10 @@ const TestDetailsModal: React.FunctionComponent<{
.setComment(testRun.id, comment)
.then((testRun) => updateTestRun(testRunDispatch, testRun)),
// update in variation
- testVariationService
- .setComment(testRun.testVariationId, comment),
+ testVariationService.setComment(
+ testRun.testVariationId,
+ comment
+ ),
])
}
/>
diff --git a/src/components/TestVariationMergeForm.tsx b/src/components/TestVariationMergeForm.tsx
new file mode 100644
index 00000000..0033979d
--- /dev/null
+++ b/src/components/TestVariationMergeForm.tsx
@@ -0,0 +1,53 @@
+import React from "react";
+import { Grid, Select, MenuItem, Button } from "@material-ui/core";
+import { testVariationService } from "../services";
+import { useHistory } from "react-router-dom";
+import { buildBuildPageUrl } from "../_helpers/route.helpers";
+
+interface IProps {
+ projectId: string;
+ items: string[];
+}
+
+export const TestVariationMergeForm: React.FunctionComponent = ({
+ projectId,
+ items,
+}) => {
+ const history = useHistory();
+ const [branch, setBranch] = React.useState("");
+
+ const handleSubmit = (event: React.FormEvent) => {
+ event.preventDefault();
+ testVariationService.merge(projectId, branch).then((build) => {
+ history.push(buildBuildPageUrl(projectId, build.id));
+ });
+ };
+
+ return (
+
+ );
+};
diff --git a/src/pages/TestVariationListPage.tsx b/src/pages/TestVariationListPage.tsx
index 0edf9516..1f068ce9 100644
--- a/src/pages/TestVariationListPage.tsx
+++ b/src/pages/TestVariationListPage.tsx
@@ -6,9 +6,10 @@ import { testVariationService } from "../services";
import { Container, Box, Grid, Typography } from "@material-ui/core";
import ProjectSelect from "../components/ProjectSelect";
import Filters from "../components/Filters";
+import { TestVariationMergeForm } from "../components/TestVariationMergeForm";
const TestVariationListPage: React.FunctionComponent = () => {
- const { projectId } = useParams();
+ const { projectId = "" } = useParams();
const [testVariations, setTestVariations] = React.useState(
[]
);
@@ -54,17 +55,23 @@ const TestVariationListPage: React.FunctionComponent = () => {
-
-
-
+ t.branchName))
+ )}
+ />
+
+
+
diff --git a/src/services/testRun.service.ts b/src/services/testRun.service.ts
index ea586081..9e28358a 100644
--- a/src/services/testRun.service.ts
+++ b/src/services/testRun.service.ts
@@ -50,15 +50,16 @@ function recalculateDiff(id: string): Promise {
).then(handleResponse);
}
-function approve(id: string): Promise {
+function approve(id: string, merge: boolean): Promise {
const requestOptions = {
method: "GET",
headers: authHeader(),
};
- return fetch(`${API_URL}${ENDPOINT_URL}/approve/${id}`, requestOptions).then(
- handleResponse
- );
+ return fetch(
+ `${API_URL}${ENDPOINT_URL}/approve?id=${id}&merge=${merge}`,
+ requestOptions
+ ).then(handleResponse);
}
function reject(id: string): Promise {
diff --git a/src/services/testVariation.service.ts b/src/services/testVariation.service.ts
index 5cd179ab..1b66d167 100644
--- a/src/services/testVariation.service.ts
+++ b/src/services/testVariation.service.ts
@@ -1,4 +1,4 @@
-import { TestVariation } from "../types";
+import { TestVariation, Build } from "../types";
import { handleResponse, authHeader } from "../_helpers/service.helpers";
import { API_URL } from "../_config/api.config";
import { IgnoreArea } from "../types/ignoreArea";
@@ -10,6 +10,7 @@ export const testVariationService = {
getDetails,
setIgnoreAreas,
setComment,
+ merge,
};
function getList(projectId: String): Promise {
@@ -30,7 +31,7 @@ function getDetails(id: String): Promise {
headers: authHeader(),
};
- return fetch(`${API_URL}${ENDPOINT_URL}/${id}`, requestOptions).then(
+ return fetch(`${API_URL}${ENDPOINT_URL}/details/${id}`, requestOptions).then(
handleResponse
);
}
@@ -62,3 +63,15 @@ function setComment(id: string, comment: string): Promise {
handleResponse
);
}
+
+function merge(projectId: String, branchName: String): Promise {
+ const requestOptions = {
+ method: "GET",
+ headers: authHeader(),
+ };
+
+ return fetch(
+ `${API_URL}${ENDPOINT_URL}/merge?projectId=${projectId}&branchName=${branchName}`,
+ requestOptions
+ ).then(handleResponse);
+}
\ No newline at end of file
diff --git a/src/types/testRun.ts b/src/types/testRun.ts
index 55b19226..bd03ad9e 100644
--- a/src/types/testRun.ts
+++ b/src/types/testRun.ts
@@ -19,4 +19,5 @@ export interface TestRun {
comment?: string;
branchName: string;
baselineBranchName: string;
+ merge: boolean;
}