Commit 7994cf1a82cc7498f2248ba4b6b4f3baa9a32a7a

Authored by Goutte
1 parent 243cd8a4

Hunt bugs.

Showing 2 changed files with 22 additions and 25 deletions   Show diff stats
web/static/js/swapp.js
... ... @@ -36,18 +36,15 @@
36 36 this.configuration['parameters'].forEach(function(p){
37 37 return this$.parameters[p['id']] = p;
38 38 });
  39 + this.orbiter = null;
39 40 this.timeSeries = [];
40 41 }
41 42 SpaceWeather.prototype.init = function(){
42 43 "This is called by the inline bootstrap javascript code.\nThis ain't in the constructor because it might return a Promise later on.\n(for the loader, for example)";
43 44 var started_at, stopped_at, this$ = this;
44   - this.orbits = new Orbits(this.configuration.orbits_container, this.configuration);
45   - this.started_at = moment().subtract(1, 'years').hours(0).minutes(0).seconds(0);
46   - this.stopped_at = moment().add(7, 'days').hours(0).minutes(0).seconds(0);
47   - started_at = this.started_at.format(API_TIME_FORMAT);
48   - stopped_at = this.stopped_at.format(API_TIME_FORMAT);
49   - console.info("Setting time interval from " + started_at + " to " + stopped_at + "…");
50   - this.setStartAndStop(this.started_at, this.stopped_at);
  45 + started_at = moment().subtract(1, 'years').hours(0).minutes(0).seconds(0);
  46 + stopped_at = moment().add(7, 'days').hours(0).minutes(0).seconds(0);
  47 + this.setStartAndStop(started_at, stopped_at);
51 48 this.loadAndCreatePlots(started_at, stopped_at);
52 49 return window.addEventListener('resize', function(){
53 50 return this$.resize();
... ... @@ -142,6 +139,9 @@
142 139 "started_at: moment(.js) object\nstopped_at: moment(.js) object";
143 140 var active_targets, res$, k, this$ = this;
144 141 this.showLoader();
  142 + this.started_at = started_at;
  143 + this.stopped_at = stopped_at;
  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 147 res$ = [];
... ... @@ -258,11 +258,9 @@
258 258 return [this.started_at, this.stopped_at];
259 259 };
260 260 SpaceWeather.prototype.resizeDomain = function(started_at, stopped_at){
261   - var tmp, formatted_started_at, formatted_stopped_at;
  261 + var ref$, formatted_started_at, formatted_stopped_at;
262 262 if (stopped_at < started_at) {
263   - tmp = started_at;
264   - started_at = stopped_at;
265   - stopped_at = started_at;
  263 + ref$ = [stopped_at, started_at], started_at = ref$[0], stopped_at = ref$[1];
266 264 }
267 265 if (started_at === stopped_at) {
268 266 console.warn("Please provide distinct start and stop dates.");
... ... @@ -301,6 +299,7 @@
301 299 return this;
302 300 };
303 301 SpaceWeather.prototype.setStartAndStop = function(started_at, stopped_at){
  302 + console.info("Setting time interval from " + started_at + " to " + stopped_at + "…");
304 303 this.current_started_at = started_at;
305 304 this.current_stopped_at = stopped_at;
306 305 $("#started_at").val(started_at.format(INPUT_TIME_FORMAT));
... ... @@ -561,6 +560,7 @@
561 560 };
562 561 this.data = {};
563 562 this.orbiters = {};
  563 + this.orbitersElements = {};
564 564 this.extremum = 1;
565 565 this.xScale = d3.scaleLinear().domain([-1 * this.extremum, this.extremum]);
566 566 this.yScale = d3.scaleLinear().domain([-1 * this.extremum, this.extremum]);
... ... @@ -587,7 +587,6 @@
587 587 $(this.svg.node()).hide();
588 588 return this.resize();
589 589 };
590   - Orbits.prototype.orbitersElements = {};
591 590 Orbits.prototype.initOrbiter = function(slug, config, data){
592 591 var orbit_ellipse, orbiter, orbit_line, orbit_section, this$ = this;
593 592 console.info("Initializing orbit of " + config.name + "…");
... ...
web/static/js/swapp.ls
... ... @@ -63,7 +63,8 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE
63 63 @configuration['parameters'].forEach((p) ~>
64 64 @parameters[p['id']] = p
65 65 )
66   - @timeSeries = []
  66 + @orbiter = null # our Orbiter
  67 + @timeSeries = [] # a List of TimeSeries objects
67 68  
68 69 init: ->
69 70 """
... ... @@ -71,15 +72,11 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE
71 72 This ain't in the constructor because it might return a Promise later on.
72 73 (for the loader, for example)
73 74 """
74   - @orbits = new Orbits(@configuration.orbits_container, @configuration)
75 75 # Default time interval is from one year ago to one week ahead.
76 76 # We set the h/m/s to zero to benefit from a daily cache.
77   - @started_at = moment().subtract(1, 'years').hours(0).minutes(0).seconds(0)
78   - @stopped_at = moment().add(7, 'days').hours(0).minutes(0).seconds(0)
79   - started_at = @started_at.format(API_TIME_FORMAT)
80   - stopped_at = @stopped_at.format(API_TIME_FORMAT)
81   - console.info "Setting time interval from #{started_at} to #{stopped_at}…"
82   - @setStartAndStop(@started_at, @stopped_at)
  77 + started_at = moment().subtract(1, 'years').hours(0).minutes(0).seconds(0)
  78 + stopped_at = moment().add(7, 'days').hours(0).minutes(0).seconds(0)
  79 + @setStartAndStop(started_at, stopped_at)
83 80 @loadAndCreatePlots(started_at, stopped_at)
84 81  
85 82 window.addEventListener 'resize', ~> @resize()
... ... @@ -154,6 +151,9 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE
154 151 stopped_at: moment(.js) object
155 152 """
156 153 @showLoader()
  154 + @started_at = started_at
  155 + @stopped_at = stopped_at
  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 159 active_targets = [@targets[k] for k of @targets when @targets[k].active]
... ... @@ -223,10 +223,7 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE
223 223  
224 224 resizeDomain: (started_at, stopped_at) ->
225 225 if stopped_at < started_at
226   - tmp = started_at
227   - started_at = stopped_at
228   - stopped_at = started_at
229   -
  226 + [started_at, stopped_at] = [stopped_at, started_at]
230 227 if started_at == stopped_at
231 228 console.warn "Please provide distinct start and stop dates."
232 229 return
... ... @@ -259,6 +256,7 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE
259 256 this
260 257  
261 258 setStartAndStop: (started_at, stopped_at) ->
  259 + console.info "Setting time interval from #{started_at} to #{stopped_at}…"
262 260 @current_started_at = started_at
263 261 @current_stopped_at = stopped_at
264 262 $("\#started_at").val(started_at.format(INPUT_TIME_FORMAT))
... ... @@ -574,6 +572,7 @@ export class Orbits
574 572  
575 573 @data = {} # slug => HCI array
576 574 @orbiters = {} # slug => config
  575 + @orbitersElements = {}
577 576 @extremum = 1
578 577 @xScale = d3.scaleLinear().domain([-1 * @extremum, @extremum])
579 578 @yScale = d3.scaleLinear().domain([-1 * @extremum, @extremum])
... ... @@ -613,7 +612,6 @@ export class Orbits
613 612 $(@svg.node()).hide(); # we'll show it later when there'll be data
614 613 @resize()
615 614  
616   - orbitersElements: {}
617 615 initOrbiter: (slug, config, data) ->
618 616 console.info "Initializing orbit of #{config.name}…"
619 617 if slug of @orbitersElements then throw new Error("Second init of #{slug}")
... ...