Skip to content

Commit 225526b

Browse files
committed
branh added
1 parent d0335d0 commit 225526b

File tree

8 files changed

+33
-6
lines changed

8 files changed

+33
-6
lines changed

src/components/DrawArea.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const useStyles = makeStyles((theme) => ({
3232
interface IDrawArea {
3333
type: "Baseline" | "Image" | "Diff";
3434
imageName: string;
35+
branchName: string;
3536
ignoreAreas: IgnoreArea[];
3637
setIgnoreAreas: (ignoreAreas: IgnoreArea[]) => void;
3738
selectedRectId: string | undefined;
@@ -55,6 +56,7 @@ interface IDrawArea {
5556
export const DrawArea: FunctionComponent<IDrawArea> = ({
5657
type,
5758
imageName,
59+
branchName,
5860
ignoreAreas,
5961
setIgnoreAreas,
6062
selectedRectId,
@@ -124,7 +126,7 @@ export const DrawArea: FunctionComponent<IDrawArea> = ({
124126
<React.Fragment>
125127
<Grid container direction="column">
126128
<Grid item>
127-
<ImageDetails type={type} imageName={imageName} />
129+
<ImageDetails type={type} branchName={branchName} imageName={imageName} />
128130
</Grid>
129131
{imageStatus === "loading" && (
130132
<Grid

src/components/ImageDetails.tsx

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,38 @@
11
import React from "react";
2-
import { Typography } from "@material-ui/core";
2+
import { Typography, Chip, Grid } from "@material-ui/core";
33
import { staticService } from "../services";
44
import useImage from "use-image";
55

66
interface IProps {
77
type: "Baseline" | "Image" | "Diff";
88
imageName: string;
9+
branchName: string;
910
}
1011

11-
const ImageDetails: React.FunctionComponent<IProps> = ({ type, imageName }) => {
12+
const ImageDetails: React.FunctionComponent<IProps> = ({
13+
type,
14+
imageName,
15+
branchName,
16+
}) => {
1217
const [image] = useImage(staticService.getImage(imageName));
1318
return (
1419
<React.Fragment>
1520
<Typography>{type}</Typography>
1621
{imageName ? (
1722
<React.Fragment>
18-
<Typography variant='caption'>Real size: {`${image?.width} x ${image?.height}`}</Typography>
23+
<Grid container spacing={2}>
24+
<Grid item>
25+
<Typography variant="caption">
26+
Real size: {`${image?.width} x ${image?.height}`}
27+
</Typography>
28+
</Grid>
29+
<Grid item>
30+
<Chip size="small" label={branchName} />
31+
</Grid>
32+
</Grid>
1933
</React.Fragment>
2034
) : (
21-
<Typography variant='caption'>No image</Typography>
35+
<Typography variant="caption">No image</Typography>
2236
)}
2337
</React.Fragment>
2438
);

src/components/TestDetailsModal.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ const TestDetailsModal: React.FunctionComponent<{
319319
<DrawArea
320320
type="Baseline"
321321
imageName={testRun.baselineName}
322+
branchName={testRun.baselineBranchName}
322323
ignoreAreas={[]}
323324
setIgnoreAreas={setIgnoreAreas}
324325
selectedRectId={selectedRectId}
@@ -336,6 +337,7 @@ const TestDetailsModal: React.FunctionComponent<{
336337
<DrawArea
337338
type="Diff"
338339
imageName={testRun.diffName}
340+
branchName={testRun.branchName}
339341
ignoreAreas={ignoreAreas}
340342
setIgnoreAreas={setIgnoreAreas}
341343
selectedRectId={selectedRectId}
@@ -351,6 +353,7 @@ const TestDetailsModal: React.FunctionComponent<{
351353
<DrawArea
352354
type="Image"
353355
imageName={testRun.imageName}
356+
branchName={testRun.branchName}
354357
ignoreAreas={ignoreAreas}
355358
setIgnoreAreas={setIgnoreAreas}
356359
selectedRectId={selectedRectId}

src/components/TestVariationDetails.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from "react";
2-
import { Grid, Typography } from "@material-ui/core";
2+
import { Grid, Typography, Chip } from "@material-ui/core";
33
import { TestVariation } from "../types";
44

55
interface IProps {
@@ -33,6 +33,9 @@ export const TestVariationDetails: React.FunctionComponent<IProps> = ({
3333
<Typography>Viewport: {testVariation.viewport}</Typography>
3434
</Grid>
3535
)}
36+
<Grid item>
37+
<Chip size="small" label={testVariation.branchName} />
38+
</Grid>
3639
</Grid>
3740
</Grid>
3841
);

src/pages/ProjectListPage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ const ProjectsListPage = () => {
116116
<CardContent>
117117
<Typography>Key: {project.id}</Typography>
118118
<Typography>Name: {project.name}</Typography>
119+
<Typography>Main branch: {project.mainBranchName}</Typography>
119120
<Typography>Created: {formatDateTime(project.createdAt)}</Typography>
120121
</CardContent>
121122
<CardActions>

src/types/project.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Build } from "./build";
33
export interface Project {
44
id: string;
55
name: string;
6+
mainBranchName: string;
67
builds: Build[];
78
updatedAt: string;
89
createdAt: string;

src/types/testRun.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ export interface TestRun {
1717
device: string;
1818
ignoreAreas: string;
1919
comment?: string;
20+
branchName: string;
21+
baselineBranchName: string;
2022
}

src/types/testVariation.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export interface TestVariation {
44
id: string;
55
name: string;
66
baselineName: string;
7+
branchName: string;
78
os: string;
89
browser: string;
910
viewport: string;

0 commit comments

Comments
 (0)