Commit de9b257886fba5949c8d2e03414c75451f388f58

Authored by Benjamin Renard
1 parent 81fae858

Update TimeSelectorUI for catalog selection

js/app/views/DownloadUI.js
... ... @@ -145,7 +145,7 @@ Ext.define('amdaUI.DownloadUI', {
145 145 if (downloadSrc === 0)
146 146 {
147 147 var timeformat = basicForm.findField('timeformat').getRawValue();
148   - var timeSource = values.timesrc_downloadTimeSelector;
  148 + var timeSource = this.timeSelector.getActiveTimeSource();
149 149 var structure = values.filestructure;
150 150 var sampling = values.sampling ? values.sampling : 600;
151 151 var refparamSampling = values.refparamsampling == 'on';
... ...
js/app/views/SearchUI.js
... ... @@ -68,7 +68,7 @@ Ext.define('amdaUI.SearchUI', {
68 68 // get the basic form
69 69 var basicForm = this.formPanel.getForm();
70 70 // get the timeSource selected
71   - var timeSource = basicForm.findField('timesrc_'+this.timeSelector.id).getGroupValue();
  71 + var timeSource = this.timeSelector.getActiveTimeSource();
72 72 var updateStatus = true;
73 73  
74 74 var fieldsWithoutName = basicForm.getFields().items;
... ...
js/app/views/StatisticsUI.js
... ... @@ -68,7 +68,7 @@ Ext.define('amdaUI.StatisticsUI', {
68 68 });
69 69 this.object.set('parameter', paramArr);
70 70  
71   - var timeSource = formValues.timesrc_statisticsTimeSelector;
  71 + var timeSource = this.timeSelector.getActiveTimeSource();
72 72  
73 73 if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0] // timeSource 'TimeTable'
74 74 && this.timeSelector.TTGrid.getStore().count() == 0) {
... ...
js/app/views/TimeSelectorUI.js
... ... @@ -20,7 +20,7 @@ Ext.define('amdaUI.TimeSelectorUI',
20 20  
21 21 setTTTab: function(arrayTT)
22 22 {
23   - /*var arrayRec = new Array();
  23 + var arrayRec = new Array();
24 24 var index = 1;
25 25 if (arrayTT)
26 26 {
... ... @@ -45,9 +45,9 @@ Ext.define('amdaUI.TimeSelectorUI',
45 45 // RadioManager is a singleton working with getByName !!!!!
46 46 var obj = new Object();
47 47 obj['timesrc_' + this.id] = this.activeTab;
48   - this.timeSrc.setValue(obj);
  48 + this.timeSrc.setActiveTab(this.activeTab);
49 49  
50   - if (index === 0) this.TTGrid.getStore().loadData(arrayRec); */
  50 + if (index === 0) this.TTGrid.getStore().loadData(arrayRec);
51 51 },
52 52  
53 53 addTT : function(newTTName,newTTid)
... ... @@ -55,10 +55,8 @@ Ext.define('amdaUI.TimeSelectorUI',
55 55 // set the TimeTable radio checked
56 56 var obj = new Object();
57 57 obj['timesrc_'+this.id] = amdaModel.AmdaTimeObject.inputTimeSrc[0]; /*'TimeTable'*/
58   - this.timeSrc.setValue(obj);
  58 + this.timeSrc.setActiveTab(obj['timesrc_'+this.id]);
59 59  
60   - // fireEvent to show the corresponding panel
61   - this.timeSrc.fireEvent('change', this.timeSrc, this.timeSrc.getValue());
62 60 // search for an existing record in store with this unique name
63 61 var existingIndex = this.TTGrid.store.findExact( 'name', newTTName);
64 62 // if no corresponding TT found
... ... @@ -69,6 +67,11 @@ Ext.define('amdaUI.TimeSelectorUI',
69 67 }
70 68 },
71 69  
  70 + getActiveTimeSource: function()
  71 + {
  72 + return this.timeSrc.getActiveTab().getItemId();
  73 + },
  74 +
72 75 initComponent: function()
73 76 {
74 77 this.activeField = null;
... ... @@ -84,7 +87,7 @@ Ext.define('amdaUI.TimeSelectorUI',
84 87 columns:
85 88 [
86 89 Ext.create('Ext.grid.RowNumberer', { width: 20 } ),
87   - { header: "Time Table Name", dataIndex: 'name', flex:1, sortable : false, menuDisabled: true },
  90 + { header: "Time Table or Catalog Name", dataIndex: 'name', flex:1, sortable : false, menuDisabled: true },
88 91 {
89 92 menuDisabled: true, width: 30, renderer: function()
90 93 {
... ... @@ -100,7 +103,10 @@ Ext.define('amdaUI.TimeSelectorUI',
100 103 ddGroup: 'explorerTree',
101 104 notifyOver : function(ddSource, e, data)
102 105 {
103   - if ((data.records[0].get('nodeType') == 'timeTable' || data.records[0].get('nodeType') == 'sharedtimeTable') && (data.records[0].get('leaf')))
  106 + if ((data.records[0].get('nodeType') == 'timeTable' ||
  107 + data.records[0].get('nodeType') == 'sharedtimeTable' ||
  108 + data.records[0].get('nodeType') == 'catalog' ||
  109 + data.records[0].get('nodeType') == 'sharedcatalog') && (data.records[0].get('leaf')))
104 110 {
105 111 this.valid = true;
106 112 return this.dropAllowed;
... ... @@ -193,28 +199,6 @@ Ext.define('amdaUI.TimeSelectorUI',
193 199 }
194 200  
195 201 });
196   -
197   - this.cardContainer =
198   - {
199   - xtype: 'container',
200   - flex: 4,
201   - width: '99%',
202   - layout: 'card',
203   - border: false,
204   - activeItem: 1,
205   - items:
206   - [
207   - this.TTGrid,
208   - this.intervalSel
209   - ],
210   - listeners:
211   - {
212   - afterrender: function (container,opt)
213   - {
214   - this.layout.setActiveItem(this.initialConfig.activeItem);
215   - }
216   - }
217   - };
218 202  
219 203 this.timeSrc = new Ext.tab.Panel(
220 204 {
... ... @@ -227,66 +211,29 @@ Ext.define('amdaUI.TimeSelectorUI',
227 211 title: 'Interval',
228 212 layout: 'fit',
229 213 bodyStyle: 'background: none',
  214 + itemId: amdaModel.AmdaTimeObject.inputTimeSrc[1],//'Interval'
230 215 items: [
231 216 this.intervalSel
232 217 ]
233 218 },
234 219 {
235   - title: 'Time Table',
  220 + title: 'Time Table or Catalog',
236 221 layout: 'fit',
  222 + itemId: amdaModel.AmdaTimeObject.inputTimeSrc[0],//'TimeTable'
237 223 items: [
238 224 this.TTGrid
239 225 ]
240   - },
241   - {
242   - title: 'Catalog',
243   - items: [
244   - ]
245 226 }
246   - /*{
247   - boxLabel: 'Time Table',
248   - name: 'timesrc_'+this.id,
249   - inputValue: amdaModel.AmdaTimeObject.inputTimeSrc[0]//'TimeTable',
250   - },
251   - {
252   - boxLabel: 'Interval',
253   - name: 'timesrc_'+this.id,
254   - inputValue: amdaModel.AmdaTimeObject.inputTimeSrc[1],//'Interval',
255   - checked: true
256   - },
257   - {
258   - boxLabel: 'Catalog',
259   - name: 'timesrc_'+this.id,
260   - inputValue: amdaModel.AmdaTimeObject.inputTimeSrc[2],//'Catalog'
261   - }*/
262   - ]/*,
263   - listeners:
264   - {
265   - scope: this,
266   - change: function(radio, newValue, oldValue, options)
267   - {
268   - var ttIndex = newValue['timesrc_'+this.id] === amdaModel.AmdaTimeObject.inputTimeSrc[0] ? 0 : 1 ;
269   - if (this.rendered)
270   - {
271   - radio.nextSibling().layout.setActiveItem(ttIndex);
272   - }
273   - else
274   - {
275   - this.cardContainer.activeItem = ttIndex;
276   - }
277   - }
278   - } */
  227 + ]
279 228 });
280 229  
281 230 var config =
282 231 {
283   - //style: { borderColor: '#98c0f4', borderWidth: '2px' },
284 232 title: 'Time Selection',
285 233 layout: 'fit',
286 234 items:
287 235 [
288   - this.timeSrc/*,
289   - this.cardContainer*/
  236 + this.timeSrc
290 237 ]
291 238 };
292 239  
... ...