diff options
author | rpereira2 <rpereira@gitlab.com> | 2019-04-16 21:07:47 +0530 |
---|---|---|
committer | syasonik <syasonik@gitlab.com> | 2019-04-24 18:23:03 +0800 |
commit | 0007a42a7bcc7bcee3dd10a3132dc96478b77e80 (patch) | |
tree | ad3c60001843faba84d56d329bdb1b5671263dab /lib | |
parent | b1773bf8b741ffc52e2699848e42aa0a054c9e6e (diff) | |
download | gitlab-ce-0007a42a7bcc7bcee3dd10a3132dc96478b77e80.tar.gz |
Correct the order of groups and panels
- Order groups by descending order of priority.
- Order panels by descending order of weight.
- Perform sorting after adding project/custom metrics.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/metrics_dashboard/processor.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/metrics_dashboard/sorter.rb | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/gitlab/metrics_dashboard/processor.rb b/lib/gitlab/metrics_dashboard/processor.rb index cfeb0ddb468..518e0123220 100644 --- a/lib/gitlab/metrics_dashboard/processor.rb +++ b/lib/gitlab/metrics_dashboard/processor.rb @@ -3,7 +3,7 @@ module Gitlab module MetricsDashboard class Processor - STAGES = [CommonMetricsInserter, Sorter, ProjectMetricsInserter].freeze + STAGES = [CommonMetricsInserter, ProjectMetricsInserter, Sorter].freeze def initialize(dashboard, project) @dashboard = dashboard.deep_transform_keys(&:to_sym) diff --git a/lib/gitlab/metrics_dashboard/sorter.rb b/lib/gitlab/metrics_dashboard/sorter.rb index 1d28fc8bd3a..9a8f87fcb6e 100644 --- a/lib/gitlab/metrics_dashboard/sorter.rb +++ b/lib/gitlab/metrics_dashboard/sorter.rb @@ -13,13 +13,13 @@ module Gitlab # Sorts the groups in the dashboard by the :priority key def sort_groups!(dashboard) - dashboard[:panel_groups] = dashboard[:panel_groups].sort_by { |group| group[:priority] } + dashboard[:panel_groups] = dashboard[:panel_groups].sort_by { |group| group[:priority] }.reverse end # Sorts the panels in the dashboard by the :weight key def sort_panels!(dashboard) dashboard[:panel_groups].each do |group| - group[:panels] = group[:panels].sort_by { |panel| panel[:weight] } + group[:panels] = group[:panels].sort_by { |panel| panel[:weight] }.reverse end end end |