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

WIP: React version of visualizations #2988

Closed
wants to merge 44 commits into from

Conversation

washort
Copy link

@washort washort commented Oct 19, 2018

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:

@washort washort force-pushed the react-visualizations branch from b52a316 to 29ddbc6 Compare October 19, 2018 04:26
@washort washort force-pushed the react-visualizations branch 2 times, most recently from 1313118 to 5fd2cb6 Compare October 19, 2018 17:24
Copy link
Member

@arikfr arikfr left a 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.

package.json Outdated Show resolved Hide resolved
@@ -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",
Copy link
Member

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.

Copy link
Author

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.

package.json Outdated Show resolved Hide resolved
client/app/visualizations/registry.js Outdated Show resolved Hide resolved
client/app/visualizations/map/MapEditor.jsx Outdated Show resolved Hide resolved
@arikfr
Copy link
Member

arikfr commented Oct 21, 2018

@jezdez @kravets-levko @washort Let's keep a list of changes done to visualizations in other pull requests, so we know what to sync.

@washort washort force-pushed the react-visualizations branch 4 times, most recently from f11c02d to 6ec0332 Compare October 27, 2018 02:45
@arikfr
Copy link
Member

arikfr commented Oct 28, 2018

Can you please rebase with master, so we can start testing this with the new Netlify previews (#2999)? You can even just copy the Netlify config file introduced in #2999 if rebasing generates too much conflicts/work.

Thanks!

@washort washort force-pushed the react-visualizations branch from 6ec0332 to 6619df9 Compare October 29, 2018 15:01
@washort
Copy link
Author

washort commented Oct 29, 2018

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.

@arikfr
Copy link
Member

arikfr commented Oct 29, 2018

Some issues I found from testing this for a few minutes:

  • The navbar is broken because of Ant's styles -- you need to move the Select component styles to the ant.less file.
  • The table doesn't render for unsaved queries.
  • Table visualization: sorting no longer works.
  • Table visualization editor: in any input field, after each change (add/remove character), it loses focus.
  • Table visualization editor: the grid size option seems to have no effect.
  • Chart visualization editor: the forms look broken, but maybe this is because of Ant's style collisions?

@washort washort force-pushed the react-visualizations branch from 6619df9 to f7541d2 Compare October 30, 2018 23:38
@washort
Copy link
Author

washort commented Oct 30, 2018

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.

@washort washort force-pushed the react-visualizations branch 2 times, most recently from 0fb09fb to 70f0970 Compare November 6, 2018 20:05
@arikfr
Copy link
Member

arikfr commented Nov 7, 2018

I did another run at it on the preview instance, and here's a few things I stumbled at:

  • When enabling search in a table visualization, it doesn't actually filter. Example
  • Table pagination doesn't work. Example
  • Table: grid size default is 250, but needs to be 25.
  • Filters: they don't look the same as before (title next to drop down). Example
  • Multi Filters: don't work (show some React error). Example
  • NavBar is broken due to misplaced Ant styles.
  • Charts: legend click event don't work. Example
  • Charts: we need to hide the Plotly logo in the toolbox.

We might want to find a more scalable to document these issues. Maybe Google Sheets? Or just update a single comment over here?

@washort washort force-pushed the react-visualizations branch 2 times, most recently from 5d032c3 to 495a3a9 Compare November 8, 2018 21:56
@washort
Copy link
Author

washort commented Nov 8, 2018

Fixed the above; however I wasn't able to reproduce a couple -- 25 seems to be the default page size for new tables. Also, what's the issue with the navbar? this is what I see:

2018-11-08-161204_713x131_scrot

@arikfr
Copy link
Member

arikfr commented Nov 9, 2018

25 seems to be the default page size for new tables.

I'll check that again.

Also, what's the issue with the navbar? this is what I see:

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? :)

@arikfr arikfr mentioned this pull request Nov 9, 2018
@washort washort force-pushed the react-visualizations branch from 495a3a9 to 052a489 Compare November 9, 2018 17:14
@arikfr
Copy link
Member

arikfr commented Nov 12, 2018

@arikfr arikfr changed the title React version of visualizations WIP: React version of visualizations Nov 12, 2018
@arikfr
Copy link
Member

arikfr commented Nov 12, 2018

I started tracking open issues in the pull request description to make it easier to find and see what's still open.

@washort washort force-pushed the react-visualizations branch from a667488 to 4626ee4 Compare January 14, 2019 20:34
@arikfr
Copy link
Member

arikfr commented Jan 17, 2019

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' ?
Copy link

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) ?
Copy link

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;
Copy link

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?

Copy link
Collaborator

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).

@arikfr
Copy link
Member

arikfr commented May 27, 2019

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 :)

@arikfr arikfr closed this May 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Frontend: React Frontend codebase migration to React Frontend Visualizations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants