Commit 3a42858d858732b2e2c601cc9d8c514fa7cd6aa0
1 parent
0f872815
Exists in
master
and in
111 other branches
Update the number of results when the epn-tap window is loaded (All dataproductType)
Showing
2 changed files
with
32 additions
and
24 deletions
Show diff stats
js/app/controllers/EpnTapModule.js
... | ... | @@ -96,6 +96,7 @@ Ext.define('amdaDesktop.EpnTapModule', { |
96 | 96 | - `target`: an array of 3 values: [dataproduct_type, target_class, target_name]; or null. |
97 | 97 | */ |
98 | 98 | initWindow: function(target) { |
99 | + Ext.data.StoreManager.lookup('servicesStore').on('add', function() { this.updateNbResults(); }, this); | |
99 | 100 | Ext.data.StoreManager.lookup('servicesStore').load(); |
100 | 101 | Ext.data.StoreManager.lookup('metadataStore').load(); |
101 | 102 | |
... | ... | @@ -154,8 +155,6 @@ Ext.define('amdaDesktop.EpnTapModule', { |
154 | 155 | this.targetNameCB.select('all'); |
155 | 156 | this.targetNameCB.disable(); |
156 | 157 | } |
157 | - | |
158 | - this.updateNbResults(); | |
159 | 158 | }, |
160 | 159 | |
161 | 160 | /** |
... | ... | @@ -335,6 +334,7 @@ Ext.define('amdaDesktop.EpnTapModule', { |
335 | 334 | this.select = Array(); |
336 | 335 | |
337 | 336 | var selectedService = Ext.data.StoreManager.lookup('servicesStore').findRecord('id', selectedServiceId).data; |
337 | + console.log(selectedService); | |
338 | 338 | if (selectedService == null) { |
339 | 339 | throw this.selectedServiceId + ' not found in the list of services.'; |
340 | 340 | return; |
... | ... | @@ -373,38 +373,44 @@ Ext.define('amdaDesktop.EpnTapModule', { |
373 | 373 | /** |
374 | 374 | Update the nb_result field of the services store (see `EpnTapUI.servicesStore`), according to the field values in `serviceFilterPanel`. |
375 | 375 | */ |
376 | - updateNbResults: function(ui) { | |
377 | - if(this.productTypeCB.value === 'all' && !this.launchedFromTree ) { | |
376 | + updateNbResults: function() { | |
377 | + var productType = Ext.getCmp('epnTapProductTypeCB').value; | |
378 | + var targetClass = Ext.getCmp('epnTapTargetClassCB').value; | |
379 | + var targetName = Ext.getCmp('epnTapTargetNameCB').value; | |
380 | + var metadataStore = Ext.data.StoreManager.lookup('metadataStore'); | |
381 | + var servicesStore = Ext.data.StoreManager.lookup('servicesStore'); | |
382 | + var timeSelector = Ext.getCmp('epnTapTimeSelector'); | |
383 | + | |
384 | + if(productType === 'all' && !this.launchedFromTree ) { | |
378 | 385 | var filter = []; |
379 | - } else if(this.targetClassCB.value === 'all') { | |
386 | + } else if(targetClass === 'all') { | |
380 | 387 | var filter = [ |
381 | - {property: "dataproduct_type", value: this.productTypeCB.value} | |
388 | + {property: "dataproduct_type", value: productType} | |
382 | 389 | ]; |
383 | - } else if(this.targetNameCB.value === 'all') { | |
390 | + } else if(targetName === 'all') { | |
384 | 391 | var filter = [ |
385 | - {property: "dataproduct_type", value: this.productTypeCB.value}, | |
386 | - {property: "target_class", value: this.targetClassCB.value} | |
392 | + {property: "dataproduct_type", value: productType}, | |
393 | + {property: "target_class", value: targetClass} | |
387 | 394 | ]; |
388 | 395 | } else { |
389 | 396 | var filter = [ |
390 | - {property: "dataproduct_type", value: this.productTypeCB.value}, | |
391 | - {property: "target_class", value: this.targetClassCB.value}, | |
392 | - {property: "target_name", value: this.targetNameCB.value} | |
397 | + {property: "dataproduct_type", value: productType}, | |
398 | + {property: "target_class", value: targetClass}, | |
399 | + {property: "target_name", value: targetName} | |
393 | 400 | ]; |
394 | 401 | } |
395 | - var metadataStore = Ext.data.StoreManager.lookup('metadataStore'); | |
396 | 402 | |
397 | - Ext.data.StoreManager.lookup('servicesStore').each(function(record, idx) { | |
403 | + servicesStore.each(function(record, idx) { | |
398 | 404 | metadataStore.filter(filter.concat({property: 'service_id', value: record.get('id')})); |
399 | 405 | record.set('nb_results', metadataStore.sum('nb_results')); |
400 | 406 | metadataStore.clearFilter(); |
401 | 407 | }); |
402 | - Ext.data.StoreManager.lookup('servicesStore').sort('nb_results', 'DESC'); | |
408 | + servicesStore.sort('nb_results', 'DESC'); | |
403 | 409 | |
404 | 410 | var timeMin = metadataStore.min('time_min'); |
405 | 411 | var timeMax = metadataStore.max('time_max'); |
406 | - this.timeSelector.setLimits(timeMin, timeMax); | |
407 | - this.timeSelector.setInterval(timeMin, timeMax); | |
412 | + timeSelector.setLimits(timeMin, timeMax); | |
413 | + timeSelector.setInterval(timeMin, timeMax); | |
408 | 414 | }, |
409 | 415 | |
410 | 416 | /** | ... | ... |
js/app/views/EpnTapUI.js
... | ... | @@ -99,9 +99,7 @@ Ext.create('Ext.data.Store', { |
99 | 99 | ], |
100 | 100 | listeners: { |
101 | 101 | beforeload: function(store) { |
102 | - AmdaAction.epnTapGetServices( function(services) { | |
103 | - store.add(services); | |
104 | - }); | |
102 | + AmdaAction.epnTapGetServices( function(services) { store.add(services); }); | |
105 | 103 | } |
106 | 104 | } |
107 | 105 | }); |
... | ... | @@ -250,8 +248,8 @@ Ext.define('amdaUI.EpnTapUI', { |
250 | 248 | flex: 1, |
251 | 249 | height: 405, |
252 | 250 | columns: [ |
253 | - {text: 'Name', dataIndex: 'short_name', flex: 3}, | |
254 | - {text: '~Nb results', dataIndex: 'nb_results', flex: 2} | |
251 | + {text: 'Name', dataIndex: 'short_name', flex: 1}, | |
252 | + {text: '~Nb results', dataIndex: 'nb_results', flex: 1} | |
255 | 253 | ], |
256 | 254 | renderer: function(value, metadata, record) { |
257 | 255 | return getExpandableImage(value, metadata,record); |
... | ... | @@ -289,7 +287,11 @@ Ext.define('amdaUI.EpnTapUI', { |
289 | 287 | var service = epnTapServicesGrid.getView().getRecord(tooltip.triggerElement); |
290 | 288 | var ttContent = '<h3>' + service.get('short_name') + '</h3><ul>'; |
291 | 289 | for (var column in column_titles) { |
292 | - ttContent += '<li><b>' + column_titles[column] + '</b>: ' + service.get(column) + '</li>'; | |
290 | + var col_content = service.get(column); | |
291 | + if(column === 'content_level' && col_content!=='') { | |
292 | + col_content = col_content.replace(/#/g, ", "); | |
293 | + } | |
294 | + ttContent += '<li><b>' + column_titles[column] + '</b>: ' + col_content + '</li>'; | |
293 | 295 | } |
294 | 296 | tooltip.update(ttContent + '</ul>'); |
295 | 297 | } |
... | ... | @@ -405,7 +407,7 @@ Ext.define('amdaUI.EpnTapUI', { |
405 | 407 | id: 'epnTapGranulesGrid', |
406 | 408 | title: 'Granules', |
407 | 409 | store: Ext.data.StoreManager.lookup('granulesStore'), |
408 | - flex: 5, | |
410 | + flex: 4, | |
409 | 411 | height: 405, |
410 | 412 | columns: [ |
411 | 413 | { text: 'Num', dataIndex: 'num', flex: 1, renderer: txtRender }, | ... | ... |