Commit a06a0a671e1a88707ef7a79a8f7f08d73575c7bc

Authored by Goutte
1 parent 116197a0

Prepare the time domain for the future download button.

Showing 2 changed files with 17 additions and 1 deletions   Show diff stats
web/static/js/swapp.js
@@ -236,6 +236,12 @@ @@ -236,6 +236,12 @@
236 }); 236 });
237 return this; 237 return this;
238 }; 238 };
  239 + SpaceWeather.prototype.getDomain = function(){
  240 + if (this.current_started_at != null && this.current_stopped_at != null) {
  241 + return [this.current_started_at, this.current_stopped_at];
  242 + }
  243 + return [this.started_at, this.stopped_at];
  244 + };
239 SpaceWeather.prototype.resizeDomain = function(started_at, stopped_at){ 245 SpaceWeather.prototype.resizeDomain = function(started_at, stopped_at){
240 var tmp; 246 var tmp;
241 if (stopped_at < started_at) { 247 if (stopped_at < started_at) {
@@ -247,6 +253,8 @@ @@ -247,6 +253,8 @@
247 console.warn("Please provide distinct start and stop dates."); 253 console.warn("Please provide distinct start and stop dates.");
248 return; 254 return;
249 } 255 }
  256 + this.current_started_at = started_at;
  257 + this.current_stopped_at = stopped_at;
250 if ((this.started_at <= started_at && started_at <= this.stopped_at) && (this.started_at <= stopped_at && stopped_at <= this.stopped_at)) { 258 if ((this.started_at <= started_at && started_at <= this.stopped_at) && (this.started_at <= stopped_at && stopped_at <= this.stopped_at)) {
251 console.info("Resizing the temporal domain from " + started_at + " to " + stopped_at + " without fetching new data…"); 259 console.info("Resizing the temporal domain from " + started_at + " to " + stopped_at + " without fetching new data…");
252 timeSeries.forEach(function(ts){ 260 timeSeries.forEach(function(ts){
web/static/js/swapp.ls
@@ -189,6 +189,11 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE @@ -189,6 +189,11 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE
189 timeSeries.forEach((ts) -> ts.hide() if ts.parameter == parameter_slug) 189 timeSeries.forEach((ts) -> ts.hide() if ts.parameter == parameter_slug)
190 this 190 this
191 191
  192 + getDomain: ->
  193 + if @current_started_at? and @current_stopped_at?
  194 + return [@current_started_at, @current_stopped_at]
  195 + return [@started_at, @stopped_at]
  196 +
192 resizeDomain: (started_at, stopped_at) -> 197 resizeDomain: (started_at, stopped_at) ->
193 if stopped_at < started_at 198 if stopped_at < started_at
194 tmp = started_at 199 tmp = started_at
@@ -199,11 +204,14 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE @@ -199,11 +204,14 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE
199 console.warn "Please provide distinct start and stop dates." 204 console.warn "Please provide distinct start and stop dates."
200 return 205 return
201 206
  207 + @current_started_at = started_at
  208 + @current_stopped_at = stopped_at
  209 +
202 if (@started_at <= started_at <= @stopped_at) and 210 if (@started_at <= started_at <= @stopped_at) and
203 (@started_at <= stopped_at <= @stopped_at) then 211 (@started_at <= stopped_at <= @stopped_at) then
204 console.info "Resizing the temporal domain from #{started_at} to #{stopped_at} without fetching new data…" 212 console.info "Resizing the temporal domain from #{started_at} to #{stopped_at} without fetching new data…"
205 # We first resize the hidden time series and only afterwards we resize 213 # We first resize the hidden time series and only afterwards we resize
206 - # the visible ones, for a smoother transition 214 + # the visible ones, for a smoother transition.
207 timeSeries.forEach((ts) -> if not ts.visible then ts.zoomIn(started_at, stopped_at)) 215 timeSeries.forEach((ts) -> if not ts.visible then ts.zoomIn(started_at, stopped_at))
208 timeSeries.forEach((ts) -> if ts.visible then ts.zoomIn(started_at, stopped_at)) 216 timeSeries.forEach((ts) -> if ts.visible then ts.zoomIn(started_at, stopped_at))
209 @orbits.resizeDomain started_at, stopped_at 217 @orbits.resizeDomain started_at, stopped_at