fix: save dataset and repopulate state#20965
Conversation
Codecov Report
@@ Coverage Diff @@
## master #20965 +/- ##
===========================================
- Coverage 66.38% 54.86% -11.53%
===========================================
Files 1767 1767
Lines 67232 67284 +52
Branches 7138 7140 +2
===========================================
- Hits 44633 36916 -7717
- Misses 20773 28541 +7768
- Partials 1826 1827 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
532561f to
ef1b78e
Compare
There was a problem hiding this comment.
This is a first attempt at creating a set of types of that map to the api. cc @hughhhh cc @eric-briscoe. We talked about auto-generating this with Marshmallow, but this seemed like a decent start. Thoughts?
081228c to
18e3c12
Compare
|
/testenv up |
|
@yousoph Ephemeral environment spinning up at http://35.167.113.206:8080. Credentials are |
|
@yousoph thanks for catching that. I just pushed up a fix for the dashboard button too. |
574fe39 to
f38811d
Compare
|
/testenv up |
There was a problem hiding this comment.
Use this pattern instead for grabbing the time_filter:
https://github.com/preset-io/superset/blob/master/superset/models/helpers.py#L1550
There was a problem hiding this comment.
shouldn't this be for col in self.columns: it's missing the colon
There was a problem hiding this comment.
It looks like it's the end of a dictionary comprehension, not a for loop, so no colon needed. The comment change btw was just part of my automated linting on line length. I'm not actually sure what the comment means, too. :)
|
/testenv up |
|
@yousoph Ephemeral environment spinning up at http://54.244.60.192:8080. Credentials are |
|
@yousoph Ephemeral environment spinning up at http://35.88.30.184:8080. Credentials are |
f38811d to
9a43dd2
Compare
| form_data: initialFormData, | ||
| slice: initialSlice, | ||
| controlsTransferred: [], | ||
| controlsTransferred: explore.controlsTransferred, |
There was a problem hiding this comment.
@michael-s-molina do you see any problems with us pulling in state here on hydrate? It's not a property that exists in the persisted db.
There was a problem hiding this comment.
Yes. The hydrateExplore is the action responsible for mounting the Explore state so it shouldn't have a reference to itself. It will only work because there's a known problem where the save action is firing hydrateExplore again but it shouldn't. We're calling hydrateExplore on save intentionally because during the SPA work we wanted to avoid reloading the page but many of the existing logic depended on that. It would require a major refactor to change this behavior. Currently, explore.controlsTransferred is being updated by UPDATE_FORM_DATA_BY_DATASOURCE action. You'll probably won't need all the logic inside that action, so I suggest creating a new action to update this piece of state and call this new action from your code.
Ping me or @kgabryje if you need more assistance on this.
| fetchMock.post(saveDatasetEndpoint, saveDatasetResponse); | ||
| const dispatch = sinon.spy(); | ||
| const getState = sinon.spy(() => ({ explore: { datasource } })); | ||
| const dataset = await saveDataset(SAVE_DATASET_POST_ARGS)(dispatch); |
|
looks good to me baring any of Michael's feedback! I'l approve! |
|
/testenv up |
|
@eschutho Ephemeral environment spinning up at http://34.219.161.252:8080. Credentials are |
|
LGTM |
|
Ephemeral environment shutdown and build artifacts deleted. |
* save dataset and repopulate state * disable dashboard button if dataset is missing * fix error message * fix tests (cherry picked from commit 463406f)
* save dataset and repopulate state * disable dashboard button if dataset is missing * fix error message * fix tests

SUMMARY
This PR fixes a bug in the sqllab to explore chart with a query flow where upon saving, there was an error saying that the form fields had not been transferred when they had.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:

After:

TESTING INSTRUCTIONS
Repro steps
1, query in sql and click create chart
2, create chart in explore and save chart
3, in save chart modal when chart power=query, remove dataset name and leave it blank
4, click save button
ADDITIONAL INFORMATION