Commit 5e099488f194e50c53ae7fcce0bd9a9bbf3d4ede

Authored by Goutte
1 parent 1754789b

Fix that loading a new interval does not load de-activated targets' data.

Showing 2 changed files with 15 additions and 12 deletions   Show diff stats
web/static/js/swapp.js
... ... @@ -137,21 +137,20 @@
137 137 };
138 138 SpaceWeather.prototype.loadAndCreatePlots = function(started_at, stopped_at){
139 139 "started_at: moment(.js) object\nstopped_at: moment(.js) object";
140   - var active_targets, res$, k, this$ = this;
  140 + var k, this$ = this;
141 141 this.showLoader();
142 142 this.started_at = started_at;
143 143 this.stopped_at = stopped_at;
144 144 this.orbits = new Orbits(this.configuration.orbits_container, this.configuration);
145 145 started_at = started_at.format(API_TIME_FORMAT);
146 146 stopped_at = stopped_at.format(API_TIME_FORMAT);
147   - res$ = [];
148   - for (k in this.targets) {
149   - if (this.targets[k].active) {
150   - res$.push(this.targets[k]);
  147 + return (function(){
  148 + var results$ = [];
  149 + for (k in this.targets) {
  150 + results$.push(this.targets[k]);
151 151 }
152   - }
153   - active_targets = res$;
154   - return active_targets.forEach(function(target){
  152 + return results$;
  153 + }.call(this)).forEach(function(target){
155 154 var targetButton;
156 155 console.info("Loading CSV data of " + target.name + "…");
157 156 targetButton = $(".targets-filters .target." + target.slug);
... ... @@ -161,7 +160,11 @@
161 160 this$.createTimeSeries(target, data);
162 161 this$.orbits.initOrbiter(target.slug, target.config, data['hci']);
163 162 targetButton.removeClass('loading');
164   - return this$.hideLoader();
  163 + if (target.active) {
  164 + return this$.hideLoader();
  165 + } else {
  166 + return this$.disableTarget(target.slug);
  167 + }
165 168 }, function(error){
166 169 return console.error("Failed loading CSV data of " + target.name + ".", error);
167 170 });
... ...
web/static/js/swapp.ls
... ... @@ -156,8 +156,8 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE
156 156 @orbits = new Orbits(@configuration.orbits_container, @configuration)
157 157 started_at = started_at.format(API_TIME_FORMAT)
158 158 stopped_at = stopped_at.format(API_TIME_FORMAT)
159   - active_targets = [@targets[k] for k of @targets when @targets[k].active]
160   - active_targets.forEach((target) ~>
  159 + # active_targets = [@targets[k] for k of @targets when @targets[k].active]
  160 + [@targets[k] for k of @targets].forEach((target) ~>
161 161 console.info "Loading CSV data of #{target.name}…"
162 162 targetButton = $(".targets-filters .target.#{target.slug}")
163 163 targetButton.addClass('loading')
... ... @@ -167,7 +167,7 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE
167 167 @createTimeSeries(target, data)
168 168 @orbits.initOrbiter(target.slug, target.config, data['hci'])
169 169 targetButton.removeClass('loading')
170   - @hideLoader()
  170 + if target.active then @hideLoader() else @disableTarget(target.slug)
171 171 ,
172 172 (error) -> console.error("Failed loading CSV data of #{target.name}.", error)
173 173 )
... ...