Refactor duplicated graph visualization code in html report#12
Conversation
- Consolidate visualization logic by using `SITEGRAPH_HTML` template in `generateHtml`. - Sanitize `graphData` in `generateHtml` to reduce report size (removing `html` property). - Inject data via `window.GRAPH_DATA` and `window.METRICS_DATA`. - Update `SITEGRAPH_HTML` to display session stats (fetched/cached) to maintain feature parity with the old report. - Update tests to reflect the new implementation.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
This change addresses the code health issue of duplicated graph visualization code.
The
generateHtmlfunction inplugins/core/src/report/html.tspreviously contained a duplicated and simpler implementation of the graph visualization. This has been refactored to use the more robustSITEGRAPH_HTMLtemplate fromplugins/core/src/report/sitegraph_template.ts.Key changes:
generateHtmlnow injectsgraphDataandmetricsintoSITEGRAPH_HTMLinstead of generating its own HTML.graphDatais sanitized (HTML content removed) before injection to keep the file size manageable.sitegraph_template.tswas updated to display session crawl statistics (fetched/cached pages), ensuring no regression in the information provided by the report.html_report.test.tswere updated to verify the correct data injection.This consolidation reduces maintenance overhead and provides a better visualization experience for the HTML report.
PR created automatically by Jules for task 11969879025056150495 started by @saurabhsharma2u