diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c830809..a8ced58e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +# 0.90.56 (06-25-2020) +- Modified metrics now include service name for each service metric +- Added switch for true/false notifier values +- Added list for notifiers that have static values (in drop down) +- Fixed oAuth form saving +- Fixed some HTTP Cookie issues +- Added error if Theme Editor returns an error from API +- Added Pushover priority and sounds +- Added HTTP headers for outgoing requests (includes User-Agent=Statping and Statping-Version=0.90.55) + # 0.90.55 (06-18-2020) - Added 404 page - Modified Statping's PR process, dev -> master diff --git a/frontend/src/API.js b/frontend/src/API.js index 1adbbacc..aed0c464 100644 --- a/frontend/src/API.js +++ b/frontend/src/API.js @@ -9,7 +9,7 @@ const errorReporter = "https://bed4d75404924cb3a799e370733a1b64@sentry.statping. class Api { constructor() { - + axios.defaults.withCredentials = true } async oauth() { @@ -251,17 +251,13 @@ class Api { } token() { - const tk = $cookies.get(tokenKey) - if (!tk) { - return {admin: false}; - } - return tk; + return $cookies.get(tokenKey); } authToken() { const tk = $cookies.get(tokenKey) - if (tk.token) { - return {'Authorization': 'Bearer ' + tk.token}; + if (tk) { + return {'Authorization': 'Bearer ' + tk}; } else { return {}; } diff --git a/frontend/src/components/Dashboard/ThemeEditor.vue b/frontend/src/components/Dashboard/ThemeEditor.vue index 5d402f16..bf0f6d1a 100644 --- a/frontend/src/components/Dashboard/ThemeEditor.vue +++ b/frontend/src/components/Dashboard/ThemeEditor.vue @@ -107,9 +107,14 @@ }, async createAssets() { this.pending = true - const resp = await Api.theme_generate(true) + let resp + try { + resp = await Api.theme_generate(true) + } catch(e) { + this.error = e.response.data.error + } this.pending = false - await this.fetchTheme() + await this.fetchTheme() }, async deleteAssets() { this.pending = true diff --git a/frontend/src/components/Dashboard/TopNav.vue b/frontend/src/components/Dashboard/TopNav.vue index 8b887f89..3129592a 100644 --- a/frontend/src/components/Dashboard/TopNav.vue +++ b/frontend/src/components/Dashboard/TopNav.vue @@ -52,7 +52,7 @@ this.$store.commit('setHasAllData', false) this.$store.commit('setToken', null) this.$store.commit('setAdmin', false) - this.$cookies.remove("statping_auth") + // this.$cookies.remove("statping_auth") await this.$router.push('/logout') } } diff --git a/frontend/src/components/Dashboard/Variables.vue b/frontend/src/components/Dashboard/Variables.vue index 57393818..3dc1ec9d 100644 --- a/frontend/src/components/Dashboard/Variables.vue +++ b/frontend/src/components/Dashboard/Variables.vue @@ -38,8 +38,16 @@ 8080 - {{"\{\{.Service.DowntimeAgo\}\}"}} - 35 minutes ago + {{"\{\{.Service.Downtime.Human\}\}"}} + 2 minutes + + + {{"\{\{.Service.Uptime.Human\}\}"}} + 13 hours + + + {{"\{\{.Service.Online\}\}"}} + true/false {{"\{\{.Service.LastStatusCode\}\}"}} @@ -49,6 +57,22 @@ {{"\{\{.Service.FailuresLast24Hours\}\}"}} 38 + + {{"\{\{.Service.LastOnline\}\}"}} + 2020-11-05T13:15:30Z + + + {{"\{\{.Service.LastOffline\}\}"}} + 2020-10-01T13:15:30Z + + + {{"\{\{.Service.Online24Hours\}\}"}} + 0.99 + + + {{"\{\{.Service.Online7Days\}\}"}} + 0.97 + Additional variables within the Service struct diff --git a/frontend/src/forms/Login.vue b/frontend/src/forms/Login.vue index dd0fce1d..796f02ec 100644 --- a/frontend/src/forms/Login.vue +++ b/frontend/src/forms/Login.vue @@ -80,9 +80,8 @@ if (auth.error) { this.error = true } else if (auth.token) { - const u = {username: this.username, admin: auth.admin, token: auth.token} - this.$cookies.set("statping_auth", JSON.stringify(u)) - this.$store.dispatch('loadAdmin') + // this.$cookies.set("statping_auth", auth.token) + await this.$store.dispatch('loadAdmin') this.$store.commit('setAdmin', auth.admin) this.$router.push('/dashboard') } diff --git a/frontend/src/forms/Notifier.vue b/frontend/src/forms/Notifier.vue index a071dbeb..53cd3fef 100644 --- a/frontend/src/forms/Notifier.vue +++ b/frontend/src/forms/Notifier.vue @@ -12,9 +12,23 @@

-

+
+ + Scan this QR Code on the Statping Mobile App for quick setup +
+ +
- + + + + + + + +
@@ -155,17 +169,26 @@ export default { theme: 'neat', mode: "mymode", lineWrapping: true, - json: true, + json: this.notifier.data_type === "json", autoRefresh: true, mime: this.notifier.data_type === "json" ? "application/json" : "text/plain" }, beautifySettings: { indent_size: 2, space_in_empty_paren: true }, } }, - computed: { - - }, + computed: { + core() { + return this.$store.getters.core + }, + qrcode() { + const u = `statping://setup?domain=${this.core.domain}&api=${this.core.api_secret}` + return "https://chart.googleapis.com/chart?chs=500x500&cht=qr&chl=" + encodeURIComponent(u) + } + }, methods: { + formVisible(want, form) { + return !!want.includes(form.type); + }, visible(isVisible, entry) { if (isVisible) { this.$refs.cmfailure.codemirror.refresh() @@ -173,13 +196,19 @@ export default { } }, onCmSuccessReady(cm) { - this.success_data = beautify(this.notifier.success_data, this.beautifySettings) + this.success_data = this.notifier.success_data + if (this.notifier.data_type === "json") { + this.success_data = beautify(this.notifier.success_data, this.beautifySettings) + } setTimeout(function() { cm.refresh(); },1); }, onCmFailureReady(cm) { - this.failure_data = beautify(this.notifier.failure_data, this.beautifySettings) + this.failure_data = this.notifier.failure_data + if (this.notifier.data_type === "json") { + this.failure_data = beautify(this.notifier.failure_data, this.beautifySettings) + } setTimeout(function() { cm.refresh(); },1); diff --git a/frontend/src/forms/OAuth.vue b/frontend/src/forms/OAuth.vue index ca0c7a5d..46933705 100644 --- a/frontend/src/forms/OAuth.vue +++ b/frontend/src/forms/OAuth.vue @@ -1,6 +1,5 @@