Avoid showing HTML code from gateway if server is not running
This commit is contained in:
parent
4f79e9e069
commit
74b4b833da
|
@ -38,6 +38,8 @@ export function queryRoute(method, path, callback, type)
|
|||
return window.alert('Authentication failed. Try again.');
|
||||
default:
|
||||
try {
|
||||
// avoid showing HTML code from gateway
|
||||
ajaxRequest.responseTextDisplay = ajaxRequest.status >= 500 || ajaxRequest.status < 600 ? 'internal server error' : ajaxRequest.responseText;
|
||||
return callback(this, status === 200);
|
||||
} catch (e) {
|
||||
window.alert('Unable to process server response: ' + e);
|
||||
|
|
|
@ -250,19 +250,20 @@ function renderBuildActionActions(actionValue, buildAction, detailsTable)
|
|||
|
||||
function showBuildActions(ajaxRequest)
|
||||
{
|
||||
if (!window.globalInfo) {
|
||||
if (!window.globalInfo && ajaxRequest.status === 200) {
|
||||
window.functionsPostponedUntilGlobalInfo.push(showBuildActions.bind(this, ...arguments));
|
||||
return;
|
||||
}
|
||||
const buildActionsList = Utils.getAndEmptyElement('build-actions-list');
|
||||
if (ajaxRequest.status !== 200) {
|
||||
buildActionsList.appendChild(document.createTextNode('Unable to load build actions: ' + ajaxRequest.responseText));
|
||||
buildActionsList.appendChild(document.createTextNode('Unable to load build actions: ' + ajaxRequest.responseTextDisplay));
|
||||
buildActionsList.appendChild(document.createTextNode(' '));
|
||||
buildActionsList.appendChild(CustomRendering.renderReloadButton(queryBuildActions));
|
||||
return;
|
||||
}
|
||||
const responseJson = JSON.parse(ajaxRequest.responseText);
|
||||
if (!Array.isArray(responseJson)) {
|
||||
buildActionsList.appendChild(document.createTextNode('Unable to load build actions: response is no array'));
|
||||
buildActionsList.appendChild(document.createTextNode('Unable to load build actions: response is no array '));
|
||||
buildActionsList.appendChild(CustomRendering.renderReloadButton(queryBuildActions));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -18,11 +18,10 @@ function handleGlobalStatusUpdate(ajaxRequest)
|
|||
{
|
||||
const globalStatus = Utils.getAndEmptyElement('global-status');
|
||||
let responseText = ajaxRequest.responseText;
|
||||
if (ajaxRequest.status === 500) {
|
||||
responseText = 'internal server error';
|
||||
}
|
||||
if (ajaxRequest.status !== 200) {
|
||||
globalStatus.appendChild(document.createTextNode('unable to load global status: ' + responseText));
|
||||
globalStatus.appendChild(document.createTextNode('unable to load global status: ' + ajaxRequest.responseTextDisplay));
|
||||
globalStatus.appendChild(document.createTextNode(' '));
|
||||
globalStatus.appendChild(CustomRendering.renderReloadButton(queryGlobalStatus));
|
||||
return;
|
||||
}
|
||||
const responseJson = JSON.parse(responseText);
|
||||
|
|
|
@ -156,7 +156,7 @@ export function showPackageDetails(ajaxRequest, row)
|
|||
const packageID = makePackageID(row);
|
||||
const packageDetailsContainer = Utils.getAndEmptyElement('package-details-container');
|
||||
if (ajaxRequest.status !== 200) {
|
||||
packageDetailsContainer.appendChild(document.createTextNode('unable query package details: ' + ajaxRequest.responseText));
|
||||
packageDetailsContainer.appendChild(document.createTextNode('unable query package details: ' + ajaxRequest.responseTextDisplay));
|
||||
return;
|
||||
}
|
||||
const responseJson = JSON.parse(ajaxRequest.responseText);
|
||||
|
|
|
@ -108,7 +108,7 @@ function showPackageSearchResults(ajaxRequest)
|
|||
{
|
||||
const packageSearchResults = Utils.getAndEmptyElement('package-search-results');
|
||||
if (ajaxRequest.status !== 200) {
|
||||
packageSearchResults.appendChild(document.createTextNode('unable search for packages: ' + ajaxRequest.responseText));
|
||||
packageSearchResults.appendChild(document.createTextNode('unable search for packages: ' + ajaxRequest.responseTextDisplay));
|
||||
return;
|
||||
}
|
||||
const responseJson = JSON.parse(ajaxRequest.responseText);
|
||||
|
|
Loading…
Reference in New Issue