Commit 05ebfb1e476dd9015b108188a7e56665a4afc186

Authored by Elena.Budnik
1 parent db2c0c60
Exists in alias

alias, first commit

js/app/models/AliasNode.js
... ... @@ -18,120 +18,121 @@ Ext.define('amdaModel.AliasNode', {
18 18 deletedAliases : null
19 19 },
20 20  
21   - constructor : function(config)
22   - {
23   - this.callParent(arguments);
24   - if (this.get('leaf')) this.set('iconCls', 'icon-scalar');
25   - },
  21 + constructor : function(config) {
  22 + this.callParent(arguments);
  23 + if (this.get('leaf')) this.set('iconCls', 'icon-scalar');
  24 + },
26 25  
27   - allMenuItems : function() {
28   - var menuItems =
29   - [{
30   - fnId : 'leaf-deleteNode',
31   - text : 'Delete Alias'
32   - },{
33   - fnId : 'leaf-plotParam',
34   - text : 'Plot Parameter',
35   - hidden : true
36   - }, {
37   - fnId : 'leaf-downParam',
38   - text : 'Download Parameter',
39   - hidden : true
40   - }];
  26 + allMenuItems : function() {
  27 + var menuItems =
  28 + [{
  29 + fnId : 'leaf-deleteNode',
  30 + text : 'Delete Alias'
  31 + },{
  32 + fnId : 'leaf-plotParam',
  33 + text : 'Plot Parameter',
  34 + hidden : true
  35 + }, {
  36 + fnId : 'leaf-downParam',
  37 + text : 'Download Parameter',
  38 + hidden : true
  39 + }];
41 40  
42   - return menuItems;
43   - },
  41 + return menuItems;
  42 + },
44 43  
45   -
46   - create: function(alias, param) {
47   - AmdaAction.createObject({name: alias, param: param,
48   - nodeType:amdaModel.AliasNode.nodeType, leaf:true}, null,
49   - function(result, e){
50   - var t = e.getTransaction();
51   - if (e.status) {
52   - // SUCCESS
53   - if (result && !result.error) {
54   - if ( result == "OK" ) {
55   - Ext.Msg.alert('Complete', 'New alias '+ alias +' has been created');
56   - // set text of this node
57   - this.set('text', alias);
58   - //TODO id from server
59   - this.set('id', 'alias_' + param);
60   - // create node in tree as child of contextNode
61   - this.get('rootNode').appendChild(this);
62   - // set the tooltip
63   - this.set('info',param);
64   - }
65   - } else {
66   - // EXCEPTION :
67   - alert(t.action + "." + t.method + " : " + e.message);
68   - }
69   - }
70   - else
71   - {
72   - // FAILURE
73   - Ext.Msg.show({title:'Error System', msg: e.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK});
74   - }
75   - },this);
  44 + create: function(alias, param, component_info) {
  45 + //if (!Ext.Object.isEmpty(component_info)))
  46 + AmdaAction.createObject({ name: alias, param: param, component_info : component_info,
  47 + nodeType:amdaModel.AliasNode.nodeType, leaf:true }, null,
  48 + function(result, e){
  49 + var t = e.getTransaction();
  50 + if (e.status) {
  51 + // SUCCESS
  52 + if (result && !result.error) {
  53 + if ( result == "OK" ) {
  54 + Ext.Msg.alert('Complete', 'New alias '+ alias +' has been created');
  55 + // set text of this node
  56 + this.set('text', alias);
  57 + //TODO id from server
  58 + this.set('id', 'alias_' + param);
  59 + // create node in tree as child of contextNode
  60 + this.get('rootNode').appendChild(this);
  61 + // set the tooltip
  62 + this.set('info', param);
  63 + this.set('component_info',component_info);
  64 + }
  65 + } else {
  66 + // EXCEPTION :
  67 + alert(t.action + "." + t.method + " : " + e.message);
  68 + }
  69 + }
  70 + else
  71 + {
  72 + // FAILURE
  73 + Ext.Msg.show({title:'Error System', msg: e.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK});
  74 + }
  75 + },this);
76 76 },
77   -
78   - renameNode: function(old_alias,alias, param) {
79   - AmdaAction.renameObject({id : param, old_name: old_alias, name: alias,
80   - parent : this.parentNode.get('id'), leaf: this.isLeaf(), nodeType: this.get('nodeType')},
81   - function(result, e){
82   - var t = e.getTransaction();
83   - if (e.status) {
84   - // SUCCESS
85   - if (result && !result.error) {
86   - if ( result.id ) {
87   - Ext.Msg.alert('Complete', 'Alias '+ alias +' has been renamed');
88   - // set text of this node
89   - this.set('text', alias);
90   - //TODO id from server
91   - this.set('id', 'alias_' + param);
92   - // create node in tree as child of contextNode
93   - this.get('rootNode').appendChild(this);
94   -
95   - }
96   - } else {
97   - // EXCEPTION :
98   - alert(t.action + "." + t.method + " : " + e.message);
99   - }
100   - }
101   - else
102   - {
103   - // FAILURE
104   - Ext.Msg.show({title:'Error System', msg: e.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK});
105   - }
106   - },this);
107   - },
108   -
109   - deleteNode: function() {
110   - this.callParent();
111   -//temporary array to keep deleted aliases during this session
112   - if (!amdaModel.AliasNode.deletedAliases) {
113   - amdaModel.AliasNode.deletedAliases = new Array();
114   - }
115   - amdaModel.AliasNode.deletedAliases.push(this.get('id').substr(6));
116 77  
117   - // Replace alias by parameter name in active window
118   - Ext.Array.each(myDesktopApp.paramModulesID, function(id){
119   - var module = myDesktopApp.getLoadedModule(id);
120   - if (module) {
121   - module.getUiContent().updateConstruct("#"+this.get('text'),this.get('id').substr(6));
122   - }
123   - }, this);
124   -
125   - // Reset alias of parameter in local data tree or in remote data tree
126   - var tree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID);
127   - var rootNode = tree.getRootNode().findChild('id','myLocalData-treeRootNode',true);
128   -
129   - var paramNode = rootNode.findChild('id', this.get('id').substr(6),true);
130   -
131   - if (paramNode == null) {
132   - var rootNode = tree.getRootNode().findChild('id','myRemoteData-treeRootNode',true);
  78 + renameNode: function(old_alias,alias, param) {
  79 + AmdaAction.renameObject({id : param, old_name: old_alias, name: alias,
  80 + parent : this.parentNode.get('id'), leaf: this.isLeaf(), nodeType: this.get('nodeType')},
  81 + function(result, e){
  82 + var t = e.getTransaction();
  83 + if (e.status) {
  84 + // SUCCESS
  85 + if (result && !result.error) {
  86 + if ( result.id ) {
  87 + Ext.Msg.alert('Complete', 'Alias '+ alias +' has been renamed');
  88 + // set text of this node
  89 + this.set('text', alias);
  90 + //TODO id from server
  91 + this.set('id', 'alias_' + param);
  92 + // create node in tree as child of contextNode
  93 + this.get('rootNode').appendChild(this);
  94 +
  95 + }
  96 + } else {
  97 + // EXCEPTION :
  98 + alert(t.action + "." + t.method + " : " + e.message);
  99 + }
  100 + }
  101 + else
  102 + {
  103 + // FAILURE
  104 + Ext.Msg.show({title:'Error System', msg: e.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK});
  105 + }
  106 + },this);
  107 + },
  108 +
  109 + deleteNode: function() {
  110 + this.callParent();
  111 + //temporary array to keep deleted aliases during this session
  112 + if (!amdaModel.AliasNode.deletedAliases) {
  113 + amdaModel.AliasNode.deletedAliases = new Array();
  114 + }
  115 + amdaModel.AliasNode.deletedAliases.push(this.get('id').substr(6));
  116 +
  117 + // Replace alias by parameter name in active window
  118 + Ext.Array.each(myDesktopApp.paramModulesID, function(id){
  119 + var module = myDesktopApp.getLoadedModule(id);
  120 + if (module) {
  121 + module.getUiContent().updateConstruct("#"+this.get('text'),this.get('id').substr(6));
  122 + }
  123 + }, this);
  124 +
  125 + // Reset alias of parameter in local data tree or in remote data tree
  126 + var tree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID);
  127 + var rootNode = tree.getRootNode().findChild('id','myLocalData-treeRootNode',true);
  128 +
133 129 var paramNode = rootNode.findChild('id', this.get('id').substr(6),true);
134   - }
135   - if (paramNode) paramNode.set('alias',null);
136   - }
  130 +
  131 + if (paramNode == null) {
  132 + var rootNode = tree.getRootNode().findChild('id','myRemoteData-treeRootNode',true);
  133 + var paramNode = rootNode.findChild('id', this.get('id').substr(6),true);
  134 + }
  135 +
  136 + if (paramNode) paramNode.set('alias',null);
  137 + }
