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

upcoming: [DI-21200] - Migration from ChartJS to Recharts in CloudPulse #11204

Draft
wants to merge 20 commits into
base: develop
Choose a base branch
from

Conversation

nikhagra-akamai
Copy link
Contributor

@nikhagra-akamai nikhagra-akamai commented Nov 4, 2024

Description 📝

Migrated ChartJS to Recharts in CloudPulse.

Note: This PR is raised so that code changes can be reviewed & parallelly we are working on automation test cases which will eventually be added in this PR.

Changes 🔄

List any change relevant to the reviewer.

  1. Replaced LineGraph with AreaChart in CloudPulseLineGraph component.
  2. Updated x-axis ticks & chart variant in CloudPulseWidget
  3. Modified structure the of data passed to AreaChart component in CloudPulseWidgetUtils
  4. Removed CloudPulseColorPalette
  5. Modified legendColor property in metrics display to accept any color
  6. Added a connectNulls property in AreaChart component
  7. Added DataSet type in cloudpulse types

Target release date 🗓️

18th November

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.

No Data Display
Screenshot 2024-11-04 at 1 41 57 PM
Screenshot 2024-11-04 at 1 42 10 PM

X-Axis with timestamp ticks for less than 24hrs
Screenshot 2024-11-04 at 1 42 22 PM
Screenshot 2024-11-04 at 1 42 30 PM

X-Axis with date & timestamp ticks for more than 24hrs
Screenshot 2024-11-04 at 1 42 57 PM
Screenshot 2024-11-04 at 1 43 16 PM

Legends rows
https://github.com/user-attachments/assets/bc8886ba-db7a-44ba-aa09-fea7d715bd22

Error State
Screenshot 2024-11-04 at 2 16 32 PM
Screenshot 2024-11-04 at 2 16 40 PM

How to test 🧪

  1. Switch to mock user
  2. Select mandatory filters to generate the graphs
  3. Change time duration filter to see difference in x-axis tick
  4. Modify data in serverHandlers.ts for monitor/services/:serviceType/metrics endpoint to playaround with graph & legends.
  5. You can see a scroll bar in legend rows table if more than 2 legends are present

As an Author I have considered 🤔

Check all that apply

  • 👀 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

@nikhagra-akamai nikhagra-akamai self-assigned this Nov 4, 2024
@nikhagra-akamai nikhagra-akamai marked this pull request as ready for review November 4, 2024 14:22
@nikhagra-akamai nikhagra-akamai requested a review from a team as a code owner November 4, 2024 14:22
@nikhagra-akamai nikhagra-akamai requested review from hkhalil-akamai and abailly-akamai and removed request for a team November 4, 2024 14:22
@abailly-akamai
Copy link
Contributor

@nikhagra-akamai please address the e2e failures before we get to the review - thx!

