Class: Gitlab::Metrics::Dashboard::Stages::CustomMetricsDetailsInserter

Inherits:
BaseStage
  • Object
show all
Defined in:
lib/gitlab/metrics/dashboard/stages/custom_metrics_details_inserter.rb

Constant Summary

Constants included from Defaults

Defaults::DEFAULT_PANEL_TYPE

Instance Attribute Summary

Attributes inherited from BaseStage

#dashboard, #params, #project

Instance Method Summary collapse

Methods inherited from BaseStage

#initialize

Constructor Details

This class inherits a constructor from Gitlab::Metrics::Dashboard::Stages::BaseStage

Instance Method Details

#transform!Object


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/gitlab/metrics/dashboard/stages/custom_metrics_details_inserter.rb', line 8

def transform!
  dashboard[:panel_groups].each do |panel_group|
    next unless panel_group

    has_custom_metrics = custom_group_titles.include?(panel_group[:group])
    panel_group[:has_custom_metrics] = has_custom_metrics

    panel_group[:panels].each do |panel|
      next unless panel

      panel[:metrics].each do |metric|
        next unless metric

        metric[:edit_path] = has_custom_metrics ? edit_path(metric) : nil
      end
    end
  end
end