dpgaspar commented on a change in pull request #9337: Filter owners select by
text input
URL:
https://github.com/apache/incubator-superset/pull/9337#discussion_r395932633
##########
File path: superset-frontend/src/dashboard/components/PropertiesModal.jsx
##########
@@ -90,41 +90,41 @@ class PropertiesModal extends React.PureComponent {
// datamodel, the dashboard could probably just be passed as a prop.
SupersetClient.get({
endpoint: `/api/v1/dashboard/${this.props.dashboardId}`,
- })
- .then(response => {
- const dashboard = response.json.result;
- this.setState(state => ({
- isDashboardLoaded: true,
- values: {
- ...state.values,
- dashboard_title: dashboard.dashboard_title || '',
- slug: dashboard.slug || '',
- json_metadata: dashboard.json_metadata || '',
- },
- }));
- const initialSelectedValues = dashboard.owners.map(owner => ({
- value: owner.id,
- label: owner.username,
- }));
- this.onOwnersChange(initialSelectedValues);
- })
- .catch(err => console.error(err));
+ }).then(response => {
+ const dashboard = response.json.result;
+ this.setState(state => ({
+ isDashboardLoaded: true,
+ values: {
+ ...state.values,
+ dashboard_title: dashboard.dashboard_title || '',
+ slug: dashboard.slug || '',
+ json_metadata: dashboard.json_metadata || '',
+ },
+ }));
+ const initialSelectedOwners = dashboard.owners.map(owner => ({
+ value: owner.id,
+ label: owner.username,
+ }));
+ this.onOwnersChange(initialSelectedOwners);
+ }, this.handleErrorResponse);
}
- fetchOwnerOptions() {
- SupersetClient.get({
- endpoint: `/api/v1/dashboard/related/owners`,
- })
- .then(response => {
+ loadOwnerOptions(input = '') {
+ return SupersetClient.get({
+ endpoint: `/api/v1/dashboard/related/owners?filter=${input}`,
Review comment:
Did it really work?
You can always use Swagger to access API docs:
http://localhost:8080/swaggerview/v1
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]