Commit feed9c98d05ec0761cc7eeaac397c829d6e7192f

Authored by Nathanael Jourdane
1 parent cc663bbe

Update services results when loading epntap from tree for the first time

Showing 1 changed file with 19 additions and 11 deletions   Show diff stats
js/app/controllers/EpnTapModule.js
... ... @@ -43,15 +43,17 @@ Ext.define('amdaDesktop.EpnTapModule', {
43 43 this.acquireElements()
44 44 this.addListeners()
45 45  
46   - this.servicesStore.each(function (record) {
47   - record.set('nb_results', -1)
48   - }, this)
49   - this.granulesStore.removeAll()
50   -
51 46 if (filter) {
52 47 this.targetNameCB.setRawValue(filter['targetName'])
53 48 this.productTypeCB.select(filter['productType'])
54   - this.getServices()
  49 + if (this.servicesStore.count() > 0) {
  50 + this.getServices()
  51 + }
  52 + } else {
  53 + this.servicesStore.each(function (record) {
  54 + record.set('nb_results', -1)
  55 + }, this)
  56 + this.granulesStore.removeAll()
55 57 }
56 58 },
57 59  
... ... @@ -71,6 +73,10 @@ Ext.define('amdaDesktop.EpnTapModule', {
71 73 },
72 74  
73 75 addListeners: function () {
  76 + this.servicesStore.on('load', function () {
  77 + this.getServices()
  78 + }, this)
  79 +
74 80 this.servicesGrid.on('cellclick', function (grid, td, cellIndex, record) {
75 81 this.onServiceSelected(record)
76 82 }, this)
... ... @@ -89,16 +95,18 @@ Ext.define('amdaDesktop.EpnTapModule', {
89 95 */
90 96 getServices: function () {
91 97 /* global loadMask */
  98 + loadMask.show()
  99 +
  100 + const targetName = this.targetNameCB.rawValue
  101 + const productTypes = this.productTypeCB.value.join(';')
  102 + const timeMin = Ext.Date.format(this.timeSelector.getStartTime(), 'd/m/Y H:i:s')
  103 + const timeMax = Ext.Date.format(this.timeSelector.getStopTime(), 'd/m/Y H:i:s')
  104 +
92 105 this.servicesStore.each(function (record) {
93 106 record.set('nb_results', -1)
94 107 }, this)
95 108 this.granulesStore.removeAll()
96   - const targetName = this.targetNameCB.rawValue
97   - const productTypes = this.productTypeCB.value.join(';')
98   - const timeMin = Ext.Date.format(this.timeSelector.getStartTime(), 'd/m/Y H:i:s') // start time
99   - const timeMax = Ext.Date.format(this.timeSelector.getStopTime(), 'd/m/Y H:i:s') // stop time
100 109  
101   - loadMask.show()
102 110 this.servicesStore.each(function (record) {
103 111 const ss = this.servicesStore
104 112 Ext.Ajax.request({
... ...