Commit 33ce72a7bf396cdcdc35921d2d18754c17edb866

Authored by Benjamin Renard
1 parent 571ea5f8

Do not show arguments plugin when it's not necessary + New default config for plot

js/app/models/DownloadParam.js
... ... @@ -18,6 +18,7 @@ Ext.define('amdaModel.DownloadParam', {
18 18 extend: 'amdaModel.AmdaObject',
19 19  
20 20 fields : [
  21 + {name: 'type', type: 'int'},
21 22 {name: 'dim1', type: 'string'},
22 23 {name: 'dim2', type: 'string'}
23 24 ]
... ...
js/app/models/PlotObjects/PlotObjectConfig.js
... ... @@ -38,7 +38,7 @@ Ext.define('amdaPlotObj.PlotObjectConfig', {
38 38 },
39 39 font : {
40 40 name : 'sans-serif',
41   - size: '12'
  41 + size: '8'
42 42 },
43 43 layout : {
44 44 type : 'vertical',
... ... @@ -51,13 +51,13 @@ Ext.define('amdaPlotObj.PlotObjectConfig', {
51 51 plotType : 'timePlot',
52 52 isotropic : false,
53 53 title : {
54   - position: 'bottom',
  54 + position: 'top',
55 55 alignment: ' center',
56 56 color: '#000000'
57 57 },
58 58 font : {
59 59 name : 'sans-serif',
60   - size: '12'
  60 + size: '8'
61 61 },
62 62 backgroundColor : 'none',
63 63 status : {
... ... @@ -74,7 +74,7 @@ Ext.define('amdaPlotObj.PlotObjectConfig', {
74 74 color: '#000000',
75 75 font : {
76 76 name : 'sans-serif',
77   - size: '12'
  77 + size: '8'
78 78 }
79 79 },
80 80 timeFormat : 'dd/mm/yy',
... ... @@ -111,7 +111,7 @@ Ext.define('amdaPlotObj.PlotObjectConfig', {
111 111 },
112 112 font : {
113 113 name : 'sans-serif',
114   - size: '12'
  114 + size: '8'
115 115 }
116 116 },
117 117 intervaltick : {
... ... @@ -124,7 +124,7 @@ Ext.define('amdaPlotObj.PlotObjectConfig', {
124 124 },
125 125 font : {
126 126 name : 'sans-serif',
127   - size: '12'
  127 + size: '8'
128 128 }
129 129 },
130 130 errorbar : {
... ... @@ -155,7 +155,7 @@ Ext.define('amdaPlotObj.PlotObjectConfig', {
155 155 },
156 156 font : {
157 157 name : 'sans-serif',
158   - size: '12'
  158 + size: '8'
159 159 }
160 160 },
161 161 text : {
... ... @@ -163,7 +163,7 @@ Ext.define('amdaPlotObj.PlotObjectConfig', {
163 163 color : '#000000',
164 164 font : {
165 165 name : 'sans-serif',
166   - size: '12'
  166 + size: '8'
167 167 }
168 168 }
169 169 },
... ... @@ -183,7 +183,7 @@ Ext.define('amdaPlotObj.PlotObjectConfig', {
183 183 color : '#000000',
184 184 font : {
185 185 name : 'sans-serif',
186   - size: '12'
  186 + size: '8'
187 187 }
188 188 },
189 189 curves : {
... ...
js/app/views/ParamArgumentsPlug.js
... ... @@ -64,7 +64,8 @@ Ext.define('amdaUI.ParamArgumentsPlug', {
64 64 items: this.getFormConfig(),
65 65 listeners: {
66 66 scope: this,
67   - beforeclose: function() {
  67 + beforeclose: function() {
  68 + this.hostCmp.setDisabled(false);
68 69 Ext.PluginManager.unregister(this);
69 70 }
70 71 },
... ... @@ -87,6 +88,7 @@ Ext.define('amdaUI.ParamArgumentsPlug', {
87 88 this.paramId = paramId;
88 89 this.paramArgs.editParameter(paramId, crtArgsValues, this.hostCmp);
89 90  
  91 + this.hostCmp.setDisabled(true);
90 92 this.win.show();
91 93 },
92 94  
... ... @@ -128,6 +130,7 @@ Ext.define('amdaUI.ParamArgumentsPlug', {
128 130 if (me.onApply)
129 131 me.onApply(this.hostCmp, me.paramId, me.paramArgs.getValues());
130 132 }
  133 + me.close();
131 134 }
132 135 },
133 136 {
... ...
js/app/views/ParamArgumentsUI.js
... ... @@ -110,6 +110,10 @@ Ext.define('amdaUI.ParamArgumentsUI', {
110 110 ++this.paramType;
111 111 }
112 112 }
  113 +
  114 + if (this.paramType <= 0)
  115 + //Add no args message
  116 + this.resetArguments(false);
113 117 },
114 118  
115 119 buildDimIndexSelection: function(relatedDim, data, uiScope) {
... ...
js/app/views/ParameterUI.js
... ... @@ -34,38 +34,42 @@ Ext.define(&#39;amdaUI.ParameterUI&#39;, {
34 34 paramArgsPlug.onApply = this.onApplyParameterArgs;
35 35 },
36 36  
  37 + addParamInEditor : function(param) {
  38 + var selection = this.constructionField.getSelection();
  39 + this.constructionField.setValue(selection.beforeText + param + selection.afterText);
  40 + this.constructionField.focus();
  41 + this.constructionField.setCaretPosition(this.constructionField.getValue().length);
  42 + },
  43 +
37 44 onApplyParameterArgs : function(uiScope, paramId, values) {
38 45 var fullParam = paramId;
39   - switch (values['type']) {
  46 + switch (values['type']) {
40 47 case 0:
41 48 //scalar - nothing to do
42 49 break;
43 50 case 1:
44 51 //Tab1D
45   - if ((values['dim_1'] != '') && (values['dim_1'] != '*'))
  52 + if (values['dim_1'] && (values['dim_1'] != '') && (values['dim_1'] != '*'))
46 53 fullParam += '('+values['dim_1']+')';
47   - else if ((values['dim_2'] != '') && (values['dim_2'] != '*'))
  54 + else if (values['dim_2'] && (values['dim_2'] != '') && (values['dim_2'] != '*'))
48 55 fullParam += '('+values['dim_2']+')';
49 56 break;
50 57 case 2:
51 58 //Tab2D
52   - var dim1 = values['dim_1'] != '' ? values['dim_1'] : "*";
53   - var dim2 = values['dim_2'] != '' ? values['dim_2'] : "*";
  59 + var dim1 = (values['dim_1'] && (values['dim_1'] != '')) ? values['dim_1'] : "*";
  60 + var dim2 = (values['dim_2'] && (values['dim_2'] != '')) ? values['dim_2'] : "*";
54 61 if ((dim1 != '*') || (dim2 != '*'))
55 62 fullParam += '('+dim1+','+dim2+')';
56 63 }
57   -
58   - var selection = uiScope.constructionField.getSelection();
59   - uiScope.constructionField.setValue(selection.beforeText + fullParam + selection.afterText);
60   - uiScope.constructionField.focus();
61   - uiScope.constructionField.setCaretPosition(uiScope.constructionField.getValue().length);
62   - this.close();
  64 +
  65 + uiScope.addParamInEditor(fullParam);
63 66 },
64 67  
65   - addParam : function(newParamName,isLeaf) {
66   - if (isLeaf){
  68 + addParam : function(newParamName, isArgsToDefined) {
  69 + if (isArgsToDefined)
67 70 this.editParameterArgs(newParamName);
68   - }
  71 + else
  72 + this.addParamInEditor(newParamName);
69 73 },
70 74  
71 75 editParameterArgs: function(name) {
... ... @@ -321,8 +325,9 @@ Ext.define(&#39;amdaUI.ParameterUI&#39;, {
321 325 return false;
322 326 }
323 327 var paramModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.param.id);
324   - if (paramModule)
325   - paramModule.addParam(nameToSent,true);
  328 + if (paramModule) {
  329 + paramModule.addParam(nameToSent, !data.records[0].get('leaf') || data.records[0].get('needsArgs'));
  330 + }
326 331 return true;
327 332 }
328 333 });
... ...
js/app/views/SearchUI.js
... ... @@ -40,10 +40,18 @@ Ext.define(&#39;amdaUI.SearchUI&#39;, {
40 40 this.timeSelector.setTTTab(TTarray);
41 41 },
42 42  
43   - addParam : function(newParamName, isLeaf) {
44   - if (isLeaf){
  43 + addParam : function(newParamName, isArgsToDefined) {
  44 + if (isArgsToDefined)
45 45 this.editParameterArgs(newParamName);
46   - }
  46 + else
  47 + this.addParamInEditor(newParamName);
  48 + },
  49 +
  50 + addParamInEditor : function(param) {
  51 + var selection = this.constructionField.getSelection();
  52 + this.constructionField.setValue(selection.beforeText + param + selection.afterText);
  53 + this.constructionField.focus();
  54 + this.constructionField.setCaretPosition(this.constructionField.getValue().length);
47 55 },
48 56  
49 57 onApplyParameterArgs : function(uiScope, paramId, values) {
... ... @@ -54,24 +62,20 @@ Ext.define(&#39;amdaUI.SearchUI&#39;, {
54 62 break;
55 63 case 1:
56 64 //Tab1D
57   - if ((values['dim_1'] != '') && (values['dim_1'] != '*'))
  65 + if (values['dim_1'] && (values['dim_1'] != '') && (values['dim_1'] != '*'))
58 66 fullParam += '('+values['dim_1']+')';
59   - else if ((values['dim_2'] != '') && (values['dim_2'] != '*'))
  67 + else if (values['dim_2'] && (values['dim_2'] != '') && (values['dim_2'] != '*'))
60 68 fullParam += '('+values['dim_2']+')';
61 69 break;
62 70 case 2:
63 71 //Tab2D
64   - var dim1 = values['dim_1'] != '' ? values['dim_1'] : "*";
65   - var dim2 = values['dim_2'] != '' ? values['dim_2'] : "*";
  72 + var dim1 = (values['dim_1'] && (values['dim_1'] != '')) ? values['dim_1'] : "*";
  73 + var dim2 = (values['dim_2'] && (values['dim_2'] != '')) ? values['dim_2'] : "*";
66 74 if ((dim1 != '*') || (dim2 != '*'))
67 75 fullParam += '('+dim1+','+dim2+')';
68 76 }
69 77  
70   - var selection = uiScope.constructionField.getSelection();
71   - uiScope.constructionField.setValue(selection.beforeText + fullParam + selection.afterText);
72   - uiScope.constructionField.focus();
73   - uiScope.constructionField.setCaretPosition(uiScope.constructionField.getValue().length);
74   - this.close();
  78 + uiScope.addParamInEditor(fullParam);
75 79 },
76 80  
77 81 editParameterArgs: function(name) {
... ... @@ -365,7 +369,7 @@ Ext.define(&#39;amdaUI.SearchUI&#39;, {
365 369 var searchModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.search.id);
366 370  
367 371 if (searchModule)
368   - searchModule.addParam(nameToSent,true);
  372 + searchModule.addParam(nameToSent, !data.records[0].get('leaf') || data.records[0].get('needsArgs'));
369 373 return true;
370 374 }
371 375 });
... ...