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

chore: Refactor dashboard header to func component #31029

Merged
merged 2 commits into from
Nov 22, 2024

Conversation

kgabryje
Copy link
Member

SUMMARY

Refactor the dashboard Header component from class to function component. No functional changes, just a refactor

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

Everything should work like before

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

@dosubot dosubot bot added the frontend:refactor Related to refactoring the frontend label Nov 22, 2024
dashboardInfo.common?.conf?.DASHBOARD_AUTO_REFRESH_MODE === 'fetch'
) {
// force-refresh while auto-refresh in dashboard
return boundActionCreators.fetchCharts(

Choose a reason for hiding this comment

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

nit: I know it was like this before this PR, but we could DRY it with a helper function so you can pass the boolean as arg and return the fetchCharts call with it here and the one below

t(
'Your dashboard is too large. Please reduce its size before saving it.',
),
);
} else {
if (positionJSONLength >= limit * 0.9) {
this.props.addWarningToast('Your dashboard is near the size limit.');
boundActionCreators.addWarningToast(
'Your dashboard is near the size limit.',

Choose a reason for hiding this comment

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

Should we translate this?

Copy link
Member Author

Choose a reason for hiding this comment

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

nice catch!


if (interval) {
const periodicRefreshOptions =
dashboardInfo.common?.conf?.DASHBOARD_AUTO_REFRESH_INTERVALS;

Choose a reason for hiding this comment

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

nit: Is this value dynamically changing somewhere or just a static config loaded once? If static, we could move this out the callback.

Copy link
Member Author

Choose a reason for hiding this comment

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

it doesn't change, but technically it could since it's a part of the redux state object, so it should be included in the dependency array - it won't hurt and it won't trigger a lint warning

Copy link
Member

@Antonio-RiveroMartnez Antonio-RiveroMartnez left a comment

Choose a reason for hiding this comment

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

lgtm

@kgabryje kgabryje merged commit f8adaf6 into apache:master Nov 22, 2024
34 checks passed
@michael-s-molina
Copy link
Member

Maybe it would be nice to use refactor instead of chore for this type of PR.

@kgabryje
Copy link
Member Author

Maybe it would be nice to use refactor instead of chore for this type of PR.

good point 🤦 will keep that in mind next time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend:refactor Related to refactoring the frontend size/XXL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants