소스 검색

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

exclude dashboard field from snapshot list search
Alexander Zobnin 8 년 전
부모
커밋
473c47cd1c
2개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 1
      pkg/models/dashboard_snapshot.go
  2. 2 1
      pkg/services/sqlstore/dashboard_snapshot.go

+ 2 - 1
pkg/models/dashboard_snapshot.go

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

+ 2 - 1
pkg/services/sqlstore/dashboard_snapshot.go

@@ -86,9 +86,10 @@ func GetDashboardSnapshot(query *m.GetDashboardSnapshotQuery) error {
 }
 }
 
 
 func SearchDashboardSnapshots(query *m.GetDashboardSnapshotsQuery) 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 := x.Limit(query.Limit)
+	sess.Table("dashboard_snapshot")
 
 
 	if query.Name != "" {
 	if query.Name != "" {
 		sess.Where("name LIKE ?", query.Name)
 		sess.Where("name LIKE ?", query.Name)