Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upcoming: [M3-7938] - Show custom error message in EditAccessKeyDrawer #10329

Merged
merged 9 commits into from
Apr 2, 2024
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Upcoming Features
---

Show custom error message in EditAccessKeyDrawer. ([#10329](https://github.com/linode/manager/pull/10329))
cpathipa marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface EnhancedAutocompleteProps<
'renderInput'
> {
/** Provides a hint with error styling to assist users. */
errorText?: string;
errorText?: React.ReactNode | string;
cpathipa marked this conversation as resolved.
Show resolved Hide resolved
/** Provides a hint with normal styling to assist users. */
helperText?: string;
/** A required label for the Autocomplete to ensure accessibility. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const useStyles = makeStyles<void, 'editIcon' | 'icon'>()(
interface Props {
className?: string;
disabledBreadcrumbEditButton?: boolean;
errorText?: string;
errorText?: React.ReactNode | string;
cpathipa marked this conversation as resolved.
Show resolved Hide resolved
/**
* Send event analytics
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/manager/src/components/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ interface BaseProps {
/**
* When defined, makes the input show an error state with the defined text
*/
errorText?: string;
errorText?: React.ReactNode | string;
cpathipa marked this conversation as resolved.
Show resolved Hide resolved
/**
* Makes the TextField use 100% of the available width
* @default false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { RegionSelectOption } from 'src/components/RegionSelect/RegionSelec

interface Props {
disabled?: boolean;
error?: string;
error?: React.ReactNode | string;
cpathipa marked this conversation as resolved.
Show resolved Hide resolved
name: string;
onBlur: (e: any) => void;
onChange: (value: string[]) => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { ActionsPanel } from 'src/components/ActionsPanel/ActionsPanel';
import { CircleProgress } from 'src/components/CircleProgress';
import { Drawer } from 'src/components/Drawer';
import { Link } from 'src/components/Link';
import { LinkButton } from 'src/components/LinkButton';
import { Notice } from 'src/components/Notice/Notice';
import { TextField } from 'src/components/TextField';
import { Typography } from 'src/components/Typography';
Expand Down Expand Up @@ -289,6 +290,23 @@ export const OMC_AccessKeyDrawer = (props: AccessKeyDrawerProps) => {
value={formik.values.label}
/>
<AccessKeyRegions
error={
!createMode && formik.errors.regions ? (
<span>
Select at least one region. To delete all keys,{' '}
<LinkButton
onClick={() => {
onClose();
cpathipa marked this conversation as resolved.
Show resolved Hide resolved
}}
>
revoke
</LinkButton>{' '}
an access key individually.
cpathipa marked this conversation as resolved.
Show resolved Hide resolved
</span>
) : (
(formik.errors.regions as string)
cpathipa marked this conversation as resolved.
Show resolved Hide resolved
)
}
onBlur={() => {
const bucketsInRegions = buckets?.filter(
(bucket) =>
Expand All @@ -312,7 +330,6 @@ export const OMC_AccessKeyDrawer = (props: AccessKeyDrawerProps) => {
formik.setFieldValue('regions', values);
}}
disabled={isRestrictedUser}
error={formik.errors.regions as string}
name="regions"
required
selectedRegion={formik.values.regions}
Expand Down
Loading