1
0
mirror of https://github.com/KubaPro010/fm-dx-webserver.git synced 2026-02-27 14:33:52 +01:00

bugfixes, UI improvements, logging improvements

This commit is contained in:
NoobishSVK
2024-09-15 14:47:32 +02:00
parent 546997f351
commit e29e3a3f04
11 changed files with 120 additions and 49 deletions

View File

@@ -181,6 +181,38 @@ $(document).ready(function () {
textInput.focus();
});
initTooltips();
//FMLIST logging
$('#log-fmlist').on('click', function() {
console.log('asdfdasf');
$.ajax({
url: './log_fmlist',
method: 'GET',
success: function(response) {
// Show a success toast with the response message
sendToast('success', 'Log successful', response, false, true);
},
error: function(xhr) {
let errorMessage;
// Handle different error status codes with custom messages
switch (xhr.status) {
case 429:
errorMessage = xhr.responseText;
break;
case 500:
errorMessage = 'Server error: ' + xhr.responseText || 'Internal Server Error';
break;
default:
errorMessage = xhr.statusText || 'An error occurred';
}
// Show an error toast with the specific error message
sendToast('error', 'Log failed', errorMessage, false, true);
}
});
});
});
function getServerTime() {
@@ -834,7 +866,7 @@ const updateDataElements = throttle(function(parsedData) {
}
if(parsedData.txInfo.tx.length > 1 && parsedData.txInfo.dist > 150 && parsedData.txInfo.dist < 4000) {
$('#log-fmlist').attr('disabled', 'false').removeClass('btn-disabled cursor-disabled');
$('#log-fmlist').removeAttr('disabled').removeClass('btn-disabled cursor-disabled');
} else {
$('#log-fmlist').attr('disabled', 'true').addClass('btn-disabled cursor-disabled');
}
@@ -1016,18 +1048,4 @@ function fillPresets() {
tuneTo(Number(presetText));
});
}
}
//FMLIST logging
$('#log-fmlist').on('click', function() {
$.ajax({
url: './log_fmlist',
method: 'GET',
success: function(response) {
sendToast('success', 'Log successful', response, false, true);
},
error: function(xhr) {
sendToast('error', 'Log failed', xhr.statusText, false, true);
}
});
});
}