Commit 9cebb23e by bergquist

dashboards as cfg: revert minor changes

parent 74e12c26
...@@ -3,6 +3,7 @@ package api ...@@ -3,6 +3,7 @@ package api
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
//"github.com/grafana/grafana/pkg/services/dashboards"
"os" "os"
"path" "path"
"strings" "strings"
...@@ -124,6 +125,12 @@ func PostDashboard(c *middleware.Context, cmd m.SaveDashboardCommand) Response { ...@@ -124,6 +125,12 @@ func PostDashboard(c *middleware.Context, cmd m.SaveDashboardCommand) Response {
dash := cmd.GetDashboardModel() dash := cmd.GetDashboardModel()
// dashItem := &dashboards.SaveDashboardItem{
// Dashboard: dash,
// Message: cmd.Message,
// }
// err := dashboards.SaveDashboard(dashItem)
// Check if Title is empty // Check if Title is empty
if dash.Title == "" { if dash.Title == "" {
return ApiError(400, m.ErrDashboardTitleEmpty.Error(), nil) return ApiError(400, m.ErrDashboardTitleEmpty.Error(), nil)
......
package dashboard package dashboards
import ( import (
"github.com/grafana/grafana/pkg/bus" "github.com/grafana/grafana/pkg/bus"
......
package dashboard package dashboards
import ( import (
"github.com/grafana/grafana/pkg/components/simplejson" "github.com/grafana/grafana/pkg/components/simplejson"
......
package datasource package datasources
import "github.com/grafana/grafana/pkg/models" import "github.com/grafana/grafana/pkg/models"
import "github.com/grafana/grafana/pkg/components/simplejson" import "github.com/grafana/grafana/pkg/components/simplejson"
......
...@@ -4,19 +4,19 @@ import ( ...@@ -4,19 +4,19 @@ import (
"context" "context"
"path/filepath" "path/filepath"
"github.com/grafana/grafana/pkg/services/provisioning/dashboard" "github.com/grafana/grafana/pkg/services/provisioning/dashboards"
"github.com/grafana/grafana/pkg/services/provisioning/datasource" "github.com/grafana/grafana/pkg/services/provisioning/datasources"
ini "gopkg.in/ini.v1" ini "gopkg.in/ini.v1"
) )
func Init(ctx context.Context, homePath string, cfg *ini.File) error { func Init(ctx context.Context, homePath string, cfg *ini.File) error {
datasourcePath := makeAbsolute(cfg.Section("paths").Key("datasources").String(), homePath) datasourcePath := makeAbsolute(cfg.Section("paths").Key("datasources").String(), homePath)
if err := datasource.Provision(datasourcePath); err != nil { if err := datasources.Provision(datasourcePath); err != nil {
return err return err
} }
dashboardPath := makeAbsolute(cfg.Section("paths").Key("dashboards").String(), homePath) dashboardPath := makeAbsolute(cfg.Section("paths").Key("dashboards").String(), homePath)
_, err := dashboard.Provision(ctx, dashboardPath) _, err := dashboards.Provision(ctx, dashboardPath)
if err != nil { if err != nil {
return err return err
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment