Query history: Add from and to parameters (#48212)

* Query history: Add from and to parameters

* Update docs/sources/http_api/query_history.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Update docs/sources/http_api/query_history.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Update docs/sources/http_api/query_history.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Implement Grafana relative time range

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
This commit is contained in:
Ivana Huckova
2022-04-29 09:55:33 +02:00
committed by GitHub
co-authored by achatterjee-grafana
parent 17eca4505c
commit b92fe0e0f5
6 changed files with 175 additions and 16 deletions
+2 -3
View File
@@ -2,7 +2,6 @@ package queryhistory
import (
"context"
"errors"
"fmt"
"time"
@@ -47,8 +46,8 @@ func (s QueryHistoryService) searchQueries(ctx context.Context, user *models.Sig
var dtos []QueryHistoryDTO
var allQueries []interface{}
if len(query.DatasourceUIDs) == 0 {
return QueryHistorySearchResult{}, errors.New("no selected data source for query history search")
if query.To <= 0 {
query.To = time.Now().Unix()
}
if query.Page <= 0 {