From f959ba9bcfb4e5fc850a92a0be73f71a3f836b97 Mon Sep 17 00:00:00 2001 From: Daniel Lee Date: Mon, 19 Feb 2018 10:00:09 +0100 Subject: [PATCH 01/16] influxdb: escape backslashes in tag values (for alerting) Closes #10957. Backslash escaping was already implemented on the frontend but does not work for queries executed on the backend. --- pkg/tsdb/influxdb/query.go | 2 +- pkg/tsdb/influxdb/query_test.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/tsdb/influxdb/query.go b/pkg/tsdb/influxdb/query.go index 499f446e9f0..0a16a507877 100644 --- a/pkg/tsdb/influxdb/query.go +++ b/pkg/tsdb/influxdb/query.go @@ -70,7 +70,7 @@ func (query *Query) renderTags() []string { } else if tag.Operator == "<" || tag.Operator == ">" { textValue = tag.Value } else { - textValue = fmt.Sprintf("'%s'", tag.Value) + textValue = fmt.Sprintf("'%s'", strings.Replace(tag.Value, `\`, `\\`, -1)) } res = append(res, fmt.Sprintf(`%s"%s" %s %s`, str, tag.Key, tag.Operator, textValue)) diff --git a/pkg/tsdb/influxdb/query_test.go b/pkg/tsdb/influxdb/query_test.go index 4a620539a26..f1270560269 100644 --- a/pkg/tsdb/influxdb/query_test.go +++ b/pkg/tsdb/influxdb/query_test.go @@ -170,6 +170,12 @@ func TestInfluxdbQueryBuilder(t *testing.T) { So(strings.Join(query.renderTags(), ""), ShouldEqual, `"key" = 'value'`) }) + Convey("can escape backslashes when rendering string tags", func() { + query := &Query{Tags: []*Tag{{Operator: "=", Value: `C:\test\`, Key: "key"}}} + + So(strings.Join(query.renderTags(), ""), ShouldEqual, `"key" = 'C:\\test\\'`) + }) + Convey("can render regular measurement", func() { query := &Query{Measurement: `apa`, Policy: "policy"} From ae20366b018a688ab18b4f1ad759c1919d6a187b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 19 Feb 2018 11:37:42 +0100 Subject: [PATCH 02/16] graph: added 0.5 point radius option --- public/app/plugins/panel/graph/tab_display.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/plugins/panel/graph/tab_display.html b/public/app/plugins/panel/graph/tab_display.html index d5d93250e36..2ab5418c6c2 100644 --- a/public/app/plugins/panel/graph/tab_display.html +++ b/public/app/plugins/panel/graph/tab_display.html @@ -43,7 +43,7 @@
- +
From 1de889169c64e67b48efc03f43cda4d11c599f0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 19 Feb 2018 14:24:01 +0100 Subject: [PATCH 03/16] build: updated build version to v5.0-beta4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 645982e2b4c..1cae6360f01 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "company": "Grafana Labs" }, "name": "grafana", - "version": "5.0.0-beta3", + "version": "5.0.0-beta4", "repository": { "type": "git", "url": "http://github.com/grafana/grafana.git" From 89a17a4ace0c9d3a916e4896afeb45b66d1d33c3 Mon Sep 17 00:00:00 2001 From: Aleksandar Gyorev Date: Mon, 19 Feb 2018 15:44:20 +0200 Subject: [PATCH 04/16] Correct typo in DashboardInputMissingError --- pkg/plugins/dashboard_importer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/plugins/dashboard_importer.go b/pkg/plugins/dashboard_importer.go index 558f61871ba..53012f3e817 100644 --- a/pkg/plugins/dashboard_importer.go +++ b/pkg/plugins/dashboard_importer.go @@ -35,7 +35,7 @@ type DashboardInputMissingError struct { } func (e DashboardInputMissingError) Error() string { - return fmt.Sprintf("Dashbord input variable: %v missing from import command", e.VariableName) + return fmt.Sprintf("Dashboard input variable: %v missing from import command", e.VariableName) } func init() { From c5461fe2e28301d3c6fa5fce7753cc07edf633c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 19 Feb 2018 15:41:10 +0100 Subject: [PATCH 05/16] docs: updated for changelog and docs with beta4 --- CHANGELOG.md | 8 ++++++++ docs/sources/installation/debian.md | 6 +++--- docs/sources/installation/rpm.md | 4 ++-- docs/sources/installation/windows.md | 2 +- packaging/publish/publish_testing.sh | 4 ++-- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ebb62e80fdc..8d16e816f3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# 5.0.0-beta4 (2018-02-19) + +### Fixes + +- **Dashboard** Fixed dashboard overwrite permission issue [#10814](https://github.com/grafana/grafana/issues/10814) +- **Keyboard shortcuts** Fixed Esc key when in panel edit/view mode [#10945](https://github.com/grafana/grafana/issues/10945) +- **Save dashboard** Fixed issue with time range & variable reset after saving [#10946](https://github.com/grafana/grafana/issues/10946) + # 5.0.0-beta3 (2018-02-16) ### Fixes diff --git a/docs/sources/installation/debian.md b/docs/sources/installation/debian.md index 9df942c6bed..a45afe35e6b 100644 --- a/docs/sources/installation/debian.md +++ b/docs/sources/installation/debian.md @@ -16,7 +16,7 @@ weight = 1 Description | Download ------------ | ------------- Stable for Debian-based Linux | [grafana_4.6.3_amd64.deb](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_4.6.3_amd64.deb) -Beta for Debian-based Linux | [grafana_5.0.0-beta3_amd64.deb](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_5.0.0-beta3_amd64.deb) +Beta for Debian-based Linux | [grafana_5.0.0-beta4_amd64.deb](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_5.0.0-beta4_amd64.deb) Read [Upgrading Grafana]({{< relref "installation/upgrading.md" >}}) for tips and guidance on updating an existing installation. @@ -33,9 +33,9 @@ sudo dpkg -i grafana_4.6.3_amd64.deb ## Install Latest Beta ```bash -wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_5.0.0-beta3_amd64.deb +wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_5.0.0-beta4_amd64.deb sudo apt-get install -y adduser libfontconfig -sudo dpkg -i grafana_5.0.0-beta3_amd64.deb +sudo dpkg -i grafana_5.0.0-beta4_amd64.deb ``` ## APT Repository diff --git a/docs/sources/installation/rpm.md b/docs/sources/installation/rpm.md index db29ecb3343..e97ab17a697 100644 --- a/docs/sources/installation/rpm.md +++ b/docs/sources/installation/rpm.md @@ -16,7 +16,7 @@ weight = 2 Description | Download ------------ | ------------- Stable for CentOS / Fedora / OpenSuse / Redhat Linux | [4.6.3 (x86-64 rpm)](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.6.3-1.x86_64.rpm) -Latest Beta for CentOS / Fedora / OpenSuse / Redhat Linux | [5.0.0-beta3 (x86-64 rpm)](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.0.0-beta3.x86_64.rpm) +Latest Beta for CentOS / Fedora / OpenSuse / Redhat Linux | [5.0.0-beta4 (x86-64 rpm)](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.0.0-beta4.x86_64.rpm) Read [Upgrading Grafana]({{< relref "installation/upgrading.md" >}}) for tips and guidance on updating an existing installation. @@ -32,7 +32,7 @@ $ sudo yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/g ## Install Beta ```bash -$ sudo yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.0.0-beta3.x86_64.rpm +$ sudo yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.0.0-beta4.x86_64.rpm ``` Or install manually using `rpm`. diff --git a/docs/sources/installation/windows.md b/docs/sources/installation/windows.md index fb052101f44..07f5abde52f 100644 --- a/docs/sources/installation/windows.md +++ b/docs/sources/installation/windows.md @@ -14,7 +14,7 @@ weight = 3 Description | Download ------------ | ------------- Latest stable package for Windows | [grafana.4.6.3.windows-x64.zip](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.6.3.windows-x64.zip) -Latest beta package for Windows | [grafana.5.0.0-beta3.windows-x64.zip](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.0.0-beta3.windows-x64.zip) +Latest beta package for Windows | [grafana.5.0.0-beta4.windows-x64.zip](https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.0.0-beta4.windows-x64.zip) Read [Upgrading Grafana]({{< relref "installation/upgrading.md" >}}) for tips and guidance on updating an existing installation. diff --git a/packaging/publish/publish_testing.sh b/packaging/publish/publish_testing.sh index f009631a52d..5dea3655251 100755 --- a/packaging/publish/publish_testing.sh +++ b/packaging/publish/publish_testing.sh @@ -1,6 +1,6 @@ #! /usr/bin/env bash -deb_ver=5.0.0-beta3 -rpm_ver=5.0.0-beta3 +deb_ver=5.0.0-beta4 +rpm_ver=5.0.0-beta4 wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_${deb_ver}_amd64.deb From 4dc6074e791fa11ae87f9e0d149e5a611b764c09 Mon Sep 17 00:00:00 2001 From: bergquist Date: Tue, 20 Feb 2018 07:33:24 +0100 Subject: [PATCH 06/16] provisioning: dont ignore sample yaml files closes #10963 --- conf/provisioning/dashboards/sample.yaml | 5 +- conf/provisioning/datasources/sample.yaml | 5 +- .../provisioning/dashboards/config_reader.go | 2 +- .../dashboards-from-disk/sample.yaml | 16 +++--- .../provisioning/datasources/config_reader.go | 2 +- .../datasources/config_reader_test.go | 13 ++++- .../test-configs/all-properties/sample.yaml | 54 +++++++++---------- 7 files changed, 51 insertions(+), 46 deletions(-) diff --git a/conf/provisioning/dashboards/sample.yaml b/conf/provisioning/dashboards/sample.yaml index caaf3754b0f..d70bd425634 100644 --- a/conf/provisioning/dashboards/sample.yaml +++ b/conf/provisioning/dashboards/sample.yaml @@ -1,8 +1,5 @@ -# This file is only an example. -# Grafana will never read sample.yaml files - # # config file version -# apiVersion: 1 +apiVersion: 1 #providers: # - name: 'default' diff --git a/conf/provisioning/datasources/sample.yaml b/conf/provisioning/datasources/sample.yaml index 740b4c19772..877e229183d 100644 --- a/conf/provisioning/datasources/sample.yaml +++ b/conf/provisioning/datasources/sample.yaml @@ -1,8 +1,5 @@ -# This file is only an example. -# Grafana will never read sample.yaml files - # # config file version -# apiVersion: 1 +apiVersion: 1 # # list of datasources that should be deleted from the database #deleteDatasources: diff --git a/pkg/services/provisioning/dashboards/config_reader.go b/pkg/services/provisioning/dashboards/config_reader.go index 3183d21262a..9030ba609b9 100644 --- a/pkg/services/provisioning/dashboards/config_reader.go +++ b/pkg/services/provisioning/dashboards/config_reader.go @@ -63,7 +63,7 @@ func (cr *configReader) readConfig() ([]*DashboardsAsConfig, error) { } for _, file := range files { - if (!strings.HasSuffix(file.Name(), ".yaml") && !strings.HasSuffix(file.Name(), ".yml")) || file.Name() == "sample.yaml" { + if !strings.HasSuffix(file.Name(), ".yaml") && !strings.HasSuffix(file.Name(), ".yml") { continue } diff --git a/pkg/services/provisioning/dashboards/test-configs/dashboards-from-disk/sample.yaml b/pkg/services/provisioning/dashboards/test-configs/dashboards-from-disk/sample.yaml index 9090e5f472a..5b73632b1ff 100644 --- a/pkg/services/provisioning/dashboards/test-configs/dashboards-from-disk/sample.yaml +++ b/pkg/services/provisioning/dashboards/test-configs/dashboards-from-disk/sample.yaml @@ -1,10 +1,10 @@ apiVersion: 1 -providers: -- name: 'gasdf' - orgId: 2 - folder: 'developers' - editable: true - type: file - options: - path: /var/lib/grafana/dashboards +#providers: +#- name: 'gasdf' +# orgId: 2 +# folder: 'developers' +# editable: true +# type: file +# options: +# path: /var/lib/grafana/dashboards diff --git a/pkg/services/provisioning/datasources/config_reader.go b/pkg/services/provisioning/datasources/config_reader.go index 82504f4972b..58ed5472a6b 100644 --- a/pkg/services/provisioning/datasources/config_reader.go +++ b/pkg/services/provisioning/datasources/config_reader.go @@ -24,7 +24,7 @@ func (cr *configReader) readConfig(path string) ([]*DatasourcesAsConfig, error) } for _, file := range files { - if (strings.HasSuffix(file.Name(), ".yaml") || strings.HasSuffix(file.Name(), ".yml")) && file.Name() != "sample.yaml" { + if strings.HasSuffix(file.Name(), ".yaml") || strings.HasSuffix(file.Name(), ".yml") { datasource, err := cr.parseDatasourceConfig(path, file) if err != nil { return nil, err diff --git a/pkg/services/provisioning/datasources/config_reader_test.go b/pkg/services/provisioning/datasources/config_reader_test.go index 9a0419232ac..3198329e0ae 100644 --- a/pkg/services/provisioning/datasources/config_reader_test.go +++ b/pkg/services/provisioning/datasources/config_reader_test.go @@ -138,7 +138,7 @@ func TestDatasourceAsConfig(t *testing.T) { t.Fatalf("readConfig return an error %v", err) } - So(len(cfg), ShouldEqual, 2) + So(len(cfg), ShouldEqual, 3) dsCfg := cfg[0] @@ -146,6 +146,17 @@ func TestDatasourceAsConfig(t *testing.T) { validateDatasource(dsCfg) validateDeleteDatasources(dsCfg) + + dsCount := 0 + delDsCount := 0 + + for _, c := range cfg { + dsCount += len(c.Datasources) + delDsCount += len(c.DeleteDatasources) + } + + So(dsCount, ShouldEqual, 2) + So(delDsCount, ShouldEqual, 1) }) Convey("can read all properties from version 0", func() { diff --git a/pkg/services/provisioning/datasources/test-configs/all-properties/sample.yaml b/pkg/services/provisioning/datasources/test-configs/all-properties/sample.yaml index 70ad6c6d2f6..2187eabdc46 100644 --- a/pkg/services/provisioning/datasources/test-configs/all-properties/sample.yaml +++ b/pkg/services/provisioning/datasources/test-configs/all-properties/sample.yaml @@ -3,30 +3,30 @@ apiVersion: 1 -datasources: - - name: name - type: type - access: proxy - orgId: 2 - url: url - password: password - user: user - database: database - basicAuth: true - basicAuthUser: basic_auth_user - basicAuthPassword: basic_auth_password - withCredentials: true - jsonData: - graphiteVersion: "1.1" - tlsAuth: true - tlsAuthWithCACert: true - secureJsonData: - tlsCACert: "MjNOcW9RdkbUDHZmpco2HCYzVq9dE+i6Yi+gmUJotq5CDA==" - tlsClientCert: "ckN0dGlyMXN503YNfjTcf9CV+GGQneN+xmAclQ==" - tlsClientKey: "ZkN4aG1aNkja/gKAB1wlnKFIsy2SRDq4slrM0A==" - editable: true - version: 10 - -deleteDatasources: - - name: old-graphite3 - orgId: 2 +#datasources: +# - name: name +# type: type +# access: proxy +# orgId: 2 +# url: url +# password: password +# user: user +# database: database +# basicAuth: true +# basicAuthUser: basic_auth_user +# basicAuthPassword: basic_auth_password +# withCredentials: true +# jsonData: +# graphiteVersion: "1.1" +# tlsAuth: true +# tlsAuthWithCACert: true +# secureJsonData: +# tlsCACert: "MjNOcW9RdkbUDHZmpco2HCYzVq9dE+i6Yi+gmUJotq5CDA==" +# tlsClientCert: "ckN0dGlyMXN503YNfjTcf9CV+GGQneN+xmAclQ==" +# tlsClientKey: "ZkN4aG1aNkja/gKAB1wlnKFIsy2SRDq4slrM0A==" +# editable: true +# version: 10 +# +#deleteDatasources: +# - name: old-graphite3 +# orgId: 2 From 7d0c3ae6a7f99aaf0760a9577f75bf913df5eaf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 20 Feb 2018 09:33:28 +0100 Subject: [PATCH 07/16] fix: alert history list now shows on graphs with manually added annotation events, fixes #10968 --- public/app/features/alerting/alert_tab_ctrl.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/features/alerting/alert_tab_ctrl.ts b/public/app/features/alerting/alert_tab_ctrl.ts index 29498f5d92b..79baa1e3f5a 100644 --- a/public/app/features/alerting/alert_tab_ctrl.ts +++ b/public/app/features/alerting/alert_tab_ctrl.ts @@ -75,7 +75,7 @@ export class AlertTabCtrl { getAlertHistory() { this.backendSrv - .get(`/api/annotations?dashboardId=${this.panelCtrl.dashboard.id}&panelId=${this.panel.id}&limit=50`) + .get(`/api/annotations?dashboardId=${this.panelCtrl.dashboard.id}&panelId=${this.panel.id}&limit=50&type=alert`) .then(res => { this.alertHistory = _.map(res, ah => { ah.time = this.dashboardSrv.getCurrent().formatDate(ah.time, 'MMM D, YYYY HH:mm:ss'); From 1293fcadd24b4ece234e3f7c4c8b0d13dae1aca9 Mon Sep 17 00:00:00 2001 From: Patrick O'Carroll Date: Tue, 20 Feb 2018 09:45:30 +0100 Subject: [PATCH 08/16] added an if to check for null to sort null as 0 (#10961) * added an if to check for null to sort null as 0 * changed 0 to -Infinity --- public/app/plugins/panel/graph/legend.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/app/plugins/panel/graph/legend.ts b/public/app/plugins/panel/graph/legend.ts index cd43ac58469..0c8852bf55a 100644 --- a/public/app/plugins/panel/graph/legend.ts +++ b/public/app/plugins/panel/graph/legend.ts @@ -151,7 +151,11 @@ module.directive('graphLegend', function(popoverSrv, $timeout) { if (panel.legend.sort) { seriesList = _.sortBy(seriesList, function(series) { - return series.stats[panel.legend.sort]; + let sort = series.stats[panel.legend.sort]; + if (sort === null) { + sort = -Infinity; + } + return sort; }); if (panel.legend.sortDesc) { seriesList = seriesList.reverse(); From 9f4b7ac26f3c2a35037ddc9e2e7d04863418e361 Mon Sep 17 00:00:00 2001 From: Patrick O'Carroll Date: Tue, 20 Feb 2018 11:08:53 +0100 Subject: [PATCH 09/16] added scroll to org list modal (#10960) * added scroll to org list modal, fixes #10774 * removed console.log --- public/app/core/components/org_switcher.ts | 3 +-- public/sass/components/_modals.scss | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/public/app/core/components/org_switcher.ts b/public/app/core/components/org_switcher.ts index 1816e11af49..f7b53fa3c81 100644 --- a/public/app/core/components/org_switcher.ts +++ b/public/app/core/components/org_switcher.ts @@ -15,8 +15,7 @@ const template = ` -