-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
show edit modal on dashboards list view #9211
Conversation
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.
a couple questions, none are blocking
superset/views/dashboard/api.py
Outdated
"slug", | ||
"table_names", | ||
] | ||
order_columns = ["dashboard_title", "changed_on", "published", "changed_by_fk"] | ||
list_columns = [ | ||
"json_metadata", |
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 this property consumed in the listview? Seems like we're fetching the full dashboard show payload on edit.
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.
That's a good point, we could use the metadata from the modal's fetch call.
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 ended up simplifying the contract for PropertiesModal
, now it just takes a dashboard id and fetches everything it needs on its own. Not ideal, it'd be nicer to pass a dashboard object as a prop, but we don't have a super consistent data model for a dashboard in every place that it's used, so it's probably the best option for now.
handleDashboardEdit = (edits: any, original: Dashboard) => { | ||
this.setState({ loading: true }); | ||
return SupersetClient.get({ | ||
endpoint: `/api/v1/dashboard/${original.id}`, |
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 a reason we're making this call instead of just updating from edits
?
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 think there was some field that wasn't returned from the PUT
endpoint. I wasn't sure how to add that field and eventually just did this to make it work. If you think it's worth the effort I'll take another pass at it, otherwise I can add a comment documenting why it's there.
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.
happy to merge this, this shouldn't affect perf much. However, we should figure out how to configure the PUT response
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.
might be edit_columns
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 remember this now. The API endpoint uses the edit_model_schema
Marshmallow schema when returning the edited object, which is the same as the one used to parse incoming edited fields from the client. IMO a better design would be to return the entire object as it would from the GET
endpoint, but that's a larger scale API design decision.
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.
In this particular case, the impact is that slug
can be changed, which changes the url
, but only slug
is returned from the endpoint.
Codecov Report
@@ Coverage Diff @@
## master #9211 +/- ##
==========================================
+ Coverage 58.92% 59.14% +0.21%
==========================================
Files 372 373 +1
Lines 11999 12057 +58
Branches 2940 2961 +21
==========================================
+ Hits 7071 7131 +60
+ Misses 4750 4747 -3
- Partials 178 179 +1
Continue to review full report at Codecov.
|
CATEGORY
Choose one
SUMMARY
This changes the dashboard react list view to use the react-based edit modal, instead of linking to the CRUD-based edit page.
A detail of this implementation is that after editing a dashboard, it will stay in the list even if it is no longer applicable based on the chosen filters. This is intended, as removing a just-edited dashboard from the list could be annoying.
I had to remove the "owners" accessor column as it doesn't actually work correctly when a dashboard has
owners
populated. React complains about trying to render an object. Owners will need a component rather than just an accessor. This bug was invisible before, since the list endpoint for dashboards doesn't actually return owners at all.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
After clicking the edit button
![Screen Shot 2020-02-26 at 11 51 47 AM](https://user-images.githubusercontent.com/1858430/75382042-a5e3ee00-588e-11ea-8861-40ebf88c0f90.png)
After saving the dashboard
![Screen Shot 2020-02-26 at 11 51 56 AM](https://user-images.githubusercontent.com/1858430/75382060-a8dede80-588e-11ea-8ea4-bc8dd819f8d5.png)
TEST PLAN
ADDITIONAL INFORMATION
REVIEWERS
@nytai