1
0
Fork 0

Diskspace

This commit is contained in:
Joe Wroten 2019-05-15 23:17:45 -05:00
parent f6b92ada16
commit 3af007d0f4
8 changed files with 50 additions and 5 deletions

View file

@ -1 +1 @@
/dev/disk1 1000G 100G 900G 10% 0000001 9999999999999999999 0% / /dev/disk1 1000000 100000 900000 10% 0000001 9999999999999999999 0% /

View file

@ -29,3 +29,10 @@ app.route(apiPrefix + '/builddate').get((req, res) => {
}); });
}); });
app.route(apiPrefix + '/diskspace').get((req, res) => {
fs.readFile(path.join(__dirname, 'data/json', 'diskspace.json'), 'utf8', (err, json) => {
if (err) { throw new Error(err); }
res.json(JSON.parse(json));
});
});

View file

@ -5,4 +5,4 @@ touch data/raw/real/date.raw
date > data/raw/real/date.raw date > data/raw/real/date.raw
touch data/raw/real/diskspace.raw touch data/raw/real/diskspace.raw
df -H | grep /dev/disk1s1 > data/raw/real/diskspace.raw df | grep /dev/disk1s1 > data/raw/real/diskspace.raw

View file

@ -16,7 +16,16 @@
<div class="autogrid"> <div class="autogrid">
<section class="col"> <section class="col">
<div class="feed-card"> <div class="feed-card">
<img src="assets/emby.png" alt="" class="fadein" /> <div>
<meter min="0" v-bind:max="diskSize" v-bind:value="diskUsed"></meter>
</div>
<div class="load" v-if="fetchingDiskSpace"></div>
<h3 v-else>Used: {{diskCapacity}}
</div>
</section>
<section class="col">
<div class="feed-card">
<h3><a href="/emby">Emby</a></h3> <h3><a href="/emby">Emby</a></h3>
</div> </div>
</section> </section>

View file

@ -1,11 +1,17 @@
new Vue({ new Vue({
el: '#app', el: '#app',
data: { data: {
lastBuildDate: '',
fetchingLastBuildDate: true, fetchingLastBuildDate: true,
lastBuildDate: '',
fetchingDiskSpace: '',
diskSize: '',
diskUsed: '',
diskCapacity: '',
}, },
created() { created() {
this.fetchLastBuildDate(); this.fetchLastBuildDate();
this.fetchDiskSpace();
}, },
methods: { methods: {
async fetchLastBuildDate() { async fetchLastBuildDate() {
@ -16,5 +22,15 @@ new Vue({
this.fetchingLastBuildDate = false; this.fetchingLastBuildDate = false;
} catch (err) { throw new Error(err); } } catch (err) { throw new Error(err); }
}, },
async fetchDiskSpace() {
this.fetchingDiskSpace = true;
try {
let { data } = await axios.get('/api/diskspace');
this.diskSize = data.size;
this.diskUsed = data.used;
this.diskCapacity = data.capacity;
this.fetchingDiskSpace = false;
} catch (err) { throw new Error(err); }
},
}, },
}); });

Binary file not shown.

Before

Width:  |  Height:  |  Size: 999 KiB

View file

@ -1,3 +1,7 @@
meter {
width: 100%;
}
.fadein { .fadein {
animation: fadein 1s; animation: fadein 1s;
} }

View file

@ -16,7 +16,16 @@
<div class="autogrid"> <div class="autogrid">
<section class="col"> <section class="col">
<div class="feed-card"> <div class="feed-card">
<img src="assets/emby.png" alt="" class="fadein" /> <div>
<meter min="0" v-bind:max="diskSize" v-bind:value="diskUsed"></meter>
</div>
<div class="load" v-if="fetchingDiskSpace"></div>
<h3 v-else>Used: {{diskCapacity}}
</div>
</section>
<section class="col">
<div class="feed-card">
<h3><a href="/emby">Emby</a></h3> <h3><a href="/emby">Emby</a></h3>
</div> </div>
</section> </section>