commit/galaxy-central: guerler: Charts: Add progress notification
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/0fc231c66f8d/ Changeset: 0fc231c66f8d User: guerler Date: 2014-06-11 12:59:41 Summary: Charts: Add progress notification Affected #: 5 files diff -r b62ff72c0d872fd03ed20ffd782a974f7bc0205d -r 0fc231c66f8de637ed9559a7f2d116870edb8dba config/plugins/visualizations/charts/static/app.css --- a/config/plugins/visualizations/charts/static/app.css +++ b/config/plugins/visualizations/charts/static/app.css @@ -48,6 +48,7 @@ margin-left: 5px; top: -1px; font-size: 1.0em; + display: inline-block; } .charts-viewport .icon { diff -r b62ff72c0d872fd03ed20ffd782a974f7bc0205d -r 0fc231c66f8de637ed9559a7f2d116870edb8dba config/plugins/visualizations/charts/static/charts/tools.js --- a/config/plugins/visualizations/charts/static/charts/tools.js +++ b/config/plugins/visualizations/charts/static/charts/tools.js @@ -4,6 +4,9 @@ // render function panelHelper (options) { + // link this + var self = this; + // require parameters var process_id = options.process_id; var chart = options.chart; @@ -15,9 +18,8 @@ // get request size from chart request_dictionary.query_limit = chart.definition.query_limit; - // request data - var self = this; - app.datasets.request(request_dictionary, function() { + // define success function + request_dictionary.success = function() { try { // check if this chart has multiple panels if (!chart.definition.use_panels && chart.settings.get('use_panels') !== 'true') { @@ -52,7 +54,15 @@ // unregister process chart.deferred.done(process_id); } - }); + }; + + // add progress + request_dictionary.progress = function(percentage) { + chart.state('wait', 'Loading data...' + percentage + '%'); + }; + + // request data + app.datasets.request(request_dictionary); }; // get domain boundaries value diff -r b62ff72c0d872fd03ed20ffd782a974f7bc0205d -r 0fc231c66f8de637ed9559a7f2d116870edb8dba config/plugins/visualizations/charts/static/library/datasets.js --- a/config/plugins/visualizations/charts/static/library/datasets.js +++ b/config/plugins/visualizations/charts/static/library/datasets.js @@ -21,18 +21,23 @@ }, // request handler - request: function(request_dictionary, success, error) { + request: function(request_dictionary) { if (request_dictionary.groups) { - this._get_blocks(request_dictionary, success, error); + this._get_blocks(request_dictionary); } else { - this._get_dataset(request_dictionary.id, success, error) + this._get_dataset(request_dictionary.id, request_dictionary.success, request_dictionary.error) } }, // multiple request handler - _get_blocks: function(request_dictionary, success, error) { + _get_blocks: function(request_dictionary) { + // get callbacks + var success = request_dictionary.success; + var progress = request_dictionary.progress; + // query block size - var query_size = this.app.config.get('query_limit'); + var query_size = this.app.config.get('query_limit'); + var query_timeout = this.app.config.get('query_timeout'); // set range var query_start = request_dictionary.start || 0; @@ -51,9 +56,12 @@ // get query dictionary template var query_dictionary_template = $.extend(true, {}, request_dictionary); + // reset query counter + var query_counter = 0; + // fetch blocks var self = this; - function fetch_blocks (query, success, error) { + function fetch_blocks (query) { self._get(query, function() { // copy values from query into request_dictionary var done = false; @@ -78,10 +86,16 @@ } // check if for remaining queries - if (--query_number > 0 && !done) { + if (++query_counter < query_number && !done) { + // report progress + if (progress) { + progress(parseInt((query_counter / query_number) * 100)); + } + + // next query var start = query.start + query_size; query = $.extend(true, query_dictionary_template, {start: start}); - fetch_blocks(query, success, error); + fetch_blocks(query); } else { success(); } @@ -94,7 +108,7 @@ // get dataset meta data this._get_dataset(request_dictionary.id, function() { - fetch_blocks(query, success, error); + fetch_blocks(query); }); }, @@ -197,12 +211,12 @@ // convert _fill_from_cache: function(request_dictionary) { - // log - console.debug('Datasets::_fill_from_cache() - Filling request from cache.'); - // identify start of request var start = request_dictionary.start; + // log + console.debug('Datasets::_fill_from_cache() - Filling request from cache at ' + start + '.'); + // identify end of request var limit = 0; for (var i in request_dictionary.groups) { diff -r b62ff72c0d872fd03ed20ffd782a974f7bc0205d -r 0fc231c66f8de637ed9559a7f2d116870edb8dba config/plugins/visualizations/charts/static/views/group.js --- a/config/plugins/visualizations/charts/static/views/group.js +++ b/config/plugins/visualizations/charts/static/views/group.js @@ -110,19 +110,25 @@ // register process var process_id = this.chart.deferred.register(); + // request dictionary + var request_dictionary = { + id : dataset_id, + success : function(dataset) { + // update select fields + for (var id in select_list) { + self._addRow(id, dataset, select_list, chart_definition.columns[id]) + } + + // loading + self.chart.state('ok', 'Metadata initialized...'); + + // unregister + self.chart.deferred.done(process_id); + } + }; + // get dataset - this.app.datasets.request({id : dataset_id}, function(dataset) { - // update select fields - for (var id in select_list) { - self._addRow(id, dataset, select_list, chart_definition.columns[id]) - } - - // loading - self.chart.state('ok', 'Metadata initialized...'); - - // unregister - self.chart.deferred.done(process_id); - }); + this.app.datasets.request(request_dictionary); }, // add row diff -r b62ff72c0d872fd03ed20ffd782a974f7bc0205d -r 0fc231c66f8de637ed9559a7f2d116870edb8dba 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 @@ -50,7 +50,7 @@ // show info $info.show(); $info.find('#text').html(self.chart.get('state_info')); - + // check status var state = self.chart.get('state'); switch (state) { @@ -274,7 +274,7 @@ _template: function() { return '<div class="charts-viewport">' + '<div id="info" class="info">' + - '<span id="icon" class="icon" />' + + '<span id="icon" class="icon"/>' + '<span id="text" class="text" />' + '</div>' + '</div>'; 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