diff --git a/js/app/models/BkgJobNode.js b/js/app/models/BkgJobNode.js index 9580ae9..31c4cc9 100644 --- a/js/app/models/BkgJobNode.js +++ b/js/app/models/BkgJobNode.js @@ -328,7 +328,7 @@ Ext.define('amdaModel.BkgJobNode', { case 'condition' : var type = 'Data Mining '; break; case 'request' : var type = 'Plot '; break; case 'download' : var type = 'Download '; break; - case 'statistics' : var type = 'Statistics '; break; + case 'statistics' : var type = 'Statistics '; break; default: var type = 'unknown'; } 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', { var isNewTab = false; loadMask.show(this.get('object').get('tabId')); - AmdaAction.execute({nodeType : this.get('nodeType')}, jsonObj, function(res,e){ - + AmdaAction.execute({nodeType : this.get('nodeType')}, jsonObj, function(res,e) + { loadMask.hide(); //AKKA - Rework of the result treatment for the integration with the new kernel if (!e.status) diff --git a/js/app/models/ExecutableNode.js b/js/app/models/ExecutableNode.js index 63a208c..336d6f2 100644 --- a/js/app/models/ExecutableNode.js +++ b/js/app/models/ExecutableNode.js @@ -6,142 +6,134 @@ * @brief Generic Model of Executable Node * @author elena * @version $Id: ExecutableNode.js 1662 2013-07-02 15:10:22Z benjamin $ - * @todo - ******************************************************************************* - * FT Id : Date : Name - Description - ******************************************************************************* - * : :12/07/2011: elena - creation - * */ Ext.define('amdaModel.ExecutableNode', { - extend: 'amdaModel.InteractiveNode', + extend: 'amdaModel.InteractiveNode', -//TODO use resultModel in execute method Is it needed??? - - fields: [ 'jobNode', 'resultModel'], + fields: [ 'jobNode', 'resultModel'], - statics: { jobTreeLoaded : false }, + statics: { jobTreeLoaded : false }, - constructor : function(config) { - this.callParent(arguments); - this.set('ownerTreeId',amdaUI.ExplorerUI.OPE_TAB.TREE_ID); - this.set('jobNode', 'amdaModel.BkgJobNode'); - }, + constructor : function(config) + { + this.callParent(arguments); + this.set('ownerTreeId',amdaUI.ExplorerUI.OPE_TAB.TREE_ID); + this.set('jobNode', 'amdaModel.BkgJobNode'); + }, - loadJobTree : function() { - var rootNode = Ext.getCmp(amdaUI.ExplorerUI.JOB_TAB.TREE_ID).getRootNode(); - var me = this; - amdaModel.InteractiveNode.preloadNodes(rootNode, - function() - { - amdaModel.ExecutableNode.jobTreeLoaded = true; - me.realExecute(); - }); - }, - - execute : function(isDirty) { - - if (!amdaModel.ExecutableNode.jobTreeLoaded) this.loadJobTree(); - else this.realExecute(); - - }, + loadJobTree : function() + { + var rootNode = Ext.getCmp(amdaUI.ExplorerUI.JOB_TAB.TREE_ID).getRootNode(); + var me = this; + amdaModel.InteractiveNode.preloadNodes(rootNode, function(){ + amdaModel.ExecutableNode.jobTreeLoaded = true; + me.realExecute(); + }); + }, - /** - * Method to execute this node - */ - realExecute : function() { - - var isInteractivePlot = (this.get('nodeType') == 'request') && (this.get('object').get('file-output') == 'INTERACTIVE'); + execute : function(isDirty) + { + if (!amdaModel.ExecutableNode.jobTreeLoaded) + this.loadJobTree(); + else + this.realExecute(); + }, + + /** + * Method to execute this node + */ + realExecute : function() + { + var isInteractivePlot = (this.get('nodeType') == 'request') && (this.get('object').get('file-output') == 'INTERACTIVE'); - if (!loadMask.isMasked()) - loadMask.show(isInteractivePlot); + if (!loadMask.isMasked()) + loadMask.show(isInteractivePlot); - AmdaAction.execute({nodeType : this.get('nodeType')}, this.get('object').getJsonValues(true), function(res,e){ - - loadMask.hide(); + AmdaAction.execute({nodeType : this.get('nodeType')}, this.get('object').getJsonValues(true), + function(res,e) + { + loadMask.hide(); - //AKKA - Rework of the result treatment for the integration with the new kernel - if (!e.status) - { - myDesktopApp.errorMsg('Internal error during request'); - return; - } + //AKKA - Rework of the result treatment for the integration with the new kernel + if (!e.status){ + myDesktopApp.errorMsg('Internal error during request'); + return; + } - if (!res.success) - { - myDesktopApp.errorMsg(res.message); - return; - } - - if (res.killed) - return; + if (!res.success){ + myDesktopApp.errorMsg(res.message); + return; + } + + if (res.killed) + return; - if (isInteractivePlot) - { - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id, true, function (module) { - module.updateInteractiveSession(res, true); - }); - } - else - { - var newobj = this.createJobObject(res); - var newNode = Ext.create(this.get('jobNode'), - { - info : res.info, - jobType : this.get('nodeType'), - processId : res.id, - id : res.id, - text : res.name, - status : res.status, - start : res.start, - stop : res.stop, - tabId : res.tabId, - leaf : true, - object : newobj}); + if (isInteractivePlot){ + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id, true, function (module) { + module.updateInteractiveSession(res, true); + }); + } + else { + var newobj = this.createJobObject(res); + var newNode = Ext.create(this.get('jobNode'), { + info : res.info, + jobType : this.get('nodeType'), + processId : res.id, + id : res.id, + text : res.name, + status : res.status, + start : res.start, + stop : res.stop, + tabId : res.tabId, + leaf : true, + object : newobj + }); - newNode.get('object').on('execute', function() { - // Then call the node creation method - this.execute(arguments); - }, newNode); + newNode.get('object').on('execute', function() { + // Then call the node creation method + this.execute(arguments); + }, newNode); - switch (res.status) - { - case amdaModel.BkgJobNode.STATUS_LIST.DONE : - newNode.createJobNode(true); - newNode.editNode(true, false); - break; - case amdaModel.BkgJobNode.STATUS_LIST.IN_PROGRESS : - newNode.createJobNode(false); - break; - default: - newNode.createJobNode(true); - } - } - }, this ); - }, + switch (res.status) + { + case amdaModel.BkgJobNode.STATUS_LIST.DONE : + newNode.createJobNode(true); + newNode.editNode(true, false); + break; + case amdaModel.BkgJobNode.STATUS_LIST.IN_PROGRESS : + newNode.createJobNode(false); + break; + default: + newNode.createJobNode(true); + } + } + }, this ); + }, - createJobObject: function(res) { - - var obj = this.get('object').getJsonValues(); -//TODO text, name, outputName - if all is needed - //new object to attach to new bkgJobNode -//TODO Ext.clone() - var newobj = Ext.copyTo({}, obj, this.get('object').propertiesToCopy); - newobj.resultId = res.result; - newobj.folderId = res.folder; - newobj.processId= res.id; - newobj.tabId = res.tabId; - newobj.name = res.name; - newobj = Ext.create(this.get('object').$className, newobj); - return newobj; + createJobObject: function(res) + { + var obj = this.get('object').getJsonValues(); + //TODO text, name, outputName - if all is needed + + //new object to attach to new bkgJobNode + //TODO Ext.clone() + var newobj = Ext.copyTo({}, obj, this.get('object').propertiesToCopy); + newobj.resultId = res.result; + newobj.folderId = res.folder; + newobj.processId= res.id; + newobj.tabId = res.tabId; + newobj.name = res.name; + newobj = Ext.create(this.get('object').$className, newobj); + + return newobj; }, - /** - * override isExecutable to return true - */ - isExecutable: function(){ - return true; - } - + + /** + * override isExecutable to return true + */ + isExecutable: function() + { + return true; + } }); - -- libgit2 0.21.2