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