summaryrefslogtreecommitdiff
path: root/app/controllers/projects/clusters_controller.rb
blob: 8acf5235c1aa40a21cc2b322b3bc8dcafa8df127 (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
35
# frozen_string_literal: true

class Projects::ClustersController < Clusters::ClustersController
  prepend_before_action :project
  before_action :repository

  before_action do
    push_frontend_feature_flag(:prometheus_computed_alerts)
  end

  layout 'project'

  private

  def clusterable
    @clusterable ||= ClusterablePresenter.fabricate(project, current_user: current_user)
  end

  def project
    @project ||= find_routable!(Project, File.join(params[:namespace_id], params[:project_id]))
  end

  def repository
    @repository ||= project.repository
  end

  def metrics_dashboard_params
    params.permit(:embedded, :group, :title, :y_label).merge(
      {
        cluster: cluster,
        cluster_type: :project
      }
    )
  end
end