2021-01-02 19:09:05 +00:00
|
|
|
GeneralChart.init();
|
|
|
|
|
2023-10-08 16:46:03 +00:00
|
|
|
tstor.dashboard = {
|
|
|
|
_cacheChart: new CacheChart("main-cache-chart", "Cache disk"),
|
|
|
|
loadView: function () {
|
|
|
|
fetch("/api/status")
|
|
|
|
.then(function (response) {
|
|
|
|
if (response.ok) {
|
|
|
|
return response.json();
|
|
|
|
} else {
|
|
|
|
tstor.message.error(
|
|
|
|
"Error getting data from server. Response: " + response.status
|
|
|
|
);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.then(function (stats) {
|
|
|
|
var download =
|
|
|
|
stats.torrentStats.downloadedBytes / stats.torrentStats.timePassed;
|
|
|
|
var upload =
|
|
|
|
stats.torrentStats.uploadedBytes / stats.torrentStats.timePassed;
|
2021-01-02 19:09:05 +00:00
|
|
|
|
2023-10-08 16:46:03 +00:00
|
|
|
GeneralChart.update(download, upload);
|
2021-01-02 19:09:05 +00:00
|
|
|
|
2023-10-08 16:46:03 +00:00
|
|
|
tstor.dashboard._cacheChart.update(
|
|
|
|
stats.cacheFilled,
|
|
|
|
stats.cacheCapacity - stats.cacheFilled
|
|
|
|
);
|
2021-01-02 19:09:05 +00:00
|
|
|
|
2023-10-08 16:46:03 +00:00
|
|
|
document.getElementById("general-download-speed").innerText =
|
|
|
|
Humanize.ibytes(download, 1024) + "/s";
|
2021-01-02 19:09:05 +00:00
|
|
|
|
2023-10-08 16:46:03 +00:00
|
|
|
document.getElementById("general-upload-speed").innerText =
|
|
|
|
Humanize.ibytes(upload, 1024) + "/s";
|
|
|
|
})
|
|
|
|
.catch(function (error) {
|
|
|
|
tstor.message.error("Error getting status info: " + error.message);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
};
|