mirror of
https://github.com/TwiN/gatus.git
synced 2024-11-21 23:43:27 +01:00
Sort results alphabetically when returning all service statuses
This commit is contained in:
parent
67642b130c
commit
670e35949e
@ -2,6 +2,7 @@ package memory
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/gob"
|
"encoding/gob"
|
||||||
|
"sort"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -53,6 +54,9 @@ func (s *Store) GetAllServiceStatuses(params *paging.ServiceStatusParams) []*cor
|
|||||||
for _, v := range serviceStatuses {
|
for _, v := range serviceStatuses {
|
||||||
pagedServiceStatuses = append(pagedServiceStatuses, ShallowCopyServiceStatus(v.(*core.ServiceStatus), params))
|
pagedServiceStatuses = append(pagedServiceStatuses, ShallowCopyServiceStatus(v.(*core.ServiceStatus), params))
|
||||||
}
|
}
|
||||||
|
sort.Slice(pagedServiceStatuses, func(i, j int) bool {
|
||||||
|
return pagedServiceStatuses[i].Key < pagedServiceStatuses[j].Key
|
||||||
|
})
|
||||||
return pagedServiceStatuses
|
return pagedServiceStatuses
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@ var (
|
|||||||
Interval: 30 * time.Second,
|
Interval: 30 * time.Second,
|
||||||
Conditions: []*core.Condition{&firstCondition, &secondCondition, &thirdCondition},
|
Conditions: []*core.Condition{&firstCondition, &secondCondition, &thirdCondition},
|
||||||
Alerts: nil,
|
Alerts: nil,
|
||||||
Insecure: false,
|
|
||||||
NumberOfFailuresInARow: 0,
|
NumberOfFailuresInARow: 0,
|
||||||
NumberOfSuccessesInARow: 0,
|
NumberOfSuccessesInARow: 0,
|
||||||
}
|
}
|
||||||
|
@ -522,7 +522,7 @@ func (s *Store) updateServiceUptime(tx *sql.Tx, serviceID int64, result *core.Re
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Store) getAllServiceKeys(tx *sql.Tx) (keys []string, err error) {
|
func (s *Store) getAllServiceKeys(tx *sql.Tx) (keys []string, err error) {
|
||||||
rows, err := tx.Query("SELECT service_key FROM service")
|
rows, err := tx.Query("SELECT service_key FROM service ORDER BY service_key")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,6 @@ var (
|
|||||||
Interval: 30 * time.Second,
|
Interval: 30 * time.Second,
|
||||||
Conditions: []*core.Condition{&firstCondition, &secondCondition, &thirdCondition},
|
Conditions: []*core.Condition{&firstCondition, &secondCondition, &thirdCondition},
|
||||||
Alerts: nil,
|
Alerts: nil,
|
||||||
Insecure: false,
|
|
||||||
NumberOfFailuresInARow: 0,
|
NumberOfFailuresInARow: 0,
|
||||||
NumberOfSuccessesInARow: 0,
|
NumberOfSuccessesInARow: 0,
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,6 @@ var (
|
|||||||
Interval: 30 * time.Second,
|
Interval: 30 * time.Second,
|
||||||
Conditions: []*core.Condition{&firstCondition, &secondCondition, &thirdCondition},
|
Conditions: []*core.Condition{&firstCondition, &secondCondition, &thirdCondition},
|
||||||
Alerts: nil,
|
Alerts: nil,
|
||||||
Insecure: false,
|
|
||||||
NumberOfFailuresInARow: 0,
|
NumberOfFailuresInARow: 0,
|
||||||
NumberOfSuccessesInARow: 0,
|
NumberOfSuccessesInARow: 0,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user