Skip to content

Commit

Permalink
Merge pull request #229 from uselagoon/errors-on-dev/prod
Browse files Browse the repository at this point in the history
fix numerous errors
  • Loading branch information
tobybellwood authored Mar 25, 2024
2 parents fc986bd + 9ceda92 commit 3368759
Show file tree
Hide file tree
Showing 30 changed files with 92 additions and 80 deletions.
2 changes: 1 addition & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ app

// organizations start
server.get('/organizations', (req, res) => {
app.render(req, res, '/organizations/organizations');
app.render(req, res, '/organizations');
});

server.get('/organizations/:organizationSlug', (req, res) => {
Expand Down
6 changes: 3 additions & 3 deletions src/components/Backups/BackupsSkeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { BackupsHeader, DataTable } from './StyledBackups';
const Backups = () => {
const numberOfBackupFields = typeof window !== 'undefined' ? Math.floor((window.innerHeight * 8) / 10 / 65) : 10;

const backupFieldSkeleton = (
<div className="data-row">
const backupFieldSkeleton = (idx: number) => (
<div className="data-row" key={idx}>
<div className="source">
<Skeleton />
</div>
Expand All @@ -32,7 +32,7 @@ const Backups = () => {
<label className="backupid">Backup id</label>
</BackupsHeader>

<DataTable>{[...Array<undefined>(numberOfBackupFields)].map(() => backupFieldSkeleton)}</DataTable>
<DataTable>{[...Array<undefined>(numberOfBackupFields)].map((_, idx) => backupFieldSkeleton(idx))}</DataTable>
</div>
);
};
Expand Down
8 changes: 4 additions & 4 deletions src/components/Box/StyledBox.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { color } from 'lib/variables';
import styled, { css } from 'styled-components';

export const StyledBox = styled.div<{ activeBgs?: string[] }>`
export const StyledBox = styled.div<{ $activeBgs?: string[] }>`
border: 2px solid ${props => props.theme.borders.box};
box-shadow: 0px 4px 8px 0px rgba(0, 0, 0, 0.03);
transition: all 0.3s ease;
Expand Down Expand Up @@ -38,13 +38,13 @@ export const StyledBox = styled.div<{ activeBgs?: string[] }>`
z-index: 10;
}
${props =>
props.activeBgs &&
props.$activeBgs &&
css`
.content {
background-image: ${props.activeBgs[0]};
background-image: ${props.$activeBgs[0]};
&:hover {
background-image: ${props.activeBgs[1]};
background-image: ${props.$activeBgs[1]};
}
}
`}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Box/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface BoxProps {
activeBgs?: string[]; // if present, they act as hover backgrounds
}
const Box: FC<BoxProps> = ({ className = '', activeBgs, children }) => (
<StyledBox className={className} activeBgs={activeBgs}>
<StyledBox className={className} $activeBgs={activeBgs}>
<div className="content">{children}</div>
</StyledBox>
);
Expand Down
8 changes: 5 additions & 3 deletions src/components/BulkDeployments/BulkDeploymentsSkeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { BulkDeploymentsDataTable, BulkDeploymentsHeader } from './StyledBulkDep

const BulkDeploymentsSkeleton = () => {
const numberOfItems = typeof window !== 'undefined' ? Math.floor((window.innerHeight * 8) / 10 / 65) : 10;
const rowItem = (
<div className="data-row">
const rowItem = (idx: number) => (
<div className="data-row" key={idx}>
<div className="project">
<Skeleton width={'100%'} />
</div>
Expand Down Expand Up @@ -46,7 +46,9 @@ const BulkDeploymentsSkeleton = () => {
<label className="duration">Duration</label>
<label></label>
</BulkDeploymentsHeader>
<BulkDeploymentsDataTable>{[...Array<undefined>(numberOfItems)].map(() => rowItem)}</BulkDeploymentsDataTable>
<BulkDeploymentsDataTable>
{[...Array<undefined>(numberOfItems)].map((_, idx) => rowItem(idx))}
</BulkDeploymentsDataTable>
</div>
);
};
Expand Down
8 changes: 5 additions & 3 deletions src/components/Deployments/DeploymentsSkeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { StyledDeployments } from './StyledDeployments';
const DeploymentsSkeleton = () => {
const numberOfDeploymentFields = typeof window !== 'undefined' ? Math.floor((window.innerHeight * 8) / 10 / 65) : 10;

const skeletonItem = (
<div className="deploymentRow">
const skeletonItem = (idx: number) => (
<div className="deploymentRow" key={idx}>
<div className="data-row">
<div className="name">
<Skeleton />
Expand Down Expand Up @@ -36,7 +36,9 @@ const DeploymentsSkeleton = () => {
<label>Status</label>
<label>Duration</label>
</div>
<div className="data-table">{[...Array<undefined>(numberOfDeploymentFields)].map(() => skeletonItem)}</div>
<div className="data-table">
{[...Array<undefined>(numberOfDeploymentFields)].map((_, idx) => skeletonItem(idx))}
</div>
</StyledDeployments>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import Skeleton from 'react-loading-skeleton';
import { Deployments, DeploymentsDataTable, DeploymentsHeader } from './StyledDeploymentsByFilter';

const DeploymentsByFilterSkeleton = () => {
const SkeletonRow = (
<div className="data-row row-heading skeleton">
const SkeletonRow = (idx: number) => (
<div className="data-row row-heading skeleton" key={idx}>
<div className="project">
<Skeleton />
</div>
Expand Down Expand Up @@ -67,7 +67,9 @@ const DeploymentsByFilterSkeleton = () => {
<label>Duration</label>
<label></label>
</DeploymentsHeader>
<DeploymentsDataTable>{[...Array<undefined>(numberOfItems)].map(() => SkeletonRow)}</DeploymentsDataTable>
<DeploymentsDataTable>
{[...Array<undefined>(numberOfItems)].map((_, idx) => SkeletonRow(idx))}
</DeploymentsDataTable>
</>
</Deployments>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { StyledEnvironmentVariableDetails, StyledProjectVariableTable } from './
const EnvironmentVariablesSkeleton = () => {
const numberOfVariableFields = 3;

const skeletonItem = (
<div className="data-row">
const skeletonItem = (idx: number) => (
<div className="data-row" key={idx}>
<div className="varName">
<Skeleton width={'90%'} />
</div>
Expand All @@ -18,8 +18,8 @@ const EnvironmentVariablesSkeleton = () => {
</div>
);

const projectSkeletonItem = (
<div className="data-row">
const projectSkeletonItem = (idx: number) => (
<div className="data-row" key={`project-${idx}`}>
<div className="varName">
<Skeleton width={'90%'} />
</div>
Expand Down Expand Up @@ -47,7 +47,9 @@ const EnvironmentVariablesSkeleton = () => {
<label>Scope</label>
</div>
</div>
<div className="data-table">{[...Array<undefined>(numberOfVariableFields)].map(() => skeletonItem)}</div>
<div className="data-table">
{[...Array<undefined>(numberOfVariableFields)].map((_, idx) => skeletonItem(idx))}
</div>
</StyledProjectVariableTable>
<hr style={{ margin: '30px 0' }} />
<div className="header">
Expand All @@ -66,7 +68,9 @@ const EnvironmentVariablesSkeleton = () => {
<label>Scope</label>
</div>
</div>
<div className="data-table">{[...Array<undefined>(numberOfVariableFields)].map(() => projectSkeletonItem)}</div>
<div className="data-table">
{[...Array<undefined>(numberOfVariableFields)].map((_, idx) => projectSkeletonItem(idx))}
</div>
</StyledProjectVariableTable>
</StyledEnvironmentVariableDetails>
);
Expand Down
6 changes: 3 additions & 3 deletions src/components/Header/StyledHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { color } from 'lib/variables';
import styled from 'styled-components';

export const StyledHeader = styled.header<{ isOrganizationsPath: boolean }>`
export const StyledHeader = styled.header<{ $isOrganizationsPath: boolean }>`
background: ${color.brightBlue} ${color.lightBlue};
background: ${color.lightBlue};
background: ${props =>
props.isOrganizationsPath
props.$isOrganizationsPath
? props.theme.gradients.organizationsHeaderGradient
: props.theme.gradients.headerFooterGradient};
Expand Down Expand Up @@ -42,7 +42,7 @@ export const StyledHeader = styled.header<{ isOrganizationsPath: boolean }>`
}
&.navitem {
align-items: center;
border-left: 1px solid ${props => (props.isOrganizationsPath ? 'transparent' : color.blue)};
border-left: 1px solid ${props => (props.$isOrganizationsPath ? 'transparent' : color.blue)};
cursor: pointer;
display: flex;
&::before {
Expand Down
4 changes: 2 additions & 2 deletions src/components/Header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const Header = ({ logo }) => {
const isOrganizationsPath = asPath.includes('/organizations');

return (
<StyledHeader isOrganizationsPath={isOrganizationsPath}>
<Link href="/">
<StyledHeader $isOrganizationsPath={isOrganizationsPath}>
<Link href="/projects">
<a className="home">
<img
alt="Home"
Expand Down
4 changes: 2 additions & 2 deletions src/components/HeaderMenu/StyledHeaderMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export const DropdownButton = styled.a`
}
`;

export const StyledDropdown = styled.div<{ isOrganizationsPath: boolean }>`
border-left: 1px solid ${props => (props.isOrganizationsPath ? 'transparent' : color.blue)};
export const StyledDropdown = styled.div<{ $isOrganizationsPath: boolean }>`
border-left: 1px solid ${props => (props.$isOrganizationsPath ? 'transparent' : color.blue)};
cursor: pointer;
padding: 10px 20px;
hr {
Expand Down
12 changes: 1 addition & 11 deletions src/components/HeaderMenu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,6 @@ const HeaderMenu = ({ auth, isOrganizationsPath }) => {
setOpen(!open);
};

const handleMenuOne = () => {
// do something
setOpen(false);
};

const handleMenuTwo = () => {
// do something
setOpen(false);
};

return (
<>
<Dropdown
Expand Down Expand Up @@ -100,7 +90,7 @@ const HeaderMenu = ({ auth, isOrganizationsPath }) => {
const Dropdown = ({ open, trigger, menu, isOrganizationsPath }) => {
return (
<>
<StyledDropdown isOrganizationsPath={isOrganizationsPath}>
<StyledDropdown $isOrganizationsPath={isOrganizationsPath}>
{trigger}
{open ? (
<DropdownMenu data-cy="menuList">
Expand Down
4 changes: 2 additions & 2 deletions src/components/HoverTag/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const textPairs = {

const HoverTag: FC<Props> = ({ tooltipPosition, tagColor, maxWidth, text, textColor, formatToReadableText }) => {
const toolTipTextProps = {
...(maxWidth ? { maxWidth } : {}),
...(textColor ? { textColor } : {}),
...(maxWidth ? { $maxWidth: maxWidth } : {}),
...(textColor ? { $textColor: textColor } : {}),
};

const formatText = (textProp: Props['text']) => {
Expand Down
6 changes: 3 additions & 3 deletions src/components/HoverTag/styles.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import styled from 'styled-components';

export const TooltipText = styled.p<{ maxWidth?: string; textColor?: string }>`
export const TooltipText = styled.p<{ $maxWidth?: string; $textColor?: string }>`
margin: unset;
max-width: ${props => (props.maxWidth ? props.maxWidth : '150px')};
max-width: ${props => (props.$maxWidth ? props.$maxWidth : '150px')};
margin: unset;
overflow: hidden;
text-overflow: ellipsis;
color: ${props => (props.textColor ? props.textColor : '#fff')};
color: ${props => (props.$textColor ? props.$textColor : '#fff')};
`;
4 changes: 2 additions & 2 deletions src/components/Organizations/GroupMembers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const GroupMembers = ({
const isDefaultUser = email.startsWith('default-user');
if (isDefaultUser)
return (
<Tag style={{ display: 'inline' }} background="#262D65">
<Tag style={{ display: 'inline' }} $background="#262D65">
DEFAULT USER
</Tag>
);
Expand Down Expand Up @@ -271,7 +271,7 @@ const GroupMembers = ({

<ProjectLink projectSlug={project.name} key={project.id} openInTab>
<Tooltip overlayClassName="orgTooltip" title="View Dashboard" placement="bottom">
<ProjectDashboard inlineLink>
<ProjectDashboard $inlineLink>
<IconDashboard />
</ProjectDashboard>
</Tooltip>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Organizations/Groups/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const Groups = ({ groups = [], organizationId, organizationName, ableToAddGroup,
<span>
{i.name}{' '}
{i.type === 'project-default-group' && (
<Tag style={{ display: 'inline' }} background="#262D65">
<Tag style={{ display: 'inline' }} $background="#262D65">
SYSTEM GROUP
</Tag>
)}
Expand Down
6 changes: 3 additions & 3 deletions src/components/Organizations/Manage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const Manage = ({ users = [], organization, organizationName, refetch }) => {
const isDefaultUser = email.startsWith('default-user');
if (isDefaultUser)
return (
<Tag style={{ display: 'inline' }} background="#262D65">
<Tag style={{ display: 'inline' }} $background="#262D65">
DEFAULT USER
</Tag>
);
Expand All @@ -98,11 +98,11 @@ const Manage = ({ users = [], organization, organizationName, refetch }) => {
</div>

{owner ? (
<Tag style={{ display: 'inline-block', marginLeft: '2.5rem' }} background="#47D3FF">
<Tag style={{ display: 'inline-block', marginLeft: '2.5rem' }} $background="#47D3FF">
ORG OWNER
</Tag>
) : (
<Tag style={{ display: 'inline-block', marginLeft: '2.5rem' }} background="#FF4747">
<Tag style={{ display: 'inline-block', marginLeft: '2.5rem' }} $background="#FF4747">
ORG VIEWER
</Tag>
)}
Expand Down
8 changes: 4 additions & 4 deletions src/components/Organizations/Organization/Styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export const StyledOverview = styled.div`
}
`;

export const LinkBtn = styled.a`
export const LinkBtn = styled.span`
margin-top: 25px;
background: #4b84ff;
color: #fff;
Expand All @@ -197,16 +197,16 @@ export const LinkBtn = styled.a`
}
`;

export const ManageBtn = styled.a`
export const ManageBtn = styled.p`
margin-top: 25px;
background: #4b84ff;
color: #fff;
display: inline-block;
align-items: center;
min-width: 115px;
width: max-content;
padding: 6px 15px;
cursor: pointer;
display: flex;
display: inline-flex;
align-items: center;
gap: 10px;
transition: all 0.15s ease;
Expand Down
4 changes: 2 additions & 2 deletions src/components/Organizations/Organization/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,11 @@ const Organization = ({ organization, refetch }) => {
<div className="email">{owner.email} </div>

{owner.owner ? (
<Tag style={{ display: 'inline-block', marginLeft: '1.5rem' }} background="#47D3FF">
<Tag style={{ display: 'inline-block', marginLeft: '1.5rem' }} $background="#47D3FF">
ORG OWNER
</Tag>
) : (
<Tag style={{ display: 'inline-block', marginLeft: '1.5rem' }} background="#FF4747">
<Tag style={{ display: 'inline-block', marginLeft: '1.5rem' }} $background="#FF4747">
ORG VIEWER
</Tag>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Organization, OrganizationsPage, OrgsHeader, SearchInput } from './Styl
const OrganizationsSkeleton = () => {
const RenderSkeletonBox = (index: number) => {
return (
<Box className="box">
<Box className="box" key={index}>
<Organization>
<h4>
<Skeleton style={{ width: `${index % 2 ? '50%' : '80%'}` }} />
Expand Down
4 changes: 2 additions & 2 deletions src/components/Organizations/Projects/Styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ export const OrgProjectWrapper = styled.div`
}
`;

export const ProjectDashboard = styled.div<{ inlineLink?: boolean }>`
export const ProjectDashboard = styled.div<{ $inlineLink?: boolean }>`
${props =>
!props.inlineLink
!props.$inlineLink
? `
margin-left:1.5rem;
font-size:13px;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Organizations/Projects/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const OrgProjects = ({ projects = [], organizationId, organizationName, refresh,
<TableActions style={{ marginLeft: 'auto', gap: '1rem' }}>
<ProjectLink projectSlug={project.name} key={project.id} openInTab>
<Tooltip overlayClassName="orgTooltip" title="View Dashboard" placement="bottom">
<ProjectDashboard inlineLink>
<ProjectDashboard $inlineLink>
<IconDashboard />
</ProjectDashboard>
</Tooltip>
Expand Down
Loading

0 comments on commit 3368759

Please sign in to comment.