-
Notifications
You must be signed in to change notification settings - Fork 13
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
Refactor: Introduce WebstatusFeatureUsageChartPanel
and WebstatusFeatureWPTProgressChartPanel
using WebstatusLineChartPanel
#1176
Refactor: Introduce WebstatusFeatureUsageChartPanel
and WebstatusFeatureWPTProgressChartPanel
using WebstatusLineChartPanel
#1176
Conversation
…eatureWPTProgressChartPanel` using `WebstatusLineChartPanel` This PR introduces two new custom elements, `WebstatusFeatureUsageChartPanel` and `WebstatusFeatureWPTProgressChartPanel`, for displaying feature usage and WPT progress charts, respectively. These components leverage the enhanced `WebstatusLineChartPanel` abstract class, promoting code reuse and consistency across different chart panels. **Key changes:** * **`WebstatusFeatureUsageChartPanel`:** This panel displays the usage statistics of a feature over time. It fetches data using the `getChromiumDailyUsageStats` API call and visualizes it using a line chart. * **`WebstatusFeatureWPTProgressChartPanel`:** This panel displays the WPT (Web Platform Tests) progress of a feature across different browsers. It fetches data using the `getFeatureStatsByBrowserAndChannel` API call and visualizes it using a line chart with an additional "Total" series calculated using the `calculateMax` method. * **Simplified `FeaturePage`:** By introducing these new components, the `FeaturePage` is significantly simplified. It no longer needs to handle the loading and displaying of individual charts, as these tasks are now delegated to the respective chart panel components. * **Leveraging `data-fetch-complete` event:** The `FeaturePage` now listens for the `data-fetch-complete` event dispatched by the `WebstatusFeatureWPTProgressChartPanel` to calculate and display the percentage difference in WPT results, similar to the previous implementation. * **Behavior changes:** * **Loading state:** Instead of a separate full page loading overlay, the components now use the built-in loading state of the `WebstatusLineChartPanel` abstract class. This aligns with the goal of issue #278 to move towards component-level loading states. * **Chart display:** The charts are now displayed only after all data is fetched, ensuring consistency with the stats page charts and simplifying the rendering logic. This PR improves code organization and reusability by introducing dedicated chart panel components and leveraging the `WebstatusLineChartPanel` abstract class. It also simplifies the `FeaturePage` and provides a more consistent and streamlined user experience for viewing feature usage and WPT progress.
afe3637
to
fb5d70c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume that it is OK that some of the data points changed in the snapshots.
@jrobbins That should be okay. I double checked my code against the actual live data. My charts looked mostly the same as the current ones in production. I say mostly because I did find one thing I am missing: webstatus.dev/frontend/src/static/js/components/webstatus-feature-page.ts Lines 311 to 322 in 9f983ba
webstatus.dev/frontend/src/static/js/components/webstatus-feature-page.ts Lines 337 to 340 in 9f983ba
This inconsistency is because of the data from WPT itself. So we try to create buckets for the WPT data to catch bad data. I am pushing up something now. It is simply using this same timestamp extractor in this new chart interface. |
Depends on #1175
This PR introduces two new custom elements,
WebstatusFeatureUsageChartPanel
andWebstatusFeatureWPTProgressChartPanel
, for displaying feature usage and WPT progress charts, respectively. These components leverage the enhancedWebstatusLineChartPanel
abstract class, promoting code reuse and consistency across different chart panels.Key changes:
WebstatusFeatureUsageChartPanel
: This panel displays the usage statistics of a feature over time. It fetches data using thegetChromiumDailyUsageStats
API call and visualizes it using a line chart.WebstatusFeatureWPTProgressChartPanel
: This panel displays the WPT (Web Platform Tests) progress of a feature across different browsers. It fetches data using thegetFeatureStatsByBrowserAndChannel
API call and visualizes it using a line chart with an additional "Total" series calculated using thecalculateMax
method.FeaturePage
: By introducing these new components, theFeaturePage
is significantly simplified. It no longer needs to handle the loading and displaying of individual charts, as these tasks are now delegated to the respective chart panel components.data-fetch-complete
event: TheFeaturePage
now listens for thedata-fetch-complete
event dispatched by theWebstatusFeatureWPTProgressChartPanel
to calculate and display the percentage difference in WPT results, similar to the previous implementation.WebstatusLineChartPanel
abstract class. This aligns with the goal of issue Create component specific loading & error states #278 to move towards component-level loading states.This PR improves code organization and reusability by introducing dedicated chart panel components and leveraging the
WebstatusLineChartPanel
abstract class. It also simplifies theFeaturePage
and provides a more consistent and streamlined user experience for viewing feature usage and WPT progress.