Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

docs: 'hello world' visualization plugin #216

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

mistercrunch
Copy link
Contributor

@mistercrunch mistercrunch commented Oct 2, 2019

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: apache/superset#8333

Screen Shot 2019-10-01 at 5 19 11 PM

@jitendra-kumawat
Copy link

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

@mistercrunch
Copy link
Contributor Author

@williaster @kristw working on this, I couldn’t get the plugin to call /api/v1/query instead of /superset/explore_json/. Any pointers?

@jackyq2015
Copy link

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

@Smilebags
Copy link

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.

nytai pushed a commit to preset-io/superset-ui-plugins that referenced this pull request Apr 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants