Pārlūkot izejas kodu

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

Torkel Ödegaard 9 gadi atpakaļ
vecāks
revīzija
2b2b64865b

+ 2 - 1
CHANGELOG.md

@@ -10,7 +10,8 @@
 # 3.1.2 (unreleased)
 # 3.1.2 (unreleased)
 * **Templating**: Fixed issue when combining row & panel repeats, fixes [#5790](https://github.com/grafana/grafana/issues/5790)
 * **Templating**: Fixed issue when combining row & panel repeats, fixes [#5790](https://github.com/grafana/grafana/issues/5790)
 * **Drag&Drop**: Fixed issue with drag and drop in latest Chrome(51+), fixes [#5767](https://github.com/grafana/grafana/issues/5767)
 * **Drag&Drop**: Fixed issue with drag and drop in latest Chrome(51+), fixes [#5767](https://github.com/grafana/grafana/issues/5767)
-* **Internal Metrics**: Fixed issue with dots in instance_name when sending internal metrics to Graphitge, fixes [#5739](https://github.com/grafana/grafana/issues/5739)
+* **Internal Metrics**: Fixed issue with dots in instance_name when sending internal metrics to Graphite, fixes [#5739](https://github.com/grafana/grafana/issues/5739)
+* **Grafana-CLI**: Add default plugin path for MAC OS, fixes [#5806](https://github.com/grafana/grafana/issues/5806)
 
 
 # 3.1.1 (2016-08-01)
 # 3.1.1 (2016-08-01)
 * **IFrame embedding**: Fixed issue of using full iframe height, fixes [#5605](https://github.com/grafana/grafana/issues/5606)
 * **IFrame embedding**: Fixed issue of using full iframe height, fixes [#5605](https://github.com/grafana/grafana/issues/5606)

+ 1 - 0
docker/blocks/postgres/fig

@@ -3,5 +3,6 @@ postgrestest:
   environment:
   environment:
     POSTGRES_USER: grafana
     POSTGRES_USER: grafana
     POSTGRES_PASSWORD: password
     POSTGRES_PASSWORD: password
+    POSTGRES_DATABASE: grafana
   ports:
   ports:
     - "5432:5432"
     - "5432:5432"

+ 2 - 30
pkg/cmd/grafana-cli/main.go

@@ -8,39 +8,11 @@ import (
 	"github.com/codegangsta/cli"
 	"github.com/codegangsta/cli"
 	"github.com/grafana/grafana/pkg/cmd/grafana-cli/commands"
 	"github.com/grafana/grafana/pkg/cmd/grafana-cli/commands"
 	"github.com/grafana/grafana/pkg/cmd/grafana-cli/logger"
 	"github.com/grafana/grafana/pkg/cmd/grafana-cli/logger"
+	"github.com/grafana/grafana/pkg/cmd/grafana-cli/utils"
 )
 )
 
 
 var version = "master"
 var version = "master"
 
 
-func getGrafanaPluginDir() string {
-	currentOS := runtime.GOOS
-	defaultNix := "/var/lib/grafana/plugins"
-
-	if currentOS == "windows" {
-		return "../data/plugins"
-	}
-
-	pwd, err := os.Getwd()
-
-	if err != nil {
-		logger.Error("Could not get current path. using default")
-		return defaultNix
-	}
-
-	if isDevenvironment(pwd) {
-		return "../data/plugins"
-	}
-
-	return defaultNix
-}
-
-func isDevenvironment(pwd string) bool {
-	// if ../conf/defaults.ini exists, grafana is not installed as package
-	// that its in development environment.
-	_, err := os.Stat("../conf/defaults.ini")
-	return err == nil
-}
-
 func main() {
 func main() {
 	setupLogging()
 	setupLogging()
 
 
@@ -54,7 +26,7 @@ func main() {
 		cli.StringFlag{
 		cli.StringFlag{
 			Name:   "pluginsDir",
 			Name:   "pluginsDir",
 			Usage:  "path to the grafana plugin directory",
 			Usage:  "path to the grafana plugin directory",
-			Value:  getGrafanaPluginDir(),
+			Value:  utils.GetGrafanaPluginDir(runtime.GOOS),
 			EnvVar: "GF_PLUGIN_DIR",
 			EnvVar: "GF_PLUGIN_DIR",
 		},
 		},
 		cli.StringFlag{
 		cli.StringFlag{

+ 46 - 0
pkg/cmd/grafana-cli/utils/grafana_path.go

@@ -0,0 +1,46 @@
+package utils
+
+import (
+	"os"
+
+	"github.com/grafana/grafana/pkg/cmd/grafana-cli/logger"
+)
+
+func GetGrafanaPluginDir(currentOS string) string {
+	//currentOS := runtime.GOOS
+
+	if currentOS == "windows" {
+		return returnOsDefault(currentOS)
+	}
+
+	pwd, err := os.Getwd()
+
+	if err != nil {
+		logger.Error("Could not get current path. using default")
+		return returnOsDefault(currentOS)
+	}
+
+	if isDevenvironment(pwd) {
+		return "../data/plugins"
+	}
+
+	return returnOsDefault(currentOS)
+}
+
+func isDevenvironment(pwd string) bool {
+	// if ../conf/defaults.ini exists, grafana is not installed as package
+	// that its in development environment.
+	_, err := os.Stat("../conf/defaults.ini")
+	return err == nil
+}
+
+func returnOsDefault(currentOs string) string {
+	switch currentOs {
+	case "windows":
+		return "../data/plugins"
+	case "darwin":
+		return "/usr/local/var/lib/grafana/plugins"
+	default: //"linux"
+		return "/var/lib/grafana/plugins"
+	}
+}

+ 2 - 2
public/app/plugins/datasource/influxdb/partials/config.html

@@ -14,11 +14,11 @@
 	<div class="gf-form-inline">
 	<div class="gf-form-inline">
 		<div class="gf-form max-width-15">
 		<div class="gf-form max-width-15">
 			<span class="gf-form-label width-7">User</span>
 			<span class="gf-form-label width-7">User</span>
-			<input type="text" class="gf-form-input" ng-model='ctrl.current.user' placeholder="" required></input>
+			<input type="text" class="gf-form-input" ng-model='ctrl.current.user' placeholder=""></input>
 		</div>
 		</div>
 		<div class="gf-form max-width-15">
 		<div class="gf-form max-width-15">
 			<span class="gf-form-label width-7">Password</span>
 			<span class="gf-form-label width-7">Password</span>
-			<input type="password" class="gf-form-input" ng-model='ctrl.current.password' placeholder="" required></input>
+			<input type="password" class="gf-form-input" ng-model='ctrl.current.password' placeholder=""></input>
 		</div>
 		</div>
 	</div>
 	</div>
 </div>
 </div>