mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge branch 'master' of github.com:grafana/grafana
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user