Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #247 from USGS-WiM/staging
Browse files Browse the repository at this point in the history
url fix to access at S3
  • Loading branch information
njestes authored Sep 12, 2017
2 parents 921dbe6 + eed63cd commit 8d3ba56
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 87 deletions.
2 changes: 1 addition & 1 deletion build/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ <h6 style="text-align: center;"><b>Contributing monitoring organizations</b></h6
</div>
<div role="tabpanel" class="tab-pane" id="disclaimerTabPane">
<p>Any use of trade, firm, or product names is for descriptive purposes only and does not imply endorsement by the U.S. Government.</p>
<p>Version 1.0.9</p>
<p>Version 1.1.0</p>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions build/scripts/combined.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ <h6 style="text-align: center;"><b>Contributing monitoring organizations</b></h6
</div>
<div role="tabpanel" class="tab-pane" id="disclaimerTabPane">
<p>Any use of trade, firm, or product names is for descriptive purposes only and does not imply endorsement by the U.S. Government.</p>
<p>Version 1.0.9</p>
<p>Version 1.1.0</p>
</div>
</div>
</div>
Expand Down
94 changes: 11 additions & 83 deletions src/scripts/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1175,88 +1175,16 @@ require([
//alert(pestPDFs);
} else {
var jossoSessionId = "";
$(".charts-model-loading").show();
//$(".charts-model-loading").show();
$(".charts-sbdown").hide();
$.ajax({
dataType: 'json',
type: 'GET',
url: 'https://services.wim.usgs.gov/proxies/sbProxy/Default.aspx?q=sessionid',
headers: {'Accept': '*/*'},
success: function (data) {
var jossoObj = data;
var qTerm = currentConst + "_" + currentSiteNo;
var newQTerm = qTerm.replace(" ","%20");
var url = "https://www.sciencebase.gov/catalog/items?s=Search&q="+ newQTerm + "&format=json&josso=" + jossoObj.jossoSessionId;
console.log(url);
$.ajax({
dataType: 'json',
type: 'GET',
url: url,
headers: {'Accept': '*/*'},
success: function (data) {
var itemData = data;
console.log(itemData);
//get folder id and then call this for with josso session id to get plot urls
if (itemData.items.length > 0) {
var url = "https://www.sciencebase.gov/catalog/item/" + itemData.items[0].id + "?format=json&josso=" + jossoObj.jossoSessionId;
$.ajax({
dataType: 'json',
type: 'GET',
url: url,
headers: {'Accept': '*/*'},
success: function (data) {
var pngUrlData = data;
$.each(pngUrlData.files, function (key, value) {
console.log(value.url);
switch(value.name) {
case "plotConcTime.png":
$("#pConc").attr("src", value.url + "&josso=" + jossoObj.jossoSessionId);
break;
case "boxConcMonth.png":
$("#bConc").attr("src", value.url + "&josso=" + jossoObj.jossoSessionId);
break;
case "plotConcPred.png":
$("#pConcPred").attr("src", value.url + "&josso=" + jossoObj.jossoSessionId);
break;
case "plotFluxPred.png":
$("#pFluxPred").attr("src", value.url + "&josso=" + jossoObj.jossoSessionId);
break;
case "plotConcHistBoot.png":
$("#pConcHistBoot").attr("src", value.url + "&josso=" + jossoObj.jossoSessionId);
break;
case "plotFluxHistBoot.png":
$("#pFluxHistBoot").attr("src", value.url + "&josso=" + jossoObj.jossoSessionId);
break;
default:
}
});
console.log(pngUrlData);
$(".charts-model-loading").hide();
},
error: function (error) {
console.log("Error processing the JSON. The error is:" + error);
}
});
}
},
error: function (error) {
console.log("Error processing the JSON. The error is:" + error);
}
});
},
error: function (error) {
console.log("Error processing the JSON. The error is:" + error);
//add content here when science base is not allowing access
$(".charts-model-loading").hide();
$(".charts-sbdown").show();
}
});
$("#pConc").attr("src", "");
$("#bConc").attr("src", "");
$("#pConcPred").attr("src", "");
$("#pFluxPred").attr("src", "");
$("#pConcHistBoot").attr("src", "");
$("#pFluxHistBoot").attr("src", "");
$(".charts-model-loading").hide();

$("#pConc").attr("src", "https://s3.amazonaws.com/nawqatrends.wim.usgs.gov/charts/" + currentConst + "_" + currentSiteNo + "/plotConcTime.png");
$("#bConc").attr("src", "https://s3.amazonaws.com/nawqatrends.wim.usgs.gov/charts/" + currentConst + "_" + currentSiteNo + "/boxConcMonth.png");
$("#pConcPred").attr("src", "https://s3.amazonaws.com/nawqatrends.wim.usgs.gov/charts/" + currentConst + "_" + currentSiteNo + "/plotConcPred.png");
$("#pFluxPred").attr("src", "https://s3.amazonaws.com/nawqatrends.wim.usgs.gov/charts/" + currentConst + "_" + currentSiteNo + "/plotFluxPred.png");
$("#pConcHistBoot").attr("src", "https://s3.amazonaws.com/nawqatrends.wim.usgs.gov/charts/" + currentConst + "_" + currentSiteNo + "/plotConcHistBoot.png");
$("#pFluxHistBoot").attr("src", "https://s3.amazonaws.com/nawqatrends.wim.usgs.gov/charts/" + currentConst + "_" + currentSiteNo + "/plotFluxHistBoot.png");
$('#chartModal').modal('show');
}
}
Expand Down Expand Up @@ -1589,8 +1517,8 @@ require([
$('#faq28header').click(function(){$('#faq28body').slideToggle(250);});

$('.fullsize').click(function(){
var data = "<img src='"+$(this).attr('src')+"'/>";
var myWindow = window.open("data:text/html," + encodeURIComponent(data),"_blank");
//var data = "<img src='"+$(this).attr('src')+"'/>";
var myWindow = window.open($(this).attr('src'),"_blank");
myWindow.focus();
});

Expand Down

0 comments on commit 8d3ba56

Please sign in to comment.