добавил ошибку обновления текущих статусов и графика, исправил формат даты и времени на графике
This commit is contained in:
@@ -76,13 +76,26 @@ async function makeRequest(url) {
|
||||
}
|
||||
|
||||
async function loadChartData() {
|
||||
let chartTime = localStorage.getItem("settings-chart-time")
|
||||
|
||||
return (await makeRequest('/fetch/tank-chart?days=' + chartTime))['tank_chart']
|
||||
try {
|
||||
const chartTime = localStorage.getItem("settings-chart-time")
|
||||
const res = await makeRequest('/fetch/tank-chart?days=' + chartTime)
|
||||
document.getElementById('chart-update-error').hidden = true
|
||||
return res['tank_chart']
|
||||
} catch (e) {
|
||||
document.getElementById('chart-update-error').hidden = false
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
async function loadLastUpdates() {
|
||||
return (await makeRequest('/fetch/stats'))['stats']
|
||||
try {
|
||||
const res = await makeRequest('/fetch/stats')
|
||||
document.getElementById('stats-update-error').hidden = true
|
||||
return res['stats']
|
||||
} catch (e) {
|
||||
document.getElementById('stats-update-error').hidden = false
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -352,7 +365,10 @@ const updateFunctions = {
|
||||
}
|
||||
|
||||
async function updateStatus() {
|
||||
let dataset = await loadLastUpdates()
|
||||
const dataset = await loadLastUpdates()
|
||||
if (dataset === undefined) {
|
||||
return
|
||||
}
|
||||
|
||||
for (let id in updateFunctions) {
|
||||
let element = document.getElementById(id)
|
||||
|
Reference in New Issue
Block a user