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 2019/02/27 22:14:31 UTC

[GitHub] kristw edited a comment on issue #6956: [WIP] Adding custom control overrides

kristw edited a comment on issue #6956: [WIP] Adding custom control overrides
URL: https://github.com/apache/incubator-superset/pull/6956#issuecomment-468051804
 
 
   Great work! I took a closer look at this and have a few suggestions.
   
   Instead of applying the overrides at individual control panel file (, which will be moved into plugins). And also not clear which chart control panels should include a hook. Add a single hook at `explore/controlPanels/index.js` and pass all `controlPanelConfigs` to it. 
   
   Current `index.js`
   
   ```js
   const controlPanelConfigs = {
     area: Area,
     bar: Bar,
     big_number: BigNumber,
     ...
   }
   ```
   
   Modified `index.js`
   
   ```js
   import extraOverrides from './extraOverrides';
   
   const controlPanelConfigs = extraOverrides({
     area: Area,
     bar: Bar,
     big_number: BigNumber,
     ...
   })
   ```
   
   `extraOverride.js`
   
   ```js
   export default function extraOverrides(controlPanelConfigs) {
     return controlPanelConfigs;
   }
   ```
   
   Custom `extraOverride.js` in Airbnb deployment has access to all controlPanelConfigs. If we want to apply overrides to additional charts we can do it here without modifying `incubator-superset`. 
   
   ```js
   export default function extraOverrides(controlPanelConfigs) {
     const newConfigs = {...controlPanelConfigs};
     newConfigs.line = {
       ...newConfigs.line
       controlOverrides: ... // apply override here
     };
     newConfigs.table = {
       ...newConfigs.table
       controlOverrides: ... // apply override here
     };
   
     return newConfigs;
   }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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