mirror of
https://github.com/grafana/grafana.git
synced 2025-02-11 08:05:43 -06:00
Sort notification channels alphabetically (#37426)
Even without the ability to control the sort order or to filter, this notably improves usability for long lists of notification channels. Partially fixes #20067.
This commit is contained in:
parent
170d1bf954
commit
28784935b8
@ -112,7 +112,7 @@ func GetAlertNotificationsWithUid(query *models.GetAlertNotificationsWithUidQuer
|
||||
|
||||
func GetAllAlertNotifications(query *models.GetAllAlertNotificationsQuery) error {
|
||||
results := make([]*models.AlertNotification, 0)
|
||||
if err := x.Where("org_id = ?", query.OrgId).Find(&results); err != nil {
|
||||
if err := x.Where("org_id = ?", query.OrgId).Asc("name").Find(&results); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -325,6 +325,10 @@ func TestAlertNotificationSQLAccess(t *testing.T) {
|
||||
err := GetAllAlertNotifications(query)
|
||||
So(err, ShouldBeNil)
|
||||
So(len(query.Result), ShouldEqual, 4)
|
||||
So(query.Result[0].Name, ShouldEqual, cmd4.Name)
|
||||
So(query.Result[1].Name, ShouldEqual, cmd1.Name)
|
||||
So(query.Result[2].Name, ShouldEqual, cmd3.Name)
|
||||
So(query.Result[3].Name, ShouldEqual, cmd2.Name)
|
||||
})
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user