snapshots: improve snapshot listing performance, #9314 (#9477)

exclude dashboard field from snapshot list search
This commit is contained in:
Alexander Zobnin 2017-10-10 15:25:19 +03:00 committed by Torkel Ödegaard
parent 002b4d3403
commit 473c47cd1c
2 changed files with 4 additions and 2 deletions

View File

@ -73,11 +73,12 @@ type GetDashboardSnapshotQuery struct {
}
type DashboardSnapshots []*DashboardSnapshot
type DashboardSnapshotsList []*DashboardSnapshotDTO
type GetDashboardSnapshotsQuery struct {
Name string
Limit int
OrgId int64
Result DashboardSnapshots
Result DashboardSnapshotsList
}

View File

@ -86,9 +86,10 @@ func GetDashboardSnapshot(query *m.GetDashboardSnapshotQuery) error {
}
func SearchDashboardSnapshots(query *m.GetDashboardSnapshotsQuery) error {
var snapshots = make(m.DashboardSnapshots, 0)
var snapshots = make(m.DashboardSnapshotsList, 0)
sess := x.Limit(query.Limit)
sess.Table("dashboard_snapshot")
if query.Name != "" {
sess.Where("name LIKE ?", query.Name)