Fix fetchProcesses to add date to time
This commit is contained in:
parent
d8ac71d1c9
commit
2cb259577d
|
|
@ -388,7 +388,15 @@
|
||||||
// Функция для получения топ-процессов для указанного времени
|
// Функция для получения топ-процессов для указанного времени
|
||||||
function fetchProcesses(serverId, time) {
|
function fetchProcesses(serverId, time) {
|
||||||
return new Promise(function(resolve) {
|
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(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
var lines = [];
|
var lines = [];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue