From 218c5718596508d23c57937fbf3d7f3c40f54ad4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferdinand=20M=C3=BCtsch?= Date: Fri, 12 Feb 2021 10:10:44 +0100 Subject: [PATCH] feat: display setup instructions on startup (resolve #120) --- README.md | 1 + data/colors.json | 1 + models/summary.go | 1 + routes/summary.go | 2 ++ static/assets/app.js | 4 ++- views/footer.tpl.html | 24 ++++++++++++++- views/index.tpl.html | 1 + views/settings.tpl.html | 20 ------------ views/summary.tpl.html | 68 +++++++++++++++++++++++++++++++++-------- 9 files changed, 88 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 5e06021..bc05434 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,7 @@ I'd love to get some community feedback from active Wakapi users. If you want, p * ✅ Partially compatible with WakaTime * ✅ WakaTime integration * ✅ Support for Prometheus exports +* ✅ Lightning fast * ✅ Self-hosted ## 🚧 Roadmap diff --git a/data/colors.json b/data/colors.json index c497daa..4d38faf 100644 --- a/data/colors.json +++ b/data/colors.json @@ -49,6 +49,7 @@ "DataWeave": "#003a52", "DM": "#447265", "Dockerfile": "#384d54", + "Docker": "#384d54", "Dogescript": "#cca760", "Dylan": "#6c616e", "E": "#ccce35", diff --git a/models/summary.go b/models/summary.go index f1408fe..a54ddfe 100644 --- a/models/summary.go +++ b/models/summary.go @@ -53,6 +53,7 @@ type SummaryViewModel struct { Error string Success string ApiKey string + RawQuery string } type SummaryParams struct { diff --git a/routes/summary.go b/routes/summary.go index fcf8dd5..2f52df0 100644 --- a/routes/summary.go +++ b/routes/summary.go @@ -39,6 +39,7 @@ func (h *SummaryHandler) GetIndex(w http.ResponseWriter, r *http.Request) { loadTemplates() } + rawQuery := r.URL.RawQuery q := r.URL.Query() if q.Get("interval") == "" && q.Get("from") == "" { q.Set("interval", "today") @@ -65,6 +66,7 @@ func (h *SummaryHandler) GetIndex(w http.ResponseWriter, r *http.Request) { EditorColors: utils.FilterColors(h.config.App.GetEditorColors(), summary.Editors), OSColors: utils.FilterColors(h.config.App.GetOSColors(), summary.OperatingSystems), ApiKey: user.ApiKey, + RawQuery: rawQuery, } templates[conf.SummaryTemplate].Execute(w, vm) diff --git a/static/assets/app.js b/static/assets/app.js index 6e795e6..950bff0 100644 --- a/static/assets/app.js +++ b/static/assets/app.js @@ -317,8 +317,10 @@ function equalizeHeights() { } function getTotal(items) { + const el = document.getElementById('total-span') + if (!el) return let total = items.reduce((acc, d) => acc + d.total, 0) - document.getElementById('total-span').innerText = total.toString().toHHMMSS() + el.innerText = total.toString().toHHMMSS() } function getRandomColor(seed) { diff --git a/views/footer.tpl.html b/views/footer.tpl.html index e0e7adb..3b887b3 100644 --- a/views/footer.tpl.html +++ b/views/footer.tpl.html @@ -9,4 +9,26 @@
Imprint, Cookies & Data Privacy
- \ No newline at end of file + + + \ No newline at end of file diff --git a/views/index.tpl.html b/views/index.tpl.html index f4073e5..b2c3253 100644 --- a/views/index.tpl.html +++ b/views/index.tpl.html @@ -72,6 +72,7 @@ class="underline">Prometheus metrics via exporter +
  • ✅   Lightning fast
  • ✅   Self-hosted
  • diff --git a/views/settings.tpl.html b/views/settings.tpl.html index dec7b45..f2e8c27 100644 --- a/views/settings.tpl.html +++ b/views/settings.tpl.html @@ -534,26 +534,6 @@ +