Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change: add branches and pullrequests during org project creation #276

Merged
merged 11 commits into from
Jul 4, 2024
3 changes: 3 additions & 0 deletions src/components/Organizations/NewProject/StyledNewProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ export const StyledNewProject = styled.div`

.form-box {
margin-bottom: 1rem;
&.spacetop {
margin-top: 1rem;
}
}

.docs-link {
Expand Down
78 changes: 77 additions & 1 deletion src/components/Organizations/NewProject/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ const OrgNewProject = ({
refresh,
}) => {
const [addUserToProject, setAddUserToProject] = React.useState(true);
const [pullRequests, setPullRequests] = React.useState('');
const [branches, setBranches] = React.useState('');

return (
<StyledNotificationWrapper>
<div className="margins">
Expand All @@ -95,6 +98,8 @@ const OrgNewProject = ({
setProjectName({ target: { value: '' } });
setGitURL({ target: { value: '' } });
setProdEnv({ target: { value: '' } });
setPullRequests('');
setBranches('');
setSelectedDeployTarget({ target: { value: '' } });
closeModal();
});
Expand Down Expand Up @@ -174,6 +179,74 @@ const OrgNewProject = ({
/>
</RoleSelect>
</label>

<div className="form-box spacetop">
<label>
Branches{' '}
<Tooltip
overlayClassName="orgTooltip lg"
title={
<>
<b>[Default: true]</b>
<br />
<span> Which branches should be deployed, can be one of:</span>
<ul className="tooltiplist">
<li>true - all branches are deployed </li>

<li>false - no branches are deployed</li>

<li>
regex of all branches that can be deployed (including production), example:
'^(main|staging)$'
</li>
</ul>
</>
}
placement="right"
>
<InfoCircleOutlined style={{ fontSize: '1rem' }} />
</Tooltip>
<input
type="text"
placeholder="Branches"
value={branches}
onChange={({ target: { value } }) => setBranches(value)}
/>
</label>
</div>

<div className="form-box">
<label>
Pull requests{' '}
<Tooltip
overlayClassName="orgTooltip lg"
title={
<>
<b>[Default: true]</b>
<br />
<span> Which pull requests should be deployed, can be one of:</span>
<ul className="tooltiplist">
<li>true - all pull requests are deployed </li>

<li>false - no pull requests are deployed</li>

<li>regex of all Pull Request titles that can be deployed, example: '[BUILD]'</li>
</ul>
</>
}
placement="right"
>
<InfoCircleOutlined style={{ fontSize: '1rem' }} />
</Tooltip>
<input
placeholder="Pull requests"
type="text"
value={pullRequests}
onChange={({ target: { value } }) => setPullRequests(value)}
/>
</label>
</div>

<Checkbox>
<input
type="checkbox"
Expand All @@ -182,6 +255,7 @@ const OrgNewProject = ({
/>
<span>Add my user to this project</span>
</Checkbox>

<div className="docs-link">
<div className="info-icon">
<Image src={info} alt="" />
Expand Down Expand Up @@ -219,7 +293,7 @@ const OrgNewProject = ({
inputGitURL.indexOf(' ') > 0 ||
inputProdEnv === '' ||
inputProdEnv.indexOf(' ') > 0 ||
selectedDeployTarget === undefined
selectedDeployTarget == undefined
}
action={() => {
addGroupProject({
Expand All @@ -230,6 +304,8 @@ const OrgNewProject = ({
productionEnvironment: inputProdEnv,
organization: parseInt(organizationId, 10),
addOrgOwner: addUserToProject,
...(pullRequests ? { pullRequests } : {}),
...(branches ? { branches } : {}),
},
});
}}
Expand Down
15 changes: 15 additions & 0 deletions src/layouts/GlobalStyles/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,21 @@ body {
.ant-tooltip-content .ant-tooltip-inner{
color: ${props => (props.theme.colorScheme === 'dark' ? '#000' : '#fff')};
background: ${props => (props.theme.colorScheme === 'dark' ? '#fff' : '#000')};

.tooltiplist{
margin-left: 0.812rem;
li{
margin-bottom: initial;
padding-left: 0;
list-style: disc;
}
}
}
&.lg{
.ant-tooltip-content{
width:max-content;
}

}
}
.componentTooltip {
Expand Down
Loading