Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/projects/metrics_dashboard_controller.rb')
-rw-r--r--app/controllers/projects/metrics_dashboard_controller.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/app/controllers/projects/metrics_dashboard_controller.rb b/app/controllers/projects/metrics_dashboard_controller.rb
new file mode 100644
index 00000000000..235ee1dfbf2
--- /dev/null
+++ b/app/controllers/projects/metrics_dashboard_controller.rb
@@ -0,0 +1,33 @@
+# frozen_string_literal: true
+module Projects
+ class MetricsDashboardController < Projects::ApplicationController
+ # Metrics dashboard code is in the process of being decoupled from environments
+ # and is getting moved to this controller. Some code may be duplicated from
+ # app/controllers/projects/environments_controller.rb
+ # See https://gitlab.com/gitlab-org/gitlab/-/issues/226002 for more details.
+
+ before_action :authorize_metrics_dashboard!
+ before_action do
+ push_frontend_feature_flag(:prometheus_computed_alerts)
+ end
+
+ def show
+ if environment
+ render 'projects/environments/metrics'
+ else
+ render_404
+ end
+ end
+
+ private
+
+ def environment
+ @environment ||=
+ if params[:environment]
+ project.environments.find(params[:environment])
+ else
+ project.default_environment
+ end
+ end
+ end
+end