Commit 9bc4eb02 authored by Peter Leitzen's avatar Peter Leitzen

Merge branch '214582-revert-sort-order-change-BE' into 'master'

Restore original sort order of metrics dashboard select list

See merge request gitlab-org/gitlab!31859
parents 4e5e26a0 da8bc3df
......@@ -38,7 +38,6 @@ module MetricsDashboard
dashboard_finder
.find_all_paths(project_for_dashboard)
.map(&method(:amend_dashboard))
.sort_by { |dashboard| [dashboard[:starred] ? 0 : 1, dashboard[:display_name].downcase] }
end
def amend_dashboard(dashboard)
......
---
title: Restore original sort order of the metrics dashboard select list
merge_request: 31859
author:
type: fixed
......@@ -134,10 +134,10 @@ describe MetricsDashboard do
it 'adds starred dashboard information and sorts the list' do
all_dashboards = json_response['all_dashboards'].map { |dashboard| dashboard.slice('display_name', 'starred', 'user_starred_path') }
expected_response = [
{ "display_name" => "errors.yml", "starred" => true, 'user_starred_path' => nil },
{ "display_name" => "test.yml", "starred" => true, 'user_starred_path' => nil },
{ "display_name" => "Default", "starred" => false, 'user_starred_path' => nil },
{ "display_name" => "anomaly.yml", "starred" => false, 'user_starred_path' => nil },
{ "display_name" => "Default", "starred" => false, 'user_starred_path' => nil }
{ "display_name" => "errors.yml", "starred" => true, 'user_starred_path' => nil },
{ "display_name" => "test.yml", "starred" => true, 'user_starred_path' => nil }
]
expect(all_dashboards).to eql expected_response
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment