mirror of
https://github.com/grafana/grafana.git
synced 2025-02-14 09:33:34 -06:00
Fix: return proper values in dashboard thumbs service (#55421)
This commit is contained in:
parent
c946e44741
commit
7108b4331d
@ -22,40 +22,25 @@ func ProvideService(
|
|||||||
|
|
||||||
func (s *Service) GetThumbnail(ctx context.Context, query *models.GetDashboardThumbnailCommand) (*models.DashboardThumbnail, error) {
|
func (s *Service) GetThumbnail(ctx context.Context, query *models.GetDashboardThumbnailCommand) (*models.DashboardThumbnail, error) {
|
||||||
dt, err := s.store.Get(ctx, query)
|
dt, err := s.store.Get(ctx, query)
|
||||||
if err != nil {
|
return dt, err
|
||||||
return dt, err
|
|
||||||
}
|
|
||||||
return dt, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) SaveThumbnail(ctx context.Context, cmd *models.SaveDashboardThumbnailCommand) (*models.DashboardThumbnail, error) {
|
func (s *Service) SaveThumbnail(ctx context.Context, cmd *models.SaveDashboardThumbnailCommand) (*models.DashboardThumbnail, error) {
|
||||||
dt, err := s.store.Save(ctx, cmd)
|
dt, err := s.store.Save(ctx, cmd)
|
||||||
if err != nil {
|
return dt, err
|
||||||
return dt, err
|
|
||||||
}
|
|
||||||
return dt, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) UpdateThumbnailState(ctx context.Context, cmd *models.UpdateThumbnailStateCommand) error {
|
func (s *Service) UpdateThumbnailState(ctx context.Context, cmd *models.UpdateThumbnailStateCommand) error {
|
||||||
err := s.store.UpdateState(ctx, cmd)
|
err := s.store.UpdateState(ctx, cmd)
|
||||||
if err != nil {
|
return err
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) FindThumbnailCount(ctx context.Context, cmd *models.FindDashboardThumbnailCountCommand) (int64, error) {
|
func (s *Service) FindThumbnailCount(ctx context.Context, cmd *models.FindDashboardThumbnailCountCommand) (int64, error) {
|
||||||
i, err := s.store.Count(ctx, cmd)
|
n, err := s.store.Count(ctx, cmd)
|
||||||
if err != nil {
|
return n, err
|
||||||
return i, err
|
|
||||||
}
|
|
||||||
return 0, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) FindDashboardsWithStaleThumbnails(ctx context.Context, cmd *models.FindDashboardsWithStaleThumbnailsCommand) ([]*models.DashboardWithStaleThumbnail, error) {
|
func (s *Service) FindDashboardsWithStaleThumbnails(ctx context.Context, cmd *models.FindDashboardsWithStaleThumbnailsCommand) ([]*models.DashboardWithStaleThumbnail, error) {
|
||||||
d, err := s.store.FindDashboardsWithStaleThumbnails(ctx, cmd)
|
thumbs, err := s.store.FindDashboardsWithStaleThumbnails(ctx, cmd)
|
||||||
if err != nil {
|
return thumbs, err
|
||||||
return d, err
|
|
||||||
}
|
|
||||||
return nil, nil
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user