-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
WIP: React version of visualizations #2988
Conversation
b52a316
to
29ddbc6
Compare
1313118
to
5fd2cb6
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.
Thanks! This is a huge milestone. Both in scope and the progress it brings to our move to React.
We will need to figure out a way to how to do it in a way that minimizes the (negative) impact on the application's stability/backward support. One idea I had is to create a few test case visualizations for each visualization type that we can render with the current implementation and this new one to compare for changes and issues.
Also, we need to keep track of visualizations related pull requests we merge while this is in review/development.
The included comments are from a quick review, a more detailed one will follow.
@@ -4,10 +4,10 @@ | |||
"description": "The frontend part of Redash.", | |||
"main": "index.js", | |||
"scripts": { | |||
"start": "webpack-dev-server", | |||
"start": "node --max-old-space-size=4096 node_modules/.bin/webpack-dev-server", |
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.
😮 build was failing without this? somewhat disturbing.
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 backed this out and CircleCI started failing with heap space exhausted error again, so I think so. Not sure if there's something we can do to get webpack to run leaner.
@jezdez @kravets-levko @washort Let's keep a list of changes done to visualizations in other pull requests, so we know what to sync.
|
f11c02d
to
6ec0332
Compare
6ec0332
to
6619df9
Compare
Rebased on master, all review comments addressed. I believe this is caught up now -- I think the react stuff handles relayout so #3024 probably doesn't need any attention. |
Some issues I found from testing this for a few minutes:
|
6619df9
to
f7541d2
Compare
Fixed, except for the styles in the chart editor -- I'm not a CSS expert so it's not obvious to me what's going on there. |
0fb09fb
to
70f0970
Compare
I did another run at it on the preview instance, and here's a few things I stumbled at:
We might want to find a more scalable to document these issues. Maybe Google Sheets? Or just update a single comment over here? |
5d032c3
to
495a3a9
Compare
I'll check that again.
Apparently it's a Chrome only issue 😮Anyway, it's an Ant issue. @kravets-levko @kocsmy which one of you fixed it last? Can take a look? :) |
495a3a9
to
052a489
Compare
I started tracking open issues in the pull request description to make it easier to find and see what's still open. |
a667488
to
4626ee4
Compare
Thank you, @washort, for the continued effort here. Unfortunately this been open for a long time and there seems to be no end on the horizon. Visualizations play a critical role in Redash, so we need high confidence that we didn't break anything before merging this. There are still some small issues with the visualizations and all the visualizations options editors still require an update. Considering all of the above, @ranbena will take over the effort of migrating visualizations to React. He will use the code from this pull request, but introduce each visualizations in a separate pull request. So we can gradually migrate. I know we discussed this option in the past, and decided to keep going with the monolith pull request, but: at the time I didn't expect this PR to be open for another 2 months and I wanted to save you the trouble of splitting this... :) We will keep this open for now, but probably close once the first split PR lands. We will track the migration work using #3301. |
updateOptions={pie ? this.updateValuesOptions : this.updateSeriesOptions} | ||
/> | ||
</Tabs.TabPane> : null } | ||
{opts.globalSeriesType !== 'custom' ? |
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.
These ternary operators probably shouldn't be spread across so many lines, as it makes the code difficult to read and understand.
I think this is partially a side-effect of JSX allowing full imperative logic intermixed with declarative markup. It somewhat presents a footgun, whereby developers are writing obscure and overly clever code, where a simpler template syntax would suffice.
{opts.globalSeriesType !== 'custom' ? | ||
<Tabs.TabPane key="dataLabels" tab="Data Labels"> | ||
<div className="m-t-10 m-b-10"> | ||
{includes(['line', 'area', 'column', 'scatter', 'pie'], opts.globalSeriesType) ? |
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.
Is there an alternative approach than multi-line ternary operators?
const definitionParts = definition.split('::') || definition.split('__'); | ||
const name = definitionParts[0]; | ||
const type = mapping ? mapping[definition] : definitionParts[1]; | ||
let value = v; |
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.
Can you rename v
to value
in the iterator, or are arguments treated as const
?
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.
Hi @brylie! This PR is going to be abandoned - we already implemented a part of it in #3493 and will migrate other visualizations one by one for better testability (@washort did a really good job here, but he decided to migrate all at once, and it was too hard to test everything and fix bugs. we keep this PR as an example for a future smaller PRs).
I'll close this now, to avoid further confusion. I guess we can use it as reference without it lingering in the PRs list :-) Thanks, @washort for showing the way :) |
Needs another round of testing for all visualizations but this should cover all the basics.
This is adapted from my larger branch containing a React implementation of the entire /queries/ page.
TODO:
Pull Requests to sync:
Unresolved issues: