mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Query history: Create API to delete query from query history (#44653)
* Query history: Add delete and refactor * Update docs/sources/http_api/query_history.md Co-authored-by: Piotr Jamróz <pm.jamroz@gmail.com> Co-authored-by: Piotr Jamróz <pm.jamroz@gmail.com>
This commit is contained in:
@@ -1,21 +1,48 @@
|
||||
package queryhistory
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/grafana/grafana/pkg/components/simplejson"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrQueryNotFound = errors.New("query in query history not found")
|
||||
)
|
||||
|
||||
type QueryHistory struct {
|
||||
Id int64 `json:"id"`
|
||||
Uid string `json:"uid"`
|
||||
DatasourceUid string `json:"datasourceUid"`
|
||||
OrgId int64 `json:"orgId"`
|
||||
ID int64 `xorm:"pk autoincr 'id'"`
|
||||
UID string `xorm:"uid"`
|
||||
DatasourceUID string `xorm:"datasource_uid"`
|
||||
OrgID int64 `xorm:"org_id"`
|
||||
CreatedBy int64
|
||||
CreatedAt int64
|
||||
Comment string
|
||||
Queries *simplejson.Json
|
||||
}
|
||||
|
||||
type CreateQueryInQueryHistoryCommand struct {
|
||||
DatasourceUID string `json:"datasourceUid"`
|
||||
Queries *simplejson.Json `json:"queries"`
|
||||
}
|
||||
|
||||
type QueryHistoryDTO struct {
|
||||
UID string `json:"uid"`
|
||||
DatasourceUID string `json:"datasourceUid"`
|
||||
CreatedBy int64 `json:"createdBy"`
|
||||
CreatedAt int64 `json:"createdAt"`
|
||||
Comment string `json:"comment"`
|
||||
Queries *simplejson.Json `json:"queries"`
|
||||
Starred bool `json:"starred"`
|
||||
}
|
||||
|
||||
type CreateQueryInQueryHistoryCommand struct {
|
||||
DatasourceUid string `json:"datasourceUid"`
|
||||
Queries *simplejson.Json `json:"queries"`
|
||||
// QueryHistoryResponse is a response struct for QueryHistoryDTO
|
||||
type QueryHistoryResponse struct {
|
||||
Result QueryHistoryDTO `json:"result"`
|
||||
}
|
||||
|
||||
// DeleteQueryFromQueryHistoryResponse is the response struct for deleting a query from query history
|
||||
type DeleteQueryFromQueryHistoryResponse struct {
|
||||
ID int64 `json:"id"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user