Skip to content

Commit 18109f1

Browse files
author
Przybylski Krzysztof
committed
feat(#455): add protectedBranch project variable
1 parent 50961b4 commit 18109f1

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/components/ProjectForm/ProjectForm.tsx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,35 @@ export const ProjectForm: React.FunctionComponent = () => {
130130
});
131131
}}
132132
/>
133+
<TextValidator
134+
name="protectedBranch"
135+
validators={project.protectedBranch ? ["minStringLength:2"] : []}
136+
errorMessages={["Enter at least two characters."]}
137+
margin="dense"
138+
id="protectedBranch"
139+
label="Protected branch"
140+
type="text"
141+
fullWidth
142+
helperText={
143+
<>
144+
PostgreSQL{" "}
145+
<a
146+
target="_blank"
147+
rel="noreferrer"
148+
href="https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-SIMILARTO-REGEXP"
149+
>
150+
SIMILAR TO Regular Expression
151+
</a>
152+
</>
153+
}
154+
value={project.protectedBranch || ""}
155+
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
156+
setProjectEditState(projectDispatch, {
157+
...project,
158+
protectedBranch: event.target.value,
159+
})
160+
}
161+
/>
133162
<FormControlLabel
134163
label="Auto approve feature"
135164
control={

src/types/project.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export interface Project {
1313
imageComparisonConfig: string;
1414
maxBuildAllowed: number;
1515
maxBranchLifetime: number;
16+
protectedBranch?: string;
1617
}
1718

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

0 commit comments

Comments
 (0)