Commit ef7d8ab9 by Torkel Ödegaard

Merge branch 'master' of github.com:grafana/grafana

parents 28f4f3a8 c1e4d059
......@@ -11,6 +11,7 @@ func runCommand(command func(commandLine CommandLine) error) func(context *cli.C
cmd := &contextCommandLine{context}
if err := command(cmd); err != nil {
log.Error("\nError: ")
log.Errorf("%s\n\n", err)
cmd.ShowHelp()
......
......@@ -28,7 +28,15 @@ func validateInput(c CommandLine, pluginFolder string) error {
}
fileInfo, err := os.Stat(pluginDir)
if err != nil && !fileInfo.IsDir() {
if err != nil {
if err = os.MkdirAll(pluginDir, os.ModePerm); err != nil {
return errors.New("path is not a directory")
}
return nil
}
if !fileInfo.IsDir() {
return errors.New("path is not a directory")
}
......
......@@ -41,7 +41,7 @@ func main() {
cli.StringFlag{
Name: "repo",
Usage: "url to the plugin repository",
Value: "",
Value: "https://grafana-net.raintank.io/api/plugins",
},
cli.BoolFlag{
Name: "debug, d",
......
......@@ -3,6 +3,7 @@ package services
import (
"encoding/json"
"errors"
"fmt"
"github.com/franela/goreq"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/log"
m "github.com/grafana/grafana/pkg/cmd/grafana-cli/models"
......@@ -12,8 +13,12 @@ import (
var IoHelper m.IoUtil = IoUtilImp{}
func ListAllPlugins(repoUrl string) (m.PluginRepo, error) {
fullUrl := repoUrl + "/repo"
res, _ := goreq.Request{Uri: fullUrl, MaxRedirects: 3}.Do()
res, _ := goreq.Request{Uri: repoUrl + "/repo", MaxRedirects: 3}.Do()
if res.StatusCode != 200 {
return m.PluginRepo{}, fmt.Errorf("Could not access %s statuscode %v", fullUrl, res.StatusCode)
}
var resp m.PluginRepo
err := res.Body.FromJsonTo(&resp)
......
......@@ -78,7 +78,7 @@ export class PluginEditCtrl {
secureJsonData: self.model.secureJsonData,
}, {});
return self.backendSrv.post(`/api/org/plugins/${self.pluginId}/settings`, updateCmd);
return self.backendSrv.post(`/api/plugins/${self.pluginId}/settings`, updateCmd);
});
// if set, performt he postUpdate hook. If a promise is returned it will block
......
......@@ -11,7 +11,7 @@ export class AppPageCtrl {
/** @ngInject */
constructor(private backendSrv, private $routeParams: any, private $rootScope) {
this.pluginId = $routeParams.pluginId;
this.backendSrv.get(`/api/org/plugins/${this.pluginId}/settings`).then(app => {
this.backendSrv.get(`/api/plugins/${this.pluginId}/settings`).then(app => {
this.appModel = app;
this.page = _.findWhere(app.pages, {slug: this.$routeParams.slug});
if (!this.page) {
......
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