You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/03/20 23:05:07 UTC

[GitHub] [incubator-superset] suddjian commented on a change in pull request #9337: Filter owners select by text input

suddjian commented on a change in pull request #9337: Filter owners select by text input
URL: https://github.com/apache/incubator-superset/pull/9337#discussion_r395926142
 
 

 ##########
 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:
   I tested this and it seemed to work fine. What's the advantage of changing it?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org