superset-ui-plugins
superset-ui-plugins copied to clipboard
docs: 'hello world' visualization plugin
DRAFT / WIP.
This is WiP towards documenting the process of developing and using plugins.
I'm trying to create simple template for people to follow to create more ambitious visualization plugins. View the related Superset package code to get this plugin integrated: https://github.com/apache/incubator-superset/pull/8333

@mistercrunch i think in this case also we need to follow some guidelines/step to add custom visualisation in superset-ui and then we need to register it in superset Mainpreset.js..
can we design arch like https://www.elastic.co/guide/en/kibana/current/development-plugin-resources.html we just develop plugin outside superset or superset-ui and just install /un-install it on top of superset.
@williaster @kristw working on this, I couldn’t get the plugin to call /api/v1/query
instead of /superset/explore_json/
. Any pointers?
@mistercrunch On current master of supetset, I can point to the URL to /api/v1/query/ by changing exploreUtils.js:
export function getURIDirectory(formData, endpointType = 'base') {
// Building the directory part of the URI
let directory = '/superset/explore/';
if (
['json', 'csv', 'query', 'results', 'samples'].indexOf(endpointType) >= 0
) {
directory = '/api/v1/query/';
}
return directory;
}
But from the flask log shows:
INFO:werkzeug:127.0.0.1 - - [06/Dec/2019 11:39:34] "GET /superset/favstar/slice/82/count/ HTTP/1.1" 200 -
DEBUG:root:[stats_logger] (incr) query
ERROR:root:Input string must be text, not bytes
Traceback (most recent call last):
File "/storj-storage/src/incubator-superset/superset/views/base.py", line 121, in wraps
return f(self, *args, **kwargs)
File "/storj-storage/src/incubator-superset/venv/lib/python3.6/site-packages/flask_appbuilder/security/decorators.py", line168, in wraps
return f(self, *args, **kwargs)
File "/storj-storage/src/incubator-superset/superset/views/api.py", line 44, in query
query_context = QueryContext(**json.loads(request.form.get("query_context")))
File "/storj-storage/src/incubator-superset/venv/lib/python3.6/site-packages/simplejson/__init__.py", line 518, in loads
return _default_decoder.decode(s)
File "/storj-storage/src/incubator-superset/venv/lib/python3.6/site-packages/simplejson/decoder.py", line 370, in decode
obj, end = self.raw_decode(s)
File "/storj-storage/src/incubator-superset/venv/lib/python3.6/site-packages/simplejson/decoder.py", line 392, in raw_decode
raise TypeError("Input string must be text, not bytes")
TypeError: Input string must be text, not bytes
INFO:werkzeug:127.0.0.1 - - [06/Dec/2019 11:39:34] "POST /api/v1/query/?form_data=%7B%22slice_id%22%3A82%7D HTTP/1.1" 500 -
INFO:werkzeug:127.0.0.1 - - [06/Dec/2019 11:39:34] "GET /static/assets/images/favicon.png HTTP/1.1" 200 -
DEBUG:root:[stats_logger] (incr) log
INFO:werkzeug:127.0.0.1 - - [06/Dec/2019 11:39:35] "POST /superset/log/?explode=events&slice_id=82 HTTP/1.1" 200 -
Any idea what that mean? seems the core part is not really ready to the new plugin system or I missed something.
I couldn’t get the plugin to call /api/v1/query instead of /superset/explore_json/. Any pointers?
I'm facing the same issue, unable to use the new API and therefore unable to develop a visualisation without changing core Superset files. From my understanding, this is meant to change based on the 'useLegacyApi' flag when creating a visualisation but it seems to have no impact.