|
|
|
@ -1,10 +1,10 @@ |
|
|
|
|
package models |
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
|
"encoding/json" |
|
|
|
|
"strconv" |
|
|
|
|
"time" |
|
|
|
|
|
|
|
|
|
"github.com/grafana/grafana/pkg/components/simplejson" |
|
|
|
|
"github.com/grafana/grafana/pkg/models" |
|
|
|
|
"github.com/grafana/grafana/pkg/tsdb/legacydata" |
|
|
|
|
) |
|
|
|
@ -61,7 +61,7 @@ type PublicDashboard struct { |
|
|
|
|
Uid string `json:"uid" xorm:"pk uid"` |
|
|
|
|
DashboardUid string `json:"dashboardUid" xorm:"dashboard_uid"` |
|
|
|
|
OrgId int64 `json:"-" xorm:"org_id"` // Don't ever marshal orgId to Json
|
|
|
|
|
TimeSettings *simplejson.Json `json:"timeSettings" xorm:"time_settings"` |
|
|
|
|
TimeSettings *TimeSettings `json:"timeSettings" xorm:"time_settings"` |
|
|
|
|
IsEnabled bool `json:"isEnabled" xorm:"is_enabled"` |
|
|
|
|
AccessToken string `json:"accessToken" xorm:"access_token"` |
|
|
|
|
|
|
|
|
@ -77,8 +77,16 @@ func (pd PublicDashboard) TableName() string { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type TimeSettings struct { |
|
|
|
|
From string `json:"from"` |
|
|
|
|
To string `json:"to"` |
|
|
|
|
From string `json:"from,omitempty"` |
|
|
|
|
To string `json:"to,omitempty"` |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (ts *TimeSettings) FromDB(data []byte) error { |
|
|
|
|
return json.Unmarshal(data, ts) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (ts *TimeSettings) ToDB() ([]byte, error) { |
|
|
|
|
return json.Marshal(ts) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// build time settings object from json on public dashboard. If empty, use
|
|
|
|
|