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

feat(Alerts and Reports): Modal redesign #26202

Merged
merged 70 commits into from
Feb 19, 2024

Conversation

rtexelm
Copy link
Member

@rtexelm rtexelm commented Dec 7, 2023

SUMMARY

This combines changes from cobrafish (CorbinBullard, rtexelm, fisjac) into one branch allowing for tests of the full redesign.
No changes have been made to the functioning purpose of the modal and no additional features have been included.

Design Proposal
Contributing PR
Contributing PR

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

BEFORE:
image
AFTER:
ar-modal-style-update

TESTING INSTRUCTIONS

  • Open the Alerts & Reports page from the Settings drop menu
  • Add a new report/alert or edit a report/alert

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@lilykuang lilykuang closed this Dec 7, 2023
@lilykuang lilykuang reopened this Dec 7, 2023
@lilykuang lilykuang marked this pull request as ready for review December 7, 2023 18:07
@lilykuang lilykuang marked this pull request as draft December 7, 2023 18:07
@lilykuang lilykuang closed this Dec 7, 2023
@lilykuang lilykuang reopened this Dec 7, 2023
@eschutho eschutho marked this pull request as ready for review December 7, 2023 18:11
@eschutho eschutho marked this pull request as draft December 7, 2023 18:11
Copy link

codecov bot commented Dec 7, 2023

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (60fe581) 67.15% compared to head (077a979) 69.52%.
Report is 9 commits behind head on master.

Files Patch % Lines
...end/src/features/alerts/components/NumberInput.tsx 40.00% 2 Missing and 1 partial ⚠️
...res/alerts/components/AlertReportCronScheduler.tsx 71.42% 1 Missing and 1 partial ⚠️
...eatures/alerts/components/ValidatedPanelHeader.tsx 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #26202      +/-   ##
==========================================
+ Coverage   67.15%   69.52%   +2.36%     
==========================================
  Files        1902     1905       +3     
  Lines       74441    74500      +59     
  Branches     8306     8324      +18     
==========================================
+ Hits        49994    51795    +1801     
+ Misses      22393    20649    -1744     
- Partials     2054     2056       +2     
Flag Coverage Δ
hive 53.79% <100.00%> (?)
javascript 56.94% <96.00%> (+0.09%) ⬆️
mysql 78.00% <100.00%> (-0.02%) ⬇️
postgres 78.10% <100.00%> (-0.02%) ⬇️
presto 53.74% <100.00%> (?)
python 83.07% <100.00%> (+4.82%) ⬆️
sqlite 77.62% <100.00%> (-0.02%) ⬇️
unit 56.42% <100.00%> (?)

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lilykuang lilykuang changed the title redesign(Alerts and Reports modal): Combine collective work into branch for testing feat(Alerts and Reports modal): Combine collective work into branch for testing Dec 7, 2023
@lilykuang lilykuang changed the title feat(Alerts and Reports modal): Combine collective work into branch for testing feat(Alerts and Reports modal): Combine collective work into branch for testing [DO NOT MERGE] Dec 7, 2023
@lilykuang
Copy link
Member

/testenv up FEATURE_ALERT_REPORTS=true

Copy link
Contributor

github-actions bot commented Dec 8, 2023

@lilykuang Ephemeral environment spinning up at http://35.93.128.126:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@rtexelm rtexelm force-pushed the redesign/ar-modal/test branch 2 times, most recently from 89281a6 to 1d031d8 Compare January 9, 2024 03:09
@yousoph
Copy link
Member

yousoph commented Jan 10, 2024

/testenv up

Copy link
Contributor

@yousoph Ephemeral environment spinning up at http://34.219.202.1:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@yousoph
Copy link
Member

yousoph commented Jan 10, 2024

/testenv up FEATURE_ALERT_REPORTS=true

Copy link
Contributor

@yousoph Ephemeral environment spinning up at http://35.92.61.181:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@kgabryje
Copy link
Member

/testenv up FEATURE_ALERT_REPORTS=true

Copy link
Contributor

