mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
PanelLibrary: Adds get and getAll to the api (#29772)
* PanelLibrary: Adds get to the API * Refactor: adds tests for get and getAll and cleans up other tests * Refactor: changed name on DTO * Update pkg/services/librarypanels/api.go Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com> * Update pkg/services/librarypanels/database.go
This commit is contained in:
@@ -19,6 +19,8 @@ type Response interface {
|
||||
WriteTo(ctx *models.ReqContext)
|
||||
// Status gets the response's status.
|
||||
Status() int
|
||||
// Body gets the response's body.
|
||||
Body() []byte
|
||||
}
|
||||
|
||||
type NormalResponse struct {
|
||||
@@ -48,6 +50,11 @@ func (r *NormalResponse) Status() int {
|
||||
return r.status
|
||||
}
|
||||
|
||||
// Body gets the response's body.
|
||||
func (r *NormalResponse) Body() []byte {
|
||||
return r.body
|
||||
}
|
||||
|
||||
func (r *NormalResponse) WriteTo(ctx *models.ReqContext) {
|
||||
if r.err != nil {
|
||||
ctx.Logger.Error(r.errMessage, "error", r.err, "remote_addr", ctx.RemoteAddr())
|
||||
|
||||
Reference in New Issue
Block a user