Commit 7d6dee0f953b9793214603951df654844df2348c

Authored by Goutte
1 parent 961953c4

Continue refacto for multiple targets.

config.yml
... ... @@ -61,7 +61,7 @@ amda: "http://cdpp.irap.omp.eu/BASE/DDService/getDataUrl.php?dataSet={dataSet}&S
61 61 # `title` appears on mouse hover
62 62 # `locked` is for sources that are "coming soon"
63 63 # `default` sources are shown to incoming visitors, others need user activation
64   -sources:
  64 +targets:
65 65 - type: 'planet'
66 66 slug: 'mercury'
67 67 name: 'Mercury'
... ... @@ -101,7 +101,7 @@ sources:
101 101 - slug: 'tao_mars_sw'
102 102 started_at: "1990-01-01T01:30:00"
103 103 stopped_at: "2017-02-19T00:00:00"
104   - locked: true
  104 + locked: false
105 105 default: true
106 106 - type: 'planet'
107 107 slug: 'jupiter'
... ... @@ -167,9 +167,9 @@ sources:
167 167 #Jupiter tao_jup_sw 1990-01-01T01:00 2017-02-19T00:00
168 168 #Saturn tao_sat_sw 1990-01-01T01:30 2017-02-19T00:00
169 169  
170   -models:
171   - jupiter:
172   - name: Jupiter
173   - model: tao_jup_sw
174   - started_at: "1990-01-01T01:30:00"
175   - stopped_at: "2017-02-19T00:00:00"
  170 +#models:
  171 +# jupiter:
  172 +# name: Jupiter
  173 +# model: tao_jup_sw
  174 +# started_at: "1990-01-01T01:30:00"
  175 +# stopped_at: "2017-02-19T00:00:00"
... ...
web/run.py
... ... @@ -156,7 +156,7 @@ def datetime_from_list(time_list):
156 156  
157 157  
158 158 def get_source_config(slug):
159   - for s in config['sources']:
  159 + for s in config['targets']:
160 160 if s['slug'] == slug:
161 161 return s
162 162 raise Exception("No source found for slug '%s'." % slug)
... ... @@ -224,10 +224,10 @@ def favicon():
224 224 @app.route("/index.html")
225 225 def home():
226 226 return render_view('home.html.jinja2', {
227   - 'sources': config['sources'],
228   - 'planets': [s for s in config['sources'] if s['type'] == 'planet'],
229   - 'probes': [s for s in config['sources'] if s['type'] == 'probe'],
230   - 'comets': [s for s in config['sources'] if s['type'] == 'comet'],
  227 + 'targets': config['targets'],
  228 + 'planets': [s for s in config['targets'] if s['type'] == 'planet'],
  229 + 'probes': [s for s in config['targets'] if s['type'] == 'probe'],
  230 + 'comets': [s for s in config['targets'] if s['type'] == 'comet'],
231 231 })
232 232  
233 233  
... ...
web/static/js/swapp.js
... ... @@ -4,7 +4,7 @@
4 4 GOLDEN_RATIO = 2 / (1 + Math.sqrt(5));
5 5 out$.SpaceWeather = SpaceWeather = (function(){
6 6 SpaceWeather.displayName = 'SpaceWeather';
7   - var prototype = SpaceWeather.prototype, constructor = SpaceWeather;
  7 + var timeSeries, prototype = SpaceWeather.prototype, constructor = SpaceWeather;
8 8 function SpaceWeather(configuration){
9 9 var configs, res$, k, this$ = this;
10 10 this.configuration = configuration;
... ... @@ -108,9 +108,9 @@
108 108 });
109 109 return promise;
110 110 };
  111 + timeSeries = [];
111 112 SpaceWeather.prototype.createTimeSeries = function(source, data){
112   - var timeSeries, this$ = this;
113   - timeSeries = [];
  113 + var this$ = this;
114 114 this.configuration['parameters'].forEach(function(parameter){
115 115 var container, id, title;
116 116 container = this.configuration['time_series_container'];
... ...
web/static/js/swapp.ls
... ... @@ -78,8 +78,8 @@ export class SpaceWeather
78 78 )
79 79 promise
80 80  
  81 + timeSeries = []
81 82 createTimeSeries: (source, data) ->
82   - timeSeries = []
83 83 @configuration['parameters'].forEach((parameter) ->
84 84 container = @configuration['time_series_container']
85 85 id = parameter['id'] ; title = parameter['title']
... ...
web/view/home.html.jinja2
... ... @@ -68,11 +68,10 @@
68 68 {# <div class="loader"><div class="hole"></div></div>#}
69 69 </main>
70 70 </div>
71   -
72   -
73 71 {% endblock %}
74 72  
75 73  
  74 +
76 75 {% block styles %}
77 76 <style>
78 77 html, body {
... ... @@ -149,6 +148,7 @@
149 148 {% endblock %}
150 149  
151 150  
  151 +
152 152 {% block scripts_footer %}
153 153 <script type="application/javascript" src="{{ static('js/vendor/d3.min.js') }}"></script>
154 154 <script type="application/javascript" src="{{ static('js/swapp.js') }}"></script>
... ... @@ -173,6 +173,15 @@ var configuration = {
173 173 maxDate: '2017-02-19T00:00:00',
174 174 orbit: { a: 5.45516759, b: 4.95155843 },
175 175 img: '{{ static('img/target/jupiter_128.png') }}'
  176 + },
  177 + mars: {
  178 + slug: 'mars',
  179 + name: 'Mars',
  180 + active: true,
  181 + minDate: '1990-01-01T01:30:00',
  182 + maxDate: '2017-02-19T00:00:00',
  183 + orbit: { a: 5.25516759, b: 4.85155843 },
  184 + img: '{{ static('img/target/mars_128.png') }}'
176 185 }
177 186 },
178 187 {# todo @Nicolas Define -somehow- error margins of each parameter #}
... ... @@ -227,5 +236,4 @@ jQuery().ready(function($){
227 236 window.addEventListener('resize', function() { sw.resize(); });
228 237 });
229 238 </script>
230   -
231 239 {% endblock %}
... ...