fix: [dashboard] fix day format

dashboard
terrtia 2024-12-06 15:15:18 +01:00
parent 2f19c12712
commit 4af3fc76fd
No known key found for this signature in database
GPG Key ID: 1E1B1F50D84613D0
1 changed files with 7 additions and 2 deletions

View File

@ -328,7 +328,11 @@ function updateFeederChart(data) {
function updateDate() { function updateDate() {
let d = new Date(); let d = new Date();
let current_date = d.getUTCFullYear() + ' - ' + (d.getUTCMonth() + 1) + ' - ' + d.getUTCDate(); let day = d.getUTCDate();
if (day < 10) {
day = "0" + day;
}
let current_date = d.getUTCFullYear() + ' - ' + (d.getUTCMonth() + 1) + ' - ' + day;
$('#current_date').text(current_date) $('#current_date').text(current_date)
} }
@ -339,6 +343,7 @@ function updateNbObjects(data) {
} }
function updateCrawlerStats(data) { function updateCrawlerStats(data) {
updateDate();
$("#stat_crawler_onion_domain_up").text(data['onion']['up']); $("#stat_crawler_onion_domain_up").text(data['onion']['up']);
$("#stat_crawler_onion_domain_down").text(data['onion']['down']); $("#stat_crawler_onion_domain_down").text(data['onion']['down']);
$("#stat_crawler_onion_total").text(data['onion']['crawled']); $("#stat_crawler_onion_total").text(data['onion']['crawled']);
@ -416,7 +421,7 @@ function update_tracked_objs_dashboard(data) {
} }
// WebSocket // WebSocket
var socket = new WebSocket("{{ url_for('ws_dashboard') }}"); var socket = new WebSocket("wss://" + window.location.host + "/ws/dashboard");
socket.wsocket = function(event) { socket.wsocket = function(event) {
console.log("WebSocket connection opened:", event); console.log("WebSocket connection opened:", event);
}; };