-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Visualizations refactor #100
Conversation
Re 2 and 3, I'd think of it from a convention over configuration angle, where we have a folder with visualization packages, each in its own folder and exposes enough meta data to be properly integrated. When re:dash loads, it will enumerate this folder and allow access to the different visualizations. In such a model, you would init and render visualizations lazily and on-demand rather than include all when re:dash web page loads. wdyt? |
It will require some effort in "orchestrating" this, but it's possible:
This doesn't solve #2 though, but I will RTFM to see if there is some easy solution around it. Also there is the question of how to handle external dependencies visualizations might have, but for now I would "skip" this and address when needed. |
|
||
this.visualizations[type] = visualization; | ||
|
||
if (!skipTypes) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arikfr when would we like to skip types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case of table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why? isn't that a valid vis. type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's created by default, so we don't need it in the menu.
The main code doesn't know about individual visualizations and each visualization is contained in its own module. Should make adding/editing/removing visualizations easier.
this.visualizations = {}; | ||
this.visualizationTypes = {}; | ||
|
||
this.registerVisualization = function(type, name, rendererTemplate, editorTemplate, defaultOptions, skipTypes) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arikfr how about using a config object here?
this.registerVisualization = function(config) {
var visualization = {
rendererTemplate: config.rendererTemplate,
editorTemplate: config.editorTemplate,
type: config.type,
name: config.name,
defaultOptions: config.defaultOptions || {}
};
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to merge 👍 |
…ion_options Visualizations refactor
I've separated each visualization declaration into its own module, so each visualization defines how to render it and what options it needs. The base visualization render/edit directives are not aware of the visualization types that are available.
Adding a new visualization requires:
redash.app
module dependencies.index.html
.I would love if it could be a single step, but not sure how to make #2 and #3 automatic (specially #3).
Would love to get comments and ideas.