[img] [/img]
Setting the suppressAlert property to true or false does not prevent this popup from showing. The javascript code is below
Code: Select all
Onload
var apiVersion = tripos.isAvailable("http://localhost:8080/api");
if (apiVersion !== null) {
changeElementValue('version', apiVersion);
} else {
changeElementValue('version', "triPOS not available");
}
/*
* check for existance of triPOS restful API
*
* Will return a string containing the version of the triPOS api
* or null which indicates some kind of error occurred and the
* error details can be determined from variables
* tripos_error_code and tripos_error_message.
*/
tripos.isAvailable = function(dtUrl) {
var dtRequest, dtJsonResponse;
tripos.resetError();
// validate parameters
if (dtUrl === null || dtUrl === undefined) {
// null or missing url error
tripos.setError("", "null or missing url parameter");
return null;
}
dtRequest = new pui.AjaxRequest(dtUrl);
if (dtRequest) {
dtRequest.method = "GET";
dtRequest.async = false;
dtRequest.setRequestHeader('tp-application-id','3028');
dtRequest.setRequestHeader('tp-application-version','1.0.0');
dtRequest.setRequestHeader('tp-application-name','MyApplication');
dtRequest.setRequestHeader('tp-authorization','Version=1.0, Credential=7c2dcd15-f327-462c-805e-0a4b7389a77a');
dtRequest.setRequestHeader('accept', 'application/json');
dtRequest.suppressAlert = false;
dtRequest.send();
if (dtRequest.getStatus() !== 200) {
tripos.setError("", "http status " + dtRequest.getStatus());
return null;
} else {
dtJsonResponse = JSON.parse(dtRequest.getResponseText());
if (dtJsonResponse) {
return dtJsonResponse._links[0].rel;
} else {
// json parsing error
tripos.setError("", "error parsing api service response!");
return null;
}
}
} else {
// error creating pui.AjaxRequest
tripos.setError("", "error creating pui.AjaxRequest!");
return null;
}
};