Skip to content

Commit dbbdcfd

Browse files
xssfoxTheSkorm
authored andcommitted
pull from s3 as well if we are doing a single lookup
1 parent 9239933 commit dbbdcfd

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

js/sondehub.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4159,12 +4159,17 @@ function refreshSingleNew(serial) {
41594159
ajax_inprogress_single_new = true;
41604160

41614161
var data_str = "duration=3d&serial=" + serial;
4162-
4162+
4163+
var xhr = new XMLHttpRequest();
4164+
41634165
ajax_positions_single_new = $.ajax({
41644166
type: "GET",
41654167
url: newdata_url,
41664168
data: data_str,
41674169
dataType: "json",
4170+
xhr: function() {
4171+
return xhr;
4172+
},
41684173
success: function(data, textStatus) {
41694174
response = formatData(data, false);
41704175
update(response, true);
@@ -4175,6 +4180,23 @@ function refreshSingleNew(serial) {
41754180
complete: function(request, textStatus) {
41764181
clearTimeout(periodical_focus_new);
41774182
ajax_inprogress_single_new = false;
4183+
// check if we have been redirected for history - if not we can also fetch that if it exists
4184+
console.log("completed first call")
4185+
console.log(xhr.responseURL)
4186+
if (xhr.responseURL.includes(newdata_url)){
4187+
console.log("getting extra history")
4188+
$.ajax({
4189+
type: "GET",
4190+
url: "https://sondehub-history.s3.amazonaws.com/serial/"+ encodeURIComponent(serial) +".json.gz",
4191+
dataType: "json",
4192+
success: function(data, textStatus) {
4193+
response = formatData(data, false);
4194+
update(response, true);
4195+
},
4196+
error: function() {
4197+
}
4198+
})
4199+
}
41784200
}
41794201
});
41804202
}

0 commit comments

Comments
 (0)