grafana/pkg/services/publicdashboards/service/annotations.go
owensmallwood b2408dd7c5
Publicdasboards: Add annotations support (#56413)
adds annotations support for public dashboards
2022-10-18 19:48:20 -06:00

23 lines
455 B
Go

package service
import (
"encoding/json"
"github.com/grafana/grafana/pkg/components/simplejson"
"github.com/grafana/grafana/pkg/services/publicdashboards/models"
)
func UnmarshalDashboardAnnotations(sj *simplejson.Json) (*models.AnnotationsDto, error) {
bytes, err := sj.MarshalJSON()
if err != nil {
return nil, err
}
dto := &models.AnnotationsDto{}
err = json.Unmarshal(bytes, dto)
if err != nil {
return nil, err
}
return dto, err
}