Skip to content

Commit

Permalink
index.html bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
PiyushXCoder committed Dec 24, 2021
1 parent 45bc871 commit 6e77384
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rasp_mgr"
version = "2.0.3"
version = "2.0.4"
description = "A simple server manager for local newtrok"
authors = ["PiyushXCoder <piyush.raj.kit@gmail.com>"]
license = "GPL-3.0-only"
Expand All @@ -12,17 +12,17 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
clap = "2.33.3"
toml = "0.5.8"
clap = "2.33"
toml = "0.5"

tide = "0.16.0"
async-std = { version = "1.6.0", features = ["attributes"] }
tide = "0.16"
async-std = { version = "1.6", features = ["attributes"] }
serde = { version = "1.0", features = ["derive"] }

humantime = "2.1.0"
humantime = "2.1"

sys-info = "0.9.0"
libc = "0.2.97"
mnt = "0.3.1"
sys-info = "0.9"
libc = "0.2"
mnt = "0.3"

libmedium = "0.6.0"
libmedium = "0.6"
32 changes: 17 additions & 15 deletions static/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand All @@ -8,6 +9,7 @@
<title>Rasp Manager</title>
<link rel="stylesheet" href="awsm.min.css">
</head>

<body>
<header>
<h1>Rasp Manager</h1>
Expand All @@ -30,10 +32,9 @@ <h1>Rasp Manager</h1>

<script src="jquery-3.6.0.min.js"></script>
<script>
$.get("/sysinfo", function(data) {
var data = JSON.parse(data);
$.get("/sysinfo", function (data) {
var area = $('#sysinfo');
var pushin = function(parent, label, dat) {
var pushin = function (parent, label, dat) {
parent.append($('<b>').append(label))
.append(dat)
.append('<br>');
Expand All @@ -43,10 +44,10 @@ <h1>Rasp Manager</h1>
var fset = $('<fieldset>');
fset.append($('<legend>').append('System'));
pushin(fset, 'System Name: ', data.system_name);
if(data.os_version != undefined)
if (data.os_version != undefined)
pushin(fset, 'Operating System Version: ', data.os_version);
pushin(fset, 'Kernel Version: ', data.kernel_ver);
if(data.last_uadate != undefined)
if (data.last_uadate != undefined)
pushin(fset, 'Last Update: ', data.last_uadate);
pushin(fset, 'Hostname: ', data.hostname);
pushin(fset, 'Boot Time: ', data.boot_time);
Expand All @@ -68,38 +69,39 @@ <h1>Rasp Manager</h1>

var fset = $('<fieldset>');
fset.append($('<legend>').append('Disk'));
fset.append($('<small>', {style:'color: grey'}).append('available/total<br>'));
fset.append($('<small>', { style: 'color: grey' }).append('available/total<br>'));
data.disk.forEach(e => {
pushin(fset, '→ '+e.mount, '');
pushin(fset, '→ ' + e.mount, '');
var available = e.available;
var total = e.total;
var unit_available = 'MB';
var unit_total = 'MB';

if(available > 1024) {
if (available > 1024) {
available /= 1024;
unit_available = 'GB';
}
if(total > 1024) {
if (total > 1024) {
total /= 1024;
unit_total = 'GB';
}
pushin(fset, '', +available.toFixed(2)+ ' '+unit_available+'/' +total.toFixed(2)+ ' '+unit_total);

pushin(fset, '', +available.toFixed(2) + ' ' + unit_available + '/' + total.toFixed(2) + ' ' + unit_total);
});
area.append(fset);

var fset = $('<fieldset>');
fset.append($('<legend>').append('Temperature'));
data.temperature.forEach(e => {
pushin(fset, '→ '+e.label+': ', e.temp.toFixed(2) +'°C');
pushin(fset, '→ ' + e.label + ': ', e.temp.toFixed(2) + '°C');
});
area.append(fset);
}).fail(function() {
$('#sysinfo').empty().append($('<span>', {style: 'color: red'})

}).fail(function () {
$('#sysinfo').empty().append($('<span>', { style: 'color: red' })
.append('Error in getting system information!'));
});
</script>
</body>

</html>

0 comments on commit 6e77384

Please sign in to comment.