github-wcha opened a new issue #12878: URL: https://github.com/apache/superset/issues/12878
A clear and concise description of what the bug is. I've been working on a custom visualisation, Traffic Lights, where I would be basically able to get a ratio and adjust the colour of the traffic light accordingly. I've tried to use a hello-world guide by [Preset](https://preset.io/blog/2020-07-02-hello-world/), but was getting bunch of errors repeatedly. Then, I've done some research and was advised to copy the folder over to the `superset-frontend/node_modules/@superset-ui/`, but the code still didn't compile. Now, I'm running off my own [npm package](https://www.npmjs.com/package/@ali.bakhodirov/plugin-chart-traffic-lights) that I'm trying to fix. I've tried to use hello-world generated by yeoman: still didn't work. And now I'm trying to use some code from existing superset-ui plugins and it has finally compiled! Yay! But when I apply the "Visualization Type", it throws `Unexpected error 'traffic_lights_total'`. The console output is the following: ``` superset_app | ERROR:superset.views.base:'traffic_lights_total' superset_app | Traceback (most recent call last): superset_app | File "/app/superset/views/base.py", line 181, in wraps superset_app | return f(self, *args, **kwargs) superset_app | File "/app/superset/utils/log.py", line 164, in wrapper superset_app | value = f(*args, **kwargs) superset_app | File "/app/superset/utils/cache.py", line 172, in wrapper superset_app | response = f(*args, **kwargs) superset_app | File "/app/superset/views/utils.py", line 450, in wrapper superset_app | check_perms(*args, **kwargs) superset_app | File "/app/superset/views/utils.py", line 519, in check_datasource_perms superset_app | force=False, superset_app | File "/app/superset/views/utils.py", line 124, in get_viz superset_app | viz_obj = viz.viz_types[viz_type]( superset_app | KeyError: 'traffic_lights_total' ``` ### Expected results I expect to apply the viz type and count the total number of entries in the dataset. ### Actual results I receive the error, `Unexpected error 'traffic_lights_total'`. The console output is the following: ``` superset_app | ERROR:superset.views.base:'traffic_lights_total' superset_app | Traceback (most recent call last): superset_app | File "/app/superset/views/base.py", line 181, in wraps superset_app | return f(self, *args, **kwargs) superset_app | File "/app/superset/utils/log.py", line 164, in wrapper superset_app | value = f(*args, **kwargs) superset_app | File "/app/superset/utils/cache.py", line 172, in wrapper superset_app | response = f(*args, **kwargs) superset_app | File "/app/superset/views/utils.py", line 450, in wrapper superset_app | check_perms(*args, **kwargs) superset_app | File "/app/superset/views/utils.py", line 519, in check_datasource_perms superset_app | force=False, superset_app | File "/app/superset/views/utils.py", line 124, in get_viz superset_app | viz_obj = viz.viz_types[viz_type]( superset_app | KeyError: 'traffic_lights_total' ``` #### Screenshots   #### How to reproduce the bug 1. Once you have superset up and running, edit `superset-frontend/package.json` to include a new dependency: `"@ali.bakhodirov/plugin-chart-traffic-lights": "^0.4.0"`  2. Edit `superset-frontend/src/visualizations/presets/MainPreset.js` to include the following lines: import { TrafficLightsChartPlugin, TrafficLightsTotalChartPlugin } from '@ali.bakhodirov/plugin-chart-traffic-lights'; at line 41 and  ``` new TrafficLightsChartPlugin().configure({ key: 'traffic_lights' }), new TrafficLightsTotalChartPlugin().configure({ key: 'traffic_lights_total' }), ``` at line 109  3. Run `docker-compose up` 4. Edit any chart to be a Traffic Lights viz type. 5. See the error. ### Environment (please complete the following information): - superset version: tried both 0.999.0dev and 1.0.0 - python version: 3.7 - node.js version: v12.18.2 ### Checklist Make sure to follow these steps before submitting your issue - thank you! - [*] I have checked the superset logs for python stacktraces and included it here as text if there are any. - [*] I have reproduced the issue with at least the latest released version of superset. - [*] I have checked the issue tracker for the same issue and I haven't found one similar. ### Additional context Please see the initial description for more contaxt. ---------------------------------------------------------------- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
