-
Notifications
You must be signed in to change notification settings - Fork 391
upcoming: [DI-23769] - multiple error handling #11874
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: [DI-23769] - multiple error handling #11874
Conversation
…s in forms, Added a Notice based component to render list or single accordingly
packages/manager/src/features/CloudPulse/Alerts/Utils/AlertListNoticeMessages.tsx
Outdated
Show resolved
Hide resolved
| continue; | ||
| } | ||
|
|
||
| const errorField = error.field.split('.')[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@santoshp210-akamai , the function is good, lets add comments above each step, explaining what it does
packages/manager/src/features/CloudPulse/Alerts/Utils/AlertListNoticeMessages.test.tsx
Show resolved
Hide resolved
venkymano-akamai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@santoshp210-akamai , Looks good, we can address minor comment I left
packages/manager/src/features/CloudPulse/Alerts/Utils/AlertListNoticeMessages.tsx
Outdated
Show resolved
Hide resolved
packages/manager/src/features/CloudPulse/Alerts/CreateAlert/CreateAlertDefinition.tsx
Show resolved
Hide resolved
|
Fixed it. |
…d the AlertListNoticeMessages to remove redundant components
pmakode-akamai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Able to see multiple error messages for Create/Edit Alerts
Left a couple of comments. thank you!
Optional: I'm wondering if we can remove the extra top padding between the notices to match the consistent margin-bottom of 8px (seems to be the default for Notices) used elsewhere in CM. The current spacing used here looks too large.
| style={{ | ||
| alignItems: 'center', | ||
| background: theme.tokens.alias.Background.Normal, | ||
| borderRadius: 1, | ||
| display: 'flex', | ||
| flexWrap: 'nowrap', | ||
| marginBottom: 0, | ||
| padding: theme.tokens.spacing.S16, | ||
| }} | ||
| errorMessage={errorText} | ||
| separator={MULTILINE_ERROR_SEPARATOR} | ||
| variant="error" | ||
| /> | ||
| </Grid> | ||
| )} | ||
| {maxSelectionCount !== undefined && ( | ||
| <AlertsNoticeMessage | ||
| text={`You can select up to ${maxSelectionCount} resources.`} | ||
| variant="warning" | ||
| /> | ||
| <Grid item md={12}> | ||
| <AlertListNoticeMessages | ||
| style={{ | ||
| alignItems: 'center', | ||
| background: theme.tokens.alias.Background.Normal, | ||
| borderRadius: 1, | ||
| display: 'flex', | ||
| flexWrap: 'nowrap', | ||
| marginBottom: 0, | ||
| padding: theme.tokens.spacing.S16, | ||
| }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of duplicating these styles, could we define them as constant and use it here or create a styled component to avoid importing useTheme?
| <List sx={{ listStyleType: 'disc', pl: 1.5 }}> | ||
| {errorList.map((error, index) => ( | ||
| <ListItem | ||
| data-testid="alert_notice_message_list" | ||
| key={index} | ||
| sx={{ display: 'list-item', pl: 0.5, py: 0.5 }} | ||
| > | ||
| {error} | ||
| </ListItem> | ||
| ))} | ||
| </List> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of hardcoding the values, can we use our theme.tokens.spacing.* here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Or our new spacingFunction! https://linode.github.io/manager/development-guide/16-design-tokens.html#examples
Hi, @pmakode-akamai . This was intentional as the spacing aligns with our UX Mockups. And ideally the background color for the notice should be slightly different. I have attached screenshots to show what the desired styling should look. These are the screenshots from my localhost. Can you please confirm if the changes look the same for you ? |
Yeah, background color for the Notice looks good to me ✅ edit: All other suggestions/required fixes have been addressed async. |
Cloud Manager UI test results🎉 534 passing tests on test run #17 ↗︎
|





Description 📝
Handling multiple error messages from API and displaying it in the form accordingly.
Changes 🔄
AlertListNoticeMessages.tsxhandleMultipleErrorto handle the error map logicAlertListNoticeMessagescomponent inAddChannelListing&MetricCriteriacomponentshandleSubmitmethod in Create and Edit flow to include the error handlingTarget release date 🗓️
08/04/2025
Preview 📷
How to test 🧪
Prerequisites
(How to setup test environment)
serverHandler.tsuse the given snippet below as the return response for eitherhttp.post('*/monitor/services/:service_type/alert-definitions')requestor
http.put('*/monitor/services/:serviceType/alert-definitions/:id')requestVerification steps
(How to verify changes)
channel_ids,rule_criteria.rulesshould be shown in AlertListNoticeMessages componentchannel_ids,rule_criteria.rulesshould be captured shown in AlertListNoticeMessages component.channel_ids,rule_criteria.rulesshould be displayed in the relevant errorText handlers of the componentschannel_ids,rule_criteria.rulesshould be concatenated if they are multiple with a space in between.Author Checklists
As an Author, to speed up the review process, I considered 🤔
👀 Doing a self review
❔ Our contribution guidelines
🤏 Splitting feature into small PRs
➕ Adding a changeset
🧪 Providing/improving test coverage
🔐 Removing all sensitive information from the code and PR description
🚩 Using a feature flag to protect the release
👣 Providing comprehensive reproduction steps
📑 Providing or updating our documentation
🕛 Scheduling a pair reviewing session
📱 Providing mobile support
♿ Providing accessibility support
As an Author, before moving this PR from Draft to Open, I confirmed ✅