@kgabryje Ephemeral environment spinning up at http://35.88.169.129:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@apache apache deleted a comment from github-actions bot Jan 30, 2024
Pipfile.lock Outdated Show resolved Hide resolved
package-lock.json Outdated Show resolved Hide resolved
superset-frontend/src/components/Button/index.tsx Outdated Show resolved Hide resolved
superset-frontend/src/components/CronPicker/CronPicker.tsx Outdated Show resolved Hide resolved
superset-frontend/src/features/alerts/types.ts Outdated Show resolved Hide resolved
superset-frontend/src/features/alerts/AlertReportModal.tsx Outdated Show resolved Hide resolved
superset-frontend/src/components/Button/index.tsx Outdated Show resolved Hide resolved
superset-frontend/src/components/CronPicker/CronPicker.tsx Outdated Show resolved Hide resolved
superset-frontend/src/components/CronPicker/CronPicker.tsx Outdated Show resolved Hide resolved
superset-frontend/src/components/CronPicker/CronPicker.tsx Outdated Show resolved Hide resolved
superset-frontend/src/components/CronPicker/CronPicker.tsx Outdated Show resolved Hide resolved
) => {
expect(element).toBeInTheDocument();
userEvent.type(element, `${value}{enter}`);
await waitFor(() => {
Copy link
Member

Choose a reason for hiding this comment

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

Let's try with findBy rather than waitFor

Copy link
Contributor

Choose a reason for hiding this comment

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

This works for instances where we are awaiting a unique element to be rendered; however, it doesn't work for tests in which we are awaiting the creation of a duplicate item such as when adding a second notification method.

await comboboxSelect( screen.getAllByRole('combobox', { name: /delivery method/i, })[1], 'Slack', () => screen.getAllByRole('textbox')[1], );

describe('properly renders the modal', () => {
it('properly renders add alert text', () => {
const addAlertProps = generateMockedProps();
render(<AlertReportModal {...addAlertProps} />, { useRedux: true });
Copy link
Member

Choose a reason for hiding this comment

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

This is repeated in a bunch of places. Let's create a setup function that renders the modal and let's refer to that in every test

Copy link
Contributor

Choose a reason for hiding this comment

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

For each of the tests in this section, the AlertReportModal is rerendered with different mocked props. Does it still make sense to use a setup function in this scenario?

superset-frontend/src/features/alerts/AlertReportModal.tsx Outdated Show resolved Hide resolved
superset-frontend/src/features/alerts/AlertReportModal.tsx Outdated Show resolved Hide resolved
superset-frontend/src/features/alerts/AlertReportModal.tsx Outdated Show resolved Hide resolved
superset-frontend/src/features/alerts/AlertReportModal.tsx Outdated Show resolved Hide resolved
superset-frontend/src/features/alerts/AlertReportModal.tsx Outdated Show resolved Hide resolved
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
}

export default function NumberInput({
Copy link
Member

Choose a reason for hiding this comment

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

Wondering why are we introducing a component for a number input rather than using the one provided by Antdesign? Is there any particular case that cannot be handled?

Copy link
Member Author

Choose a reason for hiding this comment

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

@fisjac you might want to look at this one

@kgabryje
Copy link
Member

kgabryje commented Feb 15, 2024

Scheduling section looks a bit different than on the designs

EDIT: looks like react-js-cron was bumped from version 1.2 to 2.1 a week ago and now we should import its stylesheet explicitly

@rtexelm rtexelm changed the title feat(Alerts and Reports modal): Combine collective work into branch for testing [DO NOT MERGE] feat(Alerts and Reports modal redesign): Combine collective work into branch for review Feb 15, 2024
@rtexelm rtexelm marked this pull request as ready for review February 15, 2024 18:45
@eschutho eschutho changed the title feat(Alerts and Reports modal redesign): Combine collective work into branch for review feat(Alerts and Reports): Modal redesign Feb 16, 2024
@geido
Copy link
Member

geido commented Feb 19, 2024

/testenv up FEATURE_ALERT_REPORTS=true

Copy link
Contributor

@geido Ephemeral environment spinning up at http://35.93.119.155:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

</StyledInputContainer>
{isScreenshot && (
<StyledInputContainer
css={!isReport && contentType === 'chart' && noMarginBottom}
Copy link
Member

Choose a reason for hiding this comment

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

Nit: instead of all that logic for adding noMarginBottom styles, could we maybe just use something like :last-child in StyledInputContainer? That would simplify the logic and we could get rid of noMarginBottom everywhere.

If you agree, I'm ok with doing that as a cleanup follow up

Copy link
Member

@kgabryje kgabryje left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for your great work @fisjac @rtexelm and @CorbinBullard and addressing many rounds of reviews

@geido
Copy link
Member

geido commented Feb 19, 2024

  • (Reproduced on Master) I think it would be great if the input would catch this before submitting to the backend
Screenshot 2024-02-19 at 16 35 12
  • (Reproduced on Master) We should probably erase the value when setting the "Not null" option
Screenshot 2024-02-19 at 16 38 43
  • (Reproduced on Master) There is an issue with setting up a custom width for the screenshot and then choosing the CSV option. The custom width param will still be sent to the backend and will generate a validation error if it is below 600px. That should be cleared.

  • (Reproduced on Master) Also, not sure why the input for the custom width does not behave like a standard numeric input (up and down arrows on focus).

    • I am still not clear about the reason why we chose to use a custom component rather than the one offered by Antd? CC @fisjac
  • (Reproduced on Master) The grace period shows as optional. When editing the alert I found a value being set, even though I did not set it. When trying to erase it and save again, I will get the following error

Screenshot 2024-02-19 at 16 48 53
  • (Reproduced on Master) When setting a log retention of value None, I am getting an error that it should not be none :)
Screenshot 2024-02-19 at 16 50 08
  • (Reproduced on Master) When choosing a notification method, if I click by mistake on the same notification method, "Email" for instance, it will clear the email recipients. I believe it should clear them only if the notification method is different from the one selected.

  • Probably not in the scope of this PR, but it would be nice to have some validation around the email field

Screenshot 2024-02-19 at 16 52 29

@geido geido merged commit 601e62a into apache:master Feb 19, 2024
43 checks passed
Copy link
Contributor

Ephemeral environment shutdown and build artifacts deleted.

grvoicu added a commit to grvoicu/superset that referenced this pull request Feb 20, 2024
…-to-the-embedded-dashboard

* master: (1182 commits)
  fix(ci): mypy pre-commit issues (apache#27161)
  feat(Alerts and Reports): Modal redesign (apache#26202)
  refactor: Migrate ErrorBoundary to typescript (apache#27143)
  chore(tests): Remove unnecessary explicit Flask-SQLAlchemy session expunges (apache#27136)
  fix(plugins): Apply dashboard filters to comparison query in BigNumber with Time Comparison chart (apache#27138)
  fix: Duplicated toast messages (apache#27135)
  docs: add Geotab to users list (apache#27134)
  fix: Plain error message when visiting a dashboard via permalink without permissions (apache#27132)
  fix: ID param for DELETE ssh_tunnel endpoint (apache#27130)
  chore(hail mary): Update package-lock.json via npm-audit-fix (apache#26693)
  chore: lower cryptography min version to 41.0.2 (apache#27129)
  docs(miscellaneous): Export Datasoruces: export datasources exports to ZIP (apache#27120)
  fix(pivot-table-v2): Added forgotten translation pivot table v2 (apache#22840)
  fix: RLS modal overflow (apache#27128)
  refactor: Updates some database columns to MediumText (apache#27119)
  fix: gevent upgrade to 23.9.1 (apache#27112)
  fix: removes old deprecated sqllab endpoints (apache#27117)
  feat(storybook): Co-habitating/Upgrading Storybooks to v7 (dependency madness ensues) (apache#26907)
  fix: bump grpcio, urllib3 and paramiko (apache#27124)
  chore(internet_port): added new ports and removed unnecessary string class (apache#27078)
  ...
sfirke pushed a commit to sfirke/superset that referenced this pull request Mar 22, 2024
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: fisjac <jfisher9882@gmail.com>
Co-authored-by: Corbin <corbindbullard@gmail.com>
Co-authored-by: Lily Kuang <lily@preset.io>
Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 4.0.0 labels Apr 17, 2024
vinothkumar66 pushed a commit to vinothkumar66/superset that referenced this pull request Nov 11, 2024
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: fisjac <jfisher9882@gmail.com>
Co-authored-by: Corbin <corbindbullard@gmail.com>
Co-authored-by: Lily Kuang <lily@preset.io>
Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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/XXL 🚢 4.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants