-
Notifications
You must be signed in to change notification settings - Fork 380
poc: [M3-9996] - Assigning alert definitions to a Linode during creation #12248
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
base: develop
Are you sure you want to change the base?
Conversation
… the Linode details page
...ges/manager/src/features/CloudPulse/Alerts/ContextualView/AlertInfoActionTableCreateFlow.tsx
Show resolved
Hide resolved
const handleToggleCreateFlow = (alert: Alert) => { | ||
const alerts = field.value; | ||
const currentAlertIds = alerts?.[alert.type] || []; | ||
const updatedAlerts = { ...alerts }; | ||
|
||
if (currentAlertIds?.includes(alert.id)) { | ||
// Disable the alert (remove from the list) | ||
updatedAlerts[alert.type] = currentAlertIds.filter( | ||
(id) => id !== alert.id | ||
); | ||
} else { | ||
// Enable the alert (add to the list) | ||
updatedAlerts[alert.type] = [...currentAlertIds, alert.id]; | ||
} | ||
|
||
field.onChange(updatedAlerts); | ||
}; |
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.
great work @pmakode-akamai
@jaalah-akamai this type of similar approach we've in our mind. Only difference is instead of using complete form context, we'll introduce an additional prop i.e. onChange handler function to reusable component that will update the latest value on every toggle click on which @ankita-akamai is working on.
In this way, we can avoid tight coupling of reusable component with any service specific types/forms as you can see the snippet at line 78 and can keep it completely flexible and easy to integrate.
May be, we can discuss any doubts or suggestions regarding this approach in detail either tomorrow or in weekly syncup
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.
@nikhagra-akamai @ankita-akamai
Although the PR implementation works, if we want to keep the ACLP related reusable component decoupled, then your suggestion makes sense -- avoiding the use of react-hook-form
context in these components helps maintain that separation and move this RHF logic two levels up into the Create Linode-specific Alerts logic.
I’ve just updated the PR -- I think this should be the approach we’re looking for?
Cloud Manager UI test results🎉 599 passing tests on test run #7 ↗︎
|
Description 📝
An alternative way to ensure alerts are assigned only during the Linode creation process, with RHF integrated to support Create Linode form flow
Note
Changes 🔄
Target release date 🗓️
N/A
Preview 📷
How to test 🧪
Prerequisites
ACLP Integration
feature flagVerification steps
system
anduser
alerts)undefined
or not present or excluded in legacy modeAuthor 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 ✅