Commit 29c449bb23297b0dac587b99314b00dcaf629c9a
1 parent
a087d0b3
Exists in
master
and in
110 other branches
format + redmine #4824
Showing
4 changed files
with
470 additions
and
536 deletions
Show diff stats
js/app/controllers/ResultModule.js
... | ... | @@ -6,27 +6,22 @@ |
6 | 6 | * @extends amdaDesktop.InteractiveModule |
7 | 7 | * @brief Result Module controller definition |
8 | 8 | * @author |
9 | - * @version $Id: ResultModule.js 1052 2012-07-20 14:21:37Z elena $ | |
10 | - ***************************************************************************** | |
11 | - * FT Id : Date : Name - Description | |
12 | - ******************************************************************************* | |
13 | - * | |
9 | + * @version $Id: ResultModule.js 1052 2012-07-20 14:21:37Z elena $ | |
14 | 10 | */ |
15 | 11 | |
16 | 12 | Ext.define('amdaDesktop.ResultModule', { |
17 | 13 | extend: 'amdaDesktop.InteractiveModule', |
18 | 14 | |
19 | - requires: [ | |
20 | - 'amdaUI.ResultUI' | |
21 | - ], | |
15 | + requires: ['amdaUI.ResultUI'], | |
22 | 16 | |
23 | 17 | contentId : 'resultUI', |
24 | 18 | width : 500, |
25 | 19 | height : 250, |
26 | - /** | |
27 | - * @cfg {String} data models | |
28 | - * @required | |
29 | - */ | |
20 | + | |
21 | + /** | |
22 | + * @cfg {String} data models | |
23 | + * @required | |
24 | + */ | |
30 | 25 | nodeDataModel : 'amdaModel.BkgJobNode', |
31 | 26 | uiType : 'panelResult', |
32 | 27 | nodeType : null, |
... | ... | @@ -37,15 +32,15 @@ Ext.define('amdaDesktop.ResultModule', { |
37 | 32 | this.launcher = null; |
38 | 33 | }, |
39 | 34 | |
40 | - /** | |
41 | - * Window Creation method of the Module | |
42 | - */ | |
35 | + /** | |
36 | + * Window Creation method of the Module | |
37 | + */ | |
43 | 38 | createWindow : function () { |
44 | - // init Result Win | |
45 | - var desktop = this.app.getDesktop(); | |
46 | - var win = desktop.getWindow(this.id); | |
47 | - if (!win) { | |
48 | - win = desktop.createWindow({ | |
39 | + // init Result Win | |
40 | + var desktop = this.app.getDesktop(); | |
41 | + var win = desktop.getWindow(this.id); | |
42 | + if (!win) { | |
43 | + win = desktop.createWindow({ | |
49 | 44 | id : this.id, |
50 | 45 | title : this.title, |
51 | 46 | width : this.width, |
... | ... | @@ -58,86 +53,79 @@ Ext.define('amdaDesktop.ResultModule', { |
58 | 53 | stateId : this.id, |
59 | 54 | stateEvents: ['move','show','resize'], |
60 | 55 | // closable : false, |
61 | - tools: [ | |
62 | - { | |
63 | - type:'help', | |
64 | - qtip: this.helpTitle, | |
65 | - handler: function(event, toolEl, panel){ | |
66 | - //TODO: help logic | |
67 | - } | |
68 | - } | |
69 | - ], | |
70 | - items : [ | |
71 | - { | |
72 | - xtype : this.uiType, | |
73 | - id : this.contentId | |
74 | - } | |
75 | - ], | |
56 | + tools : [{ | |
57 | + type:'help', | |
58 | + qtip: this.helpTitle, | |
59 | + handler: function(event, toolEl, panel){ | |
60 | + //TODO: help logic | |
61 | + } | |
62 | + }], | |
63 | + items : [ { | |
64 | + xtype : this.uiType, | |
65 | + id : this.contentId | |
66 | + }], | |
76 | 67 | listeners: { |
77 | - scope: this, | |
78 | - beforeclose : function() { | |
79 | - if (this.linkedNodes) this.linkedNodes.clear(); | |
80 | - } | |
68 | + scope: this, | |
69 | + beforeclose : function() { | |
70 | + if (this.linkedNodes) this.linkedNodes.clear(); | |
71 | + } | |
81 | 72 | } |
82 | 73 | }); |
83 | - } | |
84 | - win.show(); | |
85 | - | |
86 | - var linkedNode = this.getLinkedNode(); | |
74 | + } | |
75 | + win.show(); | |
87 | 76 | |
88 | - if (win && linkedNode.get('jobType')) { | |
89 | - if (!this.linkedNodes || | |
90 | - !this.linkedNodes.getByKey(linkedNode.get('processId'))){ | |
91 | - this.getUiContent().setResult(linkedNode); | |
92 | - this.addLinkedNode(linkedNode); | |
93 | - } | |
94 | - } | |
77 | + var linkedNode = this.getLinkedNode(); | |
78 | + | |
79 | + if (win && linkedNode.get('jobType')) { | |
80 | + if (!this.linkedNodes || | |
81 | + !this.linkedNodes.getByKey(linkedNode.get('processId'))){ | |
82 | + this.getUiContent().setResult(linkedNode); | |
83 | + this.addLinkedNode(linkedNode); | |
84 | + } | |
85 | + } | |
95 | 86 | }, |
96 | 87 | |
97 | -//TODO override interactive module method : is it needed??? | |
88 | + //TODO override interactive module method : is it needed??? | |
98 | 89 | setLinkedNode : function (myLinkedNode){ |
99 | 90 | this.linkedNode = myLinkedNode; |
100 | 91 | }, |
101 | 92 | |
102 | - /** | |
103 | - * add the current node in this module | |
104 | - * @param {amdaModel.InteractiveNode} myLinkedNode | |
105 | - */ | |
93 | + /** | |
94 | + * add the current node into this module | |
95 | + * @param {amdaModel.InteractiveNode} myLinkedNode | |
96 | + */ | |
106 | 97 | addLinkedNode : function (myLinkedNode){ |
107 | - if (!this.linkedNodes){ | |
108 | - this.linkedNodes = new Ext.util.MixedCollection(); | |
109 | - } | |
110 | - | |
111 | - if (myLinkedNode.get('processId')){ | |
112 | - | |
113 | - // add new linkedNode to this module | |
114 | - this.linkedNodes.add(myLinkedNode.get('processId'),myLinkedNode); | |
115 | - } | |
98 | + if (!this.linkedNodes){ | |
99 | + this.linkedNodes = new Ext.util.MixedCollection(); | |
100 | + } | |
101 | + | |
102 | + if (myLinkedNode.get('processId')){ | |
103 | + // add new linkedNode to this module | |
104 | + this.linkedNodes.add(myLinkedNode.get('processId'),myLinkedNode); | |
105 | + } | |
116 | 106 | }, |
117 | 107 | |
118 | - /** | |
119 | - * remove deleted node from this module; delete corresponding FieldSet | |
120 | - * @param {amdaModel.InteractiveNode} linkedNode | |
121 | - * @param int index | |
122 | - */ | |
123 | - | |
124 | - removeLinkedNode : function(linkedNode, index) { | |
125 | - | |
126 | - this.linkedNodes.remove(index); | |
127 | - | |
128 | - var type = linkedNode.get('jobType'); | |
129 | - var processId = linkedNode.get('processId'); | |
130 | - var tabPanel = this.getUiContent().items.items[0]; | |
131 | - var thePanel; | |
132 | - tabPanel.items.each(function(item){ | |
133 | - if (item.id == 'tab-'+type) { | |
134 | - thePanel = item; | |
135 | - thePanel.items.each(function(item) { | |
136 | - if (processId == item.intId){ | |
137 | - thePanel.remove(item); | |
138 | - } | |
139 | - }); | |
140 | - } | |
141 | - }); | |
142 | - } | |
143 | -}); | |
144 | 108 | \ No newline at end of file |
109 | + /** | |
110 | + * remove deleted node from this module; delete corresponding FieldSet | |
111 | + * @param {amdaModel.InteractiveNode} linkedNode | |
112 | + * @param int index | |
113 | + */ | |
114 | + removeLinkedNode : function(linkedNode, index) { | |
115 | + this.linkedNodes.remove(index); | |
116 | + | |
117 | + var type = linkedNode.get('jobType'); | |
118 | + var processId = linkedNode.get('processId'); | |
119 | + var tabPanel = this.getUiContent().items.items[0]; | |
120 | + var thePanel; | |
121 | + tabPanel.items.each(function(item){ | |
122 | + if (item.id == 'tab-'+type) { | |
123 | + thePanel = item; | |
124 | + thePanel.items.each(function(item) { | |
125 | + if (processId == item.intId){ | |
126 | + thePanel.remove(item); | |
127 | + } | |
128 | + }); | |
129 | + } | |
130 | + }); | |
131 | + } | |
132 | +}); | ... | ... |
js/app/models/BkgJobNode.js
... | ... | @@ -122,9 +122,8 @@ Ext.define('amdaModel.BkgJobNode', { |
122 | 122 | onMenuItemClick : function(menu, item, event) |
123 | 123 | { |
124 | 124 | var fnId = Ext.util.Format.substr(item.fnId, 5, item.fnId.length); |
125 | - | |
126 | - switch (fnId) | |
127 | - { | |
125 | + | |
126 | + switch (fnId) { | |
128 | 127 | case 'deleteNode': |
129 | 128 | this.deleteJob(); |
130 | 129 | this.deleteNode(); |
... | ... | @@ -138,17 +137,15 @@ Ext.define('amdaModel.BkgJobNode', { |
138 | 137 | alert('NOT IMPLEMENTED YET'); |
139 | 138 | // this.renameNode(); |
140 | 139 | break; |
141 | - case 'editNode': | |
142 | - //create object if it doesn't exist (tree load) | |
143 | - //TODO use data model ? | |
144 | - if (!this.get('object')) | |
145 | - { | |
140 | + case 'editNode': | |
141 | + // create object if it doesn't exist (tree load) | |
142 | + // TODO use data model ? | |
143 | + if (!this.get('object')) { | |
146 | 144 | AmdaAction.getObject(this.get('id'), this.get('nodeType'), this.getObjectCallback, this); |
147 | - } | |
148 | - else | |
149 | - { | |
145 | + } | |
146 | + else { | |
150 | 147 | var isInteractive = false; |
151 | - var isNewTab = true; | |
148 | + var isNewTab = true; | |
152 | 149 | this.editNode(isNewTab, isInteractive); |
153 | 150 | } |
154 | 151 | break; |
... | ... | @@ -209,26 +206,22 @@ Ext.define('amdaModel.BkgJobNode', { |
209 | 206 | } |
210 | 207 | }, |
211 | 208 | |
212 | - getObjectCallback : function(result,remoteEvent) | |
213 | - {//result, e) { | |
214 | - var t = remoteEvent.getTransaction(); | |
215 | - | |
209 | + getObjectCallback : function(result,remoteEvent){ | |
210 | + var t = remoteEvent.getTransaction(); | |
216 | 211 | //AKKA - Rework of the result treatment for the integration with the new kernel |
217 | - if (!remoteEvent.status) | |
218 | - { | |
212 | + if (!remoteEvent.status) { | |
219 | 213 | myDesktopApp.errorMsg('Internal error during download request'); |
220 | 214 | return; |
221 | 215 | } |
222 | 216 | |
223 | - if (!result.success) | |
224 | - { | |
217 | + if (!result.success) { | |
225 | 218 | myDesktopApp.errorMsg(result.message); |
226 | 219 | return; |
227 | 220 | } |
228 | 221 | |
229 | 222 | var obj = null; |
230 | - switch (this.get('jobType')) | |
231 | - { | |
223 | + | |
224 | + switch (this.get('jobType')) { | |
232 | 225 | case 'condition' : |
233 | 226 | obj = Ext.create('amdaModel.Search', |
234 | 227 | {name: result.name, |
... | ... | @@ -242,7 +235,7 @@ Ext.define('amdaModel.BkgJobNode', { |
242 | 235 | folderId : result.folder}); |
243 | 236 | break; |
244 | 237 | case 'request' : |
245 | - obj = Ext.create('amdaPlotObj.PlotRequestObject.', | |
238 | + obj = Ext.create('amdaPlotObj.PlotRequestObject', | |
246 | 239 | {name: result.name, format: result.format, |
247 | 240 | resultId : result.result, |
248 | 241 | folderId : result.folder}); |
... | ... | @@ -256,26 +249,25 @@ Ext.define('amdaModel.BkgJobNode', { |
256 | 249 | break; |
257 | 250 | } |
258 | 251 | |
259 | - if (!obj) | |
260 | - { | |
252 | + if (!obj){ | |
261 | 253 | myDesktopApp.errorMsg("Unknown job type"); |
262 | 254 | return; |
263 | - } | |
255 | + } | |
264 | 256 | |
265 | 257 | // set parameter into node |
266 | 258 | this.set('object',obj); |
267 | 259 | |
268 | 260 | var isInteractive = false; |
269 | - var isNewTab = true; | |
261 | + var isNewTab = true; | |
262 | + | |
270 | 263 | this.editNode(isNewTab, isInteractive); |
271 | 264 | }, |
272 | 265 | |
273 | 266 | // Show Result |
274 | - editNode : function(isNewTab, isInteractive) | |
275 | - { | |
267 | + editNode : function(isNewTab, isInteractive) { | |
276 | 268 | var me = this; |
277 | - if (isInteractive) | |
278 | - { | |
269 | + | |
270 | + if (isInteractive) { | |
279 | 271 | myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.interactive_plot.id, true, function(module) { |
280 | 272 | if (isNewTab) { |
281 | 273 | module.setLinkedNode(me); |
... | ... | @@ -286,9 +278,9 @@ Ext.define('amdaModel.BkgJobNode', { |
286 | 278 | else |
287 | 279 | { |
288 | 280 | myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.result.id, true, function(module) { |
289 | - if (isNewTab) { | |
290 | - module.setLinkedNode(me); | |
291 | - } | |
281 | + if (isNewTab) { | |
282 | + module.setLinkedNode(me); | |
283 | + } | |
292 | 284 | module.createWindow(); |
293 | 285 | }); |
294 | 286 | } | ... | ... |
js/app/views/ResultUI.js
... | ... | @@ -5,78 +5,63 @@ |
5 | 5 | * @extends Ext. |
6 | 6 | * @brief Result Module UI definition (View) |
7 | 7 | * @author |
8 | - * @version $Id: ResultUI.js 1052 2012-07-20 14:21:37Z elena $ | |
9 | - ******************************************************************************** | |
10 | - * FT Id : Date : Name - Description | |
11 | - ******************************************************************************* | |
12 | - * | |
8 | + * @version $Id: ResultUI.js 1052 2012-07-20 14:21:37Z elena $ | |
13 | 9 | */ |
14 | 10 | |
15 | 11 | Ext.define('amdaUI.ResultUI', { |
16 | - extend: 'Ext.container.Container', | |
17 | - alias: 'widget.panelResult', | |
18 | - | |
19 | - requires: [ | |
20 | - 'amdaUI.TabResultUI' | |
21 | - ], | |
22 | - | |
23 | - constructor: function(config) { | |
24 | - this.init(config); | |
25 | - this.callParent(arguments); | |
12 | + extend: 'Ext.container.Container', | |
13 | + alias: 'widget.panelResult', | |
26 | 14 | |
27 | - }, | |
15 | + requires: ['amdaUI.TabResultUI'], | |
16 | + | |
17 | + constructor: function(config) { | |
18 | + this.init(config); | |
19 | + this.callParent(arguments); | |
20 | + }, | |
28 | 21 | |
29 | - getTabResult: function(nodeType) { | |
30 | - var tabId = 'tab-'+nodeType; | |
31 | - return this.tabPanel.getComponent(tabId); | |
32 | - }, | |
22 | + getTabResult: function(nodeType) { | |
23 | + var tabId = 'tab-'+nodeType; | |
24 | + return this.tabPanel.getComponent(tabId); | |
25 | + }, | |
33 | 26 | |
34 | - setObject: function(obj){}, | |
27 | + setObject: function(obj){}, | |
35 | 28 | |
36 | - setResult: function(linkedNode){ | |
37 | - var configResult = {nodeType: linkedNode.get('jobType')}; | |
38 | - var panelResult = this.getTabResult(linkedNode.get('jobType')); | |
29 | + setResult: function(linkedNode){ | |
30 | + var configResult = {nodeType: linkedNode.get('jobType')}; | |
31 | + var panelResult = this.getTabResult(linkedNode.get('jobType')); | |
39 | 32 | |
40 | - if (!panelResult) { | |
41 | - // create the plot Tab Result Panel | |
42 | - panelResult = Ext.create('widget.tabResult',configResult); | |
43 | - | |
44 | - // add it | |
45 | - this.tabPanel.add(panelResult); | |
46 | - } | |
47 | - // focus on it | |
48 | - this.tabPanel.setActiveTab(panelResult); | |
49 | - var format = linkedNode.get('object').get('format'); | |
50 | - if (!format) format = 'unknown'; | |
51 | - var compression = linkedNode.get('object').get('compression'); | |
52 | - if (!compression) compression = 'unknown'; | |
53 | - | |
54 | -//TODO args as object ??? | |
55 | - panelResult.addResult( | |
56 | - linkedNode.get('text'), | |
57 | - linkedNode.get('object').get('resultId'), | |
58 | - linkedNode.get('object').get('folderId'), | |
59 | - compression.toLowerCase(), | |
60 | - format.toLowerCase(), | |
61 | - linkedNode.get('id')); | |
62 | - }, | |
63 | - | |
64 | - init : function(config) { | |
33 | + if (!panelResult) { | |
34 | + // create the plot Tab Result Panel | |
35 | + panelResult = Ext.create('widget.tabResult',configResult); | |
36 | + // add it | |
37 | + this.tabPanel.add(panelResult); | |
38 | + } | |
39 | + // focus on it | |
40 | + this.tabPanel.setActiveTab(panelResult); | |
41 | + var format = linkedNode.get('object').get('format'); | |
42 | + if (!format) format = 'unknown'; | |
43 | + var compression = linkedNode.get('object').get('compression'); | |
44 | + if (!compression) compression = 'unknown'; | |
65 | 45 | |
66 | - this.tabPanel = Ext.create('Ext.tab.Panel',{ | |
67 | - layout: { type :'vbox' }, | |
68 | - activeTab: 0 | |
69 | - }); | |
70 | - | |
71 | - | |
72 | - var myConf = { | |
73 | - layout: 'fit', | |
74 | - items: [ | |
75 | - this.tabPanel | |
76 | - ] | |
77 | - }; | |
78 | - | |
79 | - Ext.apply (this , Ext.apply (arguments, myConf)); | |
80 | - } | |
46 | + panelResult.addResult( | |
47 | + linkedNode.get('text'), | |
48 | + linkedNode.get('object').get('resultId'), | |
49 | + linkedNode.get('object').get('folderId'), | |
50 | + compression.toLowerCase(), | |
51 | + format.toLowerCase(), | |
52 | + linkedNode.get('id')); | |
53 | + }, | |
81 | 54 | |
55 | + init : function(config) { | |
56 | + this.tabPanel = Ext.create('Ext.tab.Panel',{ | |
57 | + layout: { type :'vbox' }, | |
58 | + activeTab: 0 | |
59 | + }); | |
60 | + | |
61 | + var myConf = { | |
62 | + layout: 'fit', | |
63 | + items: [ this.tabPanel ] | |
64 | + }; | |
65 | + Ext.apply(this, Ext.apply(arguments, myConf)); | |
66 | + } | |
82 | 67 | }); | ... | ... |
js/app/views/TabResultUI.js
... | ... | @@ -5,371 +5,340 @@ |
5 | 5 | * @extends Ext.panel.Panel |
6 | 6 | * @brief Tab Result UI definition (View) |
7 | 7 | * @author |
8 | - * @version $Id: TabResultUI.js 2618 2014-10-24 12:27:42Z elena $ | |
9 | - ******************************************************************************** | |
10 | - * FT Id : Date : Name - Description | |
11 | - ******************************************************************************* | |
12 | - * | |
8 | + * @version $Id: TabResultUI.js 2618 2014-10-24 12:27:42Z elena $ | |
13 | 9 | */ |
14 | 10 | |
15 | 11 | Ext.define('amdaUI.TabResultUI', { |
16 | - extend: 'Ext.panel.Panel', | |
17 | - | |
18 | - alias: 'widget.tabResult', | |
19 | - | |
20 | - requires: [ | |
21 | - 'amdaUI.SendToSampButtonUI' | |
22 | - ], | |
23 | - | |
24 | - constructor: function(config) { | |
25 | - this.initConfig(config); | |
26 | - this.callParent(); | |
27 | - }, | |
12 | + extend: 'Ext.panel.Panel', | |
13 | + | |
14 | + alias: 'widget.tabResult', | |
15 | + | |
16 | + requires: [ 'amdaUI.SendToSampButtonUI'], | |
17 | + | |
18 | + constructor: function(config) { | |
19 | + this.initConfig(config); | |
20 | + this.callParent(); | |
21 | + }, | |
28 | 22 | |
29 | - initConfig: function(config){ | |
30 | - this.type = config.nodeType; | |
31 | - this.id = 'tab-' + config.nodeType; | |
32 | - //var title = config.nodeType +' Result'; | |
33 | - switch (config.nodeType) { | |
34 | - case 'condition': var title = 'Data Mining Results'; | |
35 | - break; | |
36 | - case 'request' : var title = 'Plot Results'; | |
37 | - break; | |
38 | - case 'download': var title = 'Download Results'; | |
39 | - break; | |
40 | - case 'statistics': var title = 'Statistics Results'; | |
41 | - break; | |
42 | - default: | |
43 | - } | |
44 | - var newConfig = { | |
45 | - id: this.id, | |
46 | - title: title, | |
47 | - autoScroll: true, | |
48 | - height: 250, | |
49 | - closable: true, | |
50 | - layout: { | |
51 | - type: 'vbox', | |
52 | - align : 'stretch', | |
53 | - autoSize : true | |
54 | - }, | |
55 | - listeners: { | |
56 | - scope : this, | |
57 | - beforeclose : function() { | |
58 | - //delete linked nodes connected to ResultModule and corresponding to this Tab | |
59 | - var module = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.result.id); | |
60 | - if (module.linkedNodes) { | |
61 | - var indices = new Array(); | |
62 | - var i =0; | |
63 | - module.linkedNodes.each(function(item,index){ | |
64 | - if(this.type == item.get('jobType')) { | |
65 | - indices[i] = index; | |
66 | - i++; | |
67 | - } | |
68 | - }, this); | |
69 | - if (indices.length > 0) { | |
70 | - Ext.Array.each(indices, function(item) { | |
71 | - module.linkedNodes.removeAt(item); | |
72 | - }); | |
73 | - } | |
74 | - } | |
75 | - } | |
76 | - } | |
77 | - } | |
78 | - Ext.apply(this, newConfig); | |
79 | - }, | |
23 | + initConfig: function(config){ | |
24 | + this.type = config.nodeType; | |
25 | + this.id = 'tab-' + config.nodeType; | |
26 | + //var title = config.nodeType +' Result'; | |
27 | + switch (config.nodeType) { | |
28 | + case 'condition': var title = 'Data Mining Results'; | |
29 | + break; | |
30 | + case 'request' : var title = 'Plot Results'; | |
31 | + break; | |
32 | + case 'download': var title = 'Download Results'; | |
33 | + break; | |
34 | + case 'statistics': var title = 'Statistics Results'; | |
35 | + break; | |
36 | + default: | |
37 | + } | |
38 | + | |
39 | + var newConfig = { | |
40 | + id: this.id, | |
41 | + title: title, | |
42 | + autoScroll: true, | |
43 | + height: 250, | |
44 | + closable: true, | |
45 | + layout: { | |
46 | + type: 'vbox', | |
47 | + align : 'stretch', | |
48 | + autoSize : true | |
49 | + }, | |
50 | + listeners: { | |
51 | + scope : this, | |
52 | + beforeclose : function() { | |
53 | + //delete linked nodes connected to ResultModule and corresponding to this Tab | |
54 | + var module = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.result.id); | |
55 | + if (module.linkedNodes) { | |
56 | + var indices = new Array(); | |
57 | + var i = 0; | |
58 | + module.linkedNodes.each(function(item,index){ | |
59 | + if(this.type == item.get('jobType')) { | |
60 | + indices[i] = index; | |
61 | + i++; | |
62 | + } | |
63 | + }, this); | |
64 | + if (indices.length > 0) { | |
65 | + Ext.Array.each(indices, function(item) { | |
66 | + module.linkedNodes.removeAt(item); | |
67 | + }); | |
68 | + } | |
69 | + } | |
70 | + } | |
71 | + } | |
72 | + } | |
73 | + Ext.apply(this, newConfig); | |
74 | + }, | |
80 | 75 | |
81 | - addResult: function(resultName, resultId, folderId, compression, format, processId) { | |
82 | - this.insert(0,[ {xtype : 'resultItem', type : this.type, title: resultName, folderId: folderId, resultId: resultId, compress : compression, format: format, processId: processId}]); | |
83 | - } | |
76 | + addResult: function(resultName, resultId, folderId, compression, format, processId) { | |
77 | + this.insert(0,[ {xtype : 'resultItem', type : this.type, title: resultName, folderId: folderId, resultId: resultId, compress : compression, format: format, processId: processId}]); | |
78 | + } | |
84 | 79 | }); |
85 | 80 | |
86 | 81 | Ext.define('amdaUI.ResultItem', { |
87 | - extend: 'Ext.form.FieldSet', | |
88 | - | |
89 | - alias: 'widget.resultItem', | |
90 | - | |
91 | - linkedNode : null, | |
92 | - | |
93 | - delete: function(processId) { | |
94 | - var module = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.result.id); | |
95 | - var jobLinkedNode = module.linkedNodes.getByKey(processId); | |
96 | - jobLinkedNode.deleteNode(); | |
97 | - module.linkedNodes.remove(jobLinkedNode); | |
98 | - }, | |
99 | - | |
100 | - saveTable: function(folderId,ttName) { | |
101 | - this.linkedNode = Ext.create('amdaModel.TimeTableNode',{leaf : true}); | |
102 | - AmdaAction.getTmpObject( | |
103 | - folderId, | |
104 | - ttName, | |
105 | - this.linkedNode.get('nodeType'), | |
106 | - this.getResultCallback, | |
107 | - this); | |
108 | - }, | |
82 | + extend: 'Ext.form.FieldSet', | |
83 | + | |
84 | + alias: 'widget.resultItem', | |
85 | + | |
86 | + linkedNode : null, | |
87 | + | |
88 | + delete: function(processId) { | |
89 | + var module = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.result.id); | |
90 | + alert(processId); | |
91 | + var jobLinkedNode = module.linkedNodes.getByKey(processId); | |
92 | + jobLinkedNode.deleteNode(); | |
93 | + module.linkedNodes.remove(jobLinkedNode); | |
94 | + }, | |
95 | + | |
96 | + saveTable: function(folderId,ttName) { | |
97 | + this.linkedNode = Ext.create('amdaModel.TimeTableNode',{leaf : true}); | |
98 | + AmdaAction.getTmpObject( | |
99 | + folderId, | |
100 | + ttName, | |
101 | + this.linkedNode.get('nodeType'), | |
102 | + this.getResultCallback, | |
103 | + this); | |
104 | + }, | |
109 | 105 | |
110 | - saveCatalog: function(folderId,ttName) { | |
111 | - this.linkedNode = Ext.create('amdaModel.CatalogNode',{leaf : true}); | |
112 | - AmdaAction.getTmpObject( | |
113 | - folderId, | |
114 | - ttName, | |
115 | - this.linkedNode.get('nodeType'), | |
116 | - this.getResultCallback, | |
117 | - this); | |
118 | - }, | |
106 | + saveCatalog: function(folderId,ttName) { | |
107 | + this.linkedNode = Ext.create('amdaModel.CatalogNode',{leaf : true}); | |
108 | + AmdaAction.getTmpObject( | |
109 | + folderId, | |
110 | + ttName, | |
111 | + this.linkedNode.get('nodeType'), | |
112 | + this.getResultCallback, | |
113 | + this); | |
114 | + }, | |
119 | 115 | |
120 | - getResultCallback : function(result,remoteEvent){//result, e) { | |
121 | - var t = remoteEvent.getTransaction(); | |
122 | - //AKKA - catch error | |
123 | - if (!remoteEvent.status) | |
124 | - { | |
125 | - myDesktopApp.errorMsg('Internal error'); | |
126 | - return; | |
127 | - } | |
128 | - | |
129 | - if (result.error) | |
130 | - { | |
131 | - myDesktopApp.errorMsg(result.error); | |
132 | - return; | |
133 | - } | |
134 | - | |
135 | - var paramObj = Ext.create(this.linkedNode.get('objectDataModel'), result); | |
136 | - paramObj.set('fromPlugin',true); | |
137 | - paramObj.set('intervals',result.intervals); | |
138 | - // set parameter into node | |
139 | - this.linkedNode.set('object',paramObj); | |
140 | - | |
141 | - var me = this; | |
142 | - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.result.id, true, function (module) { | |
143 | - module.setLinkedNode(me.linkedNode); | |
144 | - // Edition of parameter into parameter Module | |
145 | - me.linkedNode.editInModule(); | |
146 | - }); | |
147 | - }, | |
116 | + getResultCallback : function(result,remoteEvent){ //result, e) { | |
117 | + var t = remoteEvent.getTransaction(); | |
118 | + //AKKA - catch error | |
119 | + if (!remoteEvent.status){ | |
120 | + myDesktopApp.errorMsg('Internal error'); | |
121 | + return; | |
122 | + } | |
123 | + | |
124 | + if (result.error){ | |
125 | + myDesktopApp.errorMsg(result.error); | |
126 | + return; | |
127 | + } | |
128 | + | |
129 | + var paramObj = Ext.create(this.linkedNode.get('objectDataModel'), result); | |
130 | + paramObj.set('fromPlugin',true); | |
131 | + paramObj.set('intervals',result.intervals); | |
132 | + // set parameter into node | |
133 | + this.linkedNode.set('object',paramObj); | |
134 | + | |
135 | + var me = this; | |
136 | + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.result.id, true, function (module) { | |
137 | + module.setLinkedNode(me.linkedNode); | |
138 | + // Edition of parameter into parameter Module | |
139 | + me.linkedNode.editInModule(); | |
140 | + }); | |
141 | + }, | |
148 | 142 | |
149 | - onSendVOTableToSamp : function (clientId, sendOpt) | |
150 | - { | |
151 | - var o = {folderId : sendOpt.downFolder, downId : sendOpt.downId}; | |
143 | + onSendVOTableToSamp : function (clientId, sendOpt){ | |
144 | + var o = {folderId : sendOpt.downFolder, downId : sendOpt.downId}; | |
152 | 145 | |
153 | - var me = this; | |
154 | - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.interop.id, true, function (module) { | |
155 | - loadMask.show(); | |
156 | - | |
157 | - AmdaAction.sendToSAMP(o,function (result, e) | |
158 | - { | |
159 | - loadMask.hide(); | |
160 | - if (!result.success) | |
161 | - { | |
162 | - Ext.Msg.show( { | |
163 | - title : 'SAMP - Cannot send VOTable', | |
164 | - msg : result.message, | |
165 | - modal : true, | |
166 | - icon : Ext.Msg.ERROR, | |
167 | - buttons : Ext.Msg.OK | |
168 | - }); | |
169 | - return; | |
170 | - } | |
171 | - | |
172 | - Ext.each(result.files,function (file) | |
173 | - { | |
174 | - module.sendVOTable(file,clientId); | |
175 | - }, me); | |
176 | - }, | |
177 | - me); | |
178 | - }); | |
179 | - | |
180 | - | |
181 | - }, | |
146 | + var me = this; | |
147 | + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.interop.id, true, function (module) { | |
148 | + loadMask.show(); | |
149 | + | |
150 | + AmdaAction.sendToSAMP(o,function (result, e){ | |
151 | + loadMask.hide(); | |
152 | + if (!result.success) { | |
153 | + Ext.Msg.show( { | |
154 | + title : 'SAMP - Cannot send VOTable', | |
155 | + msg : result.message, | |
156 | + modal : true, | |
157 | + icon : Ext.Msg.ERROR, | |
158 | + buttons : Ext.Msg.OK | |
159 | + }); | |
160 | + return; | |
161 | + } | |
162 | + | |
163 | + Ext.each(result.files,function (file) { | |
164 | + module.sendVOTable(file,clientId); | |
165 | + }, me); | |
166 | + }, me); | |
167 | + }); | |
168 | + }, | |
182 | 169 | |
183 | - constructor: function(config) { | |
184 | - this.initConfig(config); | |
185 | - this.callParent(); | |
186 | - }, | |
170 | + constructor: function(config) { | |
171 | + this.initConfig(config); | |
172 | + this.callParent(); | |
173 | + }, | |
187 | 174 | |
188 | - initConfig: function(config){ | |
189 | - var jobtitle = config.title; | |
190 | - | |
191 | - switch (config.type) { | |
192 | - | |
193 | - case 'request' : | |
194 | - var resultId = config.resultId; | |
195 | - var folderId = config.folderId; | |
196 | - var href = 'data/'+sessionID+'/RES/'+ folderId + '/' + resultId; | |
175 | + initConfig: function(config){ | |
176 | + var jobtitle = config.title; | |
177 | + | |
178 | + switch (config.type) { | |
179 | + case 'request' : | |
180 | + var resultId = config.resultId; | |
181 | + var folderId = config.folderId; | |
182 | + var href = 'data/'+sessionID+'/RES/'+ folderId + '/' + resultId; | |
197 | 183 | break; |
198 | - case 'download' : | |
199 | - //TODO suffix parsing | |
200 | - var suffix = '.tar.gz'; | |
201 | - if (config.compress == 'zip') var suffix = '.zip'; | |
202 | - var downId = config.resultId; | |
203 | - var downFolder = config.folderId; | |
204 | - var href = 'data/'+sessionID+'/RES/'+ downFolder + '/' + downId + suffix; | |
205 | - break; | |
206 | - default: | |
207 | - } | |
208 | - | |
184 | + case 'download' : | |
185 | + //TODO suffix parsing | |
186 | + var suffix = '.tar.gz'; | |
187 | + if (config.compress == 'zip') var suffix = '.zip'; | |
188 | + var downId = config.resultId; | |
189 | + var downFolder = config.folderId; | |
190 | + var href = 'data/'+sessionID+'/RES/'+ downFolder + '/' + downId + suffix; | |
191 | + break; | |
192 | + default: | |
193 | + } | |
209 | 194 | |
210 | - var height = 60; | |
195 | + var height = 60; | |
211 | 196 | |
212 | - var configTT = { | |
213 | - intId : config.title, | |
214 | - height : height, | |
215 | - title: jobtitle, | |
216 | - collapsible: true, | |
217 | - defaultType: 'button', | |
218 | - items :[ | |
219 | - { | |
220 | - xtype: 'label', | |
221 | - text: 'Time Table ' | |
222 | - }, | |
223 | - { | |
224 | - text: 'Edit/Save', | |
225 | - scope : this, | |
226 | - handler: function() { | |
227 | - this.saveTable(config.folderId,config.resultId); | |
228 | - } | |
229 | - }, { | |
230 | - xtype: 'label', | |
231 | - text: ' || Gaps Time Table ' | |
232 | - }, | |
233 | - { | |
234 | - text: 'Edit/Save', | |
235 | - scope : this, | |
236 | - handler: function() { | |
237 | - this.saveTable(config.folderId,'Gaps_'+config.resultId); | |
238 | - } | |
239 | - }, { | |
240 | - xtype: 'label', | |
241 | - text: ' || ', | |
242 | - width: 50 | |
243 | - }, | |
244 | - { | |
245 | - text: 'Delete Both', | |
246 | - scope : this, | |
247 | - handler: function() { | |
248 | - this.delete(config.processId); | |
249 | - this.ownerCt.remove(this); | |
250 | - } | |
251 | - } | |
252 | - ] | |
253 | - }; | |
254 | - var configCat = { | |
255 | - intId : config.title, | |
256 | - height : height, | |
257 | - title: jobtitle, | |
258 | - collapsible: true, | |
259 | - defaultType: 'button', | |
260 | - items :[ | |
261 | - { | |
262 | - xtype: 'label', | |
263 | - text: 'Catalog ' | |
264 | - }, | |
265 | - { | |
266 | - text: 'Edit/Save', | |
267 | - scope : this, | |
268 | - handler: function() { | |
269 | - this.saveCatalog(config.folderId,config.resultId); | |
270 | - } | |
271 | - }, | |
272 | - { | |
273 | - text: 'Delete', | |
274 | - scope : this, | |
275 | - handler: function() { | |
276 | - this.delete(config.processId); | |
277 | - this.ownerCt.remove(this); | |
278 | - } | |
279 | - } | |
280 | - ] | |
281 | - }; | |
197 | + var configTT = { | |
198 | + intId : config.title, | |
199 | + height : height, | |
200 | + title: jobtitle, | |
201 | + collapsible: true, | |
202 | + defaultType: 'button', | |
203 | + items :[ | |
204 | + { | |
205 | + xtype: 'label', | |
206 | + text: 'Time Table ' | |
207 | + },{ | |
208 | + text: 'Edit/Save', | |
209 | + scope : this, | |
210 | + handler: function() { | |
211 | + this.saveTable(config.folderId,config.resultId); | |
212 | + } | |
213 | + }, { | |
214 | + xtype: 'label', | |
215 | + text: ' || Gaps Time Table ' | |
216 | + }, { | |
217 | + text: 'Edit/Save', | |
218 | + scope : this, | |
219 | + handler: function() { | |
220 | + this.saveTable(config.folderId,'Gaps_'+config.resultId); | |
221 | + } | |
222 | + }, { | |
223 | + xtype: 'label', | |
224 | + text: ' || ', | |
225 | + width: 50 | |
226 | + }, { | |
227 | + text: 'Delete Both', | |
228 | + scope : this, | |
229 | + handler: function() { | |
230 | + this.delete(config.processId); | |
231 | + this.ownerCt.remove(this); | |
232 | + } | |
233 | + }] | |
234 | + }; | |
282 | 235 | |
283 | -//TODO make this properly | |
284 | - | |
285 | - var configPlot = { | |
286 | - intId : config.processId, | |
287 | - height : height, | |
288 | - title : jobtitle, | |
289 | - collapsible: true, | |
290 | - defaultType: 'button', | |
291 | - items :[ | |
292 | - { | |
293 | - xtype: 'label', | |
294 | - text: 'Plot ' | |
295 | - }, | |
296 | - { | |
297 | - text: 'Download', | |
298 | - href: href, | |
299 | - target: '_blank', // removed in 4.1 , hrefTarget: '_blank' // used in 4.1 | |
300 | - hrefTarget: '_blank' | |
301 | - }, { | |
302 | - xtype: 'label', | |
303 | - text: ' || ' | |
304 | - }, | |
305 | - { | |
306 | - text: 'Delete', | |
307 | - scope : this, | |
308 | - handler: function() { | |
309 | - this.delete(config.processId); | |
310 | - this.ownerCt.remove(this); | |
311 | - } | |
312 | - } | |
313 | - ] | |
314 | - }; | |
315 | - | |
316 | - var configDown = { | |
317 | - intId : config.processId, | |
318 | - height : height, | |
319 | - title: jobtitle, | |
320 | - collapsible: true, | |
321 | - defaultType: 'button', | |
322 | - items :[ | |
323 | - { | |
324 | - xtype: 'label', | |
325 | - text: 'File ' | |
326 | - }, | |
327 | - { | |
328 | - text: 'Download', | |
329 | - href: href, | |
330 | - target: '_self', // removed in 4.1 , hrefTarget: '_blank' // used in 4.1 | |
331 | - hrefTarget: '_self' | |
332 | - }, { | |
333 | - xtype: 'label', | |
334 | - text: ' || ' | |
335 | - }, | |
336 | - { | |
337 | - text: 'Delete', | |
338 | - scope : this, | |
339 | - handler: function() { | |
340 | - this.delete(config.processId); | |
341 | - this.ownerCt.remove(this); | |
342 | - } | |
343 | - }, | |
344 | - { | |
345 | - xtype: 'label', | |
346 | - text: ' || ' | |
347 | - }, | |
348 | - { | |
349 | - xtype : 'sendToSampButton', | |
350 | - type : 'votable', | |
351 | - onSendToSamp : this.onSendVOTableToSamp, | |
352 | - sendOpt : {'downId' : downId, 'downFolder' : downFolder} | |
236 | + var configCat = { | |
237 | + intId : config.title, | |
238 | + height : height, | |
239 | + title: jobtitle, | |
240 | + collapsible: true, | |
241 | + defaultType: 'button', | |
242 | + items :[ | |
243 | + { | |
244 | + xtype: 'label', | |
245 | + text: 'Catalog ' | |
246 | + }, { | |
247 | + text: 'Edit/Save', | |
248 | + scope : this, | |
249 | + handler: function() { | |
250 | + this.saveCatalog(config.folderId,config.resultId); | |
251 | + } | |
252 | + }, { | |
253 | + text: 'Delete', | |
254 | + scope : this, | |
255 | + handler: function() { | |
256 | + this.delete(config.processId); | |
257 | + this.ownerCt.remove(this); | |
258 | + } | |
259 | + }] | |
260 | + }; | |
261 | + | |
262 | + //TODO make this properly | |
263 | + var configPlot = { | |
264 | + intId : config.processId, | |
265 | + height : height, | |
266 | + title : jobtitle, | |
267 | + collapsible: true, | |
268 | + defaultType: 'button', | |
269 | + items :[ | |
270 | + { | |
271 | + xtype: 'label', | |
272 | + text: 'Plot ' | |
273 | + }, { | |
274 | + text: 'Download', | |
275 | + href: href, | |
276 | + target: '_blank', // removed in 4.1 , hrefTarget: '_blank' // used in 4.1 | |
277 | + hrefTarget: '_blank' | |
278 | + }, { | |
279 | + xtype: 'label', | |
280 | + text: ' || ' | |
281 | + }, { | |
282 | + text: 'Delete', | |
283 | + scope : this, | |
284 | + handler: function() { | |
285 | + this.delete(config.processId); | |
286 | + this.ownerCt.remove(this); | |
287 | + } | |
288 | + }] | |
289 | + }; | |
290 | + | |
291 | + var configDown = { | |
292 | + intId : config.processId, | |
293 | + height : height, | |
294 | + title: jobtitle, | |
295 | + collapsible: true, | |
296 | + defaultType: 'button', | |
297 | + items :[ | |
298 | + { | |
299 | + xtype: 'label', | |
300 | + text: 'File ' | |
301 | + }, { | |
302 | + text: 'Download', | |
303 | + href: href, | |
304 | + target: '_self', // removed in 4.1 , hrefTarget: '_blank' // used in 4.1 | |
305 | + hrefTarget: '_self' | |
306 | + }, { | |
307 | + xtype: 'label', | |
308 | + text: ' || ' | |
309 | + }, | |
310 | + { | |
311 | + text: 'Delete', | |
312 | + scope : this, | |
313 | + handler: function() { | |
314 | + this.delete(config.processId); | |
315 | + this.ownerCt.remove(this); | |
316 | + } | |
317 | + },{ | |
318 | + xtype: 'label', | |
319 | + text: ' || ' | |
320 | + },{ | |
321 | + xtype : 'sendToSampButton', | |
322 | + type : 'votable', | |
323 | + onSendToSamp : this.onSendVOTableToSamp, | |
324 | + sendOpt : {'downId' : downId, 'downFolder' : downFolder} | |
325 | + }] | |
326 | + }; | |
327 | + | |
328 | + switch (config.type) { | |
329 | + case 'condition' : | |
330 | + Ext.apply(this, configTT); | |
331 | + break; | |
332 | + case 'statistics' : | |
333 | + Ext.apply(this, configCat); | |
334 | + break; | |
335 | + case 'request' : | |
336 | + Ext.apply(this, configPlot); | |
337 | + break; | |
338 | + case 'download' : | |
339 | + Ext.apply(this, configDown); | |
340 | + break; | |
341 | + default: | |
353 | 342 | } |
354 | - ] | |
355 | - }; | |
356 | - | |
357 | - switch (config.type) { | |
358 | - case 'condition' : | |
359 | - Ext.apply(this, configTT); | |
360 | - break; | |
361 | - case 'statistics' : | |
362 | - Ext.apply(this, configCat); | |
363 | - break; | |
364 | - case 'request' : | |
365 | - Ext.apply(this, configPlot); | |
366 | - break; | |
367 | - case 'download' : | |
368 | - Ext.apply(this, configDown); | |
369 | - break; | |
370 | - default: | |
371 | - } | |
372 | - | |
373 | - } | |
374 | - | |
343 | + } | |
375 | 344 | }); | ... | ... |