mirror of
https://github.com/grafana/grafana.git
synced 2024-11-30 12:44:10 -06:00
b2408dd7c5
adds annotations support for public dashboards
23 lines
455 B
Go
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
|
|
}
|