From 5e099488f194e50c53ae7fcce0bd9a9bbf3d4ede Mon Sep 17 00:00:00 2001 From: Goutte Date: Mon, 17 Jul 2017 09:51:58 +0200 Subject: [PATCH] Fix that loading a new interval does not load de-activated targets' data. --- web/static/js/swapp.js | 21 ++++++++++++--------- web/static/js/swapp.ls | 6 +++--- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/web/static/js/swapp.js b/web/static/js/swapp.js index 5afde1a..86a2daa 100644 --- a/web/static/js/swapp.js +++ b/web/static/js/swapp.js @@ -137,21 +137,20 @@ }; SpaceWeather.prototype.loadAndCreatePlots = function(started_at, stopped_at){ "started_at: moment(.js) object\nstopped_at: moment(.js) object"; - var active_targets, res$, k, this$ = this; + var k, this$ = this; this.showLoader(); this.started_at = started_at; this.stopped_at = stopped_at; this.orbits = new Orbits(this.configuration.orbits_container, this.configuration); started_at = started_at.format(API_TIME_FORMAT); stopped_at = stopped_at.format(API_TIME_FORMAT); - res$ = []; - for (k in this.targets) { - if (this.targets[k].active) { - res$.push(this.targets[k]); + return (function(){ + var results$ = []; + for (k in this.targets) { + results$.push(this.targets[k]); } - } - active_targets = res$; - return active_targets.forEach(function(target){ + return results$; + }.call(this)).forEach(function(target){ var targetButton; console.info("Loading CSV data of " + target.name + "…"); targetButton = $(".targets-filters .target." + target.slug); @@ -161,7 +160,11 @@ this$.createTimeSeries(target, data); this$.orbits.initOrbiter(target.slug, target.config, data['hci']); targetButton.removeClass('loading'); - return this$.hideLoader(); + if (target.active) { + return this$.hideLoader(); + } else { + return this$.disableTarget(target.slug); + } }, function(error){ return console.error("Failed loading CSV data of " + target.name + ".", error); }); diff --git a/web/static/js/swapp.ls b/web/static/js/swapp.ls index 8b27397..a983d2e 100644 --- a/web/static/js/swapp.ls +++ b/web/static/js/swapp.ls @@ -156,8 +156,8 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE @orbits = new Orbits(@configuration.orbits_container, @configuration) started_at = started_at.format(API_TIME_FORMAT) stopped_at = stopped_at.format(API_TIME_FORMAT) - active_targets = [@targets[k] for k of @targets when @targets[k].active] - active_targets.forEach((target) ~> + # active_targets = [@targets[k] for k of @targets when @targets[k].active] + [@targets[k] for k of @targets].forEach((target) ~> console.info "Loading CSV data of #{target.name}…" targetButton = $(".targets-filters .target.#{target.slug}") targetButton.addClass('loading') @@ -167,7 +167,7 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE @createTimeSeries(target, data) @orbits.initOrbiter(target.slug, target.config, data['hci']) targetButton.removeClass('loading') - @hideLoader() + if target.active then @hideLoader() else @disableTarget(target.slug) , (error) -> console.error("Failed loading CSV data of #{target.name}.", error) ) -- libgit2 0.21.2