AppSettings.ApiUrl

This commit is contained in:
2023-01-19 16:45:16 -07:00
parent a4d3a9899f
commit 10c823dca8
10 changed files with 202 additions and 39 deletions

View File

@ -1,3 +1,4 @@
var _apiUrl = null;
var _initialHeaderAttachmentId = null;
var _initialHeaderId = null;
var _toolType = null;
@ -25,7 +26,8 @@ function loadRunInfoAwaitingDisposition() {
window.location.href = targetURL;
}
function initAwaitingDisposition() {
function initAwaitingDisposition(apiUrl) {
_apiUrl = apiUrl;
$("#grid").igGrid({
autoGenerateColumns: false,
width: "70%",
@ -45,7 +47,7 @@ function initAwaitingDisposition() {
{ key: "InsertDate", dataType: "date", width: "10%", format: "dateTime" },
{ key: "Expiration", dataType: "date", width: "10%", format: "dateTime" }
],
dataSource: "https://localhost:7130/api/awaitingdispo/",
dataSource: _apiUrl + "/api/awaitingdispo/",
responseDataKey: "Results",
tabIndex: 1,
features: [
@ -61,11 +63,12 @@ function initAwaitingDisposition() {
$("#grid").on("dblclick", "tr", loadRunInfoAwaitingDisposition);
};
function initExport(startTimeValue, endTimeValue) {
function initExport(apiUrl, startTimeValue, endTimeValue) {
_apiUrl = apiUrl;
var endTime = new Date(endTimeValue);
var startTime = new Date(startTimeValue);
$("#ToolType").igCombo({
dataSource: 'https://localhost:7130/api/tooltypes',
dataSource: _apiUrl + '/api/tooltypes',
responseDataKey: "Results",
textKey: "ToolTypeName",
valueKey: "ID",
@ -104,7 +107,7 @@ function loadHeaderGridRunHeaders() {
if (gridCreated)
$("#HeaderGrid").igGrid("destroy");
clearFieldsGridRunHeaders();
var headerURL = "https://localhost:7130/api/tooltypes/" + toolTypeID + "/headertitles";
var headerURL = _apiUrl + "/api/tooltypes/" + toolTypeID + "/headertitles";
$("#HeaderGrid").igGrid({
autoGenerateColumns: false,
primaryKey: "ID",
@ -134,7 +137,7 @@ function clearFieldsGridRunHeaders() {
function headerSelectionChangedRunHeaders(evt, ui) {
var toolTypeID = $("#ToolType").igCombo("value");
clearFieldsGridRunHeaders();
var url = "https://localhost:7130/api/tooltypes/" + toolTypeID + "/headers/" + ui.row.id + "/fields";
var url = _apiUrl + "/api/tooltypes/" + toolTypeID + "/headers/" + ui.row.id + "/fields";
$("#FieldsGrid").igGrid({
autoGenerateColumns: false,
primaryKey: "Column",
@ -153,9 +156,10 @@ function headerSelectionChangedRunHeaders(evt, ui) {
});
}
function initRunHeaders() {
function initRunHeaders(apiUrl) {
_apiUrl = apiUrl;
$("#ToolType").igCombo({
dataSource: 'https://localhost:7130/api/tooltypes',
dataSource: _apiUrl + '/api/tooltypes',
responseDataKey: "Results",
textKey: "ToolTypeName",
valueKey: "ID",
@ -181,7 +185,7 @@ function loadHeaderGridRunInfo() {
$("#HeaderGrid").igGrid("destroy");
$.ajax({
type: "GET",
url: "https://localhost:7130/api/tooltypes/" + toolTypeID + "?sortby=grid",
url: _apiUrl + "/api/tooltypes/" + toolTypeID + "?sortby=grid",
success: function (r) {
if ((r.Results == null) || (r.Results.ToolType == null) || (r.Results.Metadata == null))
ShowErrorMessage("Invalid tool type: " + toolTypeID);
@ -263,7 +267,7 @@ function detailSelectionChangedRunInfo(evt, ui) {
if (ui.row.index >= 0) {
var rowData = ui.owner.grid.dataSource.dataView()[ui.row.index];
var toolTypeID = $("#ToolTypeID").text();
var attachmentUrlBase = 'https://localhost:7130/api/tooltypes/' + toolTypeID;
var attachmentUrlBase = _apiUrl + '/api/tooltypes/' + toolTypeID;
var attachmentId = rowData.AttachmentID;
if ((attachmentId == null) || (attachmentId === ''))
return;
@ -276,7 +280,7 @@ function detailSelectionChangedRunInfo(evt, ui) {
function loadHeaderAttachmentRunInfo() {
var toolTypeID = $("#ToolTypeID").text();
var attachmentId = $("#HeaderAttachmentId").text();
var attachmentUrlBase = 'https://localhost:7130/api/tooltypes/' + toolTypeID;
var attachmentUrlBase = _apiUrl + '/api/tooltypes/' + toolTypeID;
if ((attachmentId == null) || (attachmentId === '') || (_toolType.DisplayHeaderAttachment == null) || (_toolType.DisplayHeaderAttachment === '')) {
$("#HeaderAttachmentFrame").prop("src", "");
} else {
@ -290,7 +294,7 @@ function markAsReviewedRunInfo() {
var headerId = $("#HeaderId").text();
$.ajax({
type: "POST",
url: "https://localhost:7130/api/awaitingdispo/markasreviewed?tooltypeid=" + toolTypeId + "&headerid=" + headerId,
url: _apiUrl + "/api/awaitingdispo/markasreviewed?tooltypeid=" + toolTypeId + "&headerid=" + headerId,
success: function () {
},
error: function (e, ajaxOptions, ex) {
@ -308,7 +312,7 @@ function loadDetailsRunInfo() {
$("#DetailsGrid").igGrid("destroy");
var headerId = $("#HeaderId").text();
var toolTypeID = $("#ToolTypeID").text();
var detailsURL = "https://localhost:7130/api/tooltypes/" + toolTypeID + "/headers/" + headerId + "/data";
var detailsURL = _apiUrl + "/api/tooltypes/" + toolTypeID + "/headers/" + headerId + "/data";
var gridColumns = [
{ key: "AttachmentID", dataType: "string", hidden: true },
{ key: "Title", dataType: "string", hidden: true },
@ -372,7 +376,7 @@ function requestHeaderDataRunInfo() {
$("#HeaderAttachmentId").text(_initialHeaderAttachmentId);
_initialHeaderId = -1;
}
var headerURL = "https://localhost:7130/api/tooltypes/" + _toolType.ID + "/headers?" + $.param(parms);
var headerURL = _apiUrl + "/api/tooltypes/" + _toolType.ID + "/headers?" + $.param(parms);
var gridColumns = [
{ key: "ID", dataType: "number", hidden: true },
{ key: "AttachmentID", dataType: "string", hidden: true },
@ -428,7 +432,7 @@ function reviewButtonRunInfo() {
$("#ReviewButton").prop("disabled", true);
$.ajax({
type: "POST",
url: "https://localhost:7130/api/awaitingdispo/markasawaiting?tooltypeid=" + toolTypeId + "&headerid=" + headerId,
url: _apiUrl + "/api/awaitingdispo/markasawaiting?tooltypeid=" + toolTypeId + "&headerid=" + headerId,
success: function (e) {
DisplayWSMessage("info", "Marked as awaiting disposition", e);
$("#ReviewButton").prop("disabled", false);
@ -446,7 +450,7 @@ function oiExportButtonRunInfo() {
$("#OIExportButton").prop("disabled", true);
$.ajax({
type: "POST",
url: "https://localhost:7130/api/tooltypes/" + toolTypeID + "/headers/" + headerId + "/oiexport",
url: _apiUrl + "/api/tooltypes/" + toolTypeID + "/headers/" + headerId + "/oiexport",
success: function (r) {
$("#OIExportResult").text("Exported!");
},
@ -482,11 +486,12 @@ function setInitialDateTimesRunInfo() {
});
}
function initRunInfo(initialToolTypeID, initialHeaderId, initialHeaderAttachmentId) {
function initRunInfo(apiUrl, initialToolTypeID, initialHeaderId, initialHeaderAttachmentId) {
_apiUrl = apiUrl;
_initialHeaderId = initialHeaderId;
_initialHeaderAttachmentId = initialHeaderAttachmentId;
$("#ToolType").igCombo({
dataSource: 'https://localhost:7130/api/tooltypes',
dataSource: _apiUrl + '/api/tooltypes',
responseDataKey: "Results",
textKey: "ToolTypeName",
valueKey: "ID",