Skip to content

Commit

Permalink
Merge pull request #851 from oceanzus/redesign_dlest_fix
Browse files Browse the repository at this point in the history
Fixes time and size estimator launching erroneous download attempts.
  • Loading branch information
oceanzus authored Apr 1, 2019
2 parents 17a6c1b + 3c5a769 commit e13b27c
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 22 deletions.
13 changes: 9 additions & 4 deletions ooiui/core/routes/science.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,9 @@ def get_csv(stream_name, reference_designator, start, end):
user = request.args.get('user', '')
email = request.args.get('email', '')
parameters = request.args.get('parameters', '')
url = app.config['SERVICES_URL'] + '/uframe/get_csv/%s/%s/%s/%s/%s?user=%s&email=%s&parameters=%s' % (stream_name, reference_designator, start, end, dpa, user, email, parameters)
estimate_only = request.args.get('estimate', 'false')
url = app.config['SERVICES_URL'] + '/uframe/get_csv/%s/%s/%s/%s/%s?user=%s&email=%s&parameters=%s&estimate_only=%s' \
% (stream_name, reference_designator, start, end, dpa, user, email, parameters, estimate_only)
req = requests.get(url, auth=(token, ''), stream=True)
return Response(stream_with_context(req.iter_content(chunk_size=1024*1024*4)), headers=dict(req.headers))

