Skip to content

upcoming: [DI-23778] - Added. confirmation dialog in alerts contextual view#11785

Merged
nikhagra-akamai merged 17 commits intolinode:developfrom
nikhagra-akamai:alerts-context-view-dialog
Mar 12, 2025
Merged

upcoming: [DI-23778] - Added. confirmation dialog in alerts contextual view#11785
nikhagra-akamai merged 17 commits intolinode:developfrom
nikhagra-akamai:alerts-context-view-dialog

Conversation

@nikhagra-akamai
Copy link
Contributor

@nikhagra-akamai nikhagra-akamai commented Mar 5, 2025

Description 📝

Added confirmation dialog in contextual view while enabling/disabling an alert for the selected entity

Changes 🔄

List any change(s) relevant to the reviewer.

  1. Added AlertsConfirmationDialog.tsx
  2. Updated AlertsInformationActionTable.tsx to add confirmation dialog on click of toggle button
  3. Added queries in alerts.ts for adding or removing entity to the alert.

Target release date 🗓️

15th March

Preview 📷

Include a screenshot or screen recording of the change.

🔒 Use the Mask Sensitive Data setting for security.

💡 Use <video src="" /> tag when including recordings in table.

Figma After
Screenshot 2025-03-05 at 12 54 24 PM Screenshot 2025-03-05 at 12 43 09 PM
Screenshot 2025-03-05 at 12 50 16 PM Screenshot 2025-03-05 at 12 53 28 PM

How to test 🧪

  1. Switch to mock user
  2. Go to database from mega menu & select any active database
  3. Go to Alerts tab
  4. Click on toggle button to see confirmation dialog.
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


  • I have read and considered all applicable items listed above.

As an Author, before moving this PR from Draft to Open, I confirmed ✅

  • All unit tests are passing
  • TypeScript compilation succeeded without errors
  • Code passes all linting rules

@github-actions
Copy link

github-actions bot commented Mar 5, 2025

Coverage Report:
Base Coverage: 80.08%
Current Coverage: 80.08%

entityName={entityName}
handleCancel={handleCancel}
handleConfirm={handleConfirm}
isActive={selectedAlert?.entity_ids?.includes(entityId) ?? false}
Copy link
Contributor

@ankita-akamai ankita-akamai Mar 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
isActive={selectedAlert?.entity_ids?.includes(entityId) ?? false}
isActive={selectedAlert.entity_ids.includes(entityId)}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on initial loading of action table component this object will be undefined that's why that is necessary

}))
);

const DatabaseAlert = React.lazy(() =>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added these changes for PR testing purpose and will remove it before merging the PR

entityId: string,
data: { 'alert-definition-id': number }
) =>
Request<{}>(
Copy link
Contributor

@venkymano-akamai venkymano-akamai Mar 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nikhagra-akamai , here we are returning a json object {}, is there any valid return type like, alert with entity details like that?, API should return some response right?

same below as well

Copy link
Contributor Author

@nikhagra-akamai nikhagra-akamai Mar 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as of now no any confirmation on its return type because some discussions are going on about this update APIs

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So is this PR just for the visual presentation of the confirmation dialog? When is the API response expected to be finalized?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mjac0bs Yes!! This PR is just for preparing from the UI side. Since it's a reusable component, it won’t be visible anywhere in the UI until the service-specific APIs are finalized and approved in terms of spec and implementation. Discussions with service owners are ongoing to finalize these APIs. Once that’s done, we’ll integrate them and submit a final PR, allowing this feature to be fully integrated and visible in the UI. Until then, this remains a UI-ready code update.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nikhagra-akamai May be you can place a comment /ToDo task in this to clear the confusion and setting the expectation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a todo comment in the query function

);
})
.catch(() => {
enqueueSnackbar(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nikhagra-akamai , here it is a generic error? do we need to display error message from API?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will update the logic here once the API responses will be finalized

});
};

export const useAddEntityToAlert = () => {
Copy link
Contributor

@venkymano-akamai venkymano-akamai Mar 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nikhagra-akamai , for my better understanding, can you explain how this is different from invalidating the queries on success as well error, why we need this much complexities, if just invalidating works fine?

One more point to ask, since we are waiting for the API call to get completed before closing the confirmation dialog, we don't need immediate feedback in the UI, this makes one more point for just invalidating queries?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated, thanks

Copy link
Contributor

@venkymano-akamai venkymano-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gave some simple comments, as well as one explanation in terms of invalidating queries, Rest looks good.

@github-project-automation github-project-automation bot moved this from Review to Changes Requested in Cloud Manager Mar 7, 2025
@nikhagra-akamai
Copy link
Contributor Author

Gave some simple comments, as well as one explanation in terms of invalidating queries, Rest looks good.

Thanks for review, I've updated the logic

Copy link
Contributor

@venkymano-akamai venkymano-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving, pending fix for typecheck and UT's

entityName={entityName}
handleCancel={vi.fn()}
handleConfirm={confirmFunction}
isActive={true}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add some coverage to this test so that we test both an alert that is active and not active?

We could include assertions for whether:

  • the title includes "Enable" vs "Disable"
  • the body includes "enable" vs "disable"
  • the entityName is included in the text

entityId: string,
data: { 'alert-definition-id': number }
) =>
Request<{}>(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So is this PR just for the visual presentation of the confirmation dialog? When is the API response expected to be finalized?

@nikhagra-akamai nikhagra-akamai requested a review from mjac0bs March 10, 2025 06:44
Copy link
Contributor

@mjac0bs mjac0bs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing feedback.

@github-project-automation github-project-automation bot moved this from Changes Requested to Approved in Cloud Manager Mar 11, 2025
@mjac0bs mjac0bs added Approved Multiple approvals and ready to merge! and removed Ready for Review labels Mar 11, 2025
@linode-gh-bot
Copy link
Collaborator

Cloud Manager UI test results

🔺 1 failing test on test run #14 ↗︎

❌ Failing✅ Passing↪️ Skipped🕐 Duration
1 Failing537 Passing3 Skipped120m 6s

Details

Failing Tests
SpecTest
linode-config.spec.tsEnd-to-End » Clones a config

Troubleshooting

Use this command to re-run the failing tests:

pnpm cy:run -s "cypress/e2e/core/linodes/linode-config.spec.ts"

@nikhagra-akamai nikhagra-akamai merged commit 4f9504a into linode:develop Mar 12, 2025
26 of 27 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Merged in Cloud Manager Mar 12, 2025
@cypress
Copy link

cypress bot commented Mar 12, 2025

Cloud Manager E2E    Run #7385

Run Properties:  status check passed Passed #7385  •  git commit 4f9504a065: Merge pull request #11785 from nikhagra-akamai/alerts-context-view-dialog
Project Cloud Manager E2E
Branch Review develop
Run status status check passed Passed #7385
Run duration 57m 50s
Commit git commit 4f9504a065: Merge pull request #11785 from nikhagra-akamai/alerts-context-view-dialog
Committer Nikhil Agrawal
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 6
Tests that did not run due to a developer annotating a test with .skip  Pending 3
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 538
View all changes introduced in this branch ↗︎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved Multiple approvals and ready to merge! Cloud Pulse - Alerting Cloud Pulse

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants