mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 23:12:54 +08:00
Dashboards: Add apiVersion to dashboard table (#100845)
This commit is contained in:
@ -99,6 +99,16 @@ func (hs *HTTPServer) GetDashboard(c *contextmodel.ReqContext) response.Response
|
||||
return rsp
|
||||
}
|
||||
|
||||
// V2 values should be read from the k8s API
|
||||
if strings.HasPrefix(dash.APIVersion, "v2") {
|
||||
root := hs.Cfg.AppSubURL
|
||||
if !strings.HasSuffix(root, "/") {
|
||||
root += "/"
|
||||
}
|
||||
url := fmt.Sprintf("%sapis/dashboard.grafana.app/%s/namespaces/%s/dashboards/%s", root, dash.APIVersion, hs.namespacer(c.OrgID), dash.UID)
|
||||
return response.Redirect(url)
|
||||
}
|
||||
|
||||
var (
|
||||
publicDashboardEnabled = false
|
||||
err error
|
||||
@ -182,6 +192,7 @@ func (hs *HTTPServer) GetDashboard(c *contextmodel.ReqContext) response.Response
|
||||
UpdatedBy: updater,
|
||||
CreatedBy: creator,
|
||||
Version: dash.Version,
|
||||
APIVersion: dash.APIVersion,
|
||||
HasACL: dash.HasACL,
|
||||
IsFolder: dash.IsFolder,
|
||||
FolderId: dash.FolderID, // nolint:staticcheck
|
||||
|
@ -26,6 +26,7 @@ type DashboardMeta struct {
|
||||
Version int `json:"version"`
|
||||
HasACL bool `json:"hasAcl" xorm:"has_acl"`
|
||||
IsFolder bool `json:"isFolder"`
|
||||
APIVersion string `json:"apiVersion,omitempty"` // v0alpha1, v1, v2beta1 etc -- the version things were *saved* at
|
||||
// Deprecated: use FolderUID instead
|
||||
FolderId int64 `json:"folderId"`
|
||||
FolderUid string `json:"folderUid"`
|
||||
|
Reference in New Issue
Block a user