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/09/09 01:14:18 UTC

[GitHub] [incubator-superset] ktmud commented on a change in pull request #10814: fix: ColorSchemeControl should not use CreatableSelect

ktmud commented on a change in pull request #10814:
URL: https://github.com/apache/incubator-superset/pull/10814#discussion_r485274945



##########
File path: superset-frontend/src/explore/components/controls/ColorSchemeControl.jsx
##########
@@ -100,12 +98,16 @@ export default class ColorSchemeControl extends React.PureComponent {
   }
 
   render() {
-    const { choices } = this.props;
-    const options = (isFunction(choices) ? choices() : choices).map(choice => ({
-      value: choice[0],
-      label: choice[1],
-    }));
-
+    const { schemes, choices } = this.props;
+    // save parsed schemes for later
+    this.schemes = isFunction(schemes) ? schemes() : schemes;
+    const options = (isFunction(choices) ? choices() : choices).map(
+      ([value, label]) => ({
+        value,
+        // use scheme label if available
+        label: this.schemes[value]?.label || label,

Review comment:
       Pre-compute and pass scheme labels to `options` so that we can search by labels. E.g. (without this change, searching "airbnb" will return no results---because the "Airbnb Colors" scheme has a value of "bnbColors").




----------------------------------------------------------------
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



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