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

metrics_dashboard_controller.rb « projects « controllers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 51307c3665c697a7ec5a886a84a29aa026c82e6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# 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)
      push_frontend_feature_flag(:disable_metric_dashboard_refresh_rate)
    end

    def show
      if environment
        render 'projects/environments/metrics'
      else
        render 'projects/environments/empty_metrics'
      end
    end

    private

    def environment
      @environment ||=
        if params[:environment]
          project.environments.find(params[:environment])
        else
          project.default_environment
        end
    end
  end
end