From f77ff0c7bdc0b3a18406bf256dc5814833c14d23 Mon Sep 17 00:00:00 2001 From: Jose Vargas Date: Tue, 12 Mar 2019 12:55:43 -0600 Subject: Add support for time windows for the performance dashbooards The performance dashboards will now display the data from a set amount of time windows that are defined on a constants file --- .../monitoring/components/dashboard.vue | 58 ++++++++++++++++------ 1 file changed, 44 insertions(+), 14 deletions(-) (limited to 'app/assets/javascripts/monitoring/components') diff --git a/app/assets/javascripts/monitoring/components/dashboard.vue b/app/assets/javascripts/monitoring/components/dashboard.vue index ba6a17827f7..917dc1b73b5 100644 --- a/app/assets/javascripts/monitoring/components/dashboard.vue +++ b/app/assets/javascripts/monitoring/components/dashboard.vue @@ -9,6 +9,7 @@ import MonitorAreaChart from './charts/area.vue'; import GraphGroup from './graph_group.vue'; import EmptyState from './empty_state.vue'; import MonitoringStore from '../stores/monitoring_store'; +import { timeWindows } from '../constants'; const sidebarAnimationDuration = 150; let sidebarMutationObserver; @@ -94,6 +95,7 @@ export default { state: 'gettingStarted', showEmptyState: true, elWidth: 0, + selectedTimeWindow: '', }; }, created() { @@ -102,6 +104,9 @@ export default { deploymentEndpoint: this.deploymentEndpoint, environmentsEndpoint: this.environmentsEndpoint, }); + + this.timeWindows = timeWindows; + this.selectedTimeWindow = this.timeWindows.eightHours; }, beforeDestroy() { if (sidebarMutationObserver) { @@ -160,11 +165,17 @@ export default { this.state = 'unableToConnect'; }); }, + getGraphsDataWithTime(timeFrame) { + this.selectedTimeWindow = this.timeWindows[timeFrame]; + }, onSidebarMutation() { setTimeout(() => { this.elWidth = this.$el.clientWidth; }, sidebarAnimationDuration); }, + activeTimeWindow(key) { + return this.timeWindows[key] === this.selectedTimeWindow; + }, }, }; @@ -172,21 +183,40 @@ export default {