From 7a36aba08f3bf467f0d544bbd727ffd198ebb4a7 Mon Sep 17 00:00:00 2001 From: Simon Lecoq <22963968+lowlighter@users.noreply.github.com> Date: Thu, 8 Apr 2021 20:26:03 +0200 Subject: [PATCH] Improvement on web server (#215) --- source/app/mocks/api/axios/get/nightscout.mjs | 3 +-- source/app/web/statics/app.js | 5 +++++ source/app/web/statics/app.placeholder.js | 14 +++++++++----- source/app/web/statics/index.html | 11 +++++++---- source/app/web/statics/style.css | 14 ++++++++++++-- source/plugins/achievements/metadata.yml | 4 +++- source/plugins/contributors/metadata.yml | 1 + source/plugins/people/metadata.yml | 2 ++ source/plugins/rss/metadata.yml | 1 + source/plugins/stock/metadata.yml | 1 + 10 files changed, 42 insertions(+), 14 deletions(-) diff --git a/source/app/mocks/api/axios/get/nightscout.mjs b/source/app/mocks/api/axios/get/nightscout.mjs index 560cdb64..d2e6fed6 100644 --- a/source/app/mocks/api/axios/get/nightscout.mjs +++ b/source/app/mocks/api/axios/get/nightscout.mjs @@ -5,7 +5,6 @@ export default function({faker, url}) { //Get Nightscout Data console.debug(`metrics/compute/mocks > mocking nightscout api result > ${url}`) const lastInterval = Math.floor(new Date() / 300000) * 300000 - const directionArray = ["SingleUp", "DoubleUp", "FortyFiveUp", "Flat", "FortyFiveDown", "SingleDown", "DoubleDown"] return ({ status:200, data:new Array(12).fill(null).map(_ => ({ @@ -15,7 +14,7 @@ export default function({faker, url}) { dateString:new Date(lastInterval).toISOString(), sgv:faker.random.number({min:40, max:400}), delta:faker.random.number({min:-10, max:10}), - direction:directionArray[Math.floor(Math.random() * directionArray.length)], + direction:faker.random.arrayElement(["SingleUp", "DoubleUp", "FortyFiveUp", "Flat", "FortyFiveDown", "SingleDown", "DoubleDown"]), type:"sgv", filtered:0, unfiltered:0, diff --git a/source/app/web/statics/app.js b/source/app/web/statics/app.js index d77b51c6..28ba9462 100644 --- a/source/app/web/statics/app.js +++ b/source/app/web/statics/app.js @@ -86,6 +86,7 @@ descriptions:{ classic:"Classic template", terminal:"Terminal template", + markdown:"(hidden)", repository:"(hidden)", }, }, @@ -97,6 +98,10 @@ }, //Computed data computed:{ + //Unusable plugins + unusable() { + return this.plugins.list.filter(({name}) => this.plugins.enabled[name]).filter(({enabled}) => !enabled).map(({name}) => name) + }, //User's avatar avatar() { return this.generated.content ? `https://github.com/${this.user}.png` : null diff --git a/source/app/web/statics/app.placeholder.js b/source/app/web/statics/app.placeholder.js index c4bdfc22..a9cbddf0 100644 --- a/source/app/web/statics/app.placeholder.js +++ b/source/app/web/statics/app.placeholder.js @@ -332,11 +332,15 @@ ...(set.plugins.enabled.nightscout ? ({ nightscout:{ url: options["nightscout.url"] != null && options["nightscout.url"] != "https://example.herokuapp.com" ? options["nightscout.url"]: "https://testapp.herokuapp.com/", - datapoints: faker.random.number({min: 8, max: 12}), - lowalert: faker.random.number({min: 60, max: 90}), - highalert: faker.random.number({min: 150, max: 200}), - urgentlowalert: faker.random.number({min: 40, max: 59}), - urgenthighalert: faker.random.number({min: 201, max: 300}) + data:new Array(12).fill(null).map(_ => ({ + timeUTCHumanReadable:`${new Date().getUTCHours()}:${new Date().getUTCMinutes()}`, + color:faker.random.arrayElement(["#9be9a8", "#40c463", "#30a14e", "#216e39"]), + sgv:faker.random.number({min:40, max:400}), + delta:faker.random.number({min:-10, max:10}), + direction:faker.random.arrayElement(["SingleUp", "DoubleUp", "FortyFiveUp", "Flat", "FortyFiveDown", "SingleDown", "DoubleDown"]), + alert:faker.random.arrayElement(["Normal", "Urgent High", "Urgent Low", "High", "Low"]), + arrowHumanReadable:faker.random.arrayElement(["↑↑", "↑", "↗", "→", "↘", "↓", "↓↓"]), + })), } }) : null), //Pagespeed diff --git a/source/app/web/statics/index.html b/source/app/web/statics/index.html index 2fc9dfa7..4aaef4fa 100644 --- a/source/app/web/statics/index.html +++ b/source/app/web/statics/index.html @@ -28,11 +28,11 @@ Overview -