diff --git a/js/app/models/Download.js b/js/app/models/Download.js index 23142f3..d532782 100644 --- a/js/app/models/Download.js +++ b/js/app/models/Download.js @@ -23,18 +23,17 @@ Ext.define('amdaModel.Download', { {name: 'list', defaultValue: null }, // array of parameters {name: 'timeformat', type: 'string'}, {name: 'timeformatTT', type: 'string'}, - {name: 'milli', type: 'boolean', defaultValue: false}, {name: 'structure', type: 'string'}, + {name: 'refparamSampling', type: 'boolean', defaultValue: false}, {name: 'sampling', type: 'int', defaultValue: '600'}, {name: 'output', type: 'string'}, - {name: 'header', type: 'string'}, {name: 'fileformat', type: 'string'}, {name: 'fileformatTT', type: 'string'}, {name: 'compression', type: 'string'}, {name: 'compressionTT', type: 'string'} ], - propertiesToCopy : 'id,name,downloadSrc,sampling,list,timeformat,timeformatTT,structure,output,header,fileformat,fileformatTT,compression,compressionTT', + propertiesToCopy : 'id,name,downloadSrc,refparamSampling,sampling,list,timeformat,timeformatTT,structure,output,fileformat,fileformatTT,compression,compressionTT', getJsonValues : function(){ @@ -45,9 +44,9 @@ Ext.define('amdaModel.Download', { //Data download if (myValues.downloadSrc === '0') { // Data download myValues.structure = this.get('structure'); + myValues.refparamSampling = this.get('refparamSampling'); myValues.sampling = this.get('sampling'); myValues.output = this.get('output'); - myValues.header = this.get('header'); myValues.timesrc = this.get('timesrc'); // if there's at least one timeTable in case of Download data @@ -84,8 +83,6 @@ Ext.define('amdaModel.Download', { Ext.each(list, function(item, index){ myValues.list[index]=item.get('name'); }); - // milli is used only for download - myValues.milli = this.get('milli'); } myValues.fileformat = this.get('fileformat'); myValues.timeformat = this.get('timeformat'); @@ -122,4 +119,4 @@ Ext.define('amdaModel.Download', { return myValues; } -}); \ No newline at end of file +}); diff --git a/js/app/views/DownloadUI.js b/js/app/views/DownloadUI.js index 7c5d098..e120458 100644 --- a/js/app/views/DownloadUI.js +++ b/js/app/views/DownloadUI.js @@ -18,12 +18,14 @@ Ext.define('amdaUI.DownloadUI', { 'amdaUI.SearchParamEditorPlugin' ], - 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']], - fileformatData : [['ASCII', 'ASCII'],['vot', 'VOTable']], + //Old kernel time formats + //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']], + //New kernel time formats + timeformatData : [['Y-m-dTH:i:s', 'YYYY-MM-DDThh:mm:ss'], ['DD Time', 'DD Time'], ['Timestamp', 'Timestamp']], + fileformatData : [['ASCII', 'ASCII'],['vot', 'VOTable'],['cdf', 'CDF'],['json', 'JSON']], fileformatTTData : [['text', 'plain text'], ['vot','VOTable']], filecompressData : [['zip', 'zip'], ['tar+gzip', 'tar+gzip']], filestructureData : [['0','All In One File'], ['1','One File Per Time Interval'], ['2','One File Per Param/Interval']], - fileheaderData : [['0','Write Into Data File'], ['1','Create Separate File']], constructor: function(config) { this.init(config); @@ -146,8 +148,8 @@ Ext.define('amdaUI.DownloadUI', { var timeSource = values.timesrc_downloadTimeSelector; var structure = values.filestructure; var sampling = values.sampling ? values.sampling : 600; + var refparamSampling = values.refparamsampling == 'on'; var output = values.output ? values.output : ''; - var header = values.header; var fileformat = values.fileformat; var compression = values.compression; @@ -185,9 +187,9 @@ Ext.define('amdaUI.DownloadUI', { // set parameters this.object.set('list',this.paramGrid.getStore().data.items); this.object.set('structure', structure); + this.object.set('refparamSampling', refparamSampling); this.object.set('sampling', sampling); this.object.set('output',output); - this.object.set('header', header); this.object.set('timeformat',timeformat); this.object.set('fileformat',fileformat); this.object.set('compression',compression); @@ -233,9 +235,6 @@ Ext.define('amdaUI.DownloadUI', { if (!this.object.get('compressionTT')) this.object.set('compressionTT', this.filecompressData[1][0]); - if (!this.object.get('header')) - this.object.set('header', this.fileheaderData[0][0]); - // load object into form this.formPanel.getForm().loadRecord(this.object); // set object's TTs into the timeselector @@ -261,21 +260,29 @@ Ext.define('amdaUI.DownloadUI', { grid.getStore().remove(record); }, - disableField : function(combo, newValue, oldValue){ - var tt = combo.next(); + onFileStructureChange : function(combo, newValue, oldValue){ + if (!this.formPanel) + return; + + var refParamCheck = this.formPanel.getForm().findField('refparamsampling'); + var samplingField = this.formPanel.getForm().findField('sampling'); - if (tt && newValue !== oldValue) { - var ff = tt.next(); - if (newValue == 2) { - tt.setDisabled(true); - // ff.setDisabled(true); - } - else { - tt.setDisabled(false); - // ff.setDisabled(false); - } + if (samplingField && newValue !== oldValue) { + refParamCheck.setDisabled(newValue == 2); + samplingField.setDisabled((newValue == 2) || refParamCheck.getValue()); } }, + + onRefParamSamplingChange : function(check, newValue, oldValue){ + if (!this.formPanel) + return; + + var samplingField = this.formPanel.getForm().findField('sampling'); + var structureCombo = this.formPanel.getForm().findField('filestructure'); + + if (samplingField && newValue !== oldValue) + samplingField.setDisabled((structureCombo.getValue() == 2) || check.getValue()); + }, /** * Check if changes were made before closing window @@ -479,19 +486,24 @@ Ext.define('amdaUI.DownloadUI', { store: this.timeformatData, value: this.timeformatData[0] }, - { xtype : 'checkbox', boxLabel: 'Show Milliseconds', - boxLabelAlign: 'before', - name: 'milli', checked: false//, - // margin : '0 0 5 150' //(top, right, bottom, left). - }, { fieldLabel: 'File Structure', name: 'filestructure', store: this.filestructureData, value: this.filestructureData[2], listeners : { - change : { fn : this.disableField } + change : { fn : this.onFileStructureChange }, + scope: this } + }, + { + xtype: 'checkbox', boxLabel: 'Use first param. as reference for sampling', + boxLabelAlign: 'before', + name: 'refparamsampling', checked: false, disabled: true, + listeners : { + change : { fn : this.onRefParamSamplingChange }, + scope : this + } }, { xtype: 'numberfield', name: 'sampling', @@ -504,12 +516,6 @@ Ext.define('amdaUI.DownloadUI', { fieldLabel: 'File Name', disabled: true, editable: true }, - { - fieldLabel:'Header', - name: 'header', - store: this.fileheaderData, - value: this.fileheaderData[0] - }, { fieldLabel: 'File Format', name: 'fileformat', -- libgit2 0.21.2