Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/components/ProjectForm/ProjectForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,26 @@ export const ProjectForm: React.FunctionComponent = () => {
});
}}
/>
<TextValidator
name="maxBranchLifetime"
validators={["minNumber:1"]}
errorMessages={["Enter greater than 1"]}
InputProps={{ inputProps: { min: 1, step: 1 } }}
margin="dense"
id="maxBranchLifetime"
label="Max branch lifetime (days)"
type="number"
fullWidth
required
value={project.maxBranchLifetime}
onChange={(event) => {
const value = (event.target as HTMLInputElement).value;
setProjectEditState(projectDispatch, {
...project,
maxBranchLifetime: parseInt(value),
});
}}
/>
<FormControlLabel
label="Auto approve feature"
control={
Expand Down
1 change: 1 addition & 0 deletions src/constants/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ export const DEFAULT_PROJECT_EDIT_STATE: ProjectDto = {
imageComparison: ImageComparison.pixelmatch,
imageComparisonConfig: PIXELMATCH_DEFAULT_CONFIG,
maxBuildAllowed: 100,
maxBranchLifetime: 30,
};
1 change: 1 addition & 0 deletions src/types/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface Project {
imageComparison: ImageComparison;
imageComparisonConfig: string;
maxBuildAllowed: number;
maxBranchLifetime: number;
}

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