Skip to content

Commit

Permalink
Merge branch 'main' into organization-admin
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveDarsa committed Jul 4, 2024
2 parents abce929 + 3f01f91 commit a948383
Show file tree
Hide file tree
Showing 21 changed files with 733 additions and 513 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Node builder image
FROM uselagoon/node-20-builder:latest as builder
FROM uselagoon/node-20-builder:latest AS builder

COPY . /app/

RUN yarn install
RUN yarn install --network-timeout 300000


# Node service image
Expand All @@ -28,4 +28,4 @@ ENV GRAPHQL_API=$GRAPHQL_API
RUN yarn run build

EXPOSE 3000
CMD ["yarn", "start"]
CMD ["yarn", "start"]
1 change: 1 addition & 0 deletions cypress/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { defineConfig } from 'cypress';

export default defineConfig({
requestTimeout: 15000,
defaultCommandTimeout: 8000,
e2e: {
env: {
api: 'http://0.0.0.0:33000/graphql',
Expand Down
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
9 changes: 5 additions & 4 deletions cypress/support/actions/organizations/OverviewAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export default class OverviewAction {

changeOrgFriendlyname(friendlyName: string) {
overviewRepo.getNameEditButton('edit-name').click();
overviewRepo.getEditField().type(friendlyName);

overviewRepo.getEditField().clear().type(friendlyName);
overviewRepo.getSubmitButton().click();

cy.wait('@gqlupdateOrganizationFriendlyNameMutation');
Expand All @@ -53,7 +54,7 @@ export default class OverviewAction {
}
doFailedChangeOrgFriendlyname(friendlyName: string) {
overviewRepo.getNameEditButton('edit-name').click();
overviewRepo.getEditField().type(friendlyName);
overviewRepo.getEditField().clear().type(friendlyName);
overviewRepo.getSubmitButton().click();

cy.wait('@gqlupdateOrganizationFriendlyNameMutation').then(interception => {
Expand All @@ -68,7 +69,7 @@ export default class OverviewAction {

changeOrgDescription(description: string) {
overviewRepo.getDescEditButton('edit-description').click();
overviewRepo.getEditField().type(description);
overviewRepo.getEditField().clear().type(description);
overviewRepo.getSubmitButton().click();

cy.wait('@gqlupdateOrganizationFriendlyNameMutation');
Expand All @@ -85,7 +86,7 @@ export default class OverviewAction {
}
doFailedChangeOrgDescription(description: string) {
overviewRepo.getDescEditButton('edit-description').click();
overviewRepo.getEditField().type(description);
overviewRepo.getEditField().clear().type(description);
overviewRepo.getSubmitButton().click();

cy.wait('@gqlupdateOrganizationFriendlyNameMutation').then(interception => {
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
102 changes: 50 additions & 52 deletions src/components/DeploymentsByFilter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,12 @@ const DeploymentsByFilter = ({ deployments }) => {
});
};

const sortedFilteredItems = sortedItems.filter(deployment => filterResults(deployment));

return (
<Deployments>
<div className="filters">
<label>{sortedItems.length == 1 ? `1 deployment` : `${sortedItems.length} deployments`}</label>
<label>{sortedItems.length == 1 ? `1 deployment` : `${sortedFilteredItems.length} deployments`}</label>
<label></label>
<input
type="text"
Expand Down Expand Up @@ -162,58 +164,54 @@ const DeploymentsByFilter = ({ deployments }) => {
<label>Duration</label>
<label></label>
</DeploymentsHeader>
{!sortedItems.filter(deployment => filterResults(deployment)).length && (
<div className="data-none">No deployments</div>
)}
{sortedItems
.filter(deployment => filterResults(deployment))
.map(deployment => {
return (
<div className="data-row row-heading" key={deployment.id}>
<div className="project">
<ProjectLink projectSlug={deployment.environment.project.name}>
{formatString(deployment.environment.project.name, 'project')}
</ProjectLink>
</div>
<div className="environment">
<DeploymentsLink
environmentSlug={deployment.environment.openshiftProjectName}
projectSlug={deployment.environment.project.name}
>
{formatString(deployment.environment.name, 'environment')}
</DeploymentsLink>
</div>
<div className="cluster">{formatString(deployment.environment.openshift.name, 'cluster')}</div>
<div className="name">
<DeploymentLink
deploymentSlug={deployment.name}
environmentSlug={deployment.environment.openshiftProjectName}
projectSlug={deployment.environment.project.name}
key={deployment.id}
>
{deployment.name}
</DeploymentLink>
</div>
<div className="priority">{deployment.priority}</div>
<div className="started">
{moment.utc(deployment.created).local().format('DD MMM YYYY, HH:mm:ss (Z)')}
</div>
<div className={`status buildstep ${deployment.status}`}>
{deployment.status.charAt(0).toUpperCase() + deployment.status.slice(1)}

{!['complete', 'cancelled', 'failed'].includes(deployment.status) && deployment.buildStep && (
<HoverTag text={deployment.buildStep} maxWidth="160px" tooltipPosition="bottom" />
)}
</div>
<div className="duration">{getDeploymentDuration(deployment)}</div>
<div>
{['new', 'pending', 'queued', 'running'].includes(deployment.status) && (
<CancelDeployment deployment={deployment} afterText="Cancelled" beforeText="Cancel" />
)}
</div>
{!sortedFilteredItems.length && <div className="data-none">No deployments</div>}
{sortedFilteredItems.map(deployment => {
return (
<div className="data-row row-heading" key={deployment.id}>
<div className="project">
<ProjectLink projectSlug={deployment.environment.project.name}>
{formatString(deployment.environment.project.name, 'project')}
</ProjectLink>
</div>
<div className="environment">
<DeploymentsLink
environmentSlug={deployment.environment.openshiftProjectName}
projectSlug={deployment.environment.project.name}
>
{formatString(deployment.environment.name, 'environment')}
</DeploymentsLink>
</div>
<div className="cluster">{formatString(deployment.environment.openshift.name, 'cluster')}</div>
<div className="name">
<DeploymentLink
deploymentSlug={deployment.name}
environmentSlug={deployment.environment.openshiftProjectName}
projectSlug={deployment.environment.project.name}
key={deployment.id}
>
{deployment.name}
</DeploymentLink>
</div>
<div className="priority">{deployment.priority}</div>
<div className="started">
{moment.utc(deployment.created).local().format('DD MMM YYYY, HH:mm:ss (Z)')}
</div>
<div className={`status buildstep ${deployment.status}`}>
{deployment.status.charAt(0).toUpperCase() + deployment.status.slice(1)}

{!['complete', 'cancelled', 'failed'].includes(deployment.status) && deployment.buildStep && (
<HoverTag text={deployment.buildStep} maxWidth="160px" tooltipPosition="bottom" />
)}
</div>
<div className="duration">{getDeploymentDuration(deployment)}</div>
<div>
{['new', 'pending', 'queued', 'running'].includes(deployment.status) && (
<CancelDeployment deployment={deployment} afterText="Cancelled" beforeText="Cancel" />
)}
</div>
);
})}
</div>
);
})}
</DeploymentsDataTable>
</Deployments>
);
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
Loading

0 comments on commit a948383

Please sign in to comment.