137 138 });
... ...
js/app/models/InteractiveNode.js
... ... @@ -22,7 +22,8 @@ Ext.define('amdaModel.InteractiveNode', {
22 22 {name: 'moduleId', type: 'string', persist: false},
23 23 {name: 'filtered', type: 'boolean', defaultValue: false, persist: false},
24 24 {name: 'needsArgs', type:'boolean', defaultValue: false},
25   - {name: 'disable', type: 'boolean', defaultValue: false, persist: false}
  25 + {name: 'disable', type: 'boolean', defaultValue: false, persist: false},
  26 + {name: 'component_info', type: 'object', persist: false}
26 27 ],
27 28  
28 29 statics: {
... ... @@ -475,18 +476,18 @@ Ext.define('amdaModel.InteractiveNode', {
475 476 case 'amdaModel.AliasNode' :
476 477 paramName = "#"+node.get('text');
477 478 break;
478   - case 'amdaModel.DerivedParamComponentNode' :
479   - paramId = node.get('text');
480   - var parentId = paramId.substr(0, paramId.length - 3);
481   - paramName= "ws_" + parentId;
482   - var regExp = /\(([\d]+)\)/;
483   - var component_index = regExp.exec(paramId);
484   - if (component_index)
485   - {
486   - components = [];
487   - components['index1'] = component_index[1];
488   - }
489   - break;
  479 + case 'amdaModel.DerivedParamComponentNode' :
  480 + paramId = node.get('text');
  481 + var parentId = paramId.substr(0, paramId.length - 3);
  482 + paramName= "ws_" + parentId;
  483 + var regExp = /\(([\d]+)\)/;
  484 + var component_index = regExp.exec(paramId);
  485 + if (component_index)
  486 + {
  487 + components = [];
  488 + components['index1'] = component_index[1];
  489 + }
  490 + break;
490 491 case 'amdaModel.DerivedParamNode' :
491 492 paramName = "ws_"+node.get('text');
492 493 break;
... ...
js/app/models/LocalParamNode.js
... ... @@ -98,13 +98,9 @@ Ext.define('amdaModel.LocalParamNode',
98 98 fnId : 'para-createDerivedParam',
99 99 text : 'Create Derived Parameter',
100 100 hidden : true
101   - }, {
102   - fnId : 'leaf-createAlias',
103   - text : 'Create/Edit Alias',
104   - hidden : true
105 101 },{
106   - fnId : 'leaf-createDerivedParam',
107   - text : 'Create Derived Parameter',
  102 + fnId : 'para-createAlias',
  103 + text : 'Create/Edit Alias',
108 104 hidden : true
109 105 },{
110 106 fnId : 'leaf-plotParam',
... ... @@ -114,7 +110,15 @@ Ext.define('amdaModel.LocalParamNode',
114 110 fnId : 'leaf-downParam',
115 111 text : 'Download Parameter',
116 112 hidden : true
117   - }, {
  113 + },{
  114 + fnId : 'leaf-createDerivedParam',
  115 + text : 'Create Derived Parameter',
  116 + hidden : true
  117 + }, {
  118 + fnId : 'leaf-createAlias',
  119 + text : 'Create/Edit Alias',
  120 + hidden : true
  121 + },{
118 122 fnId : 'miss-epnTap',
119 123 text : 'Display EPN-TAP services',
120 124 hidden : true
... ... @@ -160,6 +164,7 @@ Ext.define('amdaModel.LocalParamNode',
160 164 }
161 165 }
162 166 break;
  167 + case 'para-createAlias':
163 168 case 'leaf-createAlias':
164 169 if (!this.get('disable')) {
165 170 if (this.get('notyet')) {
... ... @@ -201,7 +206,7 @@ Ext.define('amdaModel.LocalParamNode',
201 206 createAlias: function(node)
202 207 {
203 208 var win = myDesktopApp.desktop.getWindow('alias-win');
204   - if (!node.get('needsArgs') && node.get('leaf'))
  209 + if (!node.get('needsArgs'))
205 210 {
206 211 if(!win)
207 212 {
... ...
js/app/models/PlotObjects/PlotPanelObject.js
... ... @@ -317,6 +317,11 @@ Ext.define('amdaPlotObj.PlotPanelObject', {
317 317 if (components['index2']) {
318 318 recs[0].set('dim2-index', components['index2']);
319 319 }
  320 + // it is alias
  321 + if (components['paramId']) {
  322 + recs[0].set('real-paramid', components['paramId']);
  323 + recs[0].set('real-type', 1);
  324 + }
320 325 }
321 326  
322 327 recs[0].set('param-type', isTTCat ? 'ttcat' : 'param');
... ...
js/app/models/RequestParamObject.js
... ... @@ -21,8 +21,10 @@ Ext.define('amdaModel.RequestParamObject', {
21 21 getEmptyObj: function() {
22 22 return {
23 23 'paramid': '',
  24 + 'real-paramid': '',
24 25 'is-init': false,
25   - 'type': 0,
  26 + 'type': 0,
  27 + 'real-type': 0,
26 28 'dim1-index': '*',
27 29 'dim1-sum-type': 0,
28 30 'dim1-min-value': 0.,
... ... @@ -44,8 +46,10 @@ Ext.define('amdaModel.RequestParamObject', {
44 46  
45 47 fields : [
46 48 {name: 'type', type: 'int'}, /* Parameter type. 0: Scalar, 1: Tab1D, 2: Tab2D */
  49 + {name: 'real-type', type: 'int'}, /* for aliases */
47 50 {name: 'is-init', type: 'bool', default:false},
48 51 {name: 'paramid', type: 'string'},
  52 + {name: 'real-paramid', type: 'string'}, /* for aliases */
49 53 /* Fields for dim1 */
50 54 {name: 'dim1-index', type: 'string', defaultValue: '*'},
51 55 {name: 'dim1-sum-type', type: 'int', defaultValue: 0}, /* Sum type. 0: None, 1: sum into values range, 2: sum between indexes */
... ... @@ -134,9 +138,12 @@ Ext.define('amdaModel.RequestParamObject', {
134 138 getJsonValues : function()
135 139 {
136 140 var paramValues = new Object();
137   -
138 141 paramValues['id'] = this.get('id');
139   - paramValues['paramid'] = this.get('paramid');
  142 + if (this.get('real-paramid') == '')
  143 + paramValues['paramid'] = this.get('paramid');
  144 + else
  145 + paramValues['paramid'] = this.get('real-paramid');
  146 +
140 147 paramValues['name'] = this.get('name');
141 148  
142 149 paramValues['dim1-index'] = this.get('dim1-index');
... ... @@ -153,7 +160,11 @@ Ext.define('amdaModel.RequestParamObject', {
153 160 paramValues['dim2-min-index'] = this.get('dim2-min-index');
154 161 paramValues['dim2-max-index'] = this.get('dim2-max-index');
155 162  
156   - paramValues['type'] = this.get('type');
  163 + if (this.get('real-type') > 0)
  164 + paramValues['type'] = this.get('real-type');
  165 + else
  166 + paramValues['type'] = this.get('type');
  167 +
157 168 paramValues['is-init'] = this.get('is-init');
158 169  
159 170 if (this.get('template_args') != null) {
... ...
js/app/views/AliasUI.js
... ... @@ -2,15 +2,12 @@
2 2 * Projectย  : AMDA-NG
3 3 * Name : AliasUI.js
4 4 * @class amdaUI.AliasUI
5   - * @extends Ext.form.FieldSet
  5 + * @extends Ext.form.Panel
6 6 * @brief Alias UI definition (View)
7 7 * @author Myriam
8 8 * @version $Id: AliasUI.js 966 2012-07-03 14:50:05Z elena $
9   - ********************************************************************************
10   - * FT Id : Date : Name - Description
11   - *******************************************************************************
12   - * 08/06/2011: Myriam - Migration extjs4
13 9 */
  10 +
14 11 Ext.define('amdaUI.AliasUI',{
15 12 extend: 'Ext.form.Panel',
16 13 alias: 'widget.alias',
... ... @@ -63,27 +60,27 @@ Ext.define('amdaUI.AliasUI',{
63 60 }
64 61 },
65 62  
66   - createLinkedNode : function (){
67   -
  63 + createLinkedNode : function ()
  64 + {
68 65 var newNode = Ext.create(this.nodeDataModel, {
69 66 leaf : true,
70 67 contextNode : this.contextNode
71 68 });
72 69  
73   - this.setLinkedNode(newNode);
  70 + this.setLinkedNode(newNode);
74 71 },
75 72  
76   - validate : function(alias,param) {
77   -
  73 + validate : function(alias,param)
  74 + {
78 75 var aliasNodeByName = this.linkedNode.get('rootNode').findChild('text', alias);
79 76 if (aliasNodeByName) {
80   - //TODO process
81   - var paramId = aliasNodeByName.get('id').substr(6);
82   - Ext.Msg.alert('Alias','Alias '+ alias +' already exists for parameter\n' + paramId);
83   - return false;
84   - }
  77 + //TODO process
  78 + var paramId = aliasNodeByName.get('id').substr(6);
  79 + Ext.Msg.alert('Alias','Alias '+ alias +' already exists for parameter\n' + paramId);
  80 + return false;
  81 + }
85 82  
86   - return true;
  83 + return true;
87 84 },
88 85  
89 86 updateConstruct : function(oldval,newval) {
... ... @@ -94,12 +91,12 @@ Ext.define('amdaUI.AliasUI',{
94 91 });
95 92 },
96 93  
97   - saveAlias: function() {
98   -
99   - if (this.parameterField.value.match(/[a-z,0-9]/gi) == null) {
100   - Ext.Msg.show({title:'No Parameter', msg: 'Please select parameter to create alias for',
101   - icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK});
102   - return;
  94 + saveAlias: function()
  95 + {
  96 + if (this.parameterField.value.match(/[a-z,0-9]/gi) == null) {
  97 + Ext.Msg.show({title:'No Parameter', msg: 'Please select parameter to create alias for',
  98 + icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK});
  99 + return;
103 100 }
104 101  
105 102 var tree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID);
... ... @@ -108,92 +105,92 @@ Ext.define('amdaUI.AliasUI',{
108 105 if (!rootNode.isExpanded()) rootNode.expand(false);
109 106  
110 107 if (!this.paramNode.get('alias')) {
111   - this.createLinkedNode();
112   - var isNew = true;
113   - }
  108 + this.createLinkedNode();
  109 + var isNew = true;
  110 + }
114 111 else {
115   - var aliasNode = rootNode.findChild('text', this.paramNode.get('alias'));
116   - if (!aliasNode) {//TODO error
117   - alert('NOT FOUND');
118   - }
119   - this.setLinkedNode(aliasNode);
120   - var isNew = false;
  112 + var aliasNode = rootNode.findChild('text', this.paramNode.get('alias'));
  113 + if (!aliasNode) {
  114 + //TODO error
  115 + alert('NOT FOUND');
  116 + }
  117 + this.setLinkedNode(aliasNode);
  118 + var isNew = false;
121 119 }
122 120  
123 121 this.linkedNode.set('rootNode', rootNode);
124 122 var alias = this.aliasField.value;
125 123 var param = this.parameterField.value;
  124 + var component_info = this.paramNode.get('component_info');
126 125 // now validation
127 126 if (this.validate(alias,param)) {
128   - if (isNew) {
129   - if (alias.match(/[a-z,0-9]/gi) == null) {
130   - Ext.Msg.show({title:'No Alias', msg: 'No alias was created for parameter '+ param,
131   - icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK});
132   -
133   - }
  127 + if (isNew) {
  128 + if (alias.match(/[a-z,0-9]/gi) == null) {
  129 + Ext.Msg.show({title:'No Alias', msg: 'No alias was created for parameter '+ param,
  130 + icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK});
  131 + }
  132 + else {
  133 + // create alias
  134 + this.linkedNode.create(alias, param, component_info);
  135 + this.updateConstruct(param,"#"+alias);
  136 + }
  137 + }
  138 + else if (alias.match(/[a-z,0-9]/gi) == null) {
  139 + var alias = this.paramNode.get('alias');
  140 + Ext.Msg.confirm('Delete', 'Are you sure you want to delete this alias ?', function(btn, text){
  141 + if (btn == 'yes'){
  142 + // remove alias
  143 + this.updateConstruct("#"+alias,param);
  144 + this.linkedNode.deleteNode();
  145 + }
  146 + },this);
  147 + }
134 148 else {
135   - // create alias
136   - this.linkedNode.create(alias, param);
137   - this.updateConstruct(param,"#"+alias);
  149 + // rename alias
  150 + this.linkedNode.renameNode(this.paramNode.get('alias'),alias, param);
  151 + this.updateConstruct("#"+this.paramNode.get('alias'),"#"+alias);
138 152 }
139   - }
140   - else if (alias.match(/[a-z,0-9]/gi) == null) {
141   - var alias = this.paramNode.get('alias');
142   - Ext.Msg.confirm('Delete', 'Are you sure you want to delete this alias ?', function(btn, text){
143   - if (btn == 'yes'){
144   - // remove alias
145   - this.updateConstruct("#"+alias,param);
146   - this.linkedNode.deleteNode();
147   - }
148   - },this);
149   - }
150   - else {
151   - // rename alias
152   - this.linkedNode.renameNode(this.paramNode.get('alias'),alias, param);
153   - this.updateConstruct("#"+this.paramNode.get('alias'),"#"+alias);
154   - }
155   - // Delete alias from array of deleted aliases
156   - this.checkDeleted(this.paramNode.get('id'));
157   - this.paramNode.set('alias',alias);
  153 + // Delete alias from array of deleted aliases
  154 + this.checkDeleted(this.paramNode.get('id'));
  155 + this.paramNode.set('alias',alias);
158 156 }
159 157 var win = myDesktopApp.getDesktop().getWindow('alias-win');
160 158 if (win) win.close();
161 159 },
162 160  
163   - initComponent : function (){
  161 + initComponent : function (){
164 162  
165   - if (this.initialConfig.paramNode)
166   - this.setParamNode(this.initialConfig.paramNode);
  163 + if (this.initialConfig.paramNode)
  164 + this.setParamNode(this.initialConfig.paramNode);
167 165  
168   - this.parameterField = new Ext.form.field.Text({
169   - fieldLabel: 'AMDA Parameter', name:'param', labelAlign: 'top',
170   - disabled: true, width : '90%', padding : '10px 0 0 10px', allowBlank: false
171   - });
  166 + this.parameterField = new Ext.form.field.Text({
  167 + fieldLabel: 'AMDA Parameter', name:'param', labelAlign: 'top',
  168 + disabled: true, width : '90%', padding : '10px 0 0 10px', allowBlank: false
  169 + });
172 170  
173   - this.aliasField = new Ext.form.field.Text({
174   - fieldLabel: 'Your Alias', padding : '10px 0 0 10px', width : '90%',
175   - labelWidth: 70, allowBlank: false
176   - });
  171 + this.aliasField = new Ext.form.field.Text({
  172 + fieldLabel: 'Your Alias', padding : '10px 0 0 10px', width : '90%',
  173 + labelWidth: 70, allowBlank: false
  174 + });
177 175  
178   - this.setAlias(this.paramNode);
  176 + this.setAlias(this.paramNode);
179 177  
180   - var config = {
181   - defaultType: 'textfield',
182   - bodyStyle: 'background:#ddecfe;',
183   - items: [
184   - this.parameterField,
185   - this.aliasField
186   - ],
187   - fbar: [
188   - {
189   - text: 'Save Alias',
190   - scope: this,
191   - handler: this.saveAlias
192   - }
193   - ]
194   - };
195   - Ext.apply (this , Ext.apply(this.initialConfig, config));
196   - this.callParent(arguments);
197   -
198   - }
  178 + var config = {
  179 + defaultType: 'textfield',
  180 + bodyStyle: 'background:#ddecfe;',
  181 + items: [
  182 + this.parameterField,
  183 + this.aliasField
  184 + ],
  185 + fbar: [
  186 + {
  187 + text: 'Save Alias',
  188 + scope: this,
  189 + handler: this.saveAlias
  190 + }
  191 + ]
  192 + };
  193 + Ext.apply (this , Ext.apply(this.initialConfig, config));
  194 + this.callParent(arguments);
  195 + }
199 196 });
200 197 \ No newline at end of file
... ...
js/app/views/ExplorerUI.js
... ... @@ -592,7 +592,7 @@ Ext.define('amdaUI.ExplorerUI', {
592 592 case 'localParam' :
593 593 case 'remoteParam':
594 594 case 'remoteSimuParam':
595   - record.createAlias(record);
  595 + record.createPlot(record);
596 596 break;
597 597 case 'bkgWorks' :
598 598 if (!record.get('object')) {
... ...
js/app/views/PlotComponents/PlotTree.js
... ... @@ -678,30 +678,48 @@ Ext.define('amdaPlotComp.PlotTree', {
678 678 if (!record.get('isParameter') || record.get('disable'))
679 679 return false;
680 680  
681   - if (record.get('alias') != "")
682   - this.dropParamToCreate(targetNode, position, "#" + record.get('alias'));
  681 + var isVector = record.get('iconCls') == 'icon-vector';
  682 + var component_info = record.get('component_info');
  683 + var param_id = record.get('id');
  684 + var plot_only = record.get('notyet');
  685 + var components = null;
  686 + if (component_info && component_info.parentId) {
  687 + //It's a component
  688 + param_id = component_info.parentId;
  689 + components = [];
  690 + if (component_info.index1)
  691 + components['index1'] = component_info.index1;
  692 + if (component_info.index2)
  693 + components['index2'] = component_info.index2;
  694 + }
  695 + if (record.get('alias') != "") {
  696 + if (components)
  697 + components['paramId'] = component_info.parentId;
  698 +
  699 + this.dropParamToCreate(targetNode, position, "#" + record.get('alias'), {'components': components });
  700 + }
683 701 else {
684   - var isVector = record.get('iconCls') == 'icon-vector';
685   - var component_info = record.get('component_info');
686   - var param_id = record.get('id');
687   - var plot_only = record.get('notyet');
688   - var components = null;
689   - if (component_info && component_info.parentId) {
690   - //It's a component
691   - param_id = component_info.parentId;
692   - components = [];
693   - if (component_info.index1)
694   - components['index1'] = component_info.index1;
695   - if (component_info.index2)
696   - components['index2'] = component_info.index2;
697   - }
698 702 this.dropParamToCreate(targetNode, position, param_id, {'components': components, 'isVector': isVector, 'plotOnly': plot_only});
699 703 }
700 704 return true;
701 705 case 'amdaModel.AliasNode' :
702 706 if (!record.isLeaf())
703 707 return false;
704   - this.dropParamToCreate(targetNode, position, "#" + record.get('text'));
  708 + var component_info = record.get('component_info');
  709 + var components = null;
  710 + if (component_info && component_info.parentId) {
  711 + //It's a component
  712 + components = [];
  713 + components['paramId'] = component_info.parentId;
  714 +
  715 + if (component_info.index1)
  716 + components['index1'] = component_info.index1;
  717 +
  718 + if (component_info.index2)
  719 + components['index2'] = component_info.index2;
  720 + }
  721 +
  722 + this.dropParamToCreate(targetNode, position, "#" + record.get('text'), { 'components': components });
705 723 return true;
706 724 case 'amdaModel.DerivedParamNode' :
707 725 if (!record.get('isParameter'))
... ...
js/app/views/PlotUI.js
... ... @@ -55,6 +55,11 @@ Ext.define('amdaUI.PlotUI', {
55 55 requestOptionCB.setValue(allInOne);
56 56 },
57 57  
  58 + updateConstruct : function(oldval,newval)
  59 + {
  60 + return;
  61 + },
  62 +
58 63 /**
59 64 * overwrite metod called by Save button
60 65 */
... ...
php/classes/AliasMgr.php
... ... @@ -2,95 +2,98 @@
2 2 /**
3 3 * @class AliasMgr
4 4 * @version $Id: AliasMgr.php 899 2012-05-02 14:08:28Z benjamin $
5   - *
6   - *
7 5 */
8 6  
9   - class AliasMgr extends AmdaObjectMgr {
10   -
11   - function __construct() {
  7 +class AliasMgr extends AmdaObjectMgr {
12 8  
13   - parent::__construct('Alias.xml');
14   - $this->contentRootId = 'alias-treeRootNode';
15   - $this->contentRootTag = 'aliasList';
16   - $this->attributes = array('name' => '', 'param' => '');
17   - $this->objTagName = 'alias';
18   - if (!file_exists($this->xmlName)) {
19   - $this->createDom();
20   - $this->xp = new domxpath($this->contentDom);
  9 + function __construct() {
  10 + parent::__construct('Alias.xml');
  11 + $this->contentRootId = 'alias-treeRootNode';
  12 + $this->contentRootTag = 'aliasList';
  13 + $this->attributes = array('name' => '', 'param' => '');
  14 + $this->objTagName = 'alias';
  15 + if (!file_exists($this->xmlName)) {
  16 + $this->createDom();
  17 + $this->xp = new domxpath($this->contentDom);
21 18 }
22 19 }
23 20  
24 21 protected function createDom() {
25   - $rootElement = $this->contentDom->createElement($this->contentRootTag);
  22 + $rootElement = $this->contentDom->createElement($this->contentRootTag);
26 23 $rootElement->setAttribute('xml:id', $this->contentRootId);
27   - $this->contentDom->appendChild($rootElement);
  24 + $this->contentDom->appendChild($rootElement);
28 25 $this->contentDom->save($this->xmlName);
29   - }
  26 + }
30 27  
31   -/*
32   -* Add Alias in Alias.xml
33   -*/
34   - protected function addAlias($obj) {
35   -
36   - $objList = $this->contentDom->getElementById($this->contentRootId);
37   - $newObj = $this->contentDom->createElement($this->objTagName);
38   - $newObj->setAttribute('xml:id',$this->id);
39   - $obj_arr = (array)$obj;
40   - foreach ($this->attributes as $key => $value) {
41   - if ($key == 'name') $newObj->setAttribute($key, $obj_arr[$key]);
42   - }
43   - $objList -> appendChild($newObj);
  28 + /*
  29 + * Add Alias in Alias.xml
  30 + */
  31 + protected function addAlias($obj) {
  32 + $objList = $this->contentDom->getElementById($this->contentRootId);
  33 + $newObj = $this->contentDom->createElement($this->objTagName);
  34 + $newObj->setAttribute('xml:id',$this->id);
  35 + $obj_arr = (array)$obj;
  36 + foreach ($this->attributes as $key => $value) {
  37 + if ($key == 'name') $newObj->setAttribute($key, $obj_arr[$key]);
  38 + }
  39 +
  40 + if (count($obj_arr['component_info']) > 0) {
  41 + foreach ($obj_arr['component_info'] as $key => $value) {
  42 + $newObj->setAttribute($key, $value);
  43 + }
  44 + }
  45 +
  46 + $objList -> appendChild($newObj);
44 47  
45   - $this->saveContent() ;
46   - }
  48 + $this->saveContent() ;
  49 + }
47 50  
48 51 /*
49 52 * Create Alias
50   - */
  53 + */
51 54 protected function createParameter($obj) {
52 55 $this->id = $obj->param;
53   - $this -> addAlias($obj);
  56 + $this->addAlias($obj);
54 57 return "OK";
55 58 }
  59 +
56 60 /*****************************************************************
57 61 * PUBLIC FUNCTIONS
58 62 *****************************************************************/
59 63  
60   - public function getList() {
61   -
62   - $AliasList = $this->contentDom->getElementsByTagName('alias');
  64 + public function getList() {
  65 + $AliasList = $this->contentDom->getElementsByTagName('alias');
63 66  
64   - return $AliasList;
65   - }
  67 + return $AliasList;
  68 + }
66 69  
67   - public function substrParamAlias($chain, $paramName, $aliasName) {
  70 + public function substrParamAlias($chain, $paramName, $aliasName) {
68 71  
69   - $aliasName="#".$aliasName;
70   - $pos = strpos($chain, $paramName);
71   - while ( $pos !== FALSE ) {
72   - $pos = $pos+strlen($paramName);
73   - if (preg_match('/[-+*,^<>&|=\/\[\]\(\)\ ]/', $chain[$pos]) || $chain[$pos] === '') {
74   - $chain = substr_replace($chain, $aliasName,$pos-strlen($paramName),strlen($paramName));
75   - }
76   - $pos = strpos($chain, $paramName, $pos);
77   - }
78   - return $chain;
79   - }
  72 + $aliasName="#".$aliasName;
  73 + $pos = strpos($chain, $paramName);
  74 + while ( $pos !== FALSE ) {
  75 + $pos = $pos+strlen($paramName);
  76 + if (preg_match('/[-+*,^<>&|=\/\[\]\(\)\ ]/', $chain[$pos]) || $chain[$pos] === '') {
  77 + $chain = substr_replace($chain, $aliasName,$pos-strlen($paramName),strlen($paramName));
  78 + }
  79 + $pos = strpos($chain, $paramName, $pos);
  80 + }
  81 + return $chain;
  82 + }
80 83  
81   - public function substrAliasParam($chain, $paramName, $aliasName) {
  84 + public function substrAliasParam($chain, $paramName, $aliasName) {
82 85  
83   - $aliasName="#".$aliasName;
84   - $pos = strpos($chain, $aliasName);
85   - while ( $pos !== FALSE ) {
86   - $pos = $pos+strlen($aliasName);
87   - if (preg_match('/[-+*,^<>&|=\/\[\]\(\)\ ]/', $chain[$pos]) || $chain[$pos] === '') {
88   - $chain = substr_replace($chain, $paramName,$pos-strlen($aliasName),strlen($aliasName));
89   - }
90   - $pos = strpos($chain, $aliasName, $pos);
91   - }
92   - return $chain;
93   - }
  86 + $aliasName="#".$aliasName;
  87 + $pos = strpos($chain, $aliasName);
  88 + while ( $pos !== FALSE ) {
  89 + $pos = $pos+strlen($aliasName);
  90 + if (preg_match('/[-+*,^<>&|=\/\[\]\(\)\ ]/', $chain[$pos]) || $chain[$pos] === '') {
  91 + $chain = substr_replace($chain, $paramName,$pos-strlen($aliasName),strlen($aliasName));
  92 + }
  93 + $pos = strpos($chain, $aliasName, $pos);
  94 + }
  95 + return $chain;
  96 + }
94 97  
95 98 protected function deleteParameter($id){
96 99  
... ... @@ -98,7 +101,7 @@
98 101  
99 102 /*
100 103 * Get Object into Edit
101   - */
  104 + */
102 105 public function getObject($id) {
103 106 if (!($obj = $this->objectExistsById($id))) return "NO_SUCH_ID";
104 107 $attributesToReturn['id'] = $obj->getAttribute('xml:id');
... ... @@ -107,8 +110,8 @@
107 110 }
108 111  
109 112 /*
110   - * Get alias of parameter
111   - */
  113 + * Get alias of parameter
  114 + */
112 115 public function getAlias($id) {
113 116 $alias = "";
114 117 if (($obj = $this->objectExistsById($id)))
... ... @@ -117,4 +120,4 @@
117 120  
118 121 return $alias;
119 122 }
120   - }
121 123 \ No newline at end of file
  124 +}
... ...
php/classes/AmdaAction.php
... ... @@ -189,7 +189,17 @@ class AmdaAction
189 189 case 'alias':
190 190 $info = $id;
191 191 $id = 'alias_'.$id;
  192 + $component_info = array();
  193 + if ($child->hasAttribute("index1"))
  194 + $component_info["index1"] = $child->getAttribute('index1');
  195 + if ($child->hasAttribute("index2"))
  196 + $component_info["index2"] = $child->getAttribute('index2');
  197 +
  198 + if ($child->hasAttribute("parentId"))
  199 + $component_info["parentId"] = $child->getAttribute("parentId");
  200 +
192 201 if ($isLeaf) $isParameter = true;
  202 +
193 203 break;
194 204  
195 205 case 'timeTable':
... ... @@ -561,7 +571,8 @@ class AmdaAction
561 571 }
562 572  
563 573 $childrenToReturn[] = array('text' => $name, 'id' => $id, 'nodeType' => $nodeType, 'info' => $info,
564   - 'help' => $help, 'leaf' => $isLeaf, 'isParameter' => $isParameter, 'dim_1' => $dim_1, 'dim_2' => $dim_2);
  574 + 'help' => $help, 'leaf' => $isLeaf, 'isParameter' => $isParameter, 'dim_1' => $dim_1, 'dim_2' => $dim_2,
  575 + "component_info" => isset($component_info) ? $component_info : NULL);
565 576 }
566 577 }
567 578 // if $childrenToReturn we have to return []
... ... @@ -915,7 +926,8 @@ class AmdaAction
915 926 }
916 927  
917 928 private function executeRequest($obj, $function)
918   - {
  929 + {
  930 +
919 931 // Check user if access to DD Server and / or possible 'space consuming' action
920 932 if ( $function == FunctionTypeEnumClass::PARAMS ||
921 933 $function == FunctionTypeEnumClass::ACTION ||
... ...