diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3b8239bd437..6b8cd4f7128 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,29 @@
+# 3.0.0-beta6 (unreleased)
+
+### Enhancements
+* **Singlestat**: Support for gauges in singlestat panel. closes [#3688](https://github.com/grafana/grafana/pull/3688)
+* **Templating**: Support for data source as variable, closes [#816](https://github.com/grafana/grafana/pull/816)
+
+### Bug fixes
+* **InfluxDB 0.12**: Fixed issue templating and `show tag values` query only returning tags for first measurement, fixes [#4726](https://github.com/grafana/grafana/issues/4726)
+* **Templating**: Fixed issue with regex formating when matching multiple values, fixes [#4755](https://github.com/grafana/grafana/issues/4755)
+* **Templating**: Fixed issue with custom all value and escaping, fixes [#4736](https://github.com/grafana/grafana/issues/4736)
+* **Dashlist**: Fixed issue dashboard list panel and caching tags, fixes [#4768](https://github.com/grafana/grafana/issues/4768)
+* **Graph**: Fixed issue with unneeded scrollbar in legend for Firefox, fixes [#4760](https://github.com/grafana/grafana/issues/4760)
+* **Table panel**: Fixed issue table panel formating string array properties, fixes [#4791](https://github.com/grafana/grafana/issues/4791)
+* **grafana-cli**: Improve error message when failing to install plugins due to corrupt response, fixes [#4651](https://github.com/grafana/grafana/issues/4651)
+* **Singlestat**: Fixes prefix an postfix for gauges, fixes [#4812](https://github.com/grafana/grafana/issues/4812)
+* **Singlestat**: Fixes auto-refresh on change for some options, fixes [#4809](https://github.com/grafana/grafana/issues/4809)
+
+### Breaking changes
+**Data Source Query Editors**: Issue [#3900](https://github.com/grafana/grafana/issues/3900)
+
+Query editors have been updated to use the new form styles. External data source plugins needs to be
+updated to work. Sorry to introduce breaking change this late in beta phase. We wanted to get this change
+in before 3.0 stable is released so we don't have to break data sources in next release (3.1). If you are
+a data source plugin author and want help for how the new form styles work please ask for help in
+slack channel (link to slack channel in readme).
+
# 3.0.0-beta5 (2016-04-15)
### Bug fixes
diff --git a/Makefile b/Makefile
new file mode 100644
index 00000000000..6cccaa7f64b
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,17 @@
+all: deps build
+
+deps:
+ go run build.go setup
+ godep restore
+ npm install
+
+build:
+ go run build.go build
+ npm run build
+
+test:
+ godep go test -v ./pkg/...
+ npm test
+
+run:
+ ./bin/grafana-server
diff --git a/README.md b/README.md
index 931055349cf..d538ba78e1e 100644
--- a/README.md
+++ b/README.md
@@ -103,8 +103,7 @@ npm (v2.5.0) and grunt (v0.4.5). Run the following:
```bash
npm install
-npm install -g grunt-cli
-grunt
+npm run build
```
### Recompile backend on source change
@@ -145,4 +144,3 @@ please [sign the CLA](http://docs.grafana.org/project/cla/)
Grafana is distributed under Apache 2.0 License.
Work in progress Grafana 2.0 (with included Grafana backend)
-
diff --git a/build.go b/build.go
index 93b9e6db087..0965a405e70 100644
--- a/build.go
+++ b/build.go
@@ -306,7 +306,7 @@ func ChangeWorkingDir(dir string) {
}
func grunt(params ...string) {
- runPrint("./node_modules/grunt-cli/bin/grunt", params...)
+ runPrint("./node_modules/.bin/grunt", params...)
}
func setup() {
diff --git a/circle.yml b/circle.yml
index 22dab8ab893..02f9f91e103 100644
--- a/circle.yml
+++ b/circle.yml
@@ -25,12 +25,12 @@ test:
# Go test
- godep go test -v ./pkg/...
# js tests
- - ./node_modules/grunt-cli/bin/grunt test
+ - npm test
- npm run coveralls
deployment:
master:
branch: master
owner: grafana
- commands:
+ commands:
- ./trigger_grafana_packer.sh ${TRIGGER_GRAFANA_PACKER_CIRCLECI_TOKEN}
diff --git a/docs/sources/http_api/dashboard.md b/docs/sources/http_api/dashboard.md
index 68f6ab022cc..ead63c722aa 100644
--- a/docs/sources/http_api/dashboard.md
+++ b/docs/sources/http_api/dashboard.md
@@ -191,7 +191,7 @@ Will return the home dashboard.
`GET /api/dashboards/tags`
-Get all tabs of dashboards
+Get all tags of dashboards
**Example Request**:
diff --git a/docs/sources/installation/debian.md b/docs/sources/installation/debian.md
index 231b4a601ac..bb870f026f3 100644
--- a/docs/sources/installation/debian.md
+++ b/docs/sources/installation/debian.md
@@ -11,7 +11,7 @@ page_keywords: grafana, installation, debian, ubuntu, guide
Description | Download
------------ | -------------
Stable .deb for Debian-based Linux | [grafana_2.6.0_amd64.deb](https://grafanarel.s3.amazonaws.com/builds/grafana_2.6.0_amd64.deb)
-Beta .deb for Debian-based Linux | [grafana_3.0.0-beta51460725904_amd64.deb](https://grafanarel.s3.amazonaws.com/builds/grafana_3.0.0-beta51460725904_amd64.deb)
+Beta .deb for Debian-based Linux | [grafana_3.0.0-beta61461918338_amd64.deb](https://grafanarel.s3.amazonaws.com/builds/grafana_3.0.0-beta61461918338_amd64.deb)
## Install Stable
@@ -21,9 +21,9 @@ Beta .deb for Debian-based Linux | [grafana_3.0.0-beta51460725904_amd64.deb](h
## Install 3.0 Beta
- $ wget https://grafanarel.s3.amazonaws.com/builds/grafana_3.0.0-beta51460725904_amd64.deb
+ $ wget https://grafanarel.s3.amazonaws.com/builds/grafana_3.0.0-beta61461918338_amd64.deb
$ sudo apt-get install -y adduser libfontconfig
- $ sudo dpkg -i grafana_3.0.0-beta51460725904_amd64.deb
+ $ sudo dpkg -i grafana_3.0.0-beta61461918338_amd64.deb
## APT Repository
diff --git a/docs/sources/installation/rpm.md b/docs/sources/installation/rpm.md
index d981a5c4b2c..f6a7ebb9c3a 100644
--- a/docs/sources/installation/rpm.md
+++ b/docs/sources/installation/rpm.md
@@ -11,7 +11,7 @@ page_keywords: grafana, installation, centos, fedora, opensuse, redhat, guide
Description | Download
------------ | -------------
Stable .RPM for CentOS / Fedora / OpenSuse / Redhat Linux | [grafana-2.6.0-1.x86_64.rpm](https://grafanarel.s3.amazonaws.com/builds/grafana-2.6.0-1.x86_64.rpm)
-Beta .RPM for CentOS / Fedor / OpenSuse / Redhat Linux | [grafana-3.0.0-beta51460725904.x86_64.rpm](https://grafanarel.s3.amazonaws.com/builds/grafana-3.0.0-beta51460725904§.x86_64.rpm)
+Beta .RPM for CentOS / Fedor / OpenSuse / Redhat Linux | [grafana-3.0.0-beta61461918338.x86_64.rpm](https://grafanarel.s3.amazonaws.com/builds/grafana-3.0.0-beta61461918338§.x86_64.rpm)
## Install Stable Release from package file
@@ -34,18 +34,18 @@ Or install manually using `rpm`.
You can install Grafana using Yum directly.
- $ sudo yum install https://grafanarel.s3.amazonaws.com/builds/grafana-3.0.0-beta51460725904.x86_64.rpm
+ $ sudo yum install https://grafanarel.s3.amazonaws.com/builds/grafana-3.0.0-beta61461918338.x86_64.rpm
Or install manually using `rpm`.
#### On CentOS / Fedora / Redhat:
$ sudo yum install initscripts fontconfig
- $ sudo rpm -Uvh grafana-3.0.0-beta51460725904.x86_64.rpm
+ $ sudo rpm -Uvh grafana-3.0.0-beta61461918338.x86_64.rpm
#### On OpenSuse:
- $ sudo rpm -i --nodeps grafana-3.0.0-beta51460725904.x86_64.rpm
+ $ sudo rpm -i --nodeps grafana-3.0.0-beta61461918338.x86_64.rpm
## Install via YUM Repository
diff --git a/docs/sources/plugins/index.md b/docs/sources/plugins/index.md
index 08654bfb946..bb5c8062223 100644
--- a/docs/sources/plugins/index.md
+++ b/docs/sources/plugins/index.md
@@ -15,7 +15,7 @@ Grafana already have a strong community of contributors and plugin developers.
By making it easier to develop and install plugins we hope that the community
can grow even stronger and develop new plugins that we would never think about.
-You can discover available plugins on [Grafana.net](http://grafana.net)
+You can discover available plugins on [Grafana.net](https://grafana.net)
diff --git a/package.json b/package.json
index f454a42ba7a..e314476f999 100644
--- a/package.json
+++ b/package.json
@@ -54,7 +54,7 @@
"phantomjs-prebuilt": "^2.1.3",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.4",
- "sass-lint": "^1.5.0",
+ "sass-lint": "^1.6.0",
"systemjs": "0.19.24"
},
"engines": {
@@ -62,6 +62,7 @@
"npm": "2.14.x"
},
"scripts": {
+ "build": "grunt",
"test": "grunt test",
"coveralls": "grunt karma:coveralls && rm -rf ./coverage"
},
diff --git a/pkg/api/cloudwatch/metrics.go b/pkg/api/cloudwatch/metrics.go
index f5e5274a202..5ecdaabf516 100644
--- a/pkg/api/cloudwatch/metrics.go
+++ b/pkg/api/cloudwatch/metrics.go
@@ -56,7 +56,7 @@ func init() {
"HbaseBackupFailed", "MostRecentBackupDuration", "TimeSinceLastSuccessfulBackup"},
"AWS/ES": {"ClusterStatus.green", "ClusterStatus.yellow", "ClusterStatus.red", "Nodes", "SearchableDocuments", "DeletedDocuments", "CPUUtilization", "FreeStorageSpace", "JVMMemoryPressure", "AutomatedSnapshotFailure", "MasterCPUUtilization", "MasterFreeStorageSpace", "MasterJVMMemoryPressure", "ReadLatency", "WriteLatency", "ReadThroughput", "WriteThroughput", "DiskQueueLength", "ReadIOPS", "WriteIOPS"},
"AWS/Events": {"Invocations", "FailedInvocations", "TriggeredRules", "MatchedEvents", "ThrottledRules"},
- "AWS/Kinesis": {"PutRecord.Bytes", "PutRecord.Latency", "PutRecord.Success", "PutRecords.Bytes", "PutRecords.Latency", "PutRecords.Records", "PutRecords.Success", "IncomingBytes", "IncomingRecords", "GetRecords.Bytes", "GetRecords.IteratorAgeMilliseconds", "GetRecords.Latency", "GetRecords.Success"},
+ "AWS/Kinesis": {"GetRecords.Bytes", "GetRecords.IteratorAge", "GetRecords.IteratorAgeMilliseconds", "GetRecords.Latency", "GetRecords.Records", "GetRecords.Success", "IncomingBytes", "IncomingRecords", "PutRecord.Bytes", "PutRecord.Latency", "PutRecord.Success", "PutRecords.Bytes", "PutRecords.Latency", "PutRecords.Records", "PutRecords.Success", "ReadProvisionedThroughputExceeded", "WriteProvisionedThroughputExceeded", "IteratorAgeMilliseconds", "OutgoingBytes", "OutgoingRecords"},
"AWS/Lambda": {"Invocations", "Errors", "Duration", "Throttles"},
"AWS/Logs": {"IncomingBytes", "IncomingLogEvents", "ForwardedBytes", "ForwardedLogEvents", "DeliveryErrors", "DeliveryThrottling"},
"AWS/ML": {"PredictCount", "PredictFailureCount"},
@@ -88,7 +88,7 @@ func init() {
"AWS/ElasticMapReduce": {"ClusterId", "JobFlowId", "JobId"},
"AWS/ES": {},
"AWS/Events": {"RuleName"},
- "AWS/Kinesis": {"StreamName"},
+ "AWS/Kinesis": {"StreamName", "ShardID"},
"AWS/Lambda": {"FunctionName"},
"AWS/Logs": {"LogGroupName", "DestinationType", "FilterName"},
"AWS/ML": {"MLModelId", "RequestMode"},
diff --git a/pkg/api/dashboard_snapshot.go b/pkg/api/dashboard_snapshot.go
index 3c369ca5b7f..cdcb871314d 100644
--- a/pkg/api/dashboard_snapshot.go
+++ b/pkg/api/dashboard_snapshot.go
@@ -21,6 +21,10 @@ func GetSharingOptions(c *middleware.Context) {
}
func CreateDashboardSnapshot(c *middleware.Context, cmd m.CreateDashboardSnapshotCommand) {
+ if cmd.Name == "" {
+ cmd.Name = "Unnamed snapshot"
+ }
+
if cmd.External {
// external snapshot ref requires key and delete key
if cmd.Key == "" || cmd.DeleteKey == "" {
diff --git a/pkg/api/dataproxy.go b/pkg/api/dataproxy.go
index eb88045cd51..b00ef595161 100644
--- a/pkg/api/dataproxy.go
+++ b/pkg/api/dataproxy.go
@@ -41,7 +41,6 @@ func NewReverseProxy(ds *m.DataSource, proxyPath string, targetUrl *url.URL) *ht
req.URL.RawQuery = reqQueryVals.Encode()
} else if ds.Type == m.DS_INFLUXDB {
req.URL.Path = util.JoinUrlFragments(targetUrl.Path, proxyPath)
- reqQueryVals.Add("db", ds.Database)
req.URL.RawQuery = reqQueryVals.Encode()
if !ds.BasicAuth {
req.Header.Del("Authorization")
diff --git a/pkg/api/dtos/plugins.go b/pkg/api/dtos/plugins.go
index fbdf8d4e0ea..7d46cc9d348 100644
--- a/pkg/api/dtos/plugins.go
+++ b/pkg/api/dtos/plugins.go
@@ -48,6 +48,6 @@ func (slice PluginList) Swap(i, j int) {
type ImportDashboardCommand struct {
PluginId string `json:"pluginId"`
Path string `json:"path"`
- Reinstall bool `json:"reinstall"`
+ Overwrite bool `json:"overwrite"`
Inputs []plugins.ImportDashboardInput `json:"inputs"`
}
diff --git a/pkg/api/index.go b/pkg/api/index.go
index 575ea35cfaf..53538fd2775 100644
--- a/pkg/api/index.go
+++ b/pkg/api/index.go
@@ -103,6 +103,10 @@ func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) {
}
for _, include := range plugin.Includes {
+ if !c.HasUserRole(include.Role) {
+ continue
+ }
+
if include.Type == "page" && include.AddToNav {
link := &dtos.NavLink{
Url: setting.AppSubUrl + "/plugins/" + plugin.Id + "/page/" + include.Slug,
@@ -110,6 +114,7 @@ func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) {
}
appLink.Children = append(appLink.Children, link)
}
+
if include.Type == "dashboard" && include.AddToNav {
link := &dtos.NavLink{
Url: setting.AppSubUrl + "/dashboard/db/" + include.Slug,
@@ -124,7 +129,9 @@ func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) {
appLink.Children = append(appLink.Children, &dtos.NavLink{Text: "Plugin Config", Icon: "fa fa-cog", Url: setting.AppSubUrl + "/plugins/" + plugin.Id + "/edit"})
}
- data.MainNavLinks = append(data.MainNavLinks, appLink)
+ if len(appLink.Children) > 0 {
+ data.MainNavLinks = append(data.MainNavLinks, appLink)
+ }
}
}
diff --git a/pkg/api/plugins.go b/pkg/api/plugins.go
index 6446f7fee33..ad81d438978 100644
--- a/pkg/api/plugins.go
+++ b/pkg/api/plugins.go
@@ -156,11 +156,12 @@ func GetPluginReadme(c *middleware.Context) Response {
func ImportDashboard(c *middleware.Context, apiCmd dtos.ImportDashboardCommand) Response {
cmd := plugins.ImportDashboardCommand{
- OrgId: c.OrgId,
- UserId: c.UserId,
- PluginId: apiCmd.PluginId,
- Path: apiCmd.Path,
- Inputs: apiCmd.Inputs,
+ OrgId: c.OrgId,
+ UserId: c.UserId,
+ PluginId: apiCmd.PluginId,
+ Path: apiCmd.Path,
+ Inputs: apiCmd.Inputs,
+ Overwrite: apiCmd.Overwrite,
}
if err := bus.Dispatch(&cmd); err != nil {
diff --git a/pkg/cmd/grafana-cli/commands/commands.go b/pkg/cmd/grafana-cli/commands/commands.go
index b3821a47844..ec454078f9b 100644
--- a/pkg/cmd/grafana-cli/commands/commands.go
+++ b/pkg/cmd/grafana-cli/commands/commands.go
@@ -4,6 +4,7 @@ import (
"os"
"github.com/codegangsta/cli"
+ "github.com/fatih/color"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/log"
)
@@ -12,7 +13,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("\n%s: ", color.RedString("Error"))
log.Errorf("%s\n\n", err)
cmd.ShowHelp()
diff --git a/pkg/cmd/grafana-cli/commands/install_command.go b/pkg/cmd/grafana-cli/commands/install_command.go
index 81e7a15233b..eb5973d07be 100644
--- a/pkg/cmd/grafana-cli/commands/install_command.go
+++ b/pkg/cmd/grafana-cli/commands/install_command.go
@@ -126,11 +126,16 @@ func downloadFile(pluginName, filePath, url string) (err error) {
defer func() {
if r := recover(); r != nil {
retryCount++
- if retryCount == 1 {
- log.Debug("\nFailed downloading. Will retry once.\n")
- downloadFile(pluginName, filePath, url)
+ if retryCount < 3 {
+ fmt.Println("Failed downloading. Will retry once.")
+ err = downloadFile(pluginName, filePath, url)
} else {
- panic(r)
+ failure := fmt.Sprintf("%v", r)
+ if failure == "runtime error: makeslice: len out of range" {
+ err = fmt.Errorf("Corrupt http response from source. Please try again.\n")
+ } else {
+ panic(r)
+ }
}
}
}()
@@ -164,14 +169,14 @@ func downloadFile(pluginName, filePath, url string) (err error) {
return fmt.Errorf(permissionsDeniedMessage, newFile)
}
- defer dst.Close()
src, err := zf.Open()
if err != nil {
- log.Errorf("%v", err)
+ log.Errorf("Failed to extract file: %v", err)
}
- defer src.Close()
io.Copy(dst, src)
+ dst.Close()
+ src.Close()
}
}
diff --git a/pkg/cmd/grafana-cli/commands/remove_command.go b/pkg/cmd/grafana-cli/commands/remove_command.go
index e0ecbb2b788..9792ed9d095 100644
--- a/pkg/cmd/grafana-cli/commands/remove_command.go
+++ b/pkg/cmd/grafana-cli/commands/remove_command.go
@@ -3,7 +3,7 @@ package commands
import (
"errors"
- "github.com/grafana/grafana/pkg/cmd/grafana-cli/log"
+ "fmt"
m "github.com/grafana/grafana/pkg/cmd/grafana-cli/models"
services "github.com/grafana/grafana/pkg/cmd/grafana-cli/services"
)
@@ -15,22 +15,17 @@ func removeCommand(c CommandLine) error {
pluginPath := c.GlobalString("pluginsDir")
localPlugins := getPluginss(pluginPath)
- log.Info("remove!\n")
-
plugin := c.Args().First()
- log.Info("plugin: " + plugin + "\n")
if plugin == "" {
return errors.New("Missing plugin parameter")
}
- log.Infof("plugins : \n%v\n", localPlugins)
-
for _, p := range localPlugins {
if p.Id == c.Args().First() {
- log.Infof("removing plugin %s", p.Id)
removePlugin(pluginPath, p.Id)
+ return nil
}
}
- return nil
+ return fmt.Errorf("Could not find plugin named %s", c.Args().First())
}
diff --git a/pkg/cmd/grafana-cli/main.go b/pkg/cmd/grafana-cli/main.go
index 5cc3fb6f306..b9549e00c1a 100644
--- a/pkg/cmd/grafana-cli/main.go
+++ b/pkg/cmd/grafana-cli/main.go
@@ -8,7 +8,6 @@ import (
"github.com/codegangsta/cli"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/commands"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/log"
- "strings"
)
var version = "master"
@@ -18,7 +17,7 @@ func getGrafanaPluginDir() string {
defaultNix := "/var/lib/grafana/plugins"
if currentOS == "windows" {
- return "C:\\opt\\grafana\\plugins"
+ return "../data/plugins"
}
pwd, err := os.Getwd()
@@ -29,16 +28,17 @@ func getGrafanaPluginDir() string {
}
if isDevenvironment(pwd) {
- return "../../../data/plugins"
+ return "../data/plugins"
}
return defaultNix
}
func isDevenvironment(pwd string) bool {
- // if grafana-cli is executed from the cmd folder we can assume
+ // if ../conf/defaults.ini exists, grafana is not installed as package
// that its in development environment.
- return strings.HasSuffix(pwd, "/pkg/cmd/grafana-cli")
+ _, err := os.Stat("../conf/defaults.ini")
+ return err == nil
}
func main() {
diff --git a/pkg/models/dashboard_snapshot.go b/pkg/models/dashboard_snapshot.go
index f920e91f2e4..4a4d1290b6d 100644
--- a/pkg/models/dashboard_snapshot.go
+++ b/pkg/models/dashboard_snapshot.go
@@ -45,7 +45,7 @@ type DashboardSnapshotDTO struct {
type CreateDashboardSnapshotCommand struct {
Dashboard *simplejson.Json `json:"dashboard" binding:"Required"`
- Name string `json:"name" binding:"Required"`
+ Name string `json:"name"`
Expires int64 `json:"expires"`
// these are passed when storing an external snapshot ref
diff --git a/pkg/models/org_user.go b/pkg/models/org_user.go
index 48d17deb9db..d7a918751ef 100644
--- a/pkg/models/org_user.go
+++ b/pkg/models/org_user.go
@@ -1,7 +1,9 @@
package models
import (
+ "encoding/json"
"errors"
+ "fmt"
"time"
)
@@ -37,6 +39,26 @@ func (r RoleType) Includes(other RoleType) bool {
return r == other
}
+func (r *RoleType) UnmarshalJSON(data []byte) error {
+ var str string
+ err := json.Unmarshal(data, &str)
+ if err != nil {
+ return err
+ }
+
+ *r = RoleType(str)
+
+ if (*r).IsValid() == false {
+ if (*r) != "" {
+ return errors.New(fmt.Sprintf("JSON validation error: invalid role value: %s", *r))
+ }
+
+ *r = ROLE_VIEWER
+ }
+
+ return nil
+}
+
type OrgUser struct {
Id int64
OrgId int64
diff --git a/pkg/plugins/dashboard_importer.go b/pkg/plugins/dashboard_importer.go
index 834bfabd048..4d2757b9a0e 100644
--- a/pkg/plugins/dashboard_importer.go
+++ b/pkg/plugins/dashboard_importer.go
@@ -11,12 +11,13 @@ import (
)
type ImportDashboardCommand struct {
- Path string `json:"string"`
- Inputs []ImportDashboardInput `json:"inputs"`
+ Path string
+ Inputs []ImportDashboardInput
+ Overwrite bool
- OrgId int64 `json:"-"`
- UserId int64 `json:"-"`
- PluginId string `json:"-"`
+ OrgId int64
+ UserId int64
+ PluginId string
Result *PluginDashboardInfoDTO
}
@@ -67,6 +68,7 @@ func ImportDashboard(cmd *ImportDashboardCommand) error {
Dashboard: generatedDash,
OrgId: cmd.OrgId,
UserId: cmd.UserId,
+ Overwrite: cmd.Overwrite,
}
if err := bus.Dispatch(&saveCmd); err != nil {
diff --git a/pkg/plugins/models.go b/pkg/plugins/models.go
index 68268239c51..aa381abacc7 100644
--- a/pkg/plugins/models.go
+++ b/pkg/plugins/models.go
@@ -7,7 +7,7 @@ import (
"strings"
"github.com/grafana/grafana/pkg/log"
- "github.com/grafana/grafana/pkg/models"
+ m "github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/setting"
)
@@ -69,6 +69,12 @@ func (pb *PluginBase) registerPlugin(pluginDir string) error {
pb.Dependencies.GrafanaVersion = "*"
}
+ for _, include := range pb.Includes {
+ if include.Role == "" {
+ include.Role = m.RoleType(m.ROLE_VIEWER)
+ }
+ }
+
pb.PluginDir = pluginDir
Plugins[pb.Id] = pb
return nil
@@ -80,14 +86,14 @@ type PluginDependencies struct {
}
type PluginInclude struct {
- Name string `json:"name"`
- Path string `json:"path"`
- Type string `json:"type"`
- Component string `json:"component"`
- Role models.RoleType `json:"role"`
- AddToNav bool `json:"addToNav"`
- DefaultNav bool `json:"defaultNav"`
- Slug string `json:"slug"`
+ Name string `json:"name"`
+ Path string `json:"path"`
+ Type string `json:"type"`
+ Component string `json:"component"`
+ Role m.RoleType `json:"role"`
+ AddToNav bool `json:"addToNav"`
+ DefaultNav bool `json:"defaultNav"`
+ Slug string `json:"slug"`
Id string `json:"-"`
}
diff --git a/pkg/services/sqlstore/dashboard.go b/pkg/services/sqlstore/dashboard.go
index a64094cb65e..ef36fd75ab6 100644
--- a/pkg/services/sqlstore/dashboard.go
+++ b/pkg/services/sqlstore/dashboard.go
@@ -216,7 +216,7 @@ func GetDashboardTags(query *m.GetDashboardTagsQuery) error {
func DeleteDashboard(cmd *m.DeleteDashboardCommand) error {
return inTransaction2(func(sess *session) error {
dashboard := m.Dashboard{Slug: cmd.Slug, OrgId: cmd.OrgId}
- has, err := x.Get(&dashboard)
+ has, err := sess.Get(&dashboard)
if err != nil {
return err
} else if has == false {
diff --git a/pkg/services/sqlstore/plugin_setting.go b/pkg/services/sqlstore/plugin_setting.go
index b3285e905cf..ec0b9b2e2d7 100644
--- a/pkg/services/sqlstore/plugin_setting.go
+++ b/pkg/services/sqlstore/plugin_setting.go
@@ -61,7 +61,6 @@ func UpdatePluginSetting(cmd *m.UpdatePluginSettingCmd) error {
for key, data := range cmd.SecureJsonData {
pluginSetting.SecureJsonData[key] = util.Encrypt([]byte(data), setting.SecretKey)
}
- pluginSetting.SecureJsonData = cmd.GetEncryptedJsonData()
pluginSetting.Updated = time.Now()
pluginSetting.Enabled = cmd.Enabled
pluginSetting.JsonData = cmd.JsonData
diff --git a/public/app/core/components/dashboard_selector.ts b/public/app/core/components/dashboard_selector.ts
index 913a43911fa..4209ff3f8dc 100644
--- a/public/app/core/components/dashboard_selector.ts
+++ b/public/app/core/components/dashboard_selector.ts
@@ -7,6 +7,9 @@ import coreModule from 'app/core/core_module';
var template = `
+