diff --git a/js/app/models/InteractiveNode.js b/js/app/models/InteractiveNode.js index 9a07da5..3c8ceba 100644 --- a/js/app/models/InteractiveNode.js +++ b/js/app/models/InteractiveNode.js @@ -602,8 +602,8 @@ Ext.define('amdaModel.InteractiveNode', { * Callback method needed to execute node deletion in tree if id in result or to show error msg */ realDelete : function() - { - AmdaAction.deleteObject({id: this.get('id'), leaf: this.isLeaf(), nodeType: this.get('nodeType')}, function(res,e){ + { + AmdaAction.deleteObject({id: this.get('id'), leaf: this.isLeaf(), nodeType: this.get('nodeType')}, function(res,e){ //TODO proper errors handling // node deletion in tree if (res) { // if success @@ -624,6 +624,14 @@ Ext.define('amdaModel.InteractiveNode', { if (editedNode.get('fileObject').get('fileName') == me.get('text')) isThisFile = true; + if (me.$className == 'amdaModel.DerivedParamNode') + { + var obj = { + paramId : 'ws_'+me.get('text') + }; + AmdaAction.compilParamDelete(obj); + } + if (editedNode === me || isThisFile){ var newNode = Ext.ModelManager.create({leaf : true}, me.$className); // several tabs could be connected to one node diff --git a/js/app/views/ParameterUI.js b/js/app/views/ParameterUI.js index d4ee3d0..fab194f 100755 --- a/js/app/views/ParameterUI.js +++ b/js/app/views/ParameterUI.js @@ -83,6 +83,25 @@ Ext.define('amdaUI.ParameterUI', { this.constructionField.setValue(expression); }, + /** + * Parameter compilation + */ + compilParam : function($action) { + var obj = { + paramId : 'ws_'+this.object.get('name') + }; + AmdaAction.compilParam(obj, function (result, e) { + if (!result || !result.success) + { + if (result.message) + myDesktopApp.warningMsg(result.message); + else + myDesktopApp.warningMsg('Unknown error during parameter compilation'); + return; + } + }); + }, + /** * save method called by Save button */ @@ -108,7 +127,7 @@ Ext.define('amdaUI.ParameterUI', { this.object = paramobj; if (toRename) paramModule.linkedNode.toRename = true; } - paramModule.linkedNode.create(); + paramModule.linkedNode.create({scope : this, callback : this.compilParam}); paramModule.linkedNode.set('iconCls', 'icon-scalar'); paramModule.linkedNode.set('isParameter', true); @@ -116,9 +135,9 @@ Ext.define('amdaUI.ParameterUI', { // this.object.fireEvent('create'); } else { paramModule.linkedNode.set('contextNode',paramModule.contextNode); - paramModule.linkedNode.update(); + paramModule.linkedNode.update({scope : this, callback : this.compilParam}); // this.object.fireEvent('modify'); - } + } } }, diff --git a/php/classes/AmdaAction.php b/php/classes/AmdaAction.php index ce82207..f226753 100644 --- a/php/classes/AmdaAction.php +++ b/php/classes/AmdaAction.php @@ -842,6 +842,33 @@ class AmdaAction { } /* + * Generate derived parameter compilation + */ + public function compilParam($obj) + { + require_once(INTEGRATION_SRC_DIR."RequestManager.php"); + return $this->executeRequest($obj, FunctionTypeEnumClass::PARAMSGEN); + } + +/* + * Delete derived parameter compilation + */ + public function compilParamDelete($obj) + { + require_once(INTEGRATION_SRC_DIR."RequestManager.php"); + $res = $this->checkUser($obj); + + if (!$res['success']) + return $res; + + IHMConfigClass::setUserName($this->user); + $libParamPath = IHMConfigClass::getCompilationPath()."lib/".$obj->paramId.".so"; + if (file_exists($libParamPath)) + unlink($libParamPath); + return array("success" => true); + } + +/* * kill plot process by tabID */ diff --git a/php/config.php b/php/config.php index 53f1ee2..e5c7743 100644 --- a/php/config.php +++ b/php/config.php @@ -251,6 +251,12 @@ $API = array( 'len'=>2 // 'formHandler'=>true ), + 'compilParam' => array( + 'len'=>1 + ), + 'compilParamDelete' => array( + 'len'=>1 + ), 'killPlotRequest' =>array( 'len'=>1 ), -- libgit2 0.21.2