commit/galaxy-central: guerler: Charts: Improve notifications and error handling
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/0cb88fa06c32/ Changeset: 0cb88fa06c32 User: guerler Date: 2014-06-04 09:54:54 Summary: Charts: Improve notifications and error handling Affected #: 4 files diff -r 9c1a51c9f85f52d4570dede166155700130d8234 -r 0cb88fa06c32e13c8881ed90af02b239aa574313 config/plugins/visualizations/charts/static/charts/highcharts/common/wrapper.js --- a/config/plugins/visualizations/charts/static/charts/highcharts/common/wrapper.js +++ b/config/plugins/visualizations/charts/static/charts/highcharts/common/wrapper.js @@ -30,22 +30,28 @@ this.app.datasets.request(request_dictionary, function() { if (self.options.canvas.length == 1) { // groups - self._drawGroups(hc_type, chart, request_dictionary.groups, self.options.canvas[0]); - - // set chart state - chart.state('ok', 'Chart drawn.'); + if (self._drawGroups(hc_type, chart, request_dictionary.groups, self.options.canvas[0])) { + // set chart state + chart.state('ok', 'Chart drawn.'); + } } else { // loop through data groups + var valid = true; for (var group_index in request_dictionary.groups) { // get group var group = request_dictionary.groups[group_index]; // draw group - self._drawGroups(hc_type, chart, [group], self.options.canvas[group_index]); + if (!self._drawGroups(hc_type, chart, [group], self.options.canvas[group_index])) { + valid = false; + break; + } } // set chart state - chart.state('ok', 'Multi-panel chart drawn.'); + if (valid) { + chart.state('ok', 'Multi-panel chart drawn.'); + } } // unregister process @@ -90,7 +96,19 @@ } // draw plot - canvas.highcharts(this.hc_config); + try { + canvas.highcharts(this.hc_config); + return true; + } catch (err) { + var regex = /\www\.highcharts\.com([^&]+)/; + var match = err.match(regex); + if (match.length > 0) { + chart.state('failed', 'Highcharts error: <a target="_blank" href="http://' + match[0] + '">' + match[0] + '</a>'); + } else { + chart.state('failed', err); + } + return false; + } } }); diff -r 9c1a51c9f85f52d4570dede166155700130d8234 -r 0cb88fa06c32e13c8881ed90af02b239aa574313 config/plugins/visualizations/charts/static/views/editor.js --- a/config/plugins/visualizations/charts/static/views/editor.js +++ b/config/plugins/visualizations/charts/static/views/editor.js @@ -28,6 +28,9 @@ // configure options this.options = Utils.merge(options, this.optionsDefault); + // message element + this.message = new Ui.Message(); + // create portlet this.portlet = new Portlet.View({ icon : 'fa-bar-chart-o', @@ -38,10 +41,6 @@ tooltip : 'Draw Chart', title : 'Draw', onclick : function() { - // show viewport - self.app.go('viewer'); - - // save chart self._saveChart(); } }), @@ -75,10 +74,6 @@ self.chart.set('modified', true); }, ondblclick : function(chart_id) { - // show viewport - self.app.go('viewer'); - - // save chart self._saveChart(); } }); @@ -135,6 +130,7 @@ }); // append tabs + this.portlet.append(this.message.$el); this.portlet.append(this.tabs.$el); // elements @@ -266,6 +262,35 @@ // create chart _saveChart: function() { + // ensure that data group is available + if (this.chart.groups.length == 0) { + var group = this._addGroupModel(); + this.tabs.show(group.id); + return; + } + + // very selected group columns + var self = this; + var valid = true; + this.chart.groups.each(function(group) { + for (var key in group.attributes) { + if (group.attributes[key] == 'null') { + self.message.update({status: 'danger', message: 'This chart type requires column types not found in your tabular file.'}); + self.tabs.show(group.id); + valid = false; + return; + } + } + }); + + // validate if columns have been selected + if (!valid) { + return; + } + + // show viewport + this.app.go('viewer'); + // update chart data this.chart.set({ type : this.types.value(), @@ -273,11 +298,6 @@ date : Utils.time() }); - // ensure that data group is available - if (this.chart.groups.length == 0) { - this._addGroupModel(); - } - // wait until chart is ready var self = this; this.chart.deferred.execute(function() { diff -r 9c1a51c9f85f52d4570dede166155700130d8234 -r 0cb88fa06c32e13c8881ed90af02b239aa574313 config/plugins/visualizations/charts/static/views/viewer.js --- a/config/plugins/visualizations/charts/static/views/viewer.js +++ b/config/plugins/visualizations/charts/static/views/viewer.js @@ -21,6 +21,9 @@ // link this var self = this; + // message element + this.message = new Ui.Message(); + // create portlet this.portlet = new Portlet.View({ icon : 'fa-bar-chart-o', @@ -53,6 +56,7 @@ }); // append portlet + this.portlet.append(this.message.$el); this.portlet.append(this.viewport_view.$el); // set element @@ -91,22 +95,7 @@ if (chart.deferred.ready()) { callback(); } else { - // show modal - var self = this; - this.app.modal.show({ - title : 'Please wait!', - body : 'Your chart is currently being processed. Please wait and try again.', - buttons : { - 'Close' : function() {self.app.modal.hide();}, - 'Retry' : function() { - // hide modal - self.app.modal.hide(); - - // retry - setTimeout(function() { self._wait(chart, callback); }, self.app.config.get('query_timeout')); - } - } - }); + this.message.update({message: 'Your chart is currently being processed. Please wait and try again.'}); } } }); diff -r 9c1a51c9f85f52d4570dede166155700130d8234 -r 0cb88fa06c32e13c8881ed90af02b239aa574313 config/plugins/visualizations/charts/static/views/viewport.js --- a/config/plugins/visualizations/charts/static/views/viewport.js +++ b/config/plugins/visualizations/charts/static/views/viewport.js @@ -39,7 +39,7 @@ this.chart.on('set:state', function() { // get info element var $info = self.$el.find('#info'); - var $container = self.$el.find('container'); + var $container = self.$el.find('.charts-viewport-container'); // get icon var $icon = $info.find('#icon'); @@ -51,21 +51,20 @@ $info.show(); $info.find('#text').html(self.chart.get('state_info')); - // hide containers - $container.hide(); - // check status var state = self.chart.get('state'); switch (state) { case 'ok': $info.hide(); - $container.show() + $container.show(); break; case 'failed': $icon.addClass('icon fa fa-warning'); + $container.hide(); break; default: $icon.addClass('icon fa fa-spinner fa-spin'); + $container.show(); } }); }, @@ -182,7 +181,6 @@ } ); } else { - // load data into view view.draw(process_id, chart, self._defaultRequestDictionary(chart)); } }); Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org