-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [M3-7292] - Stepper component - Details content (#9849)
* feat: [M3-7311] - Create Load Balancer flow - Mange state. * Code cleanup * Added changeset: Create Load Balancer flow - Mange state. * Update pr-9848-upcoming-features-1698675578462.md * feat: [M3-7292] - Stepper component - Details content * Added changeset: Stepper component - Details content * Update update-database.spec.ts * Update packages/manager/.changeset/pr-9848-upcoming-features-1698675578462.md Co-authored-by: Mariah Jacobs <[email protected]> * Fix typos * Update LoadBalancerConfiguration.test.tsx * use useFormikContext instead of custom state management hook * PR feedback * Code cleanup * Update loadbalancers.schema.ts * Update packages/validation/src/loadbalancers.schema.ts Co-authored-by: Mariah Jacobs <[email protected]> * Update packages/validation/src/loadbalancers.schema.ts Co-authored-by: jdamore-linode <[email protected]> * Update loadbalancers.schema.ts * schema dependency issue. * Resolve type issues * Fix Formik issues * update tests * Delete pr-9848-upcoming-features-1698675578462.md * PR - feedback use CreateLoadbalancerPayload * PR - feedback error handling * PR - Feedback use full type * PR - feedback * Code cleanup, PR feedback * Code cleanup * Create global test helper to wrap with formik and theme - renderWithThemeAndFormik * code cleanup * Update packages/manager/src/utilities/testHelpers.tsx Co-authored-by: Banks Nussman <[email protected]> * Update packages/manager/src/features/LoadBalancers/LoadBalancerCreate/LoadBalancerLabel.tsx Co-authored-by: Banks Nussman <[email protected]> * PR - feedback * Added latest copy * Update LoadBalancerConfiguration.test.tsx * Add learn more link * Update packages/manager/src/features/LoadBalancers/LoadBalancerCreate/ConfigurationDetails.tsx Co-authored-by: Mariah Jacobs <[email protected]> * Update packages/manager/src/features/LoadBalancers/LoadBalancerDetail/Configurations/constants.tsx Co-authored-by: Mariah Jacobs <[email protected]> --------- Co-authored-by: Mariah Jacobs <[email protected]> Co-authored-by: jdamore-linode <[email protected]> Co-authored-by: Banks Nussman <[email protected]>
- Loading branch information
1 parent
6dd45ff
commit acf3f2e
Showing
17 changed files
with
304 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/manager/.changeset/pr-9849-upcoming-features-1698676302215.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@linode/manager": Upcoming Features | ||
--- | ||
|
||
Stepper component - Details content ([#9849](https://github.com/linode/manager/pull/9849)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletions
112
packages/manager/src/features/LoadBalancers/LoadBalancerCreate/ConfigurationDetails.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
import Stack from '@mui/material/Stack'; | ||
import { useFormikContext } from 'formik'; | ||
import * as React from 'react'; | ||
|
||
import { Autocomplete } from 'src/components/Autocomplete/Autocomplete'; | ||
import { BetaChip } from 'src/components/BetaChip/BetaChip'; | ||
import { Box } from 'src/components/Box'; | ||
import { Link } from 'src/components/Link'; | ||
import { TextField } from 'src/components/TextField'; | ||
import { TooltipIcon } from 'src/components/TooltipIcon'; | ||
import { Typography } from 'src/components/Typography'; | ||
import { AGLB_DOCS_TLS_CERTIFICATE } from 'src/features/LoadBalancers/constants'; | ||
|
||
import { | ||
CONFIGURATION_COPY, | ||
protocolOptions, | ||
} from '../LoadBalancerDetail/Configurations/constants'; | ||
|
||
import type { CreateLoadbalancerPayload } from '@linode/api-v4'; | ||
|
||
interface Props { | ||
index: number; | ||
name: string; | ||
} | ||
|
||
export const ConfigurationDetails = ({ index, name }: Props) => { | ||
const { | ||
errors, | ||
handleBlur, | ||
handleChange, | ||
setFieldValue, | ||
touched, | ||
values, | ||
} = useFormikContext<CreateLoadbalancerPayload>(); | ||
|
||
return ( | ||
<Box padding={1}> | ||
<Typography variant="h2">Details</Typography> | ||
<Typography sx={(theme) => ({ marginRight: theme.spacing(1) })}> | ||
The port the load balancer listens on, and the protocol for routing | ||
incoming traffic to the targets. | ||
</Typography> | ||
<Stack spacing={2}> | ||
<Stack direction="row" spacing={2}> | ||
<Autocomplete | ||
errorText={ | ||
touched[name]?.[index]?.protocol | ||
? errors[name]?.[index]?.protocol | ||
: '' | ||
} | ||
onChange={(_, { value }) => | ||
setFieldValue(`${name}.${index}.protocol`, value) | ||
} | ||
textFieldProps={{ | ||
labelTooltipText: CONFIGURATION_COPY.Protocol, | ||
}} | ||
value={protocolOptions.find( | ||
(option) => option.value === values[name]?.[index]?.protocol | ||
)} | ||
disableClearable | ||
label="Protocol" | ||
options={protocolOptions} | ||
/> | ||
<TextField | ||
errorText={ | ||
touched[name]?.[index]?.port ? errors[name]?.[index]?.port : '' | ||
} | ||
label="Port" | ||
labelTooltipText={CONFIGURATION_COPY.Port} | ||
name={`${name}.${index}.port`} | ||
onBlur={handleBlur} | ||
onChange={handleChange} | ||
placeholder="Enter Port" | ||
type="number" | ||
value={values[name]?.[index]?.port} | ||
/> | ||
</Stack> | ||
<Stack> | ||
<Typography variant="h3"> | ||
TLS Certificates | ||
<TooltipIcon status="help" text={CONFIGURATION_COPY.Certificates} /> | ||
</Typography> | ||
<Box sx={{ alignItems: 'center', display: 'flex' }}> | ||
<BetaChip | ||
sx={(theme) => ({ | ||
marginLeft: '0 !important', | ||
marginRight: `${theme.spacing(1 / 2)} !important`, | ||
})} | ||
/> | ||
<Typography> | ||
After the load balancer is created, and if the protocol is HTTPS, | ||
upload TLS termination certificates. | ||
<Link to={AGLB_DOCS_TLS_CERTIFICATE}>Learn more.</Link> | ||
</Typography> | ||
</Box> | ||
</Stack> | ||
</Stack> | ||
<TextField | ||
errorText={ | ||
touched[name]?.[index]?.label ? errors[name]?.[index]?.label : '' | ||
} | ||
label="Configuration Label" | ||
labelTooltipText={CONFIGURATION_COPY.configuration} | ||
name={`${name}.${index}.label`} | ||
onBlur={handleBlur} | ||
onChange={handleChange} | ||
placeholder="Enter Configuration Label" | ||
value={values[name]?.[index]?.label} | ||
/> | ||
</Box> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 33 additions & 21 deletions
54
packages/manager/src/features/LoadBalancers/LoadBalancerCreate/LoadBalancerConfiguration.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...ages/manager/src/features/LoadBalancers/LoadBalancerCreate/LoadBalancerConfigurations.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { FieldArray, useFormikContext } from 'formik'; | ||
import * as React from 'react'; | ||
|
||
import { LoadBalancerConfiguration } from './LoadBalancerConfiguration'; | ||
|
||
import type { CreateLoadbalancerPayload } from '@linode/api-v4'; | ||
|
||
export const LoadBalancerConfigurations = () => { | ||
const { values } = useFormikContext<CreateLoadbalancerPayload>(); | ||
return ( | ||
<FieldArray name="configurations"> | ||
{({ insert, push, remove }) => ( | ||
<div> | ||
{values.configurations?.map((configuration, index) => ( | ||
<LoadBalancerConfiguration | ||
index={index} | ||
key={index} | ||
name="configurations" | ||
/> | ||
))} | ||
</div> | ||
)} | ||
</FieldArray> | ||
); | ||
}; |
Oops, something went wrong.