@@ -47,7 +38,7 @@ export interface MetricsDisplayRow {
data: Metrics;
format: (n: number) => string;
handleLegendClick?: () => void;
legendColor: LegendColor;
legendColor: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks worse from a type safety perspective. Is this change necessary?

Copy link
Contributor Author

@nikhagra-akamai nikhagra-akamai Nov 5, 2024

Choose a reason for hiding this comment

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

yes it is already been discussed with @jaalah-akamai that instead of restricting to the 7 predefined colors, it should accept any color, so that legend rows greater than 7 won't collide with same color. Also, I don't think color has anything related to typesafety.

Comment on lines 136 to 139
export interface DataSet {
[label: string]: number;
timestamp: number;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Interfaces in the API SDK should correspond to responses from a particular endpoint. This definition may be more appropriately located in CloudPulseWidgetUtils.ts.

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

/**
* connect nulls value between two data points
*/
connectNulls? :boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
connectNulls? :boolean;
connectNulls?: boolean;

Copy link
Contributor Author

@nikhagra-akamai nikhagra-akamai Nov 5, 2024

Choose a reason for hiding this comment

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

updated, it was there in local changes but forgot to push. Thanks

legendRows={legendRows}
connectNulls
fillOpacity={0.5}
legendHeight={theme.spacing(18.75)}
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO, the overflow in the legend is worse from a usability perspective -- I would prefer to be able to see all rows without a scroll bar.

Screenshot 2024-11-04 at 6 06 02 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is also already been discussed. I understand your concern, but think for dynamically growing legend rows where number can cross 5. Bigger legend row table won't be look so good for UI and if two side by side graphs have different number of legend row count, then that mismatch in graph & legend height will make it look more worse. As in our case legends rows are dynamic & they can grow to 20.

Copy link
Contributor

Choose a reason for hiding this comment

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

Understood, thanks for the context.

Copy link

github-actions bot commented Nov 5, 2024

Coverage Report:
Base Coverage: 87.33%
Current Coverage: 87.34%

@nikhagra-akamai
Copy link
Contributor Author

nikhagra-akamai commented Nov 5, 2024

@nikhagra-akamai please address the e2e failures before we get to the review - thx!

@abailly-akamai This PR is raised so that code changes can be reviewed & parallelly we are working on automation test cases, which will eventually be added in this PR. Please let me know if automation is necessary for the review, I'll make it draft & open once automations are done. - Thx

@abailly-akamai
Copy link
Contributor

@nikhagra-akamai I am unsure what you meant, but this just can't be merged with failing tests no matter what cause everyone would inherit these failures

@nikhagra-akamai
Copy link
Contributor Author

@nikhagra-akamai I am unsure what you meant, but this just can't be merged with failing tests no matter what cause everyone would inherit these failures

I only meant that failure tests should not be blocking the PR review. By the time tests are being fixed ( that will be done within a day or 2 ), we can have review for our rest of the PR code.

@abailly-akamai
Copy link
Contributor

@nikhagra-akamai fixing the tests may affect the current code and we are trying to minimize the back and forth.

@kmuddapo
Copy link

kmuddapo commented Nov 6, 2024

@nikhagra-akamai fixing the tests may affect the current code and we are trying to minimize the back and forth.

@nikhagra-akamai is on OOO for this week. May be @abailly-akamai / @jaalah In that case could we please move this PR to draft or even close it? That way once team is ready with E2E automations which is currently in progress, we will open up a consolidated PR.

@linode-gh-bot
Copy link
Collaborator

Cloud Manager UI test results

🔺 6 failing tests on test run #11 ↗︎

❌ Failing✅ Passing↪️ Skipped🕐 Duration
6 Failing439 Passing2 Skipped116m 56s

Details

Failing Tests
SpecTest
dbaas-widgets-verification.spec.tsIntegration Tests for DBaaS Dashboard » should allow users to select their desired granularity and see the most recent data from the API reflected in the graph
dbaas-widgets-verification.spec.tsIntegration Tests for DBaaS Dashboard » should allow users to select the desired aggregation and view the latest data from the API displayed in the graph
dbaas-widgets-verification.spec.tsIntegration Tests for DBaaS Dashboard » should zoom in and out of all the widgets
linode-widget-verification.spec.tsIntegration Tests for Linode Dashboard » should allow users to select their desired granularity and see the most recent data from the API reflected in the graph
linode-widget-verification.spec.tsIntegration Tests for Linode Dashboard » should allow users to select the desired aggregation and view the latest data from the API displayed in the graph
linode-widget-verification.spec.tsIntegration Tests for Linode Dashboard » should zoom in and out of all the widgets

Troubleshooting

Use this command to re-run the failing tests:

yarn cy:run -s "cypress/e2e/core/cloudpulse/dbaas-widgets-verification.spec.ts,cypress/e2e/core/cloudpulse/dbaas-widgets-verification.spec.ts,cypress/e2e/core/cloudpulse/dbaas-widgets-verification.spec.ts,cypress/e2e/core/cloudpulse/linode-widget-verification.spec.ts,cypress/e2e/core/cloudpulse/linode-widget-verification.spec.ts,cypress/e2e/core/cloudpulse/linode-widget-verification.spec.ts"

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

Successfully merging this pull request may close these issues.

6 participants