Expand All @@ -641,7 +643,9 @@ def get_json(stream_name, reference_designator, start, end, provenance, annotati
user = request.args.get('user', '')
email = request.args.get('email', '')
parameters = request.args.get('parameters', '')
url = app.config['SERVICES_URL'] + '/uframe/get_json/%s/%s/%s/%s/%s/%s/%s?user=%s&email=%s&parameters=%s' % (stream_name, reference_designator, start, end, dpa, provenance, annotations, user, email, parameters)
estimate_only = request.args.get('estimate', 'false')
url = app.config['SERVICES_URL'] + '/uframe/get_json/%s/%s/%s/%s/%s/%s/%s?user=%s&email=%s&parameters=%s&estimate_only=%s' \
% (stream_name, reference_designator, start, end, dpa, provenance, annotations, user, email, parameters, estimate_only)
req = requests.get(url, auth=(token, ''), stream=True, params=request.args)
return Response(stream_with_context(req.iter_content(chunk_size=1024*1024*4)), headers=dict(req.headers))

Expand All @@ -653,8 +657,9 @@ def get_netcdf(stream_name, reference_designator, start, end, provenance, annota
user = request.args.get('user', '')
email = request.args.get('email', '')
parameters = request.args.get('parameters', '')
req = requests.get(app.config['SERVICES_URL'] + '/uframe/get_netcdf/%s/%s/%s/%s/%s/%s/%s?user=%s&email=%s&parameters=%s'
% (stream_name, reference_designator, start, end, dpa, provenance, annotations, user, email, parameters), auth=(token, ''), stream=True)
estimate_only = request.args.get('estimate', 'false')
req = requests.get(app.config['SERVICES_URL'] + '/uframe/get_netcdf/%s/%s/%s/%s/%s/%s/%s?user=%s&email=%s&parameters=%s&estimate_only=%s'
% (stream_name, reference_designator, start, end, dpa, provenance, annotations, user, email, parameters, estimate_only), auth=(token, ''), stream=True)
return Response(stream_with_context(req.iter_content(chunk_size=1024*1024*4)), headers=dict(req.headers))


Expand Down
8 changes: 3 additions & 5 deletions ooiui/static/js/models/science/StreamModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,13 @@ var StreamModel = Backbone.Model.extend({

getURL: function(type) {
if(type == 'json') {
var url = '/api/uframe/get_json/' + this.get('stream_name') + '/' + this.get('reference_designator')+"/"+this.get('start')+"/"+this.get('end')+"/"+this.get('provenance')+"/"+this.get('annotations')+"?user="+this.get('user_name')+'&email='+this.get('email')+"&parameters="+this.get('parameters');
var url = '/api/uframe/get_json/' + this.get('stream_name') + '/' + this.get('reference_designator')+"/"+this.get('start')+"/"+this.get('end')+"/"+this.get('provenance')+"/"+this.get('annotations')+"?user="+this.get('user_name')+'&email='+this.get('email')+"&estimate="+this.get('estimate')+"&parameters="+this.get('parameters');
} else if(type == 'profile_json_download') {
var url = '/api/uframe/get_profiles/' + this.get('stream_name') + '/' + this.get('reference_designator')+"/"+this.get('start')+"/"+this.get('end')+"?user="+this.get('user_name')+'&email='+this.get('email')+"&parameters="+this.get('parameters');
} else if(type == 'netcdf') {
var url = '/api/uframe/get_netcdf/' + this.get('stream_name') + '/' + this.get('reference_designator')+"/"+this.get('start')+"/"+this.get('end')+"/"+this.get('provenance')+"/"+this.get('annotations')+"?user="+this.get('user_name')+'&email='+this.get('email')+"&parameters="+this.get('parameters');
var url = '/api/uframe/get_netcdf/' + this.get('stream_name') + '/' + this.get('reference_designator')+"/"+this.get('start')+"/"+this.get('end')+"/"+this.get('provenance')+"/"+this.get('annotations')+"?user="+this.get('user_name')+'&email='+this.get('email')+"&estimate="+this.get('estimate')+"&parameters="+this.get('parameters');
} else if(type == 'csv') {
var url = '/api/uframe/get_csv/' + this.get('stream_name') + '/' + this.get('reference_designator')+"/"+this.get('start')+"/"+this.get('end')+"?user="+this.get('user_name')+'&email='+this.get('email')+"&parameters="+this.get('parameters');
} else if(type == 'estimate') {
var url = '/api/uframe/get_json/' + this.get('stream_name') + '/' + this.get('reference_designator')+"/"+this.get('start')+"/"+this.get('end')+"/"+this.get('provenance')+"/"+this.get('annotations')+"?user="+this.get('user_name')+'&email='+this.get('email')+"&parameters="+this.get('parameters')+"&estimate_only=true";
var url = '/api/uframe/get_csv/' + this.get('stream_name') + '/' + this.get('reference_designator')+"/"+this.get('start')+"/"+this.get('end')+"?user="+this.get('user_name')+'&email='+this.get('email')+"&estimate="+this.get('estimate')+"&parameters="+this.get('parameters');
}
return url;
},
Expand Down
7 changes: 5 additions & 2 deletions ooiui/static/js/views/science/StreamDownloadFormView.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ var StreamDownloadFormView = Backbone.View.extend({
// $('#metadata').fadeTo(0,0.6);
// $('#metadata').append('<div id="temp-fade" style="position: absolute;top:0;left:0;width: 100%;height:100%;z-index:2;opacity:0.4;filter: alpha(opacity = 50)"></div>');
// $("#wspinner").show();
// var selection = this.$type_select.val();
var selection = this.$type_select.val();
var localModel = this.model.clone();
var startDate = moment.utc(this.$start_date.data('date')).toJSON();
var endDate = moment.utc(this.$end_date.data('date')).toJSON();
Expand Down Expand Up @@ -323,9 +323,10 @@ var StreamDownloadFormView = Backbone.View.extend({
localModel.set('parameters', '')
}

localModel.set('estimate', 'true');

// Create the typical download AJAX request
var url = localModel.getURL('estimate');
var url = localModel.getURL(selection);
$.ajax({
url: url,
type: "GET",
Expand Down Expand Up @@ -413,6 +414,8 @@ var StreamDownloadFormView = Backbone.View.extend({
localModel.set('parameters', '')
}

localModel.set('estimate', 'false');


// Create the typical download AJAX request
var url = localModel.getURL(selection);
Expand Down
27 changes: 16 additions & 11 deletions ooiui/static/json/uiPatchNotes.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
[
{
"VersionNumber": "1.6.0",
"VersionDate": "2019-03-08",
"VersionNumber": "1.6.1",
"VersionDate": "2019-03-26",
"VersionDescription": [
"Data Catalog: Changed from stream to instrument-centric table view. (12529)",
"Data Catalog: Cleanup of side filter options and behavior. (12532)",
"Data Catalog: CAMHD and HYDBB instruments and raw data links restored. (13358)",
"Data Download: Added preview of time/size estimate to download dialog. (13376)",
"General: Added click-to-zoom action to all content images. (10502)",
"General: Header update and cleanup."
"Data Download: Fixes time and size estimator launching erroneous download attempts. (14251)"
],
"ReleaseNotesPDF": "OOI_2.0_1.6.0.pdf",
"SiteTourTitle": "Release 1.6.0 Tour",
Expand Down Expand Up @@ -49,9 +44,19 @@
"intro": "This is the end of the tour. Please refer to the <a href='/help'>Help</a> page if you need further assistance."
}
]
}


}
},
{
"VersionNumber": "1.6.0",
"VersionDate": "2019-03-08",
"VersionDescription": [
"Data Catalog: Changed from stream to instrument-centric table view. (12529)",
"Data Catalog: Cleanup of side filter options and behavior. (12532)",
"Data Catalog: CAMHD and HYDBB instruments and raw data links restored. (13358)",
"Data Download: Added preview of time/size estimate to download dialog. (13376)",
"General: Added click-to-zoom action to all content images. (10502)",
"General: Header update and cleanup."
]
},
{
"VersionNumber": "1.5.1",
Expand Down

0 comments on commit e13b27c

Please sign in to comment.