Commit 9cb1f3cda4b2d53de25e2bf574821561daf1b96f

Authored by Benjamin Renard
1 parent e72f367a

Update download interface for the new kernel

Showing 2 changed files with 42 additions and 39 deletions   Show diff stats
js/app/models/Download.js
@@ -23,18 +23,17 @@ Ext.define('amdaModel.Download', { @@ -23,18 +23,17 @@ Ext.define('amdaModel.Download', {
23 {name: 'list', defaultValue: null }, // array of parameters 23 {name: 'list', defaultValue: null }, // array of parameters
24 {name: 'timeformat', type: 'string'}, 24 {name: 'timeformat', type: 'string'},
25 {name: 'timeformatTT', type: 'string'}, 25 {name: 'timeformatTT', type: 'string'},
26 - {name: 'milli', type: 'boolean', defaultValue: false},  
27 {name: 'structure', type: 'string'}, 26 {name: 'structure', type: 'string'},
  27 + {name: 'refparamSampling', type: 'boolean', defaultValue: false},
28 {name: 'sampling', type: 'int', defaultValue: '600'}, 28 {name: 'sampling', type: 'int', defaultValue: '600'},
29 {name: 'output', type: 'string'}, 29 {name: 'output', type: 'string'},
30 - {name: 'header', type: 'string'},  
31 {name: 'fileformat', type: 'string'}, 30 {name: 'fileformat', type: 'string'},
32 {name: 'fileformatTT', type: 'string'}, 31 {name: 'fileformatTT', type: 'string'},
33 {name: 'compression', type: 'string'}, 32 {name: 'compression', type: 'string'},
34 {name: 'compressionTT', type: 'string'} 33 {name: 'compressionTT', type: 'string'}
35 ], 34 ],
36 35
37 - propertiesToCopy : 'id,name,downloadSrc,sampling,list,timeformat,timeformatTT,structure,output,header,fileformat,fileformatTT,compression,compressionTT', 36 + propertiesToCopy : 'id,name,downloadSrc,refparamSampling,sampling,list,timeformat,timeformatTT,structure,output,fileformat,fileformatTT,compression,compressionTT',
38 37
39 getJsonValues : function(){ 38 getJsonValues : function(){
40 39
@@ -45,9 +44,9 @@ Ext.define('amdaModel.Download', { @@ -45,9 +44,9 @@ Ext.define('amdaModel.Download', {
45 //Data download 44 //Data download
46 if (myValues.downloadSrc === '0') { // Data download 45 if (myValues.downloadSrc === '0') { // Data download
47 myValues.structure = this.get('structure'); 46 myValues.structure = this.get('structure');
  47 + myValues.refparamSampling = this.get('refparamSampling');
48 myValues.sampling = this.get('sampling'); 48 myValues.sampling = this.get('sampling');
49 myValues.output = this.get('output'); 49 myValues.output = this.get('output');
50 - myValues.header = this.get('header');  
51 50
52 myValues.timesrc = this.get('timesrc'); 51 myValues.timesrc = this.get('timesrc');
53 // if there's at least one timeTable in case of Download data 52 // if there's at least one timeTable in case of Download data
@@ -84,8 +83,6 @@ Ext.define('amdaModel.Download', { @@ -84,8 +83,6 @@ Ext.define('amdaModel.Download', {
84 Ext.each(list, function(item, index){ 83 Ext.each(list, function(item, index){
85 myValues.list[index]=item.get('name'); 84 myValues.list[index]=item.get('name');
86 }); 85 });
87 - // milli is used only for download  
88 - myValues.milli = this.get('milli');  
89 } 86 }
90 myValues.fileformat = this.get('fileformat'); 87 myValues.fileformat = this.get('fileformat');
91 myValues.timeformat = this.get('timeformat'); 88 myValues.timeformat = this.get('timeformat');
@@ -122,4 +119,4 @@ Ext.define('amdaModel.Download', { @@ -122,4 +119,4 @@ Ext.define('amdaModel.Download', {
122 return myValues; 119 return myValues;
123 } 120 }
124 121
125 -});  
126 \ No newline at end of file 122 \ No newline at end of file
  123 +});
js/app/views/DownloadUI.js
@@ -18,12 +18,14 @@ Ext.define('amdaUI.DownloadUI', { @@ -18,12 +18,14 @@ Ext.define('amdaUI.DownloadUI', {
18 'amdaUI.SearchParamEditorPlugin' 18 'amdaUI.SearchParamEditorPlugin'
19 ], 19 ],
20 20
21 - timeformatData : [['Y-m-dTH:i:s', 'YYYY-MM-DDThh:mm:ss'], ['Y m d H i s', 'YYYY MM DD hh mm ss'], ['d m Y H i s', 'DD MM YYYY hh mm ss'], ['Y z H i s', 'YYYY DDD hh mm ss']],  
22 - fileformatData : [['ASCII', 'ASCII'],['vot', 'VOTable']], 21 + //Old kernel time formats
  22 + //timeformatData : [['Y-m-dTH:i:s', 'YYYY-MM-DDThh:mm:ss'], ['Y m d H i s', 'YYYY MM DD hh mm ss'], ['d m Y H i s', 'DD MM YYYY hh mm ss'], ['Y z H i s', 'YYYY DDD hh mm ss']],
  23 + //New kernel time formats
  24 + timeformatData : [['Y-m-dTH:i:s', 'YYYY-MM-DDThh:mm:ss'], ['DD Time', 'DD Time'], ['Timestamp', 'Timestamp']],
  25 + fileformatData : [['ASCII', 'ASCII'],['vot', 'VOTable'],['cdf', 'CDF'],['json', 'JSON']],
23 fileformatTTData : [['text', 'plain text'], ['vot','VOTable']], 26 fileformatTTData : [['text', 'plain text'], ['vot','VOTable']],
24 filecompressData : [['zip', 'zip'], ['tar+gzip', 'tar+gzip']], 27 filecompressData : [['zip', 'zip'], ['tar+gzip', 'tar+gzip']],
25 filestructureData : [['0','All In One File'], ['1','One File Per Time Interval'], ['2','One File Per Param/Interval']], 28 filestructureData : [['0','All In One File'], ['1','One File Per Time Interval'], ['2','One File Per Param/Interval']],
26 - fileheaderData : [['0','Write Into Data File'], ['1','Create Separate File']],  
27 29
28 constructor: function(config) { 30 constructor: function(config) {
29 this.init(config); 31 this.init(config);
@@ -146,8 +148,8 @@ Ext.define('amdaUI.DownloadUI', { @@ -146,8 +148,8 @@ Ext.define('amdaUI.DownloadUI', {
146 var timeSource = values.timesrc_downloadTimeSelector; 148 var timeSource = values.timesrc_downloadTimeSelector;
147 var structure = values.filestructure; 149 var structure = values.filestructure;
148 var sampling = values.sampling ? values.sampling : 600; 150 var sampling = values.sampling ? values.sampling : 600;
  151 + var refparamSampling = values.refparamsampling == 'on';
149 var output = values.output ? values.output : ''; 152 var output = values.output ? values.output : '';
150 - var header = values.header;  
151 var fileformat = values.fileformat; 153 var fileformat = values.fileformat;
152 var compression = values.compression; 154 var compression = values.compression;
153 155
@@ -185,9 +187,9 @@ Ext.define('amdaUI.DownloadUI', { @@ -185,9 +187,9 @@ Ext.define('amdaUI.DownloadUI', {
185 // set parameters 187 // set parameters
186 this.object.set('list',this.paramGrid.getStore().data.items); 188 this.object.set('list',this.paramGrid.getStore().data.items);
187 this.object.set('structure', structure); 189 this.object.set('structure', structure);
  190 + this.object.set('refparamSampling', refparamSampling);
188 this.object.set('sampling', sampling); 191 this.object.set('sampling', sampling);
189 this.object.set('output',output); 192 this.object.set('output',output);
190 - this.object.set('header', header);  
191 this.object.set('timeformat',timeformat); 193 this.object.set('timeformat',timeformat);
192 this.object.set('fileformat',fileformat); 194 this.object.set('fileformat',fileformat);
193 this.object.set('compression',compression); 195 this.object.set('compression',compression);
@@ -233,9 +235,6 @@ Ext.define('amdaUI.DownloadUI', { @@ -233,9 +235,6 @@ Ext.define('amdaUI.DownloadUI', {
233 if (!this.object.get('compressionTT')) 235 if (!this.object.get('compressionTT'))
234 this.object.set('compressionTT', this.filecompressData[1][0]); 236 this.object.set('compressionTT', this.filecompressData[1][0]);
235 237
236 - if (!this.object.get('header'))  
237 - this.object.set('header', this.fileheaderData[0][0]);  
238 -  
239 // load object into form 238 // load object into form
240 this.formPanel.getForm().loadRecord(this.object); 239 this.formPanel.getForm().loadRecord(this.object);
241 // set object's TTs into the timeselector 240 // set object's TTs into the timeselector
@@ -261,21 +260,29 @@ Ext.define('amdaUI.DownloadUI', { @@ -261,21 +260,29 @@ Ext.define('amdaUI.DownloadUI', {
261 grid.getStore().remove(record); 260 grid.getStore().remove(record);
262 }, 261 },
263 262
264 - disableField : function(combo, newValue, oldValue){  
265 - var tt = combo.next(); 263 + onFileStructureChange : function(combo, newValue, oldValue){
  264 + if (!this.formPanel)
  265 + return;
  266 +
  267 + var refParamCheck = this.formPanel.getForm().findField('refparamsampling');
  268 + var samplingField = this.formPanel.getForm().findField('sampling');
266 269
267 - if (tt && newValue !== oldValue) {  
268 - var ff = tt.next();  
269 - if (newValue == 2) {  
270 - tt.setDisabled(true);  
271 - // ff.setDisabled(true);  
272 - }  
273 - else {  
274 - tt.setDisabled(false);  
275 - // ff.setDisabled(false);  
276 - } 270 + if (samplingField && newValue !== oldValue) {
  271 + refParamCheck.setDisabled(newValue == 2);
  272 + samplingField.setDisabled((newValue == 2) || refParamCheck.getValue());
277 } 273 }
278 }, 274 },
  275 +
  276 + onRefParamSamplingChange : function(check, newValue, oldValue){
  277 + if (!this.formPanel)
  278 + return;
  279 +
  280 + var samplingField = this.formPanel.getForm().findField('sampling');
  281 + var structureCombo = this.formPanel.getForm().findField('filestructure');
  282 +
  283 + if (samplingField && newValue !== oldValue)
  284 + samplingField.setDisabled((structureCombo.getValue() == 2) || check.getValue());
  285 + },
279 286
280 /** 287 /**
281 * Check if changes were made before closing window 288 * Check if changes were made before closing window
@@ -479,19 +486,24 @@ Ext.define('amdaUI.DownloadUI', { @@ -479,19 +486,24 @@ Ext.define('amdaUI.DownloadUI', {
479 store: this.timeformatData, 486 store: this.timeformatData,
480 value: this.timeformatData[0] 487 value: this.timeformatData[0]
481 }, 488 },
482 - { xtype : 'checkbox', boxLabel: 'Show Milliseconds',  
483 - boxLabelAlign: 'before',  
484 - name: 'milli', checked: false//,  
485 - // margin : '0 0 5 150' //(top, right, bottom, left).  
486 - },  
487 { 489 {
488 fieldLabel: 'File Structure', 490 fieldLabel: 'File Structure',
489 name: 'filestructure', 491 name: 'filestructure',
490 store: this.filestructureData, 492 store: this.filestructureData,
491 value: this.filestructureData[2], 493 value: this.filestructureData[2],
492 listeners : { 494 listeners : {
493 - change : { fn : this.disableField } 495 + change : { fn : this.onFileStructureChange },
  496 + scope: this
494 } 497 }
  498 + },
  499 + {
  500 + xtype: 'checkbox', boxLabel: 'Use first param. as reference for sampling',
  501 + boxLabelAlign: 'before',
  502 + name: 'refparamsampling', checked: false, disabled: true,
  503 + listeners : {
  504 + change : { fn : this.onRefParamSamplingChange },
  505 + scope : this
  506 + }
495 }, 507 },
496 { 508 {
497 xtype: 'numberfield', name: 'sampling', 509 xtype: 'numberfield', name: 'sampling',
@@ -504,12 +516,6 @@ Ext.define('amdaUI.DownloadUI', { @@ -504,12 +516,6 @@ Ext.define('amdaUI.DownloadUI', {
504 fieldLabel: 'File Name', 516 fieldLabel: 'File Name',
505 disabled: true, editable: true 517 disabled: true, editable: true
506 }, 518 },
507 - {  
508 - fieldLabel:'Header',  
509 - name: 'header',  
510 - store: this.fileheaderData,  
511 - value: this.fileheaderData[0]  
512 - },  
513 { 519 {
514 fieldLabel: 'File Format', 520 fieldLabel: 'File Format',
515 name: 'fileformat', 521 name: 'fileformat',