debian-mirror-gitlab/app/controllers/projects/metrics_dashboard_controller.rb

35 lines
1,023 B
Ruby
Raw Normal View History

2020-07-28 23:09:34 +05:30
# 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)
2020-10-24 23:57:45 +05:30
push_frontend_feature_flag(:disable_metric_dashboard_refresh_rate)
2020-07-28 23:09:34 +05:30
end
def show
if environment
render 'projects/environments/metrics'
else
2020-10-24 23:57:45 +05:30
render 'projects/environments/empty_metrics'
2020-07-28 23:09:34 +05:30
end
end
private
def environment
@environment ||=
if params[:environment]
project.environments.find(params[:environment])
else
project.default_environment
end
end
end
end