Skip to content

Commit 61caa93

Browse files
authored
1 parent 98adc2c commit 61caa93

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

src/components/ProjectForm/ProjectForm.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,26 @@ export const ProjectForm: React.FunctionComponent = () => {
9494
});
9595
}}
9696
/>
97+
<TextValidator
98+
name="maxBranchLifetime"
99+
validators={["minNumber:1"]}
100+
errorMessages={["Enter greater than 1"]}
101+
InputProps={{ inputProps: { min: 1, step: 1 } }}
102+
margin="dense"
103+
id="maxBranchLifetime"
104+
label="Max branch lifetime (days)"
105+
type="number"
106+
fullWidth
107+
required
108+
value={project.maxBranchLifetime}
109+
onChange={(event) => {
110+
const value = (event.target as HTMLInputElement).value;
111+
setProjectEditState(projectDispatch, {
112+
...project,
113+
maxBranchLifetime: parseInt(value),
114+
});
115+
}}
116+
/>
97117
<FormControlLabel
98118
label="Auto approve feature"
99119
control={

src/constants/project.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ export const DEFAULT_PROJECT_EDIT_STATE: ProjectDto = {
1616
imageComparison: ImageComparison.pixelmatch,
1717
imageComparisonConfig: PIXELMATCH_DEFAULT_CONFIG,
1818
maxBuildAllowed: 100,
19+
maxBranchLifetime: 30,
1920
};

src/types/project.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export interface Project {
1212
imageComparison: ImageComparison;
1313
imageComparisonConfig: string;
1414
maxBuildAllowed: number;
15+
maxBranchLifetime: number;
1516
}
1617

1718
export type ProjectDto = Omit<Project, "updatedAt" | "createdAt" | "builds">;

0 commit comments

Comments
 (0)