Commit 4078a6350a1c7649b9dab3e4af232f8b953d8b8f

Authored by Elena.Budnik
1 parent 1910a90a

small cleanning up

Showing 2 changed files with 116 additions and 124 deletions   Show diff stats
js/app/models/BkgJobNode.js
... ... @@ -328,7 +328,7 @@ Ext.define('amdaModel.BkgJobNode', {
328 328 case 'condition' : var type = 'Data Mining '; break;
329 329 case 'request' : var type = 'Plot '; break;
330 330 case 'download' : var type = 'Download '; break;
331   - case 'statistics' : var type = 'Statistics '; break;
  331 + case 'statistics' : var type = 'Statistics '; break;
332 332 default: var type = 'unknown';
333 333 }
334 334 myDesktopApp.infoMsg('Your request is still running and has been assigned the name '+this.get('text')+' -- Check Jobs in Progress');
... ... @@ -424,8 +424,8 @@ Ext.define('amdaModel.BkgJobNode', {
424 424 var isNewTab = false;
425 425  
426 426 loadMask.show(this.get('object').get('tabId'));
427   - AmdaAction.execute({nodeType : this.get('nodeType')}, jsonObj, function(res,e){
428   -
  427 + AmdaAction.execute({nodeType : this.get('nodeType')}, jsonObj, function(res,e)
  428 + {
429 429 loadMask.hide();
430 430 //AKKA - Rework of the result treatment for the integration with the new kernel
431 431 if (!e.status)
... ...
js/app/models/ExecutableNode.js
... ... @@ -6,142 +6,134 @@
6 6 * @brief Generic Model of Executable Node
7 7 * @author elena
8 8 * @version $Id: ExecutableNode.js 1662 2013-07-02 15:10:22Z benjamin $
9   - * @todo
10   - *******************************************************************************
11   - * FT Id : Date : Name - Description
12   - *******************************************************************************
13   - * : :12/07/2011: elena - creation
14   - *
15 9 */
16 10  
17 11 Ext.define('amdaModel.ExecutableNode', {
18   - extend: 'amdaModel.InteractiveNode',
  12 + extend: 'amdaModel.InteractiveNode',
19 13  
20   -//TODO use resultModel in execute method Is it needed???
21   -
22   - fields: [ 'jobNode', 'resultModel'],
  14 + fields: [ 'jobNode', 'resultModel'],
23 15  
24   - statics: { jobTreeLoaded : false },
  16 + statics: { jobTreeLoaded : false },
25 17  
26   - constructor : function(config) {
27   - this.callParent(arguments);
28   - this.set('ownerTreeId',amdaUI.ExplorerUI.OPE_TAB.TREE_ID);
29   - this.set('jobNode', 'amdaModel.BkgJobNode');
30   - },
  18 + constructor : function(config)
  19 + {
  20 + this.callParent(arguments);
  21 + this.set('ownerTreeId',amdaUI.ExplorerUI.OPE_TAB.TREE_ID);
  22 + this.set('jobNode', 'amdaModel.BkgJobNode');
  23 + },
31 24  
32   - loadJobTree : function() {
33   - var rootNode = Ext.getCmp(amdaUI.ExplorerUI.JOB_TAB.TREE_ID).getRootNode();
34   - var me = this;
35   - amdaModel.InteractiveNode.preloadNodes(rootNode,
36   - function()
37   - {
38   - amdaModel.ExecutableNode.jobTreeLoaded = true;
39   - me.realExecute();
40   - });
41   - },
42   -
43   - execute : function(isDirty) {
44   -
45   - if (!amdaModel.ExecutableNode.jobTreeLoaded) this.loadJobTree();
46   - else this.realExecute();
47   -
48   - },
  25 + loadJobTree : function()
  26 + {
  27 + var rootNode = Ext.getCmp(amdaUI.ExplorerUI.JOB_TAB.TREE_ID).getRootNode();
  28 + var me = this;
  29 + amdaModel.InteractiveNode.preloadNodes(rootNode, function(){
  30 + amdaModel.ExecutableNode.jobTreeLoaded = true;
  31 + me.realExecute();
  32 + });
  33 + },
49 34  
50   - /**
51   - * Method to execute this node
52   - */
53   - realExecute : function() {
54   -
55   - var isInteractivePlot = (this.get('nodeType') == 'request') && (this.get('object').get('file-output') == 'INTERACTIVE');
  35 + execute : function(isDirty)
  36 + {
  37 + if (!amdaModel.ExecutableNode.jobTreeLoaded)
  38 + this.loadJobTree();
  39 + else
  40 + this.realExecute();
  41 + },
  42 +
  43 + /**
  44 + * Method to execute this node
  45 + */
  46 + realExecute : function()
  47 + {
  48 + var isInteractivePlot = (this.get('nodeType') == 'request') && (this.get('object').get('file-output') == 'INTERACTIVE');
56 49  
57   - if (!loadMask.isMasked())
58   - loadMask.show(isInteractivePlot);
  50 + if (!loadMask.isMasked())
  51 + loadMask.show(isInteractivePlot);
59 52  
60   - AmdaAction.execute({nodeType : this.get('nodeType')}, this.get('object').getJsonValues(true), function(res,e){
61   -
62   - loadMask.hide();
  53 + AmdaAction.execute({nodeType : this.get('nodeType')}, this.get('object').getJsonValues(true),
  54 + function(res,e)
  55 + {
  56 + loadMask.hide();
63 57  
64   - //AKKA - Rework of the result treatment for the integration with the new kernel
65   - if (!e.status)
66   - {
67   - myDesktopApp.errorMsg('Internal error during request');
68   - return;
69   - }
  58 + //AKKA - Rework of the result treatment for the integration with the new kernel
  59 + if (!e.status){
  60 + myDesktopApp.errorMsg('Internal error during request');
  61 + return;
  62 + }
70 63  
71   - if (!res.success)
72   - {
73   - myDesktopApp.errorMsg(res.message);
74   - return;
75   - }
76   -
77   - if (res.killed)
78   - return;
  64 + if (!res.success){
  65 + myDesktopApp.errorMsg(res.message);
  66 + return;
  67 + }
  68 +
  69 + if (res.killed)
  70 + return;
79 71  
80   - if (isInteractivePlot)
81   - {
82   - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id, true, function (module) {
83   - module.updateInteractiveSession(res, true);
84   - });
85   - }
86   - else
87   - {
88   - var newobj = this.createJobObject(res);
89   - var newNode = Ext.create(this.get('jobNode'),
90   - {
91   - info : res.info,
92   - jobType : this.get('nodeType'),
93   - processId : res.id,
94   - id : res.id,
95   - text : res.name,
96   - status : res.status,
97   - start : res.start,
98   - stop : res.stop,
99   - tabId : res.tabId,
100   - leaf : true,
101   - object : newobj});
  72 + if (isInteractivePlot){
  73 + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id, true, function (module) {
  74 + module.updateInteractiveSession(res, true);
  75 + });
  76 + }
  77 + else {
  78 + var newobj = this.createJobObject(res);
  79 + var newNode = Ext.create(this.get('jobNode'), {
  80 + info : res.info,
  81 + jobType : this.get('nodeType'),
  82 + processId : res.id,
  83 + id : res.id,
  84 + text : res.name,
  85 + status : res.status,
  86 + start : res.start,
  87 + stop : res.stop,
  88 + tabId : res.tabId,
  89 + leaf : true,
  90 + object : newobj
  91 + });
102 92  
103   - newNode.get('object').on('execute', function() {
104   - // Then call the node creation method
105   - this.execute(arguments);
106   - }, newNode);
  93 + newNode.get('object').on('execute', function() {
  94 + // Then call the node creation method
  95 + this.execute(arguments);
  96 + }, newNode);
107 97  
108   - switch (res.status)
109   - {
110   - case amdaModel.BkgJobNode.STATUS_LIST.DONE :
111   - newNode.createJobNode(true);
112   - newNode.editNode(true, false);
113   - break;
114   - case amdaModel.BkgJobNode.STATUS_LIST.IN_PROGRESS :
115   - newNode.createJobNode(false);
116   - break;
117   - default:
118   - newNode.createJobNode(true);
119   - }
120   - }
121   - }, this );
122   - },
  98 + switch (res.status)
  99 + {
  100 + case amdaModel.BkgJobNode.STATUS_LIST.DONE :
  101 + newNode.createJobNode(true);
  102 + newNode.editNode(true, false);
  103 + break;
  104 + case amdaModel.BkgJobNode.STATUS_LIST.IN_PROGRESS :
  105 + newNode.createJobNode(false);
  106 + break;
  107 + default:
  108 + newNode.createJobNode(true);
  109 + }
  110 + }
  111 + }, this );
  112 + },
123 113  
124   - createJobObject: function(res) {
125   -
126   - var obj = this.get('object').getJsonValues();
127   -//TODO text, name, outputName - if all is needed
128   - //new object to attach to new bkgJobNode
129   -//TODO Ext.clone()
130   - var newobj = Ext.copyTo({}, obj, this.get('object').propertiesToCopy);
131   - newobj.resultId = res.result;
132   - newobj.folderId = res.folder;
133   - newobj.processId= res.id;
134   - newobj.tabId = res.tabId;
135   - newobj.name = res.name;
136   - newobj = Ext.create(this.get('object').$className, newobj);
137   - return newobj;
  114 + createJobObject: function(res)
  115 + {
  116 + var obj = this.get('object').getJsonValues();
  117 + //TODO text, name, outputName - if all is needed
  118 +
  119 + //new object to attach to new bkgJobNode
  120 + //TODO Ext.clone()
  121 + var newobj = Ext.copyTo({}, obj, this.get('object').propertiesToCopy);
  122 + newobj.resultId = res.result;
  123 + newobj.folderId = res.folder;
  124 + newobj.processId= res.id;
  125 + newobj.tabId = res.tabId;
  126 + newobj.name = res.name;
  127 + newobj = Ext.create(this.get('object').$className, newobj);
  128 +
  129 + return newobj;
138 130 },
139   - /**
140   - * override isExecutable to return true
141   - */
142   - isExecutable: function(){
143   - return true;
144   - }
145   -
  131 +
  132 + /**
  133 + * override isExecutable to return true
  134 + */
  135 + isExecutable: function()
  136 + {
  137 + return true;
  138 + }
146 139 });
147   -
... ...