Commit f286b43ccbca0439d2b5d3566cb050aed695f451

Authored by Elena.Budnik
1 parent d45f025c

process response errors while adding remote Param

js/app/views/ParamsMgrUI.js
@@ -294,10 +294,11 @@ Ext.define('amdaUI.ParamsMgrUI',{ @@ -294,10 +294,11 @@ Ext.define('amdaUI.ParamsMgrUI',{
294 { 294 {
295 e.preventDefault();//stopEvent(); 295 e.preventDefault();//stopEvent();
296 if (tree.id == 'destination' && rec.getDepth() > 0) 296 if (tree.id == 'destination' && rec.getDepth() > 0)
297 - menu.showAt(e.getXY()); 297 + menu.showAt(e.getXY());
298 } 298 }
299 } 299 }
300 - }); 300 + });
  301 +
301 return tree; 302 return tree;
302 }, 303 },
303 304
@@ -318,32 +319,39 @@ Ext.define('amdaUI.ParamsMgrUI',{ @@ -318,32 +319,39 @@ Ext.define('amdaUI.ParamsMgrUI',{
318 }, 319 },
319 320
320 successCallBack : function(batch, options) { 321 successCallBack : function(batch, options) {
321 - loadMask.hide();  
322 - var createdNodes = options.operations.create;  
323 - // define Pathes to the created nodes  
324 - Arr = [];  
325 - Ext.Array.each(createdNodes,function(item){  
326 - // if (item.getDepth() == 5) { // parameter level  
327 - if (item.get('isParameter')){ // parameter level  
328 - Arr.push(item.getPath('id', '|'));  
329 - }  
330 - });  
331 - // reload destination tree and expand created nodes  
332 - var panel = this.destTree;  
333 - var store = this.destTree.getStore();  
334 - var root = store.getRootNode();  
335 - store.load({ node : root,  
336 - params : { nodeType: 'destination',  
337 - baseId : this.baseId },  
338 - scope : this,  
339 - callback : function(){  
340 - for (var i = 0; i < Arr.length; i++){  
341 - panel.selectPath(Arr[i], 'id', '|'); 322 + loadMask.hide();
  323 + // Check Errors
  324 + var res = batch.operations[0].response.result;
  325 + if (res.err) {
  326 + myDesktopApp.errorMsg(res.err);
  327 + this.loadTree('destination');
  328 + }
  329 + else {
  330 + var createdNodes = options.operations.create;
  331 + // define Pathes to the created nodes
  332 + Arr = [];
  333 + Ext.Array.each(createdNodes,function(item){
  334 + if (item.get('isParameter')){ // parameter level
  335 + Arr.push(item.getPath('id', '|'));
342 } 336 }
343 - }  
344 - });  
345 -  
346 - this.updateUserTree(); 337 + });
  338 + // reload destination tree and expand created nodes
  339 + var panel = this.destTree;
  340 + var store = this.destTree.getStore();
  341 + var root = store.getRootNode();
  342 + store.load({ node : root,
  343 + params : { nodeType: 'destination',
  344 + baseId : this.baseId },
  345 + scope : this,
  346 + callback : function(){
  347 + for (var i = 0; i < Arr.length; i++){
  348 + panel.selectPath(Arr[i], 'id', '|');
  349 + }
  350 + }
  351 + });
  352 +
  353 + this.updateUserTree();
  354 + }
347 }, 355 },
348 356
349 failureCallBack : function(batch, options) { 357 failureCallBack : function(batch, options) {
@@ -371,7 +379,7 @@ Ext.define(&#39;amdaUI.ParamsMgrUI&#39;,{ @@ -371,7 +379,7 @@ Ext.define(&#39;amdaUI.ParamsMgrUI&#39;,{
371 } 379 }
372 }); 380 });
373 } 381 }
374 - myDesktopApp.infoMsg('Modifs have been saved'); 382 + myDesktopApp.infoMsg('Parameter Tree has been updated');
375 }, 383 },
376 384
377 /* 385 /*
php/RemoteDataCenter/RemoteParamManager.php
@@ -142,8 +142,8 @@ class RemoteParamManager @@ -142,8 +142,8 @@ class RemoteParamManager
142 $status = $this->center->addViToDD(); 142 $status = $this->center->addViToDD();
143 143
144 if (!$status) return false; 144 if (!$status) return false;
145 - //TODO "http://apus.irap.omp.eu/  
146 - $remoteDatasetInfo = "/home/budnik/DDBASE/INFO/bases/".$this->center->baseID."/".$this->center->infoFile; 145 +
  146 + $remoteDatasetInfo = INFOSITE."/INFO/bases/".$this->center->baseID."/".$this->center->infoFile;
147 $localDatasetInfo = RemoteData.$this->center->baseID."/".$this->center->infoFile; 147 $localDatasetInfo = RemoteData.$this->center->baseID."/".$this->center->infoFile;
148 148
149 if (!copy($remoteDatasetInfo,$localDatasetInfo)) return false; 149 if (!copy($remoteDatasetInfo,$localDatasetInfo)) return false;