Commit 44c334bed62b9a60a6537f2b991471fbc73dc1ac

Authored by Nathanael Jourdane
1 parent 1ff0a9df

When lauched from the amda tree, epntap module is now launched as an interop module tab.

js/app/controllers/EpnTapModule.js
... ... @@ -69,35 +69,11 @@ Ext.define('amdaDesktop.EpnTapModule', {
69 69 ****************************/
70 70  
71 71 /**
72   - Trigerred after the a click on the "Display EPN-TAP service" item from the contextual menu in the tree view.
73   - */
74   - createWindow: function (icon_id) {
75   - this.callParent();
76   - Ext.getCmp('epntap-win').modal = true;
77   - Ext.getCmp('epntap-win').setSize(800, 600);
78   - var icons_dic = {
79   - 'icon-mercury': ['ts', 'planet', 'mercury'],
80   - 'icon-venus': ['ts', 'planet', 'venus'],
81   - 'icon-earth': ['ts', 'planet', 'earth'],
82   - 'icon-mars': ['ts', 'planet', 'mars'],
83   - 'icon-jupiter': ['ts', 'planet', 'jupiter'],
84   - 'icon-saturn': ['ts', 'planet', 'saturn'],
85   - 'icon-comet': ['ts', 'comet', 'comet'],
86   - 'icon-sw': ['ts', 'interplanetary_medium', 'all'],
87   - 'icon-solarsystem': ['ts', 'interplanetary_medium', 'all']
88   - }
89   -
90   - var target = icons_dic[icon_id];
91   - // console.log("target: ", target);
92   - this.initWindow(target);
93   - },
94   -
95   - /**
96 72 Trigerred after the render of `gridsPanel` (containing `servicesGrid` and `granulesGrid`). Among other things,
97 73 initializes the `productType` combobox and the `servicesGrid` table.
98 74 - `target`: an array of 3 values: [dataproduct_type, target_class, target_name]; or null.
99 75 */
100   - initWindow: function(target) {
  76 + initWindow: function(icon_id) {
101 77 Ext.getCmp('epnTapGranulesGrid').getStore().removeAll();
102 78 Ext.data.StoreManager.lookup('servicesStore').on('add', function() { this.updateNbResults(); }, this);
103 79 Ext.data.StoreManager.lookup('servicesStore').load();
... ... @@ -119,28 +95,30 @@ Ext.define('amdaDesktop.EpnTapModule', {
119 95 this.epnTapPanel = this.productTypeCB.findParentByType('panelEpnTap');
120 96  
121 97 // If the EPN-TAP module is launched from the AMDA tree
122   - if(target) {
123   - // --- Select product types ---
124   - if (! target[0] in this.productTypeCB.getStore()) {
125   - this.display_message("Sorry, product type " + target[0] + " is not found in available services.");
126   - return;
  98 + if(icon_id) {
  99 + var icons_dic = {
  100 + 'icon-mercury': ['ts', 'planet', 'mercury'],
  101 + 'icon-venus': ['ts', 'planet', 'venus'],
  102 + 'icon-earth': ['ts', 'planet', 'earth'],
  103 + 'icon-mars': ['ts', 'planet', 'mars'],
  104 + 'icon-jupiter': ['ts', 'planet', 'jupiter'],
  105 + 'icon-saturn': ['ts', 'planet', 'saturn'],
  106 + 'icon-comet': ['ts', 'comet', 'comet'],
  107 + 'icon-sw': ['ts', 'interplanetary_medium', 'all'],
  108 + 'icon-solarsystem': ['ts', 'interplanetary_medium', 'all']
127 109 }
128   - this.productTypeCB.select(target[0]);
129   - this.onProductTypeCBChanged(); // Fill target class CB
  110 + var target = icons_dic[icon_id];
130 111  
131   - // --- Select target class ---
132   - if (! target[1] in this.targetClassCB.getStore()) {
133   - this.display_message("Sorry, target class " + this.pretify(target[1]) + " is not found in available services.");
134   - return;
135   - }
136   - this.targetClassCB.select(target[1]);
137   - this.onTargetClassCBChanged();
  112 + this.productTypeCB.enable();
  113 + this.targetClassCB.enable();
  114 + this.targetNameCB.enable();
138 115  
139   - // --- Select target name ---
140   - if (! target[2] in this.targetNameCB.getStore()) {
141   - this.display_message("Sorry, target name " + this.pretify(target[2]) + " is not found in available services.");
142   - return;
143   - }
  116 + this.productTypeCB.getStore().add({'id': target[0], 'name': target[0]});
  117 + this.targetClassCB.getStore().add({'id': target[1], 'name': target[1]});
  118 + this.targetNameCB.getStore().add({'id': target[2], 'name': target[2]});
  119 +
  120 + this.productTypeCB.select(target[0]);
  121 + this.targetClassCB.select(target[1]);
144 122 this.targetNameCB.select(target[2]);
145 123 this.onTargetNameCBChanged();
146 124  
... ... @@ -193,7 +171,6 @@ Ext.define('amdaDesktop.EpnTapModule', {
193 171 }
194 172 this.targetNameCB.getStore().add({'id': 'all', 'name': 'All target names'});
195 173 this.targetNameCB.select('all');
196   - this.updateNbResults();
197 174 },
198 175  
199 176 /**
... ... @@ -225,7 +202,6 @@ Ext.define('amdaDesktop.EpnTapModule', {
225 202 this.targetNameCB.enable();
226 203 }
227 204 }
228   - this.updateNbResults();
229 205 },
230 206  
231 207 /**
... ... @@ -235,7 +211,6 @@ Ext.define('amdaDesktop.EpnTapModule', {
235 211 */
236 212 onTargetNameCBChanged: function() {
237 213 Ext.getCmp('epnTapGranulesGrid').getStore().removeAll();
238   - this.updateNbResults();
239 214 },
240 215  
241 216 /**
... ... @@ -409,8 +384,6 @@ Ext.define('amdaDesktop.EpnTapModule', {
409 384 var timeMax = metadataStore.max('time_max');
410 385 timeSelector.setLimits(timeMin, timeMax);
411 386 timeSelector.setInterval(timeMin, timeMax);
412   - // console.log("Done services");
413   - // loadMask.hide();
414 387 },
415 388  
416 389 /**
... ... @@ -473,8 +446,6 @@ Ext.define('amdaDesktop.EpnTapModule', {
473 446 Ext.getCmp('epnTapServicesGrid').setDisabled(false);
474 447 Ext.getCmp('epnTapGranulesGrid').setDisabled(false);
475 448 Ext.getCmp('epnTapServicesGrid').getEl().setStyle('cursor', 'default'); // CSS is correctly changed but without visible result.
476   - // console.log("Done granules");
477   - // loadMask.hide();
478 449 },
479 450  
480 451 /**
... ...
js/app/controllers/InteropModule.js
... ... @@ -425,7 +425,7 @@ Ext.define('amdaDesktop.InteropModule', {
425 425 var desktop = this.app.getDesktop();
426 426 var win = desktop.getWindow(this.id);
427 427  
428   - activeTab = 1;
  428 + activeTab = (config && 'activeTab' in config) ? config['activeTab'] : 1;
429 429  
430 430 if(!win)
431 431 {
... ... @@ -446,6 +446,7 @@ Ext.define('amdaDesktop.InteropModule', {
446 446 stateEvents: ['move','show','resize'],
447 447 items : [
448 448 {
  449 + epntapTarget: (config && 'epntapTarget' in config) ? config['epntapTarget'] : false,
449 450 xtype: 'panelInterop',
450 451 clientsStore : this.sampclientsStore,
451 452 activeTab : activeTab,
... ...
js/app/models/LocalParamNode.js
... ... @@ -167,8 +167,8 @@ Ext.define('amdaModel.LocalParamNode',
167 167  
168 168 displayEpnTap: function() {
169 169 var target = this.get('iconCls');
170   - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.epntap.id, true, function (module) {
171   - module.createWindow(target);
  170 + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.interop.id, true, function (module) {
  171 + module.createWindow({'activeTab': 2, 'epntapTarget': target});
172 172 });
173 173 },
174 174  
... ...
js/app/stores/EpnTapStores.js 0 โ†’ 100644
js/app/views/EpnTapUI.js
... ... @@ -185,7 +185,7 @@ selected.
185 185 */
186 186 Ext.create('Ext.data.Store', {
187 187 storeId:'granulesStore',
188   - fields:['num', 'dataproduct_type', 'target_name', 'time_min', 'time_max', 'access_format', 'granule_uid', 'access_estsize', 'access_url', 'thumbnail_url'],
  188 + fields:['num', 'dataproduct_type', 'target_name', 'time_min', 'time_max', 'access_format', 'granule_uid', 'access_estsize', 'access_url', 'thumbnail_url']
189 189 });
190 190  
191 191 /**
... ... @@ -460,7 +460,7 @@ Ext.define('amdaUI.EpnTapUI', {
460 460 createGranulesGrid()
461 461 ],
462 462 listeners: {
463   - afterrender: function() { mod.initWindow(); }
  463 + afterrender: function() { mod.initWindow(config.target); }
464 464 },
465 465 renderTo: Ext.getBody()
466 466 });
... ... @@ -488,7 +488,10 @@ Ext.define('amdaUI.EpnTapUI', {
488 488 name: 'productType',
489 489 editable: false,
490 490 listeners: {
491   - 'select': function(combo) { mod.onProductTypeCBChanged(combo.value); }
  491 + 'select': function(combo) {
  492 + mod.onProductTypeCBChanged(combo.value);
  493 + mod.updateNbResults();
  494 + }
492 495 }
493 496 });
494 497 };
... ... @@ -511,7 +514,10 @@ Ext.define('amdaUI.EpnTapUI', {
511 514 name: 'targetClass',
512 515 editable: false,
513 516 listeners: {
514   - 'select': function(combo) { mod.onTargetClassCBChanged(combo.value); }
  517 + 'select': function(combo) {
  518 + mod.onTargetClassCBChanged(combo.value);
  519 + mod.updateNbResults();
  520 + }
515 521 }
516 522 });
517 523 };
... ... @@ -538,7 +544,10 @@ Ext.define('amdaUI.EpnTapUI', {
538 544 minChars: 2,
539 545 forceSelection: true,
540 546 listeners: {
541   - 'select': function(combo) { mod.onTargetNameCBChanged(combo.value); }
  547 + 'select': function(combo) {
  548 + mod.onTargetNameCBChanged(combo.value);
  549 + mod.updateNbResults();
  550 + }
542 551 }
543 552 });
544 553 };
... ... @@ -735,6 +744,10 @@ Ext.define('amdaUI.EpnTapUI', {
735 744 ],
736 745 listeners: {
737 746 'beforerender': function(me) {
  747 + // if (!loadMask.isMasked()) {
  748 + // loadMask.show(true);
  749 + // }
  750 +
738 751 if(Ext.getCmp('epntap-win') != null) {
739 752 Ext.getCmp('epntap-win').setPosition(100, 100);
740 753 }
... ...
js/app/views/InteropUI.js
... ... @@ -103,11 +103,12 @@ Ext.define('amdaUI.InteropUI', {
103 103 };
104 104 },
105 105  
106   - getEpnTapTab: function() {
  106 + getEpnTapTab: function(target) {
107 107 return {
108 108 xtype : 'panelEpnTap',
109 109 id : 'epnTapTab',
110   - title : 'EPN-TAP'
  110 + title : 'EPN-TAP',
  111 + target: target
111 112 };
112 113 },
113 114  
... ... @@ -129,7 +130,7 @@ Ext.define('amdaUI.InteropUI', {
129 130 items: [
130 131 this.getSampTab(config.clientsStore),
131 132 { xtype: 'paramsMgrPanel', baseId: config.baseId, layout: 'hbox'},
132   - this.getEpnTapTab()
  133 + this.getEpnTapTab(config.epntapTarget)
133 134 ]
134 135 };
135 136  
... ...