diff --git a/.gitignore b/.gitignore index 7ab347e..3106bd8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ public data/raw/real data/json +.DS_Store +src/DS_Store # Logs logs *.log diff --git a/copyAssets.sh b/copyAssets.sh index 9092157..5f82e4c 100644 --- a/copyAssets.sh +++ b/copyAssets.sh @@ -4,3 +4,4 @@ cp -R src/assets public cp node_modules/vital-css/dist/css/vital.min.css public/assets cp node_modules/vue/dist/vue.min.js public/assets cp node_modules/axios/dist/axios.min.js public/assets +cp node_modules/moment/min/moment.min.js public/assets diff --git a/package.json b/package.json index 9cc27b6..7ce418d 100644 --- a/package.json +++ b/package.json @@ -29,5 +29,6 @@ "moment": "^2.24.0", "vital-css": "^2.2.1", "vue": "^2.6.10" - } + }, + "dependencies": {} } diff --git a/src/.DS_Store b/src/.DS_Store deleted file mode 100644 index 6f0c15d..0000000 Binary files a/src/.DS_Store and /dev/null differ diff --git a/src/assets/.DS_Store b/src/assets/.DS_Store deleted file mode 100644 index bacf0fc..0000000 Binary files a/src/assets/.DS_Store and /dev/null differ diff --git a/src/assets/app.js b/src/assets/app.js index 1cc77d5..3ef43d8 100644 --- a/src/assets/app.js +++ b/src/assets/app.js @@ -15,24 +15,38 @@ new Vue({ fetchingUptime: true, uptime: '', + + time: '', + date: '', }, created() { - this.fetchLastBuildDate(); - this.fetchDiskSpace(); - this.fetchCPUUsage(); - this.fetchUptime(); + this.fetchStats(true); + this.updateTimeAndDate(); + setInterval(this.updateTimeAndDate, 1000); // 1 Second + setInterval(this.fetchStats, 600000); // 10 Minutes }, methods: { - async fetchLastBuildDate() { - this.fetchingLastBuildDate = true; + fetchStats(showAsFetching = false) { + this.fetchLastBuildDate(showAsFetching); + this.fetchDiskSpace(showAsFetching); + this.fetchCPUUsage(showAsFetching); + this.fetchUptime(showAsFetching); + }, + updateTimeAndDate() { + let currentTime = moment(); + this.time = currentTime.format('h:mm'); + this.date = currentTime.format('dddd, MMMM Do'); + }, + async fetchLastBuildDate(showAsFetching) { + this.fetchingLastBuildDate = showAsFetching; try { let { data } = await axios.get('/api/builddate'); this.lastBuildDate = data.pretty; this.fetchingLastBuildDate = false; } catch (err) { throw new Error(err); } }, - async fetchDiskSpace() { - this.fetchingDiskSpace = true; + async fetchDiskSpace(showAsFetching) { + this.fetchingDiskSpace = showAsFetching; try { let { data } = await axios.get('/api/diskspace'); this.diskSize = data.size; @@ -41,8 +55,8 @@ new Vue({ this.fetchingDiskSpace = false; } catch (err) { throw new Error(err); } }, - async fetchCPUUsage() { - this.fetchingCPUUsage = true; + async fetchCPUUsage(showAsFetching) { + this.fetchingCPUUsage = showAsFetching; try { let { data } = await axios.get('/api/cpuusage'); this.cpuUsageNum = data.num; @@ -50,8 +64,8 @@ new Vue({ this.fetchingCPUUsage = false; } catch (err) { throw new Error(err); } }, - async fetchUptime() { - this.fetchingUptime = true; + async fetchUptime(showAsFetching) { + this.fetchingUptime = showAsFetching; try { let { data } = await axios.get('/api/uptime'); this.uptime = data.uptime; diff --git a/src/assets/header.jpg b/src/assets/header.jpg new file mode 100644 index 0000000..5d1233f Binary files /dev/null and b/src/assets/header.jpg differ diff --git a/src/assets/styles.css b/src/assets/styles.css index c6bec40..197d1ed 100644 --- a/src/assets/styles.css +++ b/src/assets/styles.css @@ -5,30 +5,49 @@ body { header { position: relative; color: white; - height: 3rem; + height: 15rem; + text-align: center; + padding-top: 3rem; + background: url('./header.jpg'); + background-size: cover; + background-position: bottom; +} + +header:after { + content: ''; + background: linear-gradient(180deg, rgba(2,0,36,0) 0%, rgba(40,42,54,1) 100%); + height: 4rem; + position: absolute; + bottom: 0; + left: 0; + right: 0; +} + +footer { + text-align: center; + color: #f1fa8c; +} + +.branding { + line-height: 2.5rem; + display: inline-block; + margin-right: 2rem; } .logo { height: 2rem; + vertical-align: bottom; margin: .5rem; } .name { - position: absolute; - top: 0; - left: 3rem; - line-height: 3rem; color: #6272a4; - margin: 0; -} - -footer { - color: #f1fa8c; } .feed-card { background: #44475a; color: #f8f8f2; + border-radius: .5rem; } h1, h2, h3, h4, h5, h6 { diff --git a/src/index.html b/src/index.html index 2c18619..11d0de2 100644 --- a/src/index.html +++ b/src/index.html @@ -18,11 +18,12 @@ +
-