From 44c334bed62b9a60a6537f2b991471fbc73dc1ac Mon Sep 17 00:00:00 2001 From: Nathanael Jourdane Date: Mon, 7 Aug 2017 20:56:46 +0200 Subject: [PATCH] When lauched from the amda tree, epntap module is now launched as an interop module tab. --- js/app/controllers/EpnTapModule.js | 73 ++++++++++++++++++++++--------------------------------------------------- js/app/controllers/InteropModule.js | 3 ++- js/app/models/LocalParamNode.js | 4 ++-- js/app/stores/EpnTapStores.js | 0 js/app/views/EpnTapUI.js | 23 ++++++++++++++++++----- js/app/views/InteropUI.js | 7 ++++--- 6 files changed, 48 insertions(+), 62 deletions(-) create mode 100644 js/app/stores/EpnTapStores.js diff --git a/js/app/controllers/EpnTapModule.js b/js/app/controllers/EpnTapModule.js index afd1b92..02a0b7a 100644 --- a/js/app/controllers/EpnTapModule.js +++ b/js/app/controllers/EpnTapModule.js @@ -69,35 +69,11 @@ Ext.define('amdaDesktop.EpnTapModule', { ****************************/ /** - Trigerred after the a click on the "Display EPN-TAP service" item from the contextual menu in the tree view. - */ - createWindow: function (icon_id) { - this.callParent(); - Ext.getCmp('epntap-win').modal = true; - Ext.getCmp('epntap-win').setSize(800, 600); - var icons_dic = { - 'icon-mercury': ['ts', 'planet', 'mercury'], - 'icon-venus': ['ts', 'planet', 'venus'], - 'icon-earth': ['ts', 'planet', 'earth'], - 'icon-mars': ['ts', 'planet', 'mars'], - 'icon-jupiter': ['ts', 'planet', 'jupiter'], - 'icon-saturn': ['ts', 'planet', 'saturn'], - 'icon-comet': ['ts', 'comet', 'comet'], - 'icon-sw': ['ts', 'interplanetary_medium', 'all'], - 'icon-solarsystem': ['ts', 'interplanetary_medium', 'all'] - } - - var target = icons_dic[icon_id]; - // console.log("target: ", target); - this.initWindow(target); - }, - - /** Trigerred after the render of `gridsPanel` (containing `servicesGrid` and `granulesGrid`). Among other things, initializes the `productType` combobox and the `servicesGrid` table. - `target`: an array of 3 values: [dataproduct_type, target_class, target_name]; or null. */ - initWindow: function(target) { + initWindow: function(icon_id) { Ext.getCmp('epnTapGranulesGrid').getStore().removeAll(); Ext.data.StoreManager.lookup('servicesStore').on('add', function() { this.updateNbResults(); }, this); Ext.data.StoreManager.lookup('servicesStore').load(); @@ -119,28 +95,30 @@ Ext.define('amdaDesktop.EpnTapModule', { this.epnTapPanel = this.productTypeCB.findParentByType('panelEpnTap'); // If the EPN-TAP module is launched from the AMDA tree - if(target) { - // --- Select product types --- - if (! target[0] in this.productTypeCB.getStore()) { - this.display_message("Sorry, product type " + target[0] + " is not found in available services."); - return; + if(icon_id) { + var icons_dic = { + 'icon-mercury': ['ts', 'planet', 'mercury'], + 'icon-venus': ['ts', 'planet', 'venus'], + 'icon-earth': ['ts', 'planet', 'earth'], + 'icon-mars': ['ts', 'planet', 'mars'], + 'icon-jupiter': ['ts', 'planet', 'jupiter'], + 'icon-saturn': ['ts', 'planet', 'saturn'], + 'icon-comet': ['ts', 'comet', 'comet'], + 'icon-sw': ['ts', 'interplanetary_medium', 'all'], + 'icon-solarsystem': ['ts', 'interplanetary_medium', 'all'] } - this.productTypeCB.select(target[0]); - this.onProductTypeCBChanged(); // Fill target class CB + var target = icons_dic[icon_id]; - // --- Select target class --- - if (! target[1] in this.targetClassCB.getStore()) { - this.display_message("Sorry, target class " + this.pretify(target[1]) + " is not found in available services."); - return; - } - this.targetClassCB.select(target[1]); - this.onTargetClassCBChanged(); + this.productTypeCB.enable(); + this.targetClassCB.enable(); + this.targetNameCB.enable(); - // --- Select target name --- - if (! target[2] in this.targetNameCB.getStore()) { - this.display_message("Sorry, target name " + this.pretify(target[2]) + " is not found in available services."); - return; - } + this.productTypeCB.getStore().add({'id': target[0], 'name': target[0]}); + this.targetClassCB.getStore().add({'id': target[1], 'name': target[1]}); + this.targetNameCB.getStore().add({'id': target[2], 'name': target[2]}); + + this.productTypeCB.select(target[0]); + this.targetClassCB.select(target[1]); this.targetNameCB.select(target[2]); this.onTargetNameCBChanged(); @@ -193,7 +171,6 @@ Ext.define('amdaDesktop.EpnTapModule', { } this.targetNameCB.getStore().add({'id': 'all', 'name': 'All target names'}); this.targetNameCB.select('all'); - this.updateNbResults(); }, /** @@ -225,7 +202,6 @@ Ext.define('amdaDesktop.EpnTapModule', { this.targetNameCB.enable(); } } - this.updateNbResults(); }, /** @@ -235,7 +211,6 @@ Ext.define('amdaDesktop.EpnTapModule', { */ onTargetNameCBChanged: function() { Ext.getCmp('epnTapGranulesGrid').getStore().removeAll(); - this.updateNbResults(); }, /** @@ -409,8 +384,6 @@ Ext.define('amdaDesktop.EpnTapModule', { var timeMax = metadataStore.max('time_max'); timeSelector.setLimits(timeMin, timeMax); timeSelector.setInterval(timeMin, timeMax); - // console.log("Done services"); - // loadMask.hide(); }, /** @@ -473,8 +446,6 @@ Ext.define('amdaDesktop.EpnTapModule', { Ext.getCmp('epnTapServicesGrid').setDisabled(false); Ext.getCmp('epnTapGranulesGrid').setDisabled(false); Ext.getCmp('epnTapServicesGrid').getEl().setStyle('cursor', 'default'); // CSS is correctly changed but without visible result. - // console.log("Done granules"); - // loadMask.hide(); }, /** diff --git a/js/app/controllers/InteropModule.js b/js/app/controllers/InteropModule.js index 3aa57b7..8c5185b 100644 --- a/js/app/controllers/InteropModule.js +++ b/js/app/controllers/InteropModule.js @@ -425,7 +425,7 @@ Ext.define('amdaDesktop.InteropModule', { var desktop = this.app.getDesktop(); var win = desktop.getWindow(this.id); - activeTab = 1; + activeTab = (config && 'activeTab' in config) ? config['activeTab'] : 1; if(!win) { @@ -446,6 +446,7 @@ Ext.define('amdaDesktop.InteropModule', { stateEvents: ['move','show','resize'], items : [ { + epntapTarget: (config && 'epntapTarget' in config) ? config['epntapTarget'] : false, xtype: 'panelInterop', clientsStore : this.sampclientsStore, activeTab : activeTab, diff --git a/js/app/models/LocalParamNode.js b/js/app/models/LocalParamNode.js index 7321138..a83b97f 100644 --- a/js/app/models/LocalParamNode.js +++ b/js/app/models/LocalParamNode.js @@ -167,8 +167,8 @@ Ext.define('amdaModel.LocalParamNode', displayEpnTap: function() { var target = this.get('iconCls'); - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.epntap.id, true, function (module) { - module.createWindow(target); + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.interop.id, true, function (module) { + module.createWindow({'activeTab': 2, 'epntapTarget': target}); }); }, diff --git a/js/app/stores/EpnTapStores.js b/js/app/stores/EpnTapStores.js new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/js/app/stores/EpnTapStores.js diff --git a/js/app/views/EpnTapUI.js b/js/app/views/EpnTapUI.js index 9be4138..7462c68 100644 --- a/js/app/views/EpnTapUI.js +++ b/js/app/views/EpnTapUI.js @@ -185,7 +185,7 @@ selected. */ Ext.create('Ext.data.Store', { storeId:'granulesStore', - fields:['num', 'dataproduct_type', 'target_name', 'time_min', 'time_max', 'access_format', 'granule_uid', 'access_estsize', 'access_url', 'thumbnail_url'], + fields:['num', 'dataproduct_type', 'target_name', 'time_min', 'time_max', 'access_format', 'granule_uid', 'access_estsize', 'access_url', 'thumbnail_url'] }); /** @@ -460,7 +460,7 @@ Ext.define('amdaUI.EpnTapUI', { createGranulesGrid() ], listeners: { - afterrender: function() { mod.initWindow(); } + afterrender: function() { mod.initWindow(config.target); } }, renderTo: Ext.getBody() }); @@ -488,7 +488,10 @@ Ext.define('amdaUI.EpnTapUI', { name: 'productType', editable: false, listeners: { - 'select': function(combo) { mod.onProductTypeCBChanged(combo.value); } + 'select': function(combo) { + mod.onProductTypeCBChanged(combo.value); + mod.updateNbResults(); + } } }); }; @@ -511,7 +514,10 @@ Ext.define('amdaUI.EpnTapUI', { name: 'targetClass', editable: false, listeners: { - 'select': function(combo) { mod.onTargetClassCBChanged(combo.value); } + 'select': function(combo) { + mod.onTargetClassCBChanged(combo.value); + mod.updateNbResults(); + } } }); }; @@ -538,7 +544,10 @@ Ext.define('amdaUI.EpnTapUI', { minChars: 2, forceSelection: true, listeners: { - 'select': function(combo) { mod.onTargetNameCBChanged(combo.value); } + 'select': function(combo) { + mod.onTargetNameCBChanged(combo.value); + mod.updateNbResults(); + } } }); }; @@ -735,6 +744,10 @@ Ext.define('amdaUI.EpnTapUI', { ], listeners: { 'beforerender': function(me) { + // if (!loadMask.isMasked()) { + // loadMask.show(true); + // } + if(Ext.getCmp('epntap-win') != null) { Ext.getCmp('epntap-win').setPosition(100, 100); } diff --git a/js/app/views/InteropUI.js b/js/app/views/InteropUI.js index 0c98a91..99f161c 100644 --- a/js/app/views/InteropUI.js +++ b/js/app/views/InteropUI.js @@ -103,11 +103,12 @@ Ext.define('amdaUI.InteropUI', { }; }, - getEpnTapTab: function() { + getEpnTapTab: function(target) { return { xtype : 'panelEpnTap', id : 'epnTapTab', - title : 'EPN-TAP' + title : 'EPN-TAP', + target: target }; }, @@ -129,7 +130,7 @@ Ext.define('amdaUI.InteropUI', { items: [ this.getSampTab(config.clientsStore), { xtype: 'paramsMgrPanel', baseId: config.baseId, layout: 'hbox'}, - this.getEpnTapTab() + this.getEpnTapTab(config.epntapTarget) ] }; -- libgit2 0.21.2