Commit a0b3d64eed334fc579fa5b73aec3b72458f1cfdc
1 parent
5d15649f
Exists in
master
and in
111 other branches
Derived parameter compilation after a save
Showing
4 changed files
with
65 additions
and
5 deletions
Show diff stats
js/app/models/InteractiveNode.js
... | ... | @@ -602,8 +602,8 @@ Ext.define('amdaModel.InteractiveNode', { |
602 | 602 | * Callback method needed to execute node deletion in tree if id in result or to show error msg |
603 | 603 | */ |
604 | 604 | realDelete : function() |
605 | - { | |
606 | - AmdaAction.deleteObject({id: this.get('id'), leaf: this.isLeaf(), nodeType: this.get('nodeType')}, function(res,e){ | |
605 | + { | |
606 | + AmdaAction.deleteObject({id: this.get('id'), leaf: this.isLeaf(), nodeType: this.get('nodeType')}, function(res,e){ | |
607 | 607 | //TODO proper errors handling |
608 | 608 | // node deletion in tree |
609 | 609 | if (res) { // if success |
... | ... | @@ -624,6 +624,14 @@ Ext.define('amdaModel.InteractiveNode', { |
624 | 624 | if (editedNode.get('fileObject').get('fileName') == me.get('text')) |
625 | 625 | isThisFile = true; |
626 | 626 | |
627 | + if (me.$className == 'amdaModel.DerivedParamNode') | |
628 | + { | |
629 | + var obj = { | |
630 | + paramId : 'ws_'+me.get('text') | |
631 | + }; | |
632 | + AmdaAction.compilParamDelete(obj); | |
633 | + } | |
634 | + | |
627 | 635 | if (editedNode === me || isThisFile){ |
628 | 636 | var newNode = Ext.ModelManager.create({leaf : true}, me.$className); |
629 | 637 | // several tabs could be connected to one node |
... | ... |
js/app/views/ParameterUI.js
... | ... | @@ -83,6 +83,25 @@ Ext.define('amdaUI.ParameterUI', { |
83 | 83 | this.constructionField.setValue(expression); |
84 | 84 | }, |
85 | 85 | |
86 | + /** | |
87 | + * Parameter compilation | |
88 | + */ | |
89 | + compilParam : function($action) { | |
90 | + var obj = { | |
91 | + paramId : 'ws_'+this.object.get('name') | |
92 | + }; | |
93 | + AmdaAction.compilParam(obj, function (result, e) { | |
94 | + if (!result || !result.success) | |
95 | + { | |
96 | + if (result.message) | |
97 | + myDesktopApp.warningMsg(result.message); | |
98 | + else | |
99 | + myDesktopApp.warningMsg('Unknown error during parameter compilation'); | |
100 | + return; | |
101 | + } | |
102 | + }); | |
103 | + }, | |
104 | + | |
86 | 105 | /** |
87 | 106 | * save method called by Save button |
88 | 107 | */ |
... | ... | @@ -108,7 +127,7 @@ Ext.define('amdaUI.ParameterUI', { |
108 | 127 | this.object = paramobj; |
109 | 128 | if (toRename) paramModule.linkedNode.toRename = true; |
110 | 129 | } |
111 | - paramModule.linkedNode.create(); | |
130 | + paramModule.linkedNode.create({scope : this, callback : this.compilParam}); | |
112 | 131 | paramModule.linkedNode.set('iconCls', 'icon-scalar'); |
113 | 132 | paramModule.linkedNode.set('isParameter', true); |
114 | 133 | |
... | ... | @@ -116,9 +135,9 @@ Ext.define('amdaUI.ParameterUI', { |
116 | 135 | // this.object.fireEvent('create'); |
117 | 136 | } else { |
118 | 137 | paramModule.linkedNode.set('contextNode',paramModule.contextNode); |
119 | - paramModule.linkedNode.update(); | |
138 | + paramModule.linkedNode.update({scope : this, callback : this.compilParam}); | |
120 | 139 | // this.object.fireEvent('modify'); |
121 | - } | |
140 | + } | |
122 | 141 | } |
123 | 142 | }, |
124 | 143 | |
... | ... |
php/classes/AmdaAction.php
... | ... | @@ -842,6 +842,33 @@ class AmdaAction { |
842 | 842 | } |
843 | 843 | |
844 | 844 | /* |
845 | + * Generate derived parameter compilation | |
846 | + */ | |
847 | + public function compilParam($obj) | |
848 | + { | |
849 | + require_once(INTEGRATION_SRC_DIR."RequestManager.php"); | |
850 | + return $this->executeRequest($obj, FunctionTypeEnumClass::PARAMSGEN); | |
851 | + } | |
852 | + | |
853 | +/* | |
854 | + * Delete derived parameter compilation | |
855 | + */ | |
856 | + public function compilParamDelete($obj) | |
857 | + { | |
858 | + require_once(INTEGRATION_SRC_DIR."RequestManager.php"); | |
859 | + $res = $this->checkUser($obj); | |
860 | + | |
861 | + if (!$res['success']) | |
862 | + return $res; | |
863 | + | |
864 | + IHMConfigClass::setUserName($this->user); | |
865 | + $libParamPath = IHMConfigClass::getCompilationPath()."lib/".$obj->paramId.".so"; | |
866 | + if (file_exists($libParamPath)) | |
867 | + unlink($libParamPath); | |
868 | + return array("success" => true); | |
869 | + } | |
870 | + | |
871 | +/* | |
845 | 872 | * kill plot process by tabID |
846 | 873 | */ |
847 | 874 | |
... | ... |
php/config.php