Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions components/cloudProviderCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import Image from 'next/image';

import { CardProps } from '../card';
import Typography from '../typography';
import Tag from '../tag';
import { InstallationType } from '../../types/redux';
import k3dLogo from '../../assets/k3d_logo.svg';
import awsLogo from '../../assets/aws_logo.svg';
import civoLogo from '../../assets/civo_logo.svg';
import digitalOceanLogo from '../../assets/digital_ocean_logo.svg';
import vultrLogo from '../../assets/vultr_logo.svg';
import Tag from '../tag';
import { BISCAY } from '../../constants/colors';

import { CardContainer, DetailsContainer, Link, LabelContainer } from './cloudProviderCard.styled';

Expand Down Expand Up @@ -90,7 +91,9 @@ const CloudProviderCard: FunctionComponent<CloudProviderCardProps> = ({
<Image src={logoSrc} alt="logo" width={width} height={height} />
<DetailsContainer>
<LabelContainer>
<Typography variant="subtitle2">{label}</Typography>
<Typography variant="subtitle2" color={BISCAY}>
{label}
</Typography>
{beta && <Tag text="BETA" bgColor="light-orange" />}
</LabelContainer>
<Typography variant="body2">
Expand Down
24 changes: 14 additions & 10 deletions components/installationButtons/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface InstallationButtonsProps {
showBackButton?: boolean;
onBackButtonClick?: () => void;
onNextButtonClick: () => void;
showNextButton: boolean;
nextButtonText?: string;
nextButtonDisabled?: boolean;
}
Expand All @@ -18,6 +19,7 @@ const InstallationButtons: FunctionComponent<InstallationButtonsProps> = ({
showBackButton,
onBackButtonClick,
onNextButtonClick,
showNextButton,
nextButtonText = 'Next',
nextButtonDisabled,
...rest
Expand All @@ -29,16 +31,18 @@ const InstallationButtons: FunctionComponent<InstallationButtonsProps> = ({
</Button>
)}

<Button
type="submit"
variant="contained"
color="primary"
id="next"
onClick={() => activeStep === 0 && onNextButtonClick()}
disabled={nextButtonDisabled}
>
{nextButtonText}
</Button>
{showNextButton && (
<Button
type="submit"
variant="contained"
color="primary"
id="next"
onClick={() => activeStep === 0 && onNextButtonClick()}
disabled={nextButtonDisabled}
>
{nextButtonText}
</Button>
)}
</Container>
);

Expand Down
21 changes: 13 additions & 8 deletions components/installationStepContainer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
InstallationButtons,
InstallTitle,
Content,
FormContent,
} from './installationStepContainer.styled';

interface InstallationStepContainerProps
Expand All @@ -34,6 +35,7 @@ const InstallationStepContainer: FunctionComponent<InstallationStepContainerProp
onBackButtonClick = noop,
nextButtonText,
nextButtonDisabled,
showNextButton,
children,
...rest
}) => {
Expand All @@ -56,21 +58,24 @@ const InstallationStepContainer: FunctionComponent<InstallationStepContainerProp
return (
<Container {...rest}>
<Progress activeStep={activeStep} steps={steps} />
{isProvisionStep ? (
<LinearProgress progress={progress} />
) : (
<InstallTitle variant="subtitle2">{installationTitle}</InstallTitle>
)}
<Content hasInfo={hasInfo} isProvisionStep={isProvisionStep}>
{children}
</Content>
<FormContent>
{isProvisionStep ? (
<LinearProgress progress={progress} />
) : (
<InstallTitle variant="subtitle2">{installationTitle}</InstallTitle>
)}
<Content hasInfo={hasInfo} isProvisionStep={isProvisionStep}>
{children}
</Content>
</FormContent>
<InstallationButtons
activeStep={activeStep}
onNextButtonClick={onNextButtonClick}
onBackButtonClick={onBackButtonClick}
showBackButton={showBackButton}
nextButtonText={nextButtonText}
nextButtonDisabled={nextButtonDisabled}
showNextButton={showNextButton}
/>
</Container>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import Typography from '../typography';
import { media } from '../../utils/media';

export const Container = styled(Column)`
background-color: ${({ theme }) => theme.colors.washMe};
height: 100%;
width: 100%;
`;
Expand All @@ -19,7 +18,6 @@ export const Content = styled(Column)<{ hasInfo?: boolean; isProvisionStep: bool
gap: 24px;
height: calc(100% - 285px);
margin: 0 auto;
overflow-y: auto;
width: 100%;

${({ hasInfo }) =>
Expand All @@ -44,3 +42,9 @@ export const InstallTitle = styled(Typography)`
export const Title = styled.div`
margin: 40px auto;
`;

export const FormContent = styled.div`
height: calc(100% - 198px);
margin-bottom: 40px;
overflow: auto;
`;
2 changes: 1 addition & 1 deletion components/password/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const Password: FunctionComponent<PasswordProps> = ({ label, helperText, ...prop
edge="end"
disableRipple
>
{showPassword ? <VisibilityOffOutlinedIcon /> : <VisibilityOutlinedIcon />}
{showPassword ? <VisibilityOutlinedIcon /> : <VisibilityOffOutlinedIcon />}
</IconButton>
</InputAdornmentContainer>
}
Expand Down
4 changes: 2 additions & 2 deletions components/progress/progress.styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { BISCAY, PORT_GORE } from '../../constants/colors';

export const Label = muiStyled(StepLabel)(() => ({
[`& .${stepLabelClasses.completed}`]: {
color: theme.colors.saltboxBlue,
color: `${theme.colors.saltboxBlue} !important`,
},
[`& .${stepLabelClasses.active}`]: {
color: BISCAY,
Expand All @@ -29,7 +29,7 @@ export const ColorlibConnector = muiStyled(StepConnector)(({ theme: muiTheme })
[`&.${stepConnectorClasses.alternativeLabel}`]: {
left: 'calc(-50% + 26px)',
right: 'calc(50% + 26px)',
top: 25,
top: 32,
},
[`&.${stepConnectorClasses.active}`]: {
[`& .${stepConnectorClasses.line}`]: {
Expand Down
41 changes: 33 additions & 8 deletions containers/clusterForms/aws/setupForm/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,38 @@
import React, { FunctionComponent } from 'react';
import React, { FunctionComponent, useEffect } from 'react';

import { InstallValues } from '../../../../types/redux';
import ControlledAutocomplete from '../../../../components/controlledFields/AutoComplete';
import ControlledTextField from '../../../../components/controlledFields/TextField';
import LearnMore from '../../../../components/learnMore';
import { AWS_REGIONS, EMAIL_REGEX } from '../../../../constants/index';
import { useAppDispatch, useAppSelector } from '../../../../redux/store';
import { getCloudDomains, getCloudRegions } from '../../../../redux/thunks/api.thunk';
import { InstallValues } from '../../../../types/redux';
import { FormFlowProps } from '../../../../types/provision';
import { EMAIL_REGEX } from '../../../../constants/index';

const AwsSetupForm: FunctionComponent<FormFlowProps<InstallValues>> = ({ control }) => {
const dispatch = useAppDispatch();
const { cloudDomains, cloudRegions } = useAppSelector(({ api }) => ({
cloudDomains: api.cloudDomains,
cloudRegions: api.cloudRegions,
}));

const handleRegionOnSelect = async (region: string) => {
dispatch(getCloudDomains(region));
};

const formatDomains = (domains: Array<string>) => {
return domains.map((domain) => {
const formattedDomain = domain[domain.length - 1].includes('.')
? domain.substring(0, domain.length - 1)
: domain;
return { label: formattedDomain, value: formattedDomain };
});
};

useEffect(() => {
dispatch(getCloudRegions());
}, [dispatch]);

return (
<>
<ControlledTextField
Expand All @@ -27,16 +52,16 @@ const AwsSetupForm: FunctionComponent<FormFlowProps<InstallValues>> = ({ control
label="Cloud region"
required
rules={{ required: true }}
options={AWS_REGIONS}
options={cloudRegions && cloudRegions.map((region) => ({ label: region, value: region }))}
onChange={handleRegionOnSelect}
/>
<ControlledTextField
<ControlledAutocomplete
control={control}
name="domainName"
label="Cluster domain name"
required
rules={{
required: true,
}}
rules={{ required: true }}
options={cloudDomains && formatDomains(cloudDomains)}
/>
<ControlledTextField
control={control}
Expand Down
24 changes: 18 additions & 6 deletions containers/clusterForms/civo/setupForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,22 @@ import { FormFlowProps } from 'types/provision';
import ControlledAutocomplete from '../../../../components/controlledFields/AutoComplete';
import ControlledTextField from '../../../../components/controlledFields/TextField';
import LearnMore from '../../../../components/learnMore';
import { useAppDispatch, useAppSelector } from '../../../../redux/store';
import { getCloudDomains } from '../../../../redux/thunks/api.thunk';
import { InstallValues } from '../../../../types/redux';
import { CIVO_REGIONS, EMAIL_REGEX } from '../../../../constants';
import { EMAIL_REGEX } from '../../../../constants';

const CivoSetupForm: FunctionComponent<FormFlowProps<InstallValues>> = ({ control }) => {
const dispatch = useAppDispatch();
const { cloudDomains, cloudRegions } = useAppSelector(({ api }) => ({
cloudDomains: api.cloudDomains,
cloudRegions: api.cloudRegions,
}));

const handleRegionOnSelect = async (region: string) => {
dispatch(getCloudDomains(region));
};

return (
<>
<ControlledTextField
Expand All @@ -27,16 +39,16 @@ const CivoSetupForm: FunctionComponent<FormFlowProps<InstallValues>> = ({ contro
label="Cloud Region"
required
rules={{ required: true }}
options={CIVO_REGIONS}
options={cloudRegions && cloudRegions.map((region) => ({ label: region, value: region }))}
onChange={handleRegionOnSelect}
/>
<ControlledTextField
<ControlledAutocomplete
control={control}
name="domainName"
label="Cluster domain name"
required
rules={{
required: true,
}}
rules={{ required: true }}
options={cloudDomains && cloudDomains.map((domain) => ({ label: domain, value: domain }))}
/>
<ControlledTextField
control={control}
Expand Down
24 changes: 18 additions & 6 deletions containers/clusterForms/digitalocean/setupForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,22 @@ import { FormFlowProps } from 'types/provision';
import LearnMore from '../../../../components/learnMore';
import ControlledAutocomplete from '../../../../components/controlledFields/AutoComplete';
import ControlledTextField from '../../../../components/controlledFields/TextField';
import { CIVO_REGIONS, EMAIL_REGEX } from '../../../../constants';
import { useAppDispatch, useAppSelector } from '../../../../redux/store';
import { getCloudDomains } from '../../../../redux/thunks/api.thunk';
import { EMAIL_REGEX } from '../../../../constants';
import { InstallValues } from '../../../../types/redux';

const DigitalOceanSetupForm: FunctionComponent<FormFlowProps<InstallValues>> = ({ control }) => {
const dispatch = useAppDispatch();
const { cloudDomains, cloudRegions } = useAppSelector(({ api }) => ({
cloudDomains: api.cloudDomains,
cloudRegions: api.cloudRegions,
}));

const handleRegionOnSelect = async (region: string) => {
dispatch(getCloudDomains(region));
};

return (
<>
<ControlledTextField
Expand All @@ -27,16 +39,16 @@ const DigitalOceanSetupForm: FunctionComponent<FormFlowProps<InstallValues>> = (
label="Datacenter region"
required
rules={{ required: true }}
options={CIVO_REGIONS}
options={cloudRegions && cloudRegions.map((region) => ({ label: region, value: region }))}
onChange={handleRegionOnSelect}
/>
<ControlledTextField
<ControlledAutocomplete
control={control}
name="domainName"
label="Cluster domain name"
required
rules={{
required: true,
}}
rules={{ required: true }}
options={cloudDomains && cloudDomains.map((domain) => ({ label: domain, value: domain }))}
/>
<ControlledTextField
control={control}
Expand Down
12 changes: 5 additions & 7 deletions containers/clusterForms/shared/authForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,17 @@ const AuthForm: FunctionComponent<FormFlowProps<InstallValues>> = ({ control, se

const gitLabel = useMemo(() => (isGitHub ? 'GitHub' : 'GitLab'), [isGitHub]);

const gitErrorLabel = useMemo(
() => (isGitHub ? 'GitHub organization' : 'GitLab group'),
[isGitHub],
);

useEffect(() => {
if (githubUser?.login || gitlabUser?.name) {
setValue('userName', githubUser?.login || gitlabUser?.name);
}
}, [dispatch, githubUser, gitlabUser, setValue]);

const gitErrorLabel = useMemo(
() => (isGitHub ? 'GitHub organization' : 'GitLab group'),
[isGitHub],
);

useEffect(() => {
return () => {
dispatch(clearUserError());
Expand Down Expand Up @@ -140,7 +140,6 @@ const AuthForm: FunctionComponent<FormFlowProps<InstallValues>> = ({ control, se
required
name="gitOwner"
rules={{ required: true }}
disabled={!isTokenValid}
onChange={validateGitOwner}
options={
githubUserOrganizations &&
Expand All @@ -156,7 +155,6 @@ const AuthForm: FunctionComponent<FormFlowProps<InstallValues>> = ({ control, se
required
name="gitOwner"
rules={{ required: true }}
disabled={!isTokenValid}
onChange={validateGitOwner}
options={
gitlabGroups && gitlabGroups.map(({ name, path }) => ({ label: name, value: path }))
Expand Down
Loading