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

[SIP-4] replace chart ajax calls with SupersetClient #5875

Merged
merged 18 commits into from
Oct 15, 2018

Conversation

williaster
Copy link
Contributor

@williaster williaster commented Sep 12, 2018

This PR is one of a few that implements the final step 4) discussed in #5772 and refactors just chart-specific ajax calls for easier review.

It also improves the JS tests for chartActions which asserted only one thing previously.

Note that the new @superset-ui/core dep + setup for SupersetClient is duplicated across all ajax PRs

@kristw @mistercrunch @graceguo-supercat @michellethomas @conglei

// of the passed response blob. It assumes the blob should be read as text,
// and that the response can be parsed as JSON. This is needed to read
// the value of any fetch-based response.
export default function readResponseBlob(blob) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you double check cypress doesn't add this in as a test? If you run tests just make sure this file doesn't show up. I had trouble adding helpers / utils because it kept picking them up as tests. I'm not sure if it will happen because this is outside of the integration folder, but if it does I added a setting to ignore any files with the pattern *.helper.js.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michellethomas thanks for bringing this up, it looks okay from the cypress UI

@codecov-io
Copy link

codecov-io commented Sep 19, 2018

Codecov Report

Merging #5875 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #5875   +/-   ##
=======================================
  Coverage   77.28%   77.28%           
=======================================
  Files          47       47           
  Lines        9332     9332           
=======================================
  Hits         7212     7212           
  Misses       2120     2120

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9029701...0265386. Read the comment docs.

export const CHART_UPDATE_STARTED = 'CHART_UPDATE_STARTED';
export function chartUpdateStarted(queryRequest, latestQueryFormData, key) {
return { type: CHART_UPDATE_STARTED, queryRequest, latestQueryFormData, key };
export function chartUpdateStarted(queryController, latestQueryFormData, key) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noting that the abort controller doesn't seem to be passed along in the reducer

// this allows for the server side generated menus to function
window.$ = $;
window.jQuery = $;
require('bootstrap');

SupersetClient.configure({ host: (window.location && window.location.host) || '' })
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noting from testing in staging that we must also configure protocol here

@@ -166,18 +167,38 @@ class Chart extends React.PureComponent {
);
}

d3format(col, number) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you accidentally revert this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😱

@williaster
Copy link
Contributor Author

@kristw @michellethomas I tested this on staging (charts + dashboards) and it worked 🎉, rebased on newest master so that I could update unit tests to jest and I fixed newer cypress tests.

I also fixed the Chart rebase-revert Krist pointed out so it should be good to go 👍 🤞

@williaster williaster merged commit 316fdcb into apache:master Oct 15, 2018
@williaster williaster deleted the chris--ajax-charts branch October 15, 2018 23:52
bipinsoniguavus pushed a commit to ThalesGroup/incubator-superset that referenced this pull request Dec 26, 2018
* [deps] add @superset-ui/core

* [superset-client] initialize SupersetClient in app setup

* [superset-client] add abortcontroller-polyfill

* [superset-client] replace all chart ajax calls with SupersetClient

* [tests] add fetch-mock dep and helpers/setupSupersetClient.js

* [superset client][charts][tests] fix and improve chartActions_spec

* [deps] @superset-ui/core@^0.0.4

* [common] add better SupersetClient initialization error

* [cypress] add readResponseBlob helper, fix broken fetch-based tests

* [cypress] fix tests from rebase

* [deps] @superset-ui/core@^0.0.5

* [cypress][fetch] fix controls test for fetch

* [cypress][dashboard][fetch] fix filter test for fetch

* [superset-client] configure protocol on init

* yarn.lock

* undo Chart.jsx revert

* yarn again

* [superset-client] fix chartAction unit tests
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.28.0 labels Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.28.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants