Skip to content

Commit

Permalink
Fixes download page estimate routing.
Browse files Browse the repository at this point in the history
Updates patch notes.
  • Loading branch information
oceanzus committed Mar 26, 2019
1 parent 17a6c1b commit 1388089
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 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
7 changes: 7 additions & 0 deletions ooiui/static/json/uiPatchNotes.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
[
{
"VersionNumber": "1.6.1",
"VersionDate": "2019-03-26",
"VersionDescription": [
"Data Download: Fixes time and size estimator launching erroneous download attempts. (14251)"
]
},
{
"VersionNumber": "1.6.0",
"VersionDate": "2019-03-08",
Expand Down

0 comments on commit 1388089

Please sign in to comment.