Fix fetchProcesses to add date to time

This commit is contained in:
mirivlad 2026-02-14 17:43:37 +00:00
parent d8ac71d1c9
commit 2cb259577d
1 changed files with 9 additions and 1 deletions

View File

@ -388,7 +388,15 @@
// Функция для получения топ-процессов для указанного времени
function fetchProcesses(serverId, time) {
return new Promise(function(resolve) {
fetch('/api/v1/agent/' + serverId + '/processes?time=' + encodeURIComponent(time))
var fullTime = time;
if (time && time.indexOf('-') === -1) {
var now = new Date();
var year = now.getFullYear();
var month = String(now.getMonth() + 1).padStart(2, '0');
var day = String(now.getDate()).padStart(2, '0');
fullTime = year + '-' + month + '-' + day + ' ' + time;
}
fetch('/api/v1/agent/' + serverId + '/processes?time=' + encodeURIComponent(fullTime))
.then(response => response.json())
.then(data => {
var lines = [];