mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-05-15 10:04:37 -04:00
consolidate getJson fail callbacks to one function
This commit is contained in:
@@ -393,10 +393,7 @@ if ( currentView != 'none' && currentView != 'login' ) {
|
||||
$j(".optionhelp").click(function(evt) {
|
||||
$j.getJSON(thisUrl + '?request=modal&modal=optionhelp&ohndx=' + evt.target.id)
|
||||
.done(optionhelpModal)
|
||||
.fail(function(jqxhr, textStatus, error) {
|
||||
console.log("Request Failed: " + textStatus + ", " + error);
|
||||
console.log("Response Text: " + jqxhr.responseText);
|
||||
});
|
||||
.fail(logAjaxFail);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -420,7 +417,7 @@ if ( currentView != 'none' && currentView != 'login' ) {
|
||||
.done(setNavBar)
|
||||
.fail(function(jqxhr, textStatus, error) {
|
||||
console.log("Request Failed: " + textStatus + ", " + error);
|
||||
console.log("Response Text: " + jqxhr.responseText);
|
||||
console.log("Response Text: " + jqxhr.responseText.replace(/(<([^>]+)>)/gi, ''));
|
||||
if ( textStatus != "timeout" ) {
|
||||
// The idea is that this should only fail due to auth, so reload the page
|
||||
// which should go to login if it can't stay logged in.
|
||||
@@ -722,10 +719,7 @@ function reminderClickFunction() {
|
||||
var option = $j(this).data('pdsa-dropdown-val');
|
||||
$j.getJSON(thisUrl + '?view=version&action=version&option=' + option)
|
||||
.done(window.location.reload(true)) //Do a full refresh to update ZM_DYN_LAST_VERSION
|
||||
.fail(function(jqxhr, textStatus, error) {
|
||||
console.log("Request Failed: " + textStatus + ", " + error);
|
||||
console.log("Response Text: " + jqxhr.responseText);
|
||||
});
|
||||
.fail(logAjaxFail);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -745,10 +739,7 @@ function enoperm() {
|
||||
$j('#ENoPerm').modal('hide');
|
||||
});
|
||||
})
|
||||
.fail(function(jqxhr, textStatus, error) {
|
||||
console.log("Request Failed: " + textStatus + ", " + error);
|
||||
console.log("Response Text: " + jqxhr.responseText);
|
||||
});
|
||||
.fail(logAjaxFail);
|
||||
}
|
||||
|
||||
function getLogoutModal() {
|
||||
@@ -760,10 +751,7 @@ function getLogoutModal() {
|
||||
$j("body").append(data.html);
|
||||
}
|
||||
})
|
||||
.fail(function(jqxhr, textStatus, error) {
|
||||
console.log("Request Failed: " + textStatus + ", " + error);
|
||||
console.log("Response Text: " + jqxhr.responseText);
|
||||
});
|
||||
.fail(logAjaxFail);
|
||||
}
|
||||
|
||||
function getStateModal() {
|
||||
@@ -777,10 +765,7 @@ function getStateModal() {
|
||||
$j('#modalState').modal('show');
|
||||
manageStateModalBtns();
|
||||
})
|
||||
.fail(function(jqxhr, textStatus, error) {
|
||||
console.log("Request Failed: " + textStatus + ", " + error);
|
||||
console.log("Response Text: " + jqxhr.responseText);
|
||||
});
|
||||
.fail(logAjaxFail);
|
||||
}
|
||||
|
||||
function manageStateModalBtns() {
|
||||
@@ -845,3 +830,8 @@ function stateStuff(action, runState, newState) {
|
||||
location.reload();
|
||||
});
|
||||
}
|
||||
|
||||
function logAjaxFail(jqxhr, textStatus, error) {
|
||||
console.log("Request Failed: " + textStatus + ", " + error);
|
||||
console.log("Response Text: " + jqxhr.responseText.replace(/(<([^>]+)>)/gi, '')); // strip any html from the response
|
||||
}
|
||||
|
||||
@@ -188,10 +188,7 @@ function initPage() {
|
||||
$j('#donateForm').submit();
|
||||
});
|
||||
})
|
||||
.fail(function(jqxhr, textStatus, error) {
|
||||
console.log("Request Failed: " + textStatus + ", " + error);
|
||||
console.log("Response Text: " + jqxhr.responseText);
|
||||
});
|
||||
.fail(logAjaxFail);
|
||||
}
|
||||
|
||||
// Makes table sortable
|
||||
@@ -217,10 +214,7 @@ function initPage() {
|
||||
// Manage the Function modal
|
||||
manageFunctionModal();
|
||||
})
|
||||
.fail(function(jqxhr, textStatus, error) {
|
||||
console.log("Request Failed: " + textStatus + ", " + error);
|
||||
console.log("Response Text: " + jqxhr.responseText);
|
||||
});
|
||||
.fail(logAjaxFail);
|
||||
}
|
||||
|
||||
function applySort(event, ui) {
|
||||
|
||||
@@ -50,10 +50,7 @@ var cueFrames = null; //make cueFrames available even if we don't send another a
|
||||
|
||||
function initialAlarmCues(eventId) {
|
||||
$j.getJSON(thisUrl + '?view=request&request=status&entity=frames&id=' + eventId, setAlarmCues) //get frames data for alarmCues and inserts into html
|
||||
.fail(function(jqxhr, textStatus, error) {
|
||||
console.log("Request Failed: " + textStatus + ", " + error);
|
||||
console.log("Response Text: " + jqxhr.responseText);
|
||||
});
|
||||
.fail(logAjaxFail);
|
||||
}
|
||||
|
||||
function setAlarmCues(data) {
|
||||
|
||||
@@ -46,10 +46,7 @@ function getDelConfirmModal() {
|
||||
}
|
||||
manageDelConfirmModalBtns();
|
||||
})
|
||||
.fail(function(jqxhr, textStatus, error) {
|
||||
console.log("Request Failed: " + textStatus + ", " + error);
|
||||
console.log("Response Text: " + jqxhr.responseText);
|
||||
});
|
||||
.fail(logAjaxFail);
|
||||
}
|
||||
|
||||
// Manage the DELETE CONFIRMATION modal button
|
||||
@@ -68,10 +65,7 @@ function manageDelConfirmModalBtns() {
|
||||
$j('#eventTable').bootstrapTable('refresh');
|
||||
window.location.reload(true);
|
||||
})
|
||||
.fail(function(jqxhr, textStatus, error) {
|
||||
console.log("Request Failed: " + textStatus + ", " + error);
|
||||
console.log("Response Text: " + jqxhr.responseText);
|
||||
});
|
||||
.fail(logAjaxFail);
|
||||
});
|
||||
|
||||
// Manage the CANCEL modal button
|
||||
@@ -95,10 +89,7 @@ function getEventDetailModal(eid) {
|
||||
$j('#eventDetailForm').submit();
|
||||
});
|
||||
})
|
||||
.fail(function(jqxhr, textStatus, error) {
|
||||
console.log("Request Failed: " + textStatus + ", " + error);
|
||||
console.log("Response Text: " + jqxhr.responseText);
|
||||
});
|
||||
.fail(logAjaxFail);
|
||||
}
|
||||
|
||||
function initPage() {
|
||||
@@ -199,10 +190,7 @@ function initPage() {
|
||||
$j('#eventTable').bootstrapTable('refresh');
|
||||
window.location.reload(true);
|
||||
})
|
||||
.fail(function(jqxhr, textStatus, error) {
|
||||
console.log("Request Failed: " + textStatus + ", " + error);
|
||||
console.log("Response Text: " + jqxhr.responseText);
|
||||
});
|
||||
.fail(logAjaxFail);
|
||||
});
|
||||
|
||||
// Manage the UNARCHIVE button
|
||||
@@ -221,10 +209,7 @@ function initPage() {
|
||||
$j('#eventTable').bootstrapTable('refresh');
|
||||
window.location.reload(true);
|
||||
})
|
||||
.fail(function(jqxhr, textStatus, error) {
|
||||
console.log("Request Failed: " + textStatus + ", " + error);
|
||||
console.log("Response Text: " + jqxhr.responseText);
|
||||
});
|
||||
.fail(logAjaxFail);
|
||||
|
||||
if ( openFilterWindow ) {
|
||||
//opener.location.reload(true);
|
||||
@@ -259,10 +244,7 @@ function initPage() {
|
||||
$j('#eventDetailForm').submit();
|
||||
});
|
||||
})
|
||||
.fail(function(jqxhr, textStatus, error) {
|
||||
console.log("Request Failed: " + textStatus + ", " + error);
|
||||
console.log("Response Text: " + jqxhr.responseText);
|
||||
});
|
||||
.fail(logAjaxFail);
|
||||
});
|
||||
|
||||
// Manage the EXPORT button
|
||||
|
||||
@@ -95,10 +95,7 @@ function getEventDetailModal(eid) {
|
||||
$j('#eventDetailForm').submit();
|
||||
});
|
||||
})
|
||||
.fail(function(jqxhr, textStatus, error) {
|
||||
console.log("Request Failed: " + textStatus + ", " + error);
|
||||
console.log("Response Text: " + jqxhr.responseText);
|
||||
});
|
||||
.fail(logAjaxFail);
|
||||
}
|
||||
|
||||
function initPage() {
|
||||
|
||||
@@ -422,10 +422,7 @@ function getModal(id) {
|
||||
}
|
||||
$j('#'+id+'Modal').modal('show');
|
||||
})
|
||||
.fail(function(jqxhr, textStatus, error) {
|
||||
console.log("Request Failed: " + textStatus + ", " + error);
|
||||
console.log("Response Text: " + jqxhr.responseText);
|
||||
});
|
||||
.fail(logAjaxFail);
|
||||
}
|
||||
|
||||
function manageModalBtns(id) {
|
||||
|
||||
@@ -32,10 +32,7 @@ function detailFormatter(index, row, $detail) {
|
||||
.done(function(data) {
|
||||
$detail.html(data.html);
|
||||
})
|
||||
.fail(function(jqxhr, textStatus, error) {
|
||||
console.log("Request Failed: " + textStatus + ", " + error);
|
||||
console.log("Response Text: " + jqxhr.responseText);
|
||||
});
|
||||
.fail(logAjaxFail);
|
||||
}
|
||||
function initPage() {
|
||||
var backBtn = $j('#backBtn');
|
||||
|
||||
@@ -14,10 +14,7 @@ function getServerModal(sid) {
|
||||
$j('#serverModalForm').submit();
|
||||
});
|
||||
})
|
||||
.fail(function(jqxhr, textStatus, error) {
|
||||
console.log("Request Failed: " + textStatus + ", " + error);
|
||||
console.log("Response Text: " + jqxhr.responseText);
|
||||
});
|
||||
.fail(logAjaxFail);
|
||||
}
|
||||
|
||||
function enableServerModal() {
|
||||
@@ -48,10 +45,7 @@ function getStorageModal(sid) {
|
||||
$j('#storageModalForm').submit();
|
||||
});
|
||||
})
|
||||
.fail(function(jqxhr, textStatus, error) {
|
||||
console.log("Request Failed: " + textStatus + ", " + error);
|
||||
console.log("Response Text: " + jqxhr.responseText);
|
||||
});
|
||||
.fail(logAjaxFail);
|
||||
}
|
||||
|
||||
function enableStorageModal() {
|
||||
|
||||
Reference in New Issue
Block a user