Skip to content

Commit

Permalink
Use plugin object instead of chart definition
Browse files Browse the repository at this point in the history
Use plugin instead of definition
  • Loading branch information
guerler committed Feb 11, 2018
1 parent 664bf8b commit 1eccb2a
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ var View = Backbone.View.extend({
.done(dataset => {
this.dataset = dataset;
this.chart = new Chart({}, options);
window.console.log(options);
this.chart.definition = options.visualization_plugin;
this.plugin = options.visualization_plugin;
this.chart.plugin = options.visualization_plugin;
this.deferred = new Deferred();
this.viewer = new Viewer(this);
this.editor = new Editor(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import Utils from "utils/utils";
export default Backbone.View.extend({
initialize: function(app) {
this.plugin = app.plugin;
this.plugin = app.chart.plugin;
this.setElement(this._template());
this.$title = this.$(".charts-description-title");
this.$image = this.$(".charts-description-image");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ export default Backbone.View.extend({
return;
}
var valid = true;
var chart_def = this.chart.definition;
this.chart.groups.each(function(group) {
if (valid) {
_.each(group.get("__data_columns"), function(data_columns, name) {
Expand Down
11 changes: 5 additions & 6 deletions client/galaxy/scripts/mvc/visualization/chart/views/groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,22 @@ import Description from "mvc/visualization/chart/views/description";
var GroupView = Backbone.View.extend({
initialize: function(app, options) {
var self = this;
this.app = app;
this.deferred = app.deferred;
this.chart = app.chart;
this.group = options.group;
this.setElement($("<div/>"));
this.listenTo(this.chart, "change:dataset_id change:type", function() {
this.listenTo(this.chart, "change:dataset_id", function() {
self.render();
});
this.render();
},
render: function() {
var self = this;
var inputs = this.chart.definition.groups ? Utils.clone(this.chart.definition.groups) : {};
var inputs = Utils.clone(this.chart.plugin.groups) || {};
var dataset_id = this.chart.get("dataset_id");
var chart_definition = this.chart.definition;
if (dataset_id) {
this.chart.state("wait", "Loading metadata...");
this.app.deferred.execute(function(process) {
this.deferred.execute(function(process) {
Utils.get({
url: Galaxy.root + "api/datasets/" + dataset_id,
cache: true,
Expand Down Expand Up @@ -123,7 +122,7 @@ export default Backbone.View.extend({
});
},
render: function() {
if (_.size(this.chart.definition.groups) > 0) {
if (_.size(this.chart.plugin.groups) > 0) {
this.repeat.$el.show();
this.message.$el.hide();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export default Backbone.View.extend({
},
render: function() {
var self = this;
var inputs = Utils.clone(this.chart.definition.settings) || {};
var panel_option = this.chart.definition.use_panels;
var inputs = Utils.clone(this.chart.plugin.settings) || {};
var panel_option = this.chart.plugin.use_panels;
if (panel_option == "both") {
inputs["__use_panels"] = {
type: "boolean",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export default Backbone.View.extend({
render: function() {
var title = this.chart.get("title");
this.portlet.title(title);
var exports = (this.chart.definition && this.chart.definition.exports) || [];
var exports = (this.chart.plugin && this.chart.plugin.exports) || [];
this.export_button.collection.each(function(model) {
model.set("visible", exports.indexOf(model.get("key")) !== -1);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export default Backbone.View.extend({
_draw: function(process, chart) {
var self = this;
var n_panels = chart.settings.get("__use_panels") == "true" ? chart.groups.length : 1;
this._createContainer(chart.definition.tag, n_panels);
this._createContainer(chart.plugin.tag, n_panels);
chart.state("wait", "Please wait...");
/*require(["repository/build/" + chart.get("type")], function(ChartView) {
new ChartView({ process: process, chart: chart, dataset: self.app.dataset, targets: self.targets });
Expand Down

0 comments on commit 1eccb2a

Please sign in to comment.