From c06840169008481346cd098d99df69ae3af743b9 Mon Sep 17 00:00:00 2001 From: hunterlong Date: Wed, 19 Aug 2020 00:36:32 -0700 Subject: [PATCH] service view page updates, chart updates --- CHANGELOG.md | 1 + .../components/Index/GroupServiceFailures.vue | 14 +- .../src/components/Service/AdvancedChart.vue | 23 ++- .../components/Service/FailuresBarChart.vue | 166 ++++++++++++++++++ frontend/src/mixin.js | 8 +- frontend/src/pages/Service.vue | 119 ++++++++----- frontend/src/store.js | 5 +- 7 files changed, 272 insertions(+), 64 deletions(-) create mode 100644 frontend/src/components/Service/FailuresBarChart.vue diff --git a/CHANGELOG.md b/CHANGELOG.md index 8795d2a9..67d0f969 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Added "reason" for failures (will be used for more custom notification messages) [regex, lookup, timeout, connection, close, status_code] - Added Help page that is generated from Statping's Wiki repo on build - Modified Service Group failures on index page to show 90 days of failures +- Modified Service view page, updated Latency and Ping charts, added failures below # 0.90.63 (08-17-2020) - Modified build process to use xgo for all arch builds diff --git a/frontend/src/components/Index/GroupServiceFailures.vue b/frontend/src/components/Index/GroupServiceFailures.vue index dbedb6f8..97544204 100644 --- a/frontend/src/components/Index/GroupServiceFailures.vue +++ b/frontend/src/components/Index/GroupServiceFailures.vue @@ -7,13 +7,13 @@
-

- 90 Days Ago - - {{service_txt}} - - Today -

+

+ 90 Days Ago + + {{service_txt}} + + Today +

{{hover_text}}
diff --git a/frontend/src/components/Service/AdvancedChart.vue b/frontend/src/components/Service/AdvancedChart.vue index 600cbaba..677432e7 100644 --- a/frontend/src/components/Service/AdvancedChart.vue +++ b/frontend/src/components/Service/AdvancedChart.vue @@ -1,6 +1,6 @@ @@ -36,6 +36,7 @@ return { loading: true, main_data: null, + ping_data: null, expanded_data: null, main_chart_options: { noData: { @@ -51,6 +52,7 @@ }, chart: { id: 'mainchart', + stacked: true, events: { dataPointSelection: (event, chartContext, config) => { window.console.log('slect') @@ -110,7 +112,9 @@ }, yaxis: { labels: { - show: true + formatter: (value) => { + return this.humanTime(value) + } }, }, markers: { @@ -165,15 +169,15 @@ show: false }, fill: { - colors: ["#48d338"], + colors: ["#f1771f", "#48d338"], opacity: 1, type: 'solid' }, stroke: { show: true, - curve: 'smooth', + curve: 'stepline', lineCap: 'butt', - colors: ["#3aa82d"], + colors: ["#f1771f", "#48d338"], width: 2, } }, @@ -227,8 +231,11 @@ computed: { main_chart () { return [{ - name: this.service.name, + name: "latency", ...this.convertToChartData(this.main_data) + },{ + name: "ping", + ...this.convertToChartData(this.ping_data) }] }, expanded_chart () { @@ -261,9 +268,13 @@ }, async chartHits() { this.main_data = await this.load_hits() + this.ping_data = await this.load_ping() }, async load_hits(start=this.params.start, end=this.params.end, group=this.group) { return await Api.service_hits(this.service.id, start, end, group, false) + }, + async load_ping(start=this.params.start, end=this.params.end, group=this.group) { + return await Api.service_ping(this.service.id, start, end, group, false) } } } diff --git a/frontend/src/components/Service/FailuresBarChart.vue b/frontend/src/components/Service/FailuresBarChart.vue new file mode 100644 index 00000000..d241d776 --- /dev/null +++ b/frontend/src/components/Service/FailuresBarChart.vue @@ -0,0 +1,166 @@ + + + diff --git a/frontend/src/mixin.js b/frontend/src/mixin.js index 953bf209..ae61b519 100644 --- a/frontend/src/mixin.js +++ b/frontend/src/mixin.js @@ -96,7 +96,7 @@ export default Vue.mixin({ }, serviceLink(service) { if (service.permalink) { - service = this.$store.getters.serviceByPermalink(service.permalink) + service = this.$store.getters.serviceById(service.permalink) } if (service === undefined || this.isEmptyObject(service)) { return `/service/0` @@ -177,6 +177,12 @@ export default Vue.mixin({ } return val + " μs" }, + humanTimeNum(val) { + if (val >= 1000) { + return Math.round(val / 1000) + } + return val + }, firstDayOfMonth(date) { return startOfMonth(date) }, diff --git a/frontend/src/pages/Service.vue b/frontend/src/pages/Service.vue index 38cfbdc5..b963d944 100644 --- a/frontend/src/pages/Service.vue +++ b/frontend/src/pages/Service.vue @@ -1,6 +1,17 @@