mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
🆕 db locked icon #685
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
// General utilities to interact with teh database
|
||||
// General utilities to interact with the database
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
// --------------------------------------------------
|
||||
// Read data and place intotarget location, callback processies the results
|
||||
function readData(sqlQuery, processDataCallback, valuesArray, targetLocation, targetField, nameTransformer) {
|
||||
var apiUrl = `php/server/dbHelper.php?action=read&rawSql=${encodeURIComponent(sqlQuery)}`;
|
||||
@@ -15,4 +17,31 @@ function readData(sqlQuery, processDataCallback, valuesArray, targetLocation, ta
|
||||
// Place the resulting HTML into the specified placeholder div
|
||||
$("#" + targetLocation).replaceWith(htmlResult);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------
|
||||
// Check if database is locked
|
||||
function checkDbLock() {
|
||||
$.ajax({
|
||||
url: 'php/server/dbHelper.php', // Replace with the actual path to your PHP file
|
||||
type: 'GET',
|
||||
data: { action: 'checkLock' },
|
||||
success: function(response) {
|
||||
if (response == 1) {
|
||||
console.log('🟥 Database is locked');
|
||||
$(".header-status-locked-db").show()
|
||||
} else {
|
||||
// console.log('Database is not locked');
|
||||
$(".header-status-locked-db").hide()
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
console.log('Error checking database lock status');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Start the loop
|
||||
setInterval(() => {
|
||||
checkDbLock();
|
||||
}, 1000);
|
||||
|
||||
Reference in New Issue
Block a user