Skip to content

Migrate charts page module to React 19 (amCharts, Chart.js, Chartist, Morris)#95

Open
devin-ai-integration[bot] wants to merge 2 commits into
demo-prepfrom
devin/1780378336-charts-react
Open

Migrate charts page module to React 19 (amCharts, Chart.js, Chartist, Morris)#95
devin-ai-integration[bot] wants to merge 2 commits into
demo-prepfrom
devin/1780378336-charts-react

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Jun 2, 2026

Copy link
Copy Markdown

Summary

Migrates the src/app/pages/charts/ module (amCharts, Chart.js, Chartist, Morris) from AngularJS controllers + templates to React 19, mounted into AngularJS via bridge directives. The framework-agnostic Playwright suite e2e/charts.spec.ts passes (42/42) against the migrated module.

Each UI-Router state now renders a thin bridge directive instead of templateUrl + controller:

.state('charts.amCharts', { template: '<charts-am-react></charts-am-react>', ... })

The directive resolves window.BlurAdminReact, injects baConfig via Angular DI (never read from window), and mounts the component with React 19 createRoot (through mountReactApp), unmounting on $destroy.

New React pages in src/app/react/pages/:

  • AmChartsPage — Bar/Area/Line/Pie/Funnel/Combined charts via global AmCharts, theme blur, cleanup via chart.clear().
  • ChartJsPage — 8 canvases (pie/doughnut/polar, radar/line/bar, animated radar/bars) via global Chart v2.4. Replicates the ChartJsProvider palette + option defaults (colors derived from baConfig, not hardcoded); wave charts animate on a 400ms interval, cleared + chart.destroy() on unmount.
  • ChartistPage — 9 charts via global Chartist with the original responsive option arrays; cleanup via chart.detach().
  • MorrisPage — Line/Donut/Bar/Area via global Morris; cleanup clears the container.

Third-party libraries are initialized inside useEffect([]) and torn down in the returned cleanup. Exact CSS classes, element IDs and DOM structure from the original templates are preserved so the e2e selectors keep matching.

Build wiring (additive, behind the existing webpack-built bundle.js):

  • gulp/inject.js excludes src/app/react/**/*.js (ES modules bundled by webpack, not standalone scripts).
  • gulp/server.js adds build/react to the serve/serve:e2e base dirs.
  • src/index.html loads <script src="bundle.js"> after the inject blocks.
  • gulp/build.js adds a copyReactBundle task (dependency of build) so the bundle lands in dist.
  • Rebuilt build/react/bundle.js.

Verification

gulp serve:e2e (Node 10) + npx playwright test e2e/charts.spec.ts (Node 20): 42 passed.

Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/2b20198567094f049b752bc932da6bfa


Open in Devin Review

…React 19

Port the AngularJS charts.* sub-modules to React 19 components mounted into
AngularJS via bridge directives. Third-party chart libraries (AmCharts,
Chart.js, Chartist, Morris) are initialized in useEffect with cleanup that
destroys/clears instances on unmount. Theme colors are injected through
baConfig (via Angular DI), not read from window.

- Add React pages: AmChartsPage, ChartJsPage, ChartistPage, MorrisPage
- Add bridge directives and switch UI-Router states to React templates
- Wire build: exclude src/app/react from gulp inject, serve build/react,
  load bundle.js in index.html, copy bundle into dist on build
- Rebuild webpack React bundle
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

devin-ai-integration[bot]

This comment was marked as resolved.

Devin Review: the funnel chart passed the whole layoutPaths object to
pathToImages instead of layoutPaths.images.amChart, matching every other
chart in the file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant