|
|
@@ -27,51 +27,15 @@ type DashboardsAsConfigV0 struct {
|
|
|
Options map[string]interface{} `json:"options" yaml:"options"`
|
|
|
}
|
|
|
|
|
|
-func convertv0ToDashboardAsConfig(v0 []*DashboardsAsConfigV0) []*DashboardsAsConfig {
|
|
|
- var r []*DashboardsAsConfig
|
|
|
-
|
|
|
- for _, v := range v0 {
|
|
|
- r = append(r, &DashboardsAsConfig{
|
|
|
- Name: v.Name,
|
|
|
- Type: v.Type,
|
|
|
- OrgId: v.OrgId,
|
|
|
- Folder: v.Folder,
|
|
|
- Editable: v.Editable,
|
|
|
- Options: v.Options,
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
- return r
|
|
|
-}
|
|
|
-
|
|
|
type ConfigVersion struct {
|
|
|
ApiVersion int64 `json:"apiVersion" yaml:"apiVersion"`
|
|
|
}
|
|
|
|
|
|
type DashboardAsConfigV1 struct {
|
|
|
- ApiVersion int64 `json:"apiVersion" yaml:"apiVersion"`
|
|
|
-
|
|
|
- Providers []*DashboardSource `json:"providers" yaml:"providers"`
|
|
|
-}
|
|
|
-
|
|
|
-func (dc *DashboardAsConfigV1) mapToDashboardAsConfig() []*DashboardsAsConfig {
|
|
|
- var r []*DashboardsAsConfig
|
|
|
-
|
|
|
- for _, v := range dc.Providers {
|
|
|
- r = append(r, &DashboardsAsConfig{
|
|
|
- Name: v.Name,
|
|
|
- Type: v.Type,
|
|
|
- OrgId: v.OrgId,
|
|
|
- Folder: v.Folder,
|
|
|
- Editable: v.Editable,
|
|
|
- Options: v.Options,
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
- return r
|
|
|
+ Providers []*DashboardProviderConfigs `json:"providers" yaml:"providers"`
|
|
|
}
|
|
|
|
|
|
-type DashboardSource struct {
|
|
|
+type DashboardProviderConfigs struct {
|
|
|
Name string `json:"name" yaml:"name"`
|
|
|
Type string `json:"type" yaml:"type"`
|
|
|
OrgId int64 `json:"orgId" yaml:"orgId"`
|
|
|
@@ -98,3 +62,37 @@ func createDashboardJson(data *simplejson.Json, lastModified time.Time, cfg *Das
|
|
|
|
|
|
return dash, nil
|
|
|
}
|
|
|
+
|
|
|
+func mapV0ToDashboardAsConfig(v0 []*DashboardsAsConfigV0) []*DashboardsAsConfig {
|
|
|
+ var r []*DashboardsAsConfig
|
|
|
+
|
|
|
+ for _, v := range v0 {
|
|
|
+ r = append(r, &DashboardsAsConfig{
|
|
|
+ Name: v.Name,
|
|
|
+ Type: v.Type,
|
|
|
+ OrgId: v.OrgId,
|
|
|
+ Folder: v.Folder,
|
|
|
+ Editable: v.Editable,
|
|
|
+ Options: v.Options,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ return r
|
|
|
+}
|
|
|
+
|
|
|
+func (dc *DashboardAsConfigV1) mapToDashboardAsConfig() []*DashboardsAsConfig {
|
|
|
+ var r []*DashboardsAsConfig
|
|
|
+
|
|
|
+ for _, v := range dc.Providers {
|
|
|
+ r = append(r, &DashboardsAsConfig{
|
|
|
+ Name: v.Name,
|
|
|
+ Type: v.Type,
|
|
|
+ OrgId: v.OrgId,
|
|
|
+ Folder: v.Folder,
|
|
|
+ Editable: v.Editable,
|
|
|
+ Options: v.Options,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ return r
|
|
|
+}
|