1
0
mirror of https://github.com/KubaPro010/fm-dx-webserver.git synced 2026-02-26 22:13:53 +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

@@ -315,8 +315,8 @@ function submitData() {
}
}
$("#fmlist-integration").prop("checked", data.extras ? data.extras?.fmlist_integration : "true");
$('#fmlist-omid').val(data.extras?.fmlist_omid);
$("#fmlist-integration").prop("checked", data.extras ? data.extras?.fmlistIntegration : "true");
$('#fmlist-omid').val(data.extras?.fmlistOmid);
})
.catch(error => {
console.error('Error fetching data:', error.message);

View File

@@ -1,9 +1,9 @@
var currentDate = new Date('Sep 15, 2024 00:00:00');
var currentDate = new Date('Sep 15, 2024 15:00:00');
var day = currentDate.getDate();
var month = currentDate.getMonth() + 1; // Months are zero-indexed, so add 1
var year = currentDate.getFullYear();
var formattedDate = day + '/' + month + '/' + year;
var currentVersion = 'v1.3.0 [' + formattedDate + ']';
var currentVersion = 'v1.3.0.1 [' + formattedDate + ']';
getInitialSettings();
removeUrlParameters(); // Call this function to remove URL parameters

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);
}
});
});
}

View File

@@ -155,6 +155,13 @@ $(document).ready(() => {
$('.version-string').text(currentVersion);
setBg();
updateIconState();
// Update icons when the checkbox state changes
$('input[type="checkbox"]').change(function() {
updateIconState();
});
});
function getQueryParameter(name) {
@@ -162,6 +169,17 @@ function getQueryParameter(name) {
return urlParams.get(name);
}
function updateIconState() {
$('input[type="checkbox"]').each(function() {
var icon = $(this).siblings('label').find('i');
if ($(this).is(':checked')) {
icon.removeClass('fa-toggle-off').addClass('fa-toggle-on');
} else {
icon.removeClass('fa-toggle-on').addClass('fa-toggle-off');
}
});
}
function setTheme(themeName) {
const themeColors = themes[themeName];
if (themeColors) {
@@ -191,4 +209,5 @@ function setBg() {
} else {
$('body').css('background', 'var(--color-main)');
}
}
}