Commit e516c1320e6f5cc33183ba6038254bc193be4f1e
1 parent
a0f13ed1
Exists in
master
and in
111 other branches
Add SAMP export in Download view
Showing
2 changed files
with
44 additions
and
15 deletions
Show diff stats
js/app/models/DownloadNode.js
... | ... | @@ -142,7 +142,7 @@ Ext.define('amdaModel.DownloadNode', { |
142 | 142 | encodeObject: function() { |
143 | 143 | }, |
144 | 144 | |
145 | - loadJobTree : function() { | |
145 | + loadJobTree : function(sendToSamp, clientId) { | |
146 | 146 | //TBD - BRE - fix code duplication with ExecutableNode if possible |
147 | 147 | var rootNode = Ext.getCmp(amdaUI.ExplorerUI.JOB_TAB.TREE_ID).getRootNode(); |
148 | 148 | var me = this; |
... | ... | @@ -150,26 +150,29 @@ Ext.define('amdaModel.DownloadNode', { |
150 | 150 | function() |
151 | 151 | { |
152 | 152 | amdaModel.InteractiveNode.jobTreeLoaded = true; |
153 | - me.realExecute(); | |
153 | + me.realExecute(sendToSamp, clientId); | |
154 | 154 | }); |
155 | 155 | }, |
156 | 156 | |
157 | - execute : function() { | |
157 | + execute : function(sendToSamp, clientId) { | |
158 | 158 | |
159 | - if (!amdaModel.ExecutableNode.jobTreeLoaded) this.loadJobTree(); | |
160 | - else this.realExecute(); | |
159 | + if (!amdaModel.ExecutableNode.jobTreeLoaded) this.loadJobTree(sendToSamp, clientId); | |
160 | + else this.realExecute(sendToSamp, clientId); | |
161 | 161 | }, |
162 | 162 | |
163 | 163 | /** |
164 | 164 | * Method to execute this node |
165 | 165 | */ |
166 | - realExecute : function() { | |
167 | - | |
166 | + realExecute : function(sendToSamp, clientId) { | |
168 | 167 | var jsonObject = this.get('object').getJsonValues(); |
169 | 168 | if (!jsonObject.list && !jsonObject.images) { |
170 | 169 | myDesktopApp.warningMsg('Please select at least one Parameter (Get Data) or one Time Table (Get Time Table)'); |
171 | 170 | return; |
172 | 171 | } |
172 | + | |
173 | + if (sendToSamp) { | |
174 | + jsonObject.sendToSamp = true; | |
175 | + } | |
173 | 176 | |
174 | 177 | loadMask.show(); |
175 | 178 | AmdaAction.execute({nodeType : this.get('nodeType')}, jsonObject, function(res,e) |
... | ... | @@ -218,11 +221,22 @@ Ext.define('amdaModel.DownloadNode', { |
218 | 221 | switch (res.status) |
219 | 222 | { |
220 | 223 | case amdaModel.BkgJobNode.STATUS_LIST.DONE : |
221 | - // New tab, non-interactive session | |
222 | - var isInteractive = false; | |
223 | - var isNewTab = true; | |
224 | - newNode.createJobNode(true); | |
225 | - newNode.editNode(isNewTab, isInteractive); | |
224 | + if (!res.sendToSamp) { | |
225 | + // New tab, non-interactive session | |
226 | + var isInteractive = false; | |
227 | + var isNewTab = true; | |
228 | + newNode.createJobNode(true); | |
229 | + newNode.editNode(isNewTab, isInteractive); | |
230 | + } | |
231 | + else { | |
232 | + var files = res.result.split(","); | |
233 | + Ext.each(files, function(file) { | |
234 | + var href = 'data/'+sessionID+'/RES/'+ res.folder + '/' + file; | |
235 | + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.interop.id, true, function (module) { | |
236 | + module.sendVOTable(href, clientId ? clientId : 'hub'); | |
237 | + }); | |
238 | + }); | |
239 | + } | |
226 | 240 | break; |
227 | 241 | case amdaModel.BkgJobNode.STATUS_LIST.IN_PROGRESS : |
228 | 242 | newNode.createJobNode(false); |
... | ... |
js/app/views/DownloadUI.js
... | ... | @@ -16,6 +16,7 @@ Ext.define('amdaUI.DownloadUI', { |
16 | 16 | requires: [ |
17 | 17 | 'amdaUI.TimeSelectorUI', |
18 | 18 | 'amdaUI.ParamArgumentsPlug', |
19 | + 'amdaUI.SendToSampButtonUI', | |
19 | 20 | 'amdaModel.DownloadParam' |
20 | 21 | ], |
21 | 22 | |
... | ... | @@ -306,10 +307,10 @@ Ext.define('amdaUI.DownloadUI', { |
306 | 307 | /** |
307 | 308 | * download method called by 'Download' button to launch the download process |
308 | 309 | */ |
309 | - doDownload : function(){ | |
310 | + doDownload : function(sendToSamp, clientId){ | |
310 | 311 | var downloadModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id); |
311 | 312 | if (downloadModule) |
312 | - downloadModule.linkedNode.execute(); | |
313 | + downloadModule.linkedNode.execute(sendToSamp, clientId); | |
313 | 314 | }, |
314 | 315 | |
315 | 316 | actionItem: function(grid, cell, cellIndex, record, row, recordIndex, e){ |
... | ... | @@ -357,6 +358,13 @@ Ext.define('amdaUI.DownloadUI', { |
357 | 358 | if (samplingField && newValue !== oldValue) |
358 | 359 | samplingField.setDisabled((structureCombo.getValue() == 2) || check.getValue()); |
359 | 360 | }, |
361 | + | |
362 | + onSendVOTableToSamp : function (clientId, sendOpt){ | |
363 | + var me = sendOpt.scope; | |
364 | + if(me.updateObject()){ | |
365 | + me.doDownload(true, clientId); | |
366 | + } | |
367 | + }, | |
360 | 368 | |
361 | 369 | /** |
362 | 370 | * Check if changes were made before closing window |
... | ... | @@ -734,7 +742,14 @@ Ext.define('amdaUI.DownloadUI', { |
734 | 742 | this.TTGrid.store.removeAll(); |
735 | 743 | } |
736 | 744 | } |
737 | - }] | |
745 | + }, | |
746 | + '->', | |
747 | + { | |
748 | + xtype : 'sendToSampButton', | |
749 | + type : 'votable', | |
750 | + onSendToSamp : this.onSendVOTableToSamp, | |
751 | + sendOpt : {scope : this} | |
752 | + }] | |
738 | 753 | }); |
739 | 754 | |
740 | 755 | var myConf = { |
... | ... |