From 761fa974706c39804f869da7209661f4845b219f Mon Sep 17 00:00:00 2001 From: Jose Vargas Date: Mon, 15 Apr 2019 22:51:17 -0500 Subject: [PATCH] Make the monitoring bundle reusable Also push the frontend flag in the clusters controller --- app/assets/javascripts/monitoring/monitoring_bundle.js | 3 ++- app/controllers/clusters/clusters_controller.rb | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/monitoring/monitoring_bundle.js b/app/assets/javascripts/monitoring/monitoring_bundle.js index 2b4ddd7afbc..ed794779ff2 100644 --- a/app/assets/javascripts/monitoring/monitoring_bundle.js +++ b/app/assets/javascripts/monitoring/monitoring_bundle.js @@ -2,7 +2,7 @@ import Vue from 'vue'; import { parseBoolean } from '~/lib/utils/common_utils'; import Dashboard from './components/dashboard.vue'; -export default () => { +export default (props = {}) => { const el = document.getElementById('prometheus-graphs'); if (el && el.dataset) { @@ -15,6 +15,7 @@ export default () => { ...el.dataset, hasMetrics: parseBoolean(el.dataset.hasMetrics), showTimeWindowDropdown: gon.features.metricsTimeWindow, + ...props, }, }); }, diff --git a/app/controllers/clusters/clusters_controller.rb b/app/controllers/clusters/clusters_controller.rb index e82756e4643..edaf07063ec 100644 --- a/app/controllers/clusters/clusters_controller.rb +++ b/app/controllers/clusters/clusters_controller.rb @@ -12,6 +12,9 @@ class Clusters::ClustersController < Clusters::BaseController before_action :authorize_update_cluster!, only: [:update] before_action :authorize_admin_cluster!, only: [:destroy] before_action :update_applications_status, only: [:cluster_status] + before_action only: [:show] do + push_frontend_feature_flag(:metrics_time_window) + end helper_method :token_in_session