Skip to content

Commit

Permalink
Merge branch 'main' into project-deletio-confirm
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveDarsa committed Jul 4, 2024
2 parents 245be9c + ef6950b commit 5be55aa
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/organizations/overview.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('Organization overview page', () => {
overview.doQuotaFieldCheck();
});

it.only('Changes org friendly name/description', () => {
it('Changes org friendly name/description', () => {
registerIdleHandler('idle');

overview.changeOrgFriendlyname(testData.organizations.overview.friendlyName);
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/rbac/developer.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ describe('DEVELOPER permission test suites', () => {
environmentOverview.doDeleteEnvironmentError('main');
});

it('Deletes stating environment', () => {
it('Deletes staging environment', () => {
cy.visit(`${Cypress.env('url')}/projects/lagoon-demo/lagoon-demo-staging`);

cy.intercept('POST', Cypress.env('api'), req => {
Expand Down Expand Up @@ -147,7 +147,7 @@ describe('DEVELOPER permission test suites', () => {
});

it('Fails to cancel any deployment - no permission to CANCEL for DEVELOPER', () => {
cy.visit(`${Cypress.env('url')}/projects/lagoon-demo/lagoon-demo-staging/deployments`);
cy.visit(`${Cypress.env('url')}/projects/lagoon-demo/lagoon-demo-main/deployments`);

registerIdleHandler('idle');

Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/rbac/guest.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ describe('GUEST permission test suites', () => {
});

it('Fails to do cancel a deployment - no permission for GUEST', () => {
cy.visit(`${Cypress.env('url')}/projects/lagoon-demo/lagoon-demo-staging/deployments`);
cy.visit(`${Cypress.env('url')}/projects/lagoon-demo/lagoon-demo-main/deployments`);
registerIdleHandler('idle');

cy.intercept('POST', Cypress.env('api'), req => {
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/rbac/maintainer.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ describe('MAINTAINER permission test suites', () => {
environmentOverview.doDeleteEnvironmentError('main');
});

it('Deletes stating environment', () => {
it('Deletes staging environment', () => {
cy.visit(`${Cypress.env('url')}/projects/lagoon-demo/lagoon-demo-staging`);

cy.intercept('POST', Cypress.env('api'), req => {
Expand Down Expand Up @@ -169,7 +169,7 @@ describe('MAINTAINER permission test suites', () => {
});

it('Cancels a staging deployment', () => {
cy.visit(`${Cypress.env('url')}/projects/lagoon-demo/lagoon-demo-staging/deployments`);
cy.visit(`${Cypress.env('url')}/projects/lagoon-demo/lagoon-demo-main/deployments`);

registerIdleHandler('idle');

Expand Down
4 changes: 3 additions & 1 deletion cypress/e2e/rbac/reporter.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ describe('REPORTER permission test suites', () => {
});

it('Fails to do cancel a deployment - no permission for REPORTER', () => {
cy.visit(`${Cypress.env('url')}/projects/lagoon-demo/lagoon-demo-staging/deployments`);
cy.visit(`${Cypress.env('url')}/projects/lagoon-demo/lagoon-demo-main/deployments`);

registerIdleHandler('idle');

Expand All @@ -168,6 +168,8 @@ describe('REPORTER permission test suites', () => {
cy.waitForNetworkIdle('@idle', 500);

deployment.navigateToRunningDeployment();

cy.waitForNetworkIdle('@idle', 500);
deployment.doFailedCancelDeployment();
});
});
Expand Down
4 changes: 2 additions & 2 deletions cypress/support/actions/organizations/ProjectsActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default class ProjectsActions {

projects.selectTarget();

projects.getAddConfirm().click();
projects.getAddConfirm().click({ force: true });

cy.wait('@gqladdProjectToOrganizationMutation');

Expand All @@ -32,7 +32,7 @@ export default class ProjectsActions {

projects.selectTarget();

projects.getAddConfirm().click();
projects.getAddConfirm().click({ force: true });

cy.wait('@gqladdProjectToOrganizationMutation').then(interception => {
expect(interception.response?.statusCode).to.eq(200);
Expand Down
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

0 comments on commit 5be55aa

Please sign in to comment.