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

fix(alert modal): set current user as default alert owner during new alert initialization #24070

Merged
merged 6 commits into from
May 16, 2023

Conversation

anamitraadhikari
Copy link
Contributor

SUMMARY

Currently, when the modal window opens, the "owners" field is left unpopulated. This is slightly annoying as it would be more user friendly and efficient to automatically pre-populate the field with the currently logged-in user.

To address this, I propose retrieving the current user from Redux state and setting it as the default owner when the alert modal is opened.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:
Screenshot 2023-05-15 at 1 43 35 AM

After:
Screenshot 2023-05-15 at 1 43 57 AM

TESTING INSTRUCTIONS

Open Superset in browser > Click on the "Settings" menu on top right > Click on "Alerts & Reports" > on the "Alerts & Reports" page, click on the "+ ALERT" button to create a new alert & notice the behavior.

ADDITIONAL INFORMATION

NA

@villebro villebro self-requested a review May 16, 2023 06:02
Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the improvement!

Comment on lines 1020 to 1025
owners: [
{
value: currentUser.userId,
label: `${currentUser.firstName} ${currentUser.lastName}`,
},
],
Copy link
Member

Choose a reason for hiding this comment

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

Note: I was going to propose breaking this out into a util, but it turns out we have a lot of different User types that are very different (sometimes id us used, other times it's userId, and sometimes it's firstName, other times first_name etc). So best leave this as-is and do a separate PR to clean up all user types in one go.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack.

@codecov
Copy link

codecov bot commented May 16, 2023

Codecov Report

Merging #24070 (f0433c2) into master (78bc069) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head f0433c2 differs from pull request most recent head 694a506. Consider uploading reports for the commit 694a506 to get more accurate results

@@           Coverage Diff           @@
##           master   #24070   +/-   ##
=======================================
  Coverage   68.22%   68.22%           
=======================================
  Files        1942     1942           
  Lines       75215    75218    +3     
  Branches     8145     8146    +1     
=======================================
+ Hits        51318    51321    +3     
  Misses      21812    21812           
  Partials     2085     2085           
Flag Coverage Δ
javascript 54.52% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...-frontend/src/features/alerts/AlertReportModal.tsx 54.44% <100.00%> (+0.37%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@rusackas rusackas merged commit e351405 into apache:master May 16, 2023
26 checks passed
@rusackas
Copy link
Member

Thanks for the PR, and looking forward to the next!

@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.0.0 labels Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/S 🚢 3.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants