From e8157f01ecc84d7fdc94c423e236cb0842a4f3d4 Mon Sep 17 00:00:00 2001 From: Mitsuhiro Tanda Date: Tue, 18 Jul 2017 13:07:39 +0900 Subject: [PATCH 01/35] add new dashboard shortcut --- public/app/core/services/keybindingSrv.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/app/core/services/keybindingSrv.ts b/public/app/core/services/keybindingSrv.ts index 46d108b43df..eee1c45bde1 100644 --- a/public/app/core/services/keybindingSrv.ts +++ b/public/app/core/services/keybindingSrv.ts @@ -193,6 +193,10 @@ export class KeybindingSrv { } }); + this.bind('d n', e => { + this.$location.url("/dashboard/new"); + }); + this.bind('d r', () => { scope.broadcastRefresh(); }); From 5420f271f1136776a289e777c134ce2fd76f120a Mon Sep 17 00:00:00 2001 From: Adrian Garza Date: Thu, 10 Aug 2017 16:03:42 -0700 Subject: [PATCH 02/35] added CloudWatch data source API documentation access and secret keys are base64-encoded gibberish --- docs/sources/http_api/data_source.md | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/docs/sources/http_api/data_source.md b/docs/sources/http_api/data_source.md index f15411e5eff..62b09fb5d2c 100644 --- a/docs/sources/http_api/data_source.md +++ b/docs/sources/http_api/data_source.md @@ -137,7 +137,7 @@ parent = "http_api" `POST /api/datasources` -**Example Request**: +**Example Graphite Request**: POST /api/datasources HTTP/1.1 Accept: application/json @@ -152,6 +152,28 @@ parent = "http_api" "basicAuth":false } +**Example CloudWatch Request**: + ``` + POST /api/datasources HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk + + { + "name": "test_datasource", + "type": "cloudwatch", + "url": "http://monitoring.us-west-1.amazonaws.com", + "access": "proxy", + "jsonData": { + "authType": "keys", + "defaultRegion": "us-west-1" + }, + "secureJsonData": { + "accessKey": "Ol4pIDpeKSA6XikgOl4p", + "secretKey": "dGVzdCBrZXkgYmxlYXNlIGRvbid0IHN0ZWFs" + } + } + ``` **Example Response**: From 91fb3f2224cd9e228ad516ec4b232bd89cfa1839 Mon Sep 17 00:00:00 2001 From: Jesse White Date: Fri, 1 Sep 2017 01:19:51 -0400 Subject: [PATCH 03/35] fix: cancel the initial timer when changing the auto-refresh interval, fixes #9139 (#9140) --- public/app/features/dashboard/time_srv.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/public/app/features/dashboard/time_srv.ts b/public/app/features/dashboard/time_srv.ts index abde4152b63..2c16915b5aa 100644 --- a/public/app/features/dashboard/time_srv.ts +++ b/public/app/features/dashboard/time_srv.ts @@ -116,16 +116,14 @@ class TimeSrv { setAutoRefresh(interval) { this.dashboard.refresh = interval; + this.cancelNextRefresh(); if (interval) { var intervalMs = kbn.interval_to_ms(interval); - this.$timeout(() => { + this.refreshTimer = this.timer.register(this.$timeout(() => { this.startNextRefreshTimer(intervalMs); this.refreshDashboard(); - }, intervalMs); - - } else { - this.cancelNextRefresh(); + }, intervalMs)); } // update url From 7dc6d67d469f6582b11eee213645c0aaf03e70db Mon Sep 17 00:00:00 2001 From: bergquist Date: Thu, 7 Sep 2017 14:29:25 +0200 Subject: [PATCH 04/35] adds note about closing #8876 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b17a86893ad..eae246c4a64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ # 4.5.0 (unreleased) +## Enhancements + +* **Shortcuts**: Adds shortcut for creating new dashboard [#8876](https://github.com/grafana/grafana/pull/8876) thx [@mtanda](https://github.com/mtanda) + # 4.5.0-beta1 (2017-09-05) ## New Features From 51d021a33784176076348c602d721fc85f3b243a Mon Sep 17 00:00:00 2001 From: bergquist Date: Thu, 7 Sep 2017 15:26:08 +0200 Subject: [PATCH 05/35] reduce readme to be about the code --- README.md | 91 +++------------------------------------------------- package.json | 3 +- 2 files changed, 6 insertions(+), 88 deletions(-) diff --git a/README.md b/README.md index 5de6a7122ab..a61640b096a 100644 --- a/README.md +++ b/README.md @@ -9,65 +9,8 @@ Graphite, Elasticsearch, OpenTSDB, Prometheus and InfluxDB. ![](http://docs.grafana.org/assets/img/features/dashboard_ex1.png) -- [Install instructions](http://docs.grafana.org/installation/) -- [What's New in Grafana 2.0](http://docs.grafana.org/guides/whats-new-in-v2/) -- [What's New in Grafana 2.1](http://docs.grafana.org/guides/whats-new-in-v2-1/) -- [What's New in Grafana 2.5](http://docs.grafana.org/guides/whats-new-in-v2-5/) -- [What's New in Grafana 3.0](http://docs.grafana.org/guides/whats-new-in-v3/) -- [What's New in Grafana 4.0](http://docs.grafana.org/guides/whats-new-in-v4/) -- [What's New in Grafana 4.1](http://docs.grafana.org/guides/whats-new-in-v4-1/) -- [What's New in Grafana 4.2](http://docs.grafana.org/guides/whats-new-in-v4-2/) -- [What's New in Grafana 4.3](http://docs.grafana.org/guides/whats-new-in-v4-3/) -- [What's New in Grafana 4.4](http://docs.grafana.org/guides/whats-new-in-v4-4/) - -## Features - -### Graphing -- Fast rendering, even over large timespans -- Click and drag to zoom -- Multiple Y-axis, logarithmic scales -- Bars, Lines, Points -- Smart Y-axis formatting -- Series toggles & color selector -- Legend values, and formatting options -- Grid thresholds, axis labels -- [Annotations](http://docs.grafana.org/reference/annotations/) -- Any panel can be rendered to PNG (server side using phantomjs) - -### Dashboards -- Create, edit, save & search dashboards -- Change column spans and row heights -- Drag and drop panels to rearrange -- [Templating](http://docs.grafana.org/reference/templating/) -- [Scripted dashboards](http://docs.grafana.org/reference/scripting/) -- [Dashboard playlists](http://docs.grafana.org/reference/playlist/) -- [Time range controls](http://docs.grafana.org/reference/timerange/) -- [Share snapshots publicly](http://docs.grafana.org/v2.0/reference/sharing/) - -### InfluxDB -- Use InfluxDB as a metric data source, annotation source -- Query editor with field and tag typeahead, easy group by and function selection - -### Graphite -- Graphite target expression parser -- Feature rich query composer -- Quickly add and edit functions & parameters -- Templated queries -- [See it in action](http://docs.grafana.org/datasources/graphite/) - -### Elasticsearch, Prometheus & OpenTSDB -- Feature rich query editor UI - -### Alerting -- Define alert rules using graphs & query conditions -- Schedule & evalute alert rules, send notifications to Slack, Hipchat, Email, PagerDuty, etc. - -## Requirements -There are no dependencies except an external time series data store. For dashboards and user accounts Grafana can use an embedded -database (sqlite3) or you can use an external SQL data base like MySQL or Postgres. - ## Installation -Head to [grafana.org](http://docs.grafana.org/installation/) and [download](https://grafana.com/get) +Head to [docs.grafana.org](http://docs.grafana.org/installation/) and [download](https://grafana.com/get) the latest release. If you have any problems please read the [troubleshooting guide](http://docs.grafana.org/installation/troubleshooting/). @@ -84,27 +27,10 @@ the latest master builds [here](https://grafana.com/grafana/download) - Go 1.8.1 - NodeJS LTS -### Get Code - -```bash -go get github.com/grafana/grafana -``` - -Since imports of dependencies use the absolute path `github.com/grafana/grafana` within the `$GOPATH`, -you will need to put your version of the code in `$GOPATH/src/github.com/grafana/grafana` to be able -to develop and build grafana on a cloned repository. To do so, you can clone your forked repository -directly to `$GOPATH/src/github.com/grafana` or you can create a symbolic link from your version -of the code to `$GOPATH/src/github.com/grafana/grafana`. The last options makes it possible to change -easily the grafana repository you want to build. -```bash -go get github.com/*your_account*/grafana -mkdir $GOPATH/src/github.com/grafana -ln -s $GOPATH/src/github.com/*your_account*/grafana $GOPATH/src/github.com/grafana/grafana -``` - ### Building the backend ```bash -cd $GOPATH/src/github.com/grafana/grafana +go get github.com/grafana/grafana +cd ~/go/src/github.com/grafana/grafana go run build.go setup go run build.go build ``` @@ -123,8 +49,7 @@ npm run build To build the frontend assets only on changes: ```bash -sudo npm install -g grunt-cli # to do only once to install grunt command line interface -grunt && grunt watch +npm run dev ``` ### Recompile backend on source change @@ -134,11 +59,6 @@ go get github.com/Unknwon/bra bra run ``` -### Running -```bash -./bin/grafana-server -``` - Open grafana in your browser (default: `http://localhost:3000`) and login with admin user (default: `user/pass = admin/admin`). ### Dev config @@ -149,9 +69,6 @@ You only need to add the options you want to override. Config files are applied 1. grafana.ini 1. custom.ini -## Create a pull request -Before or after you create a pull request, sign the [contributor license agreement](http://docs.grafana.org/project/cla/). - ## Contribute If you have any idea for an improvement or found a bug do not hesitate to open an issue. And if you have time clone this repo and submit a pull request and help me make Grafana diff --git a/package.json b/package.json index 900a5b0acee..5ac5c01d8d9 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,8 @@ }, "scripts": { "build": "./node_modules/grunt-cli/bin/grunt", - "test": "./node_modules/grunt-cli/bin/grunt test" + "test": "./node_modules/grunt-cli/bin/grunt test", + "dev": "./node_modules/grunt-cli/bin/grunt && ./node_modules/grunt-cli/bin/grunt watch" }, "license": "Apache-2.0", "dependencies": { From de647c4100587101bde8ab2b8d1e8e322b18814a Mon Sep 17 00:00:00 2001 From: Patrick O'Carroll Date: Thu, 7 Sep 2017 16:32:55 +0200 Subject: [PATCH 06/35] docs: uppdated getting started with images and text, added info on query inspector to version45 and trouble shooting (#9193) --- docs/sources/guides/getting_started.md | 29 ++++++++++---------- docs/sources/guides/whats-new-in-v4-5.md | 5 ++++ docs/sources/installation/troubleshooting.md | 7 ++++- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/docs/sources/guides/getting_started.md b/docs/sources/guides/getting_started.md index 871aa6c1e1b..5c02042481f 100644 --- a/docs/sources/guides/getting_started.md +++ b/docs/sources/guides/getting_started.md @@ -24,9 +24,9 @@ Read the [Basic Concepts](/guides/basic_concepts) document to get a crash course ### Top header -Let's start with creating a new Dashboard. You can find the new Dashboard link at the bottom of the Dashboard picker. You now have a blank Dashboard. +Let's start with creating a new Dashboard. You can find the new Dashboard link on the right side of the Dashboard picker. You now have a blank Dashboard. - + The image above shows you the top header for a Dashboard. @@ -41,19 +41,7 @@ The image above shows you the top header for a Dashboard. Dashboards are at the core of what Grafana is all about. Dashboards are composed of individual Panels arranged on a number of Rows. Grafana ships with a variety of Panels. Grafana makes it easy to construct the right queries, and customize the display properties so that you can create the perfect Dashboard for your need. Each Panel can interact with data from any configured Grafana Data Source (currently InfluxDB, Graphite, OpenTSDB, Prometheus and Cloudwatch). The [Basic Concepts](/guides/basic_concepts) guide explores these key ideas in detail. - -## Adding & Editing Graphs and Panels - -![](/img/docs/v45/metrics_tab.png) - -1. You add panels via row menu. The row menu is the green icon to the left of each row. -2. To edit the graph you click on the graph title to open the panel menu, then `Edit`. -3. This should take you to the `Metrics` tab. In this tab you should see the editor for your default data source. - -When you click the `Metrics` tab, you are presented with a Query Editor that is specific to the Panel Data Source. Use the Query Editor to build your queries and Grafana will visualize them in real time. - - - + 1. Zoom out time range 2. Time picker dropdown. Here you can access relative time range options, auto refresh options and set custom absolute time ranges. @@ -62,6 +50,17 @@ When you click the `Metrics` tab, you are presented with a Query Editor that is 5. Dashboard panel. You edit panels by clicking the panel title. 6. Graph legend. You can change series colors, y-axis and series visibility directly from the legend. + +## Adding & Editing Graphs and Panels + +![](/img/docs/v45/metrics_tab.png) + +1. You add panels via row menu. The row menu is the icon to the left of each row. +2. To edit the graph you click on the graph title to open the panel menu, then `Edit`. +3. This should take you to the `Metrics` tab. In this tab you should see the editor for your default data source. + +When you click the `Metrics` tab, you are presented with a Query Editor that is specific to the Panel Data Source. Use the Query Editor to build your queries and Grafana will visualize them in real time. + ## Drag-and-Drop panels You can Drag-and-Drop Panels within and between Rows. Click and hold the Panel title, and drag it to its new location. You can also easily resize panels by clicking the (-) and (+) icons. diff --git a/docs/sources/guides/whats-new-in-v4-5.md b/docs/sources/guides/whats-new-in-v4-5.md index 7e12b6f14b2..abce3fc4095 100644 --- a/docs/sources/guides/whats-new-in-v4-5.md +++ b/docs/sources/guides/whats-new-in-v4-5.md @@ -31,6 +31,11 @@ There is also integrated function docs right from the query editor! Create column styles that turn cells into links that use the value in the cell (or other other row values) to generate a url to another dashboard or system: ![](/img/docs/v45/table_links.jpg) +### Query Inspector +Query Inspector is a new feature that shows query requests and responses. This can be helpful if a graph is not shown or shows something very different than what you expected. +More information [here](https://community.grafana.com/t/using-grafanas-query-inspector-to-troubleshoot-issues/2630). +![](/img/docs/v45/query_inspector.png) + ## Changelog ### New Features diff --git a/docs/sources/installation/troubleshooting.md b/docs/sources/installation/troubleshooting.md index a5a74c007aa..fac96abc622 100644 --- a/docs/sources/installation/troubleshooting.md +++ b/docs/sources/installation/troubleshooting.md @@ -17,7 +17,12 @@ The most common problems are related to the query & response from you data sourc like a bug or visualization issue in Grafana it is 99% of time a problem with the data source query or the data source response. -So make sure to check the query sent and the raw response, learn how in this guide: [How to troubleshoot metric query issues](https://community.grafana.com/t/how-to-troubleshoot-metric-query-issues/50) +To check this you should use Query Inspector. Query Inspector shows query requests and responses. +![](/img/docs/v45/query_inspector.png) + +A guide on how to use it you can find [here](https://community.grafana.com/t/using-grafanas-query-inspector-to-troubleshoot-issues/2630). + + ## Logging From 8ec33574a1f28d25f3ca29945fa02cf8b047eddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 7 Sep 2017 16:44:41 +0200 Subject: [PATCH 07/35] docs: added v4.4 to docs archive --- docs/sources/archive.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/sources/archive.md b/docs/sources/archive.md index 68cd6f9c321..1d656880286 100644 --- a/docs/sources/archive.md +++ b/docs/sources/archive.md @@ -13,6 +13,7 @@ Here you can find links to older versions of the documentation that might be bet of Grafana. - [Latest](http://docs.grafana.org) +- [Version 4.4](http://docs.grafana.org/v4.4) - [Version 4.3](http://docs.grafana.org/v4.3) - [Version 4.2](http://docs.grafana.org/v4.2) - [Version 4.1](http://docs.grafana.org/v4.1) From 93be16b106e6340aca1fd6e136694f817d2c0d83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 7 Sep 2017 16:55:36 +0200 Subject: [PATCH 08/35] docs: minor docs update --- docs/sources/installation/troubleshooting.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/sources/installation/troubleshooting.md b/docs/sources/installation/troubleshooting.md index fac96abc622..12104c6e826 100644 --- a/docs/sources/installation/troubleshooting.md +++ b/docs/sources/installation/troubleshooting.md @@ -11,18 +11,18 @@ weight = 8 # Troubleshooting -## visualization & query issues +## Visualization & Query issues + +{{< imgbox max-width="40%" img="/img/docs/v45/query_inspector.png" caption="Query Inspector" >}} The most common problems are related to the query & response from you data source. Even if it looks like a bug or visualization issue in Grafana it is 99% of time a problem with the data source query or the data source response. -To check this you should use Query Inspector. Query Inspector shows query requests and responses. -![](/img/docs/v45/query_inspector.png) +To check this you should use Query Inspector (new in Grafana v4.5). The query Inspector shows query requests and responses. -A guide on how to use it you can find [here](https://community.grafana.com/t/using-grafanas-query-inspector-to-troubleshoot-issues/2630). - - +For more on the query insector read [this guide here](https://community.grafana.com/t/using-grafanas-query-inspector-to-troubleshoot-issues/2630). For +older versions of Grafana read the [how troubleshoot metric query issue](https://community.grafana.com/t/how-to-troubleshoot-metric-query-issues/50/2) article. ## Logging From ce0de35a6c00942ba0ab23489f674d136270d54b Mon Sep 17 00:00:00 2001 From: Mitsuhiro Tanda Date: Fri, 8 Sep 2017 01:04:32 +0900 Subject: [PATCH 09/35] set give focus in code editor --- public/app/core/components/code_editor/code_editor.ts | 3 +++ .../plugins/datasource/prometheus/partials/query.editor.html | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/public/app/core/components/code_editor/code_editor.ts b/public/app/core/components/code_editor/code_editor.ts index 151ebffab5d..826d62eaade 100644 --- a/public/app/core/components/code_editor/code_editor.ts +++ b/public/app/core/components/code_editor/code_editor.ts @@ -110,6 +110,9 @@ function link(scope, elem, attrs) { elem.addClass("gf-code-editor"); let textarea = elem.find("textarea"); textarea.addClass('gf-form-input'); + if (attrs.giveFocus) { + textarea.attr('give-focus', attrs.giveFocus); + } // Event handlers editorSession.on('change', (e) => { diff --git a/public/app/plugins/datasource/prometheus/partials/query.editor.html b/public/app/plugins/datasource/prometheus/partials/query.editor.html index 5140c9e7bbd..9b2aa533743 100644 --- a/public/app/plugins/datasource/prometheus/partials/query.editor.html +++ b/public/app/plugins/datasource/prometheus/partials/query.editor.html @@ -2,7 +2,7 @@
+ get-completer="ctrl.getCompleter()" data-mode="prometheus" give-focus="ctrl.target.refId == 'A'">
From d971eddc7a316fb109705bd9bdf0ad869f9498b9 Mon Sep 17 00:00:00 2001 From: Mitsuhiro Tanda Date: Fri, 8 Sep 2017 11:49:10 +0900 Subject: [PATCH 10/35] copy from give-focus --- public/app/core/components/code_editor/code_editor.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/public/app/core/components/code_editor/code_editor.ts b/public/app/core/components/code_editor/code_editor.ts index 826d62eaade..ec10b7a477b 100644 --- a/public/app/core/components/code_editor/code_editor.ts +++ b/public/app/core/components/code_editor/code_editor.ts @@ -111,7 +111,14 @@ function link(scope, elem, attrs) { let textarea = elem.find("textarea"); textarea.addClass('gf-form-input'); if (attrs.giveFocus) { - textarea.attr('give-focus', attrs.giveFocus); + setTimeout(function () { + textarea.focus(); + var domEl = textarea[0]; + if (domEl.setSelectionRange) { + var pos = textarea.val().length * 2; + domEl.setSelectionRange(pos, pos); + } + }, 200); } // Event handlers From 7c566a6539720e46626bb61df57662b60cd433da Mon Sep 17 00:00:00 2001 From: Mitsuhiro Tanda Date: Fri, 8 Sep 2017 12:33:36 +0900 Subject: [PATCH 11/35] fix to focus first query --- public/app/core/components/code_editor/code_editor.ts | 3 ++- .../plugins/datasource/prometheus/partials/query.editor.html | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/public/app/core/components/code_editor/code_editor.ts b/public/app/core/components/code_editor/code_editor.ts index ec10b7a477b..0ceb21d0335 100644 --- a/public/app/core/components/code_editor/code_editor.ts +++ b/public/app/core/components/code_editor/code_editor.ts @@ -110,7 +110,7 @@ function link(scope, elem, attrs) { elem.addClass("gf-code-editor"); let textarea = elem.find("textarea"); textarea.addClass('gf-form-input'); - if (attrs.giveFocus) { + if (scope.focus) { setTimeout(function () { textarea.focus(); var domEl = textarea[0]; @@ -209,6 +209,7 @@ export function codeEditorDirective() { template: editorTemplate, scope: { content: "=", + focus: "=", onChange: "&", getCompleter: "&" }, diff --git a/public/app/plugins/datasource/prometheus/partials/query.editor.html b/public/app/plugins/datasource/prometheus/partials/query.editor.html index 9b2aa533743..d35f9f9c14c 100644 --- a/public/app/plugins/datasource/prometheus/partials/query.editor.html +++ b/public/app/plugins/datasource/prometheus/partials/query.editor.html @@ -2,7 +2,7 @@
+ get-completer="ctrl.getCompleter()" data-mode="prometheus" focus="ctrl.target.refId == 'A'">
From e13575eaef6ee677d9cb6dbf92a1cf8da5a3b911 Mon Sep 17 00:00:00 2001 From: Mitsuhiro Tanda Date: Fri, 8 Sep 2017 16:04:15 +0900 Subject: [PATCH 12/35] add AWS/NATGateway metrics (#9202) --- pkg/api/cloudwatch/metrics.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/api/cloudwatch/metrics.go b/pkg/api/cloudwatch/metrics.go index e63798c0d8f..4f3841d4ee4 100644 --- a/pkg/api/cloudwatch/metrics.go +++ b/pkg/api/cloudwatch/metrics.go @@ -78,6 +78,7 @@ func init() { "AWS/Lambda": {"Invocations", "Errors", "Duration", "Throttles", "IteratorAge"}, "AWS/Logs": {"IncomingBytes", "IncomingLogEvents", "ForwardedBytes", "ForwardedLogEvents", "DeliveryErrors", "DeliveryThrottling"}, "AWS/ML": {"PredictCount", "PredictFailureCount"}, + "AWS/NATGateway": {"PacketsOutToDestination", "PacketsOutToSource", "PacketsInFromSource", "PacketsInFromDestination", "BytesOutToDestination", "BytesOutToSource", "BytesInFromSource", "BytesInFromDestination", "ErrorPortAllocation", "ActiveConnectionCount", "ConnectionAttemptCount", "ConnectionEstablishedCount", "IdleTimeoutCount", "PacketsDropCount"}, "AWS/OpsWorks": {"cpu_idle", "cpu_nice", "cpu_system", "cpu_user", "cpu_waitio", "load_1", "load_5", "load_15", "memory_buffers", "memory_cached", "memory_free", "memory_swap", "memory_total", "memory_used", "procs"}, "AWS/Redshift": {"CPUUtilization", "DatabaseConnections", "HealthStatus", "MaintenanceMode", "NetworkReceiveThroughput", "NetworkTransmitThroughput", "PercentageDiskSpaceUsed", "ReadIOPS", "ReadLatency", "ReadThroughput", "WriteIOPS", "WriteLatency", "WriteThroughput"}, "AWS/RDS": {"ActiveTransactions", "AuroraBinlogReplicaLag", "AuroraReplicaLag", "AuroraReplicaLagMaximum", "AuroraReplicaLagMinimum", "BinLogDiskUsage", "BlockedTransactions", "BufferCacheHitRatio", "CommitLatency", "CommitThroughput", "BinLogDiskUsage", "CPUCreditBalance", "CPUCreditUsage", "CPUUtilization", "DatabaseConnections", "DDLLatency", "DDLThroughput", "Deadlocks", "DeleteLatency", "DeleteThroughput", "DiskQueueDepth", "DMLLatency", "DMLThroughput", "EngineUptime", "FailedSqlStatements", "FreeableMemory", "FreeLocalStorage", "FreeStorageSpace", "InsertLatency", "InsertThroughput", "LoginFailures", "NetworkReceiveThroughput", "NetworkTransmitThroughput", "NetworkThroughput", "Queries", "ReadIOPS", "ReadLatency", "ReadThroughput", "ReplicaLag", "ResultSetCacheHitRatio", "SelectLatency", "SelectThroughput", "SwapUsage", "TotalConnections", "UpdateLatency", "UpdateThroughput", "VolumeBytesUsed", "VolumeReadIOPS", "VolumeWriteIOPS", "WriteIOPS", "WriteLatency", "WriteThroughput"}, @@ -122,6 +123,7 @@ func init() { "AWS/Lambda": {"FunctionName", "Resource", "Version", "Alias"}, "AWS/Logs": {"LogGroupName", "DestinationType", "FilterName"}, "AWS/ML": {"MLModelId", "RequestMode"}, + "AWS/NATGateway": {"NatGatewayId"}, "AWS/OpsWorks": {"StackId", "LayerId", "InstanceId"}, "AWS/Redshift": {"NodeID", "ClusterIdentifier"}, "AWS/RDS": {"DBInstanceIdentifier", "DBClusterIdentifier", "DatabaseClass", "EngineName", "Role"}, From b1506a2b09caf27562cf1d49d40d3204263fba13 Mon Sep 17 00:00:00 2001 From: Daniel Lee Date: Fri, 8 Sep 2017 10:19:04 +0200 Subject: [PATCH 13/35] securejson: decrypt should not modify src When decrypting a source securejson byte array, should not modify the source and now passes back a new dest byte array. --- pkg/util/encryption.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/util/encryption.go b/pkg/util/encryption.go index 2f8b5d7af56..d41665bafd6 100644 --- a/pkg/util/encryption.go +++ b/pkg/util/encryption.go @@ -27,12 +27,13 @@ func Decrypt(payload []byte, secret string) ([]byte, error) { } iv := payload[saltLength : saltLength+aes.BlockSize] payload = payload[saltLength+aes.BlockSize:] + payloadDst := make([]byte, len(payload)) stream := cipher.NewCFBDecrypter(block, iv) // XORKeyStream can work in-place if the two arguments are the same. - stream.XORKeyStream(payload, payload) - return payload, nil + stream.XORKeyStream(payloadDst, payload) + return payloadDst, nil } func Encrypt(payload []byte, secret string) ([]byte, error) { From 1076b75a2137f678309c33ed800a6731395c145d Mon Sep 17 00:00:00 2001 From: Alin Sinpalean Date: Fri, 8 Sep 2017 10:37:57 +0200 Subject: [PATCH 14/35] Fix rounding of intervals (#9197) * Prometheus: Fix actual step computation logic when a min_step is specified and the range is longer than min_step * 11000. * Fix kbn.round_interval for exact intervals. * Remove redundant 1d return, fix a couple of comments. * Be more cautious with values close to 1d not rounding up to 1d. They may, because of the way the calculation uses 2 potentially different current time values. --- public/app/core/utils/kbn.js | 65 ++++++++++++++--------------- public/test/core/utils/kbn_specs.js | 14 +++++++ 2 files changed, 45 insertions(+), 34 deletions(-) diff --git a/public/app/core/utils/kbn.js b/public/app/core/utils/kbn.js index 37888fb10ac..97078071e45 100644 --- a/public/app/core/utils/kbn.js +++ b/public/app/core/utils/kbn.js @@ -17,90 +17,87 @@ function($, _) { kbn.round_interval = function(interval) { switch (true) { // 0.015s - case (interval <= 15): + case (interval < 15): return 10; // 0.01s // 0.035s - case (interval <= 35): + case (interval < 35): return 20; // 0.02s // 0.075s - case (interval <= 75): + case (interval < 75): return 50; // 0.05s // 0.15s - case (interval <= 150): + case (interval < 150): return 100; // 0.1s // 0.35s - case (interval <= 350): + case (interval < 350): return 200; // 0.2s // 0.75s - case (interval <= 750): + case (interval < 750): return 500; // 0.5s // 1.5s - case (interval <= 1500): + case (interval < 1500): return 1000; // 1s // 3.5s - case (interval <= 3500): + case (interval < 3500): return 2000; // 2s // 7.5s - case (interval <= 7500): + case (interval < 7500): return 5000; // 5s // 12.5s - case (interval <= 12500): + case (interval < 12500): return 10000; // 10s // 17.5s - case (interval <= 17500): + case (interval < 17500): return 15000; // 15s // 25s - case (interval <= 25000): + case (interval < 25000): return 20000; // 20s // 45s - case (interval <= 45000): + case (interval < 45000): return 30000; // 30s // 1.5m - case (interval <= 90000): + case (interval < 90000): return 60000; // 1m // 3.5m - case (interval <= 210000): + case (interval < 210000): return 120000; // 2m // 7.5m - case (interval <= 450000): + case (interval < 450000): return 300000; // 5m // 12.5m - case (interval <= 750000): + case (interval < 750000): return 600000; // 10m // 12.5m - case (interval <= 1050000): + case (interval < 1050000): return 900000; // 15m // 25m - case (interval <= 1500000): + case (interval < 1500000): return 1200000; // 20m // 45m - case (interval <= 2700000): + case (interval < 2700000): return 1800000; // 30m // 1.5h - case (interval <= 5400000): + case (interval < 5400000): return 3600000; // 1h // 2.5h - case (interval <= 9000000): + case (interval < 9000000): return 7200000; // 2h // 4.5h - case (interval <= 16200000): + case (interval < 16200000): return 10800000; // 3h // 9h - case (interval <= 32400000): + case (interval < 32400000): return 21600000; // 6h - // 24h - case (interval <= 86400000): + // 1d + case (interval < 86400000): return 43200000; // 12h - // 48h - case (interval <= 172800000): - return 86400000; // 24h // 1w - case (interval <= 604800000): - return 86400000; // 24h + case (interval < 604800000): + return 86400000; // 1d // 3w - case (interval <= 1814400000): + case (interval < 1814400000): return 604800000; // 1w - // 2y + // 6w case (interval < 3628800000): return 2592000000; // 30d default: @@ -134,7 +131,7 @@ function($, _) { return nummilliseconds + 'ms'; } - return 'less then a millisecond'; //'just now' //or other string you like; + return 'less than a millisecond'; //'just now' //or other string you like; }; kbn.to_percent = function(number,outof) { diff --git a/public/test/core/utils/kbn_specs.js b/public/test/core/utils/kbn_specs.js index 0b7f4b4f2bc..0e92255792b 100644 --- a/public/test/core/utils/kbn_specs.js +++ b/public/test/core/utils/kbn_specs.js @@ -167,6 +167,20 @@ define([ var res = kbn.calculateInterval(range, 900, '>15ms'); expect(res.interval).to.be('15ms'); }); + + it('1d 1 resolution', function() { + var range = { from: dateMath.parse('now-1d'), to: dateMath.parse('now') }; + var res = kbn.calculateInterval(range, 1, null); + expect(res.interval).to.be('1d'); + expect(res.intervalMs).to.be(86400000); + }); + + it('86399s 1 resolution', function() { + var range = { from: dateMath.parse('now-86390s'), to: dateMath.parse('now') }; + var res = kbn.calculateInterval(range, 1, null); + expect(res.interval).to.be('12h'); + expect(res.intervalMs).to.be(43200000); + }); }); describe('hex', function() { From 2953d64429fa20fa4dd36195543629ea85b3c78e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 8 Sep 2017 11:43:29 +0200 Subject: [PATCH 15/35] prometheus: minor update to focus editor PR, #9201 --- public/app/core/components/code_editor/code_editor.ts | 7 ++++--- public/app/features/panel/query_ctrl.ts | 2 ++ .../datasource/prometheus/partials/query.editor.html | 2 +- public/sass/components/_code_editor.scss | 4 ++++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/public/app/core/components/code_editor/code_editor.ts b/public/app/core/components/code_editor/code_editor.ts index 0ceb21d0335..7c41eb3b3a2 100644 --- a/public/app/core/components/code_editor/code_editor.ts +++ b/public/app/core/components/code_editor/code_editor.ts @@ -110,7 +110,8 @@ function link(scope, elem, attrs) { elem.addClass("gf-code-editor"); let textarea = elem.find("textarea"); textarea.addClass('gf-form-input'); - if (scope.focus) { + + if (scope.codeEditorFocus) { setTimeout(function () { textarea.focus(); var domEl = textarea[0]; @@ -118,7 +119,7 @@ function link(scope, elem, attrs) { var pos = textarea.val().length * 2; domEl.setSelectionRange(pos, pos); } - }, 200); + }, 100); } // Event handlers @@ -209,7 +210,7 @@ export function codeEditorDirective() { template: editorTemplate, scope: { content: "=", - focus: "=", + codeEditorFocus: "<", onChange: "&", getCompleter: "&" }, diff --git a/public/app/features/panel/query_ctrl.ts b/public/app/features/panel/query_ctrl.ts index 67f4f93d16c..148322360bc 100644 --- a/public/app/features/panel/query_ctrl.ts +++ b/public/app/features/panel/query_ctrl.ts @@ -10,9 +10,11 @@ export class QueryCtrl { panel: any; hasRawMode: boolean; error: string; + isLastQuery: boolean; constructor(public $scope, private $injector) { this.panel = this.panelCtrl.panel; + this.isLastQuery = _.indexOf(this.panel.targets, this.target) === (this.panel.targets.length - 1); } refresh() { diff --git a/public/app/plugins/datasource/prometheus/partials/query.editor.html b/public/app/plugins/datasource/prometheus/partials/query.editor.html index d35f9f9c14c..a34a752bd95 100644 --- a/public/app/plugins/datasource/prometheus/partials/query.editor.html +++ b/public/app/plugins/datasource/prometheus/partials/query.editor.html @@ -2,7 +2,7 @@
+ get-completer="ctrl.getCompleter()" data-mode="prometheus" code-editor-focus="ctrl.isLastQuery">
diff --git a/public/sass/components/_code_editor.scss b/public/sass/components/_code_editor.scss index 0f03e686546..4a13d4aa811 100644 --- a/public/sass/components/_code_editor.scss +++ b/public/sass/components/_code_editor.scss @@ -77,3 +77,7 @@ $doc-font-size: $font-size-sm; .ace_tooltip { border-radius: 3px; } + +.ace_hidden-cursors .ace_cursor { + opacity: 0 !important; +} From 75c4c4d8b503815de13eb6772e304d6e24bf6eb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 8 Sep 2017 13:52:28 +0200 Subject: [PATCH 16/35] fix: query ctrl unit tests now pass as before --- .../plugins/datasource/graphite/specs/query_ctrl_specs.ts | 5 +++++ .../plugins/datasource/influxdb/specs/query_ctrl_specs.ts | 8 ++++++-- .../plugins/datasource/opentsdb/specs/query-ctrl-specs.ts | 6 +++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts b/public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts index e88fbc044c1..ff1ea9449ee 100644 --- a/public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts +++ b/public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts @@ -24,6 +24,11 @@ describe('GraphiteQueryCtrl', function() { ctx.target = {target: 'aliasByNode(scaleToSeconds(test.prod.*,1),2)'}; ctx.datasource.metricFindQuery = sinon.stub().returns(ctx.$q.when([])); ctx.panelCtrl = {panel: {}}; + ctx.panelCtrl = { + panel: { + targets: [ctx.target] + } + }; ctx.panelCtrl.refresh = sinon.spy(); ctx.ctrl = $controller(GraphiteQueryCtrl, {$scope: ctx.scope}, { diff --git a/public/app/plugins/datasource/influxdb/specs/query_ctrl_specs.ts b/public/app/plugins/datasource/influxdb/specs/query_ctrl_specs.ts index 44b593edc0e..ec433249097 100644 --- a/public/app/plugins/datasource/influxdb/specs/query_ctrl_specs.ts +++ b/public/app/plugins/datasource/influxdb/specs/query_ctrl_specs.ts @@ -19,9 +19,13 @@ describe('InfluxDBQueryCtrl', function() { ctx.$q = $q; ctx.scope = $rootScope.$new(); ctx.datasource.metricFindQuery = sinon.stub().returns(ctx.$q.when([])); - ctx.panelCtrl = {panel: {}}; - ctx.panelCtrl.refresh = sinon.spy(); ctx.target = {target: {}}; + ctx.panelCtrl = { + panel: { + targets: [ctx.target] + } + }; + ctx.panelCtrl.refresh = sinon.spy(); ctx.ctrl = $controller(InfluxQueryCtrl, {$scope: ctx.scope}, { panelCtrl: ctx.panelCtrl, target: ctx.target, diff --git a/public/app/plugins/datasource/opentsdb/specs/query-ctrl-specs.ts b/public/app/plugins/datasource/opentsdb/specs/query-ctrl-specs.ts index 644af1e7bf7..0d3a44858f4 100644 --- a/public/app/plugins/datasource/opentsdb/specs/query-ctrl-specs.ts +++ b/public/app/plugins/datasource/opentsdb/specs/query-ctrl-specs.ts @@ -18,7 +18,11 @@ describe('OpenTsQueryCtrl', function() { ctx.$q = $q; ctx.scope = $rootScope.$new(); ctx.target = {target: ''}; - ctx.panelCtrl = {panel: {}}; + ctx.panelCtrl = { + panel: { + targets: [ctx.target] + } + }; ctx.panelCtrl.refresh = sinon.spy(); ctx.datasource.getAggregators = sinon.stub().returns(ctx.$q.when([])); ctx.datasource.getFilterTypes = sinon.stub().returns(ctx.$q.when([])); From 293daf2ca104904862ae1cdf7599ad2ea32b5bf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 11 Sep 2017 10:45:00 +0200 Subject: [PATCH 17/35] fix: removed text option from text panel edit options, was by mistake not removed from settings dropdown, fixes #9204 --- public/app/plugins/panel/text/editor.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/plugins/panel/text/editor.html b/public/app/plugins/panel/text/editor.html index 21704949834..8e1283a39ba 100644 --- a/public/app/plugins/panel/text/editor.html +++ b/public/app/plugins/panel/text/editor.html @@ -3,7 +3,7 @@
Mode - +
From b1580bf3857ccbad09d83adb6b05c0e2f8d5d398 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Mon, 11 Sep 2017 16:49:15 +0300 Subject: [PATCH 18/35] ace: fix braces highlight in prometheus (#9212) --- public/app/core/components/code_editor/mode-prometheus.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/app/core/components/code_editor/mode-prometheus.js b/public/app/core/components/code_editor/mode-prometheus.js index 4843b952253..182b4d65ed9 100644 --- a/public/app/core/components/code_editor/mode-prometheus.js +++ b/public/app/core/components/code_editor/mode-prometheus.js @@ -68,17 +68,17 @@ var PrometheusHighlightRules = function() { token : "label.name", regex : '[a-zA-Z_][a-zA-Z0-9_]*' }, { - token : "label.matching_operator", + token : "keyword.operator", regex : '=|!=|=~|!~' }, { - token : "label.value", + token : "text", regex : '"[^"]*"|\'[^\']*\'' }, { - token : "label.matching_delimiter", + token : "punctuation.operator", regex : ",", push : 'start-label-matcher' }, { - token : "label.matching_end", + token : "paren.rparen", regex : "}", next : "start" } ] From e5f84484eb1210d835c06f4f60229abc3b05d9a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 11 Sep 2017 16:36:53 +0200 Subject: [PATCH 19/35] prometheus: another prometheus syntax highlight fix, #9212, #9167 --- public/app/core/components/code_editor/mode-prometheus.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/app/core/components/code_editor/mode-prometheus.js b/public/app/core/components/code_editor/mode-prometheus.js index 182b4d65ed9..78edbbd30d1 100644 --- a/public/app/core/components/code_editor/mode-prometheus.js +++ b/public/app/core/components/code_editor/mode-prometheus.js @@ -65,13 +65,13 @@ var PrometheusHighlightRules = function() { regex : "\\s+" } ], "start-label-matcher" : [ { - token : "label.name", + token : "keyword", regex : '[a-zA-Z_][a-zA-Z0-9_]*' }, { token : "keyword.operator", - regex : '=|!=|=~|!~' + regex : '=~|=|!~|!=' }, { - token : "text", + token : "string", regex : '"[^"]*"|\'[^\']*\'' }, { token : "punctuation.operator", From 057b8a6b2de33a96c86366dfba642d94e8cdd2c9 Mon Sep 17 00:00:00 2001 From: bergquist Date: Mon, 11 Sep 2017 20:07:57 +0200 Subject: [PATCH 20/35] improve error message for timeouts closes #9220 --- pkg/services/alerting/conditions/query.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/services/alerting/conditions/query.go b/pkg/services/alerting/conditions/query.go index ae8008deb75..433eb1b597f 100644 --- a/pkg/services/alerting/conditions/query.go +++ b/pkg/services/alerting/conditions/query.go @@ -5,6 +5,8 @@ import ( "strings" "time" + gocontext "context" + "github.com/grafana/grafana/pkg/bus" "github.com/grafana/grafana/pkg/components/null" "github.com/grafana/grafana/pkg/components/simplejson" @@ -112,6 +114,10 @@ func (c *QueryCondition) executeQuery(context *alerting.EvalContext, timeRange * resp, err := c.HandleRequest(context.Ctx, req) if err != nil { + if err == gocontext.DeadlineExceeded { + return nil, fmt.Errorf("Alert execution exceeded the timeout") + } + return nil, fmt.Errorf("tsdb.HandleRequest() error %v", err) } From 6e344f6eea51b6cbc53e5b38ae9dff55816642d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 12 Sep 2017 08:00:45 +0200 Subject: [PATCH 21/35] api: tsdb api orgId fix --- pkg/api/metrics.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/api/metrics.go b/pkg/api/metrics.go index e35e35cdab6..48c8d884329 100644 --- a/pkg/api/metrics.go +++ b/pkg/api/metrics.go @@ -29,7 +29,7 @@ func QueryMetrics(c *middleware.Context, reqDto dtos.MetricRequest) Response { return ApiError(400, "Query missing datasourceId", nil) } - dsQuery := models.GetDataSourceByIdQuery{Id: dsId} + dsQuery := models.GetDataSourceByIdQuery{Id: dsId, OrgId: c.OrgId} if err := bus.Dispatch(&dsQuery); err != nil { return ApiError(500, "failed to fetch data source", err) } From 90602942f5cbe88e9be8728452f4d91a4b0fbed4 Mon Sep 17 00:00:00 2001 From: Patrick O'Carroll Date: Tue, 12 Sep 2017 08:01:44 +0200 Subject: [PATCH 22/35] New alert design (#9214) * ux: updated alert design * fixed bg-color for alerts * more changes to alerts, index fixed --- public/app/core/services/alert_srv.ts | 9 ++++ public/app/features/plugins/ds_edit_ctrl.ts | 2 +- .../features/plugins/partials/ds_edit.html | 12 +++-- public/sass/_variables.dark.scss | 12 +++-- public/sass/_variables.light.scss | 19 +++---- public/sass/base/_type.scss | 8 +-- public/sass/components/_alerts.scss | 52 ++++++++++++------- public/sass/components/_drop.scss | 2 +- public/sass/pages/_dashboard.scss | 2 +- public/views/index.html | 9 ++-- 10 files changed, 77 insertions(+), 50 deletions(-) diff --git a/public/app/core/services/alert_srv.ts b/public/app/core/services/alert_srv.ts index ced6ffc6467..2412f32e29a 100644 --- a/public/app/core/services/alert_srv.ts +++ b/public/app/core/services/alert_srv.ts @@ -33,6 +33,14 @@ export class AlertSrv { appEvents.on('confirm-modal', this.showConfirmModal.bind(this)); } + getIconForSeverity(severity) { + switch (severity) { + case 'success': return 'fa fa-check'; + case 'error': return 'fa fa-exclamation-triangle'; + default: return 'fa fa-exclamation'; + } + } + set(title, text, severity, timeout) { if (_.isObject(text)) { console.log('alert error', text); @@ -45,6 +53,7 @@ export class AlertSrv { title: title || '', text: text || '', severity: severity || 'info', + icon: this.getIconForSeverity(severity) }; var newAlertJson = angular.toJson(newAlert); diff --git a/public/app/features/plugins/ds_edit_ctrl.ts b/public/app/features/plugins/ds_edit_ctrl.ts index b4a3c897e34..5fbb6f12477 100644 --- a/public/app/features/plugins/ds_edit_ctrl.ts +++ b/public/app/features/plugins/ds_edit_ctrl.ts @@ -126,7 +126,7 @@ export class DataSourceEditCtrl { return; } - this.testing = {done: false}; + this.testing = {done: false, status: 'error'}; // make test call in no backend cache context this.backendSrv.withNoBackendCache(() => { diff --git a/public/app/features/plugins/partials/ds_edit.html b/public/app/features/plugins/partials/ds_edit.html index 803198bcca1..9a74d3b85ea 100644 --- a/public/app/features/plugins/partials/ds_edit.html +++ b/public/app/features/plugins/partials/ds_edit.html @@ -59,9 +59,15 @@
Testing....
-
-
{{ctrl.testing.title}}
-
+
+
+ + +
+
+
{{ctrl.testing.title}}
+
+
diff --git a/public/sass/_variables.dark.scss b/public/sass/_variables.dark.scss index c3c673c517d..cea26ba73ed 100644 --- a/public/sass/_variables.dark.scss +++ b/public/sass/_variables.dark.scss @@ -240,12 +240,12 @@ $paginationActiveBackground: $blue; // ------------------------- $state-warning-text: $warn; $state-warning-bg: $brand-warning; +$error-text-color: #E84D4D; +$success-text-color: #12D95A; -$errorText: #E84D4D; -$errorBackground: $btn-danger-bg; - -$successText: #12D95A; -$successBackground: $btn-success-bg; +//$alert-error-bg: linear-gradient(90deg, #d94636, #e55f39); +$alert-error-bg: linear-gradient(90deg, #d44939, #e0603d); +$alert-success-bg: linear-gradient(90deg, #3aa655, #47b274); $infoText: $blue-dark; $infoBackground: $blue-dark; @@ -258,6 +258,8 @@ $popover-border-color: $gray-1; $popover-help-bg: $btn-secondary-bg; $popover-help-color: $text-color; +$popover-error-bg: $btn-danger-bg; + // Tooltips and popovers // ------------------------- $tooltipColor: $popover-help-color; diff --git a/public/sass/_variables.light.scss b/public/sass/_variables.light.scss index 19751887fa5..d90eadf500d 100644 --- a/public/sass/_variables.light.scss +++ b/public/sass/_variables.light.scss @@ -259,29 +259,24 @@ $paginationActiveBackground: $blue; // Form states and alerts // ------------------------- -$state-warning-text: lighten($orange, 10%); -$state-warning-bg: $orange; -$warningBorder: transparent; +$state-warning-text: lighten($orange, 10%); +$state-warning-bg: $orange; +$error-text-color: lighten($red, 10%); +$success-text-color: lighten($green, 10%); -$errorText: lighten($red, 10%); -$errorBackground: $red; -$errorBorder: transparent; - -$successText: lighten($green, 10%); -$successBackground: $green; -$successBorder: transparent; +$alert-error-bg: linear-gradient(90deg, #d44939, #e0603d); +$alert-success-bg: linear-gradient(90deg, #3aa655, #47b274); $infoText: $blue; $infoBackground: $blue-dark; -$infoBorder: transparent; // popover $popover-bg: $gray-5; $popover-color: $text-color; $popover-border-color: $gray-3; - $popover-help-bg: $blue-dark; $popover-help-color: $gray-6; +$popover-error-bg: $btn-danger-bg; // Tooltips and popovers // ------------------------- diff --git a/public/sass/base/_type.scss b/public/sass/base/_type.scss index 7dd6c2f94e7..62c8fc6b3b8 100644 --- a/public/sass/base/_type.scss +++ b/public/sass/base/_type.scss @@ -35,17 +35,17 @@ a.muted:focus { color: darken($text-muted, 10%); } a.text-warning:hover, a.text-warning:focus { color: darken($state-warning-text, 10%); } -.text-error { color: $errorText; } +.text-error { color: $error-text-color; } a.text-error:hover, -a.text-error:focus { color: darken($errorText, 10%); } +a.text-error:focus { color: darken($error-text-color, 10%); } .text-info { color: $infoText; } a.text-info:hover, a.text-info:focus { color: darken($infoText, 10%); } -.text-success { color: $successText; } +.text-success { color: $success-text-color; } a.text-success:hover, -a.text-success:focus { color: darken($successText, 10%); } +a.text-success:focus { color: darken($success-text-color, 10%); } a { cursor: pointer; } a[disabled] { diff --git a/public/sass/components/_alerts.scss b/public/sass/components/_alerts.scss index 859e3b88f8c..79d9afef50d 100644 --- a/public/sass/components/_alerts.scss +++ b/public/sass/components/_alerts.scss @@ -7,30 +7,32 @@ // ------------------------- .alert { - padding: 0.5rem 2rem 0.5rem 1rem; + padding: 1.5rem 2rem 1.5rem 1.5rem; margin-bottom: $line-height-base; - text-shadow: 0 1px 0 rgba(255,255,255,.5); + text-shadow: 0 2px 0 rgba(255,255,255,.5); background-color: $state-warning-bg; position: relative; color: $white; - text-shadow: 0 1px 0 rgba(0,0,0,.5); + text-shadow: 0 1px 0 rgba(0,0,0,.2); border-radius: 2px; + display: flex; + flex-direction: row; } // Alternate styles // ------------------------- .alert-success { - background-color: $successBackground; + background: $alert-success-bg; } .alert-danger, .alert-error { - background-color: $errorBackground; + background: $alert-error-bg; } .alert-info { - background-color: $infoBackground; + background: $infoBackground; } .alert-warning { @@ -39,28 +41,23 @@ .page-alert-list { z-index: 8000; - min-width: 300px; - max-width: 300px; + min-width: 400px; + max-width: 600px; position: fixed; right: 20px; top: 56px; } .alert-close { - position: absolute; - top: -4px; - right: -2px; - width: 16px; - height: 16px; - padding: 0; - background: $white; - border-radius: 50%; + padding: 0 0 0 1rem; border: none; - font-size: 1.1rem; - color: $dark-4; + background: none; + display: flex; + align-items: center; .fa { - position: relative; - top: -2px; + align-self: flex-end; + font-size: 1.5rem; + color: rgba(255,255,255,.75) } } @@ -68,3 +65,18 @@ font-weight: $font-weight-semi-bold; padding-bottom: 2px; } + +.alert-icon { + padding: 0 1rem 0 0; + display: flex; + align-items: center; + justify-content: center; + width: 2.5rem; + .fa { + font-size: 1.5rem; + } +} + +.alert-body { + flex-grow: 1; +} \ No newline at end of file diff --git a/public/sass/components/_drop.scss b/public/sass/components/_drop.scss index ae8ad806351..9e3c884bc68 100644 --- a/public/sass/components/_drop.scss +++ b/public/sass/components/_drop.scss @@ -5,7 +5,7 @@ $useDropShadow: false; $attachmentOffset: 0%; $easing: cubic-bezier(0, 0, 0.265, 1.00); -@include drop-theme("error", $errorBackground, $popover-color); +@include drop-theme("error", $popover-error-bg, $popover-color); @include drop-theme("popover", $popover-bg, $popover-color, $popover-border-color); @include drop-theme("help", $popover-help-bg, $popover-help-color); diff --git a/public/sass/pages/_dashboard.scss b/public/sass/pages/_dashboard.scss index 242f76b41bc..7aacbce4f6b 100644 --- a/public/sass/pages/_dashboard.scss +++ b/public/sass/pages/_dashboard.scss @@ -138,7 +138,7 @@ div.flot-text { &--error { display: block; color: $text-color; - @include panel-corner-color($errorBackground); + @include panel-corner-color($popover-error-bg); .fa:before { content: "\f12a"; } diff --git a/public/views/index.html b/public/views/index.html index b3c504740da..f7ea0d59caf 100644 --- a/public/views/index.html +++ b/public/views/index.html @@ -31,11 +31,14 @@
+
+
+
{{alert.title}}
+
+
-
{{alert.title}}
-
From ee4bbf61a9c78f0fc96426e186dfea0a64f871f8 Mon Sep 17 00:00:00 2001 From: bergquist Date: Tue, 12 Sep 2017 08:15:48 +0200 Subject: [PATCH 23/35] remove node restriction from package.json yarn requires correct node version in package.json and wont install with 4.x. removing since we dont care about it. --- package.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/package.json b/package.json index 5ac5c01d8d9..69877c3fa07 100644 --- a/package.json +++ b/package.json @@ -53,10 +53,6 @@ "systemjs": "0.19.41", "zone.js": "^0.7.2" }, - "engines": { - "node": "4.x", - "npm": "2.14.x" - }, "scripts": { "build": "./node_modules/grunt-cli/bin/grunt", "test": "./node_modules/grunt-cli/bin/grunt test", From f6100dd8eb601c4d40de4baf8567f8f74eaf685c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 12 Sep 2017 09:05:32 +0200 Subject: [PATCH 24/35] ux: success/error alerts refactoring, #9214 --- public/app/core/services/alert_srv.ts | 2 +- public/app/core/services/backend_srv.ts | 10 ++++++++-- public/app/features/dashboard/dashboard_srv.ts | 2 +- public/app/features/plugins/ds_edit_ctrl.ts | 5 +---- .../app/features/plugins/partials/ds_edit.html | 3 +-- .../datasource/cloudwatch/datasource.js | 2 +- .../datasource/elasticsearch/datasource.js | 8 ++++---- .../plugins/datasource/graphite/datasource.ts | 2 +- .../plugins/datasource/influxdb/datasource.ts | 6 +++--- .../app/plugins/datasource/mysql/datasource.ts | 6 +++--- .../plugins/datasource/opentsdb/datasource.js | 2 +- .../datasource/prometheus/datasource.ts | 2 +- public/sass/_variables.dark.scss | 18 ++++++++---------- public/sass/_variables.light.scss | 9 ++++----- public/sass/base/_type.scss | 10 +++++----- public/sass/components/_alerts.scss | 10 +++++----- 16 files changed, 48 insertions(+), 49 deletions(-) diff --git a/public/app/core/services/alert_srv.ts b/public/app/core/services/alert_srv.ts index 2412f32e29a..1786e526285 100644 --- a/public/app/core/services/alert_srv.ts +++ b/public/app/core/services/alert_srv.ts @@ -16,7 +16,7 @@ export class AlertSrv { init() { this.$rootScope.onAppEvent('alert-error', (e, alert) => { - this.set(alert[0], alert[1], 'error', 7000); + this.set(alert[0], alert[1], 'error', 12000); }, this.$rootScope); this.$rootScope.onAppEvent('alert-warning', (e, alert) => { diff --git a/public/app/core/services/backend_srv.ts b/public/app/core/services/backend_srv.ts index b753ae98530..e712fe2790d 100644 --- a/public/app/core/services/backend_srv.ts +++ b/public/app/core/services/backend_srv.ts @@ -64,7 +64,13 @@ export class BackendSrv { } if (data.message) { - this.alertSrv.set("Problem!", data.message, data.severity, 10000); + let description = ""; + let message = data.message; + if (message.length > 80) { + description = message; + message = "Error"; + } + this.alertSrv.set(message, description, data.severity, 10000); } throw data; @@ -97,7 +103,7 @@ export class BackendSrv { return results.data; }, err => { // handle unauthorized - if (err.status === 401 && firstAttempt) { + if (err.status === 401 && this.contextSrv.user.isSignedIn && firstAttempt) { return this.loginPing().then(() => { options.retry = 1; return this.request(options); diff --git a/public/app/features/dashboard/dashboard_srv.ts b/public/app/features/dashboard/dashboard_srv.ts index 9d622f4bbc7..f3350061caa 100644 --- a/public/app/features/dashboard/dashboard_srv.ts +++ b/public/app/features/dashboard/dashboard_srv.ts @@ -83,7 +83,7 @@ export class DashboardSrv { } this.$rootScope.appEvent('dashboard-saved', this.dash); - this.$rootScope.appEvent('alert-success', ['Dashboard saved', 'Saved as ' + clone.title]); + this.$rootScope.appEvent('alert-success', ['Dashboard saved']); } save(clone, options) { diff --git a/public/app/features/plugins/ds_edit_ctrl.ts b/public/app/features/plugins/ds_edit_ctrl.ts index 5fbb6f12477..f8e53b8ec4e 100644 --- a/public/app/features/plugins/ds_edit_ctrl.ts +++ b/public/app/features/plugins/ds_edit_ctrl.ts @@ -133,14 +133,11 @@ export class DataSourceEditCtrl { return datasource.testDatasource().then(result => { this.testing.message = result.message; this.testing.status = result.status; - this.testing.title = result.title; }).catch(err => { if (err.statusText) { - this.testing.message = err.statusText; - this.testing.title = "HTTP Error"; + this.testing.message = 'HTTP Error ' + err.statusText; } else { this.testing.message = err.message; - this.testing.title = "Unknown error"; } }); }).finally(() => { diff --git a/public/app/features/plugins/partials/ds_edit.html b/public/app/features/plugins/partials/ds_edit.html index 9a74d3b85ea..f01ca47153b 100644 --- a/public/app/features/plugins/partials/ds_edit.html +++ b/public/app/features/plugins/partials/ds_edit.html @@ -65,8 +65,7 @@
-
{{ctrl.testing.title}}
-
+
{{ctrl.testing.message}}
diff --git a/public/app/plugins/datasource/cloudwatch/datasource.js b/public/app/plugins/datasource/cloudwatch/datasource.js index 51cac9aa96f..3807464e3d5 100644 --- a/public/app/plugins/datasource/cloudwatch/datasource.js +++ b/public/app/plugins/datasource/cloudwatch/datasource.js @@ -335,7 +335,7 @@ function (angular, _, moment, dateMath, kbn, templatingVariable, CloudWatchAnnot var dimensions = {}; return this.getDimensionValues(region, namespace, metricName, 'ServiceName', dimensions).then(function () { - return { status: 'success', message: 'Data source is working', title: 'Success' }; + return { status: 'success', message: 'Data source is working' }; }); }; diff --git a/public/app/plugins/datasource/elasticsearch/datasource.js b/public/app/plugins/datasource/elasticsearch/datasource.js index 9ea679d5cc5..d6c2568ae47 100644 --- a/public/app/plugins/datasource/elasticsearch/datasource.js +++ b/public/app/plugins/datasource/elasticsearch/datasource.js @@ -175,9 +175,9 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes return this.getFields({type: 'date'}).then(function(dateFields) { var timeField = _.find(dateFields, {text: this.timeField}); if (!timeField) { - return { status: "error", message: "No date field named " + this.timeField + ' found', title: "Error" }; + return { status: "error", message: "No date field named " + this.timeField + ' found' }; } - return { status: "success", message: "Index OK. Time field name OK.", title: "Success" }; + return { status: "success", message: "Index OK. Time field name OK." }; }.bind(this), function(err) { console.log(err); if (err.data && err.data.error) { @@ -185,9 +185,9 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes if (err.data.error.reason) { message = err.data.error.reason; } - return { status: "error", message: message, title: "Error" }; + return { status: "error", message: message }; } else { - return { status: "error", message: err.status, title: "Error" }; + return { status: "error", message: err.status }; } }); }; diff --git a/public/app/plugins/datasource/graphite/datasource.ts b/public/app/plugins/datasource/graphite/datasource.ts index 61d97b38650..fd13f66c7b5 100644 --- a/public/app/plugins/datasource/graphite/datasource.ts +++ b/public/app/plugins/datasource/graphite/datasource.ts @@ -205,7 +205,7 @@ export function GraphiteDatasource(instanceSettings, $q, backendSrv, templateSrv this.testDatasource = function() { return this.metricFindQuery('*').then(function () { - return { status: "success", message: "Data source is working", title: "Success" }; + return { status: "success", message: "Data source is working"}; }); }; diff --git a/public/app/plugins/datasource/influxdb/datasource.ts b/public/app/plugins/datasource/influxdb/datasource.ts index 10f6d47f0b9..ddab664f570 100644 --- a/public/app/plugins/datasource/influxdb/datasource.ts +++ b/public/app/plugins/datasource/influxdb/datasource.ts @@ -196,11 +196,11 @@ export default class InfluxDatasource { return this.metricFindQuery('SHOW DATABASES').then(res => { let found = _.find(res, {text: this.database}); if (!found) { - return { status: "error", message: "Could not find the specified database name.", title: "DB Not found" }; + return { status: "error", message: "Could not find the specified database name." }; } - return { status: "success", message: "Data source is working", title: "Success" }; + return { status: "success", message: "Data source is working" }; }).catch(err => { - return { status: "error", message: err.message, title: "Test Failed" }; + return { status: "error", message: err.message }; }); } diff --git a/public/app/plugins/datasource/mysql/datasource.ts b/public/app/plugins/datasource/mysql/datasource.ts index dfc990b52e4..652c21c1013 100644 --- a/public/app/plugins/datasource/mysql/datasource.ts +++ b/public/app/plugins/datasource/mysql/datasource.ts @@ -118,13 +118,13 @@ export class MysqlDatasource { }], } }).then(res => { - return { status: "success", message: "Database Connection OK", title: "Success" }; + return { status: "success", message: "Database Connection OK"}; }).catch(err => { console.log(err); if (err.data && err.data.message) { - return { status: "error", message: err.data.message, title: "Error" }; + return { status: "error", message: err.data.message }; } else { - return { status: "error", message: err.status, title: "Error" }; + return { status: "error", message: err.status }; } }); } diff --git a/public/app/plugins/datasource/opentsdb/datasource.js b/public/app/plugins/datasource/opentsdb/datasource.js index 3ef11ba75aa..921805a58ca 100644 --- a/public/app/plugins/datasource/opentsdb/datasource.js +++ b/public/app/plugins/datasource/opentsdb/datasource.js @@ -296,7 +296,7 @@ function (angular, _, dateMath) { this.testDatasource = function() { return this._performSuggestQuery('cpu', 'metrics').then(function () { - return { status: "success", message: "Data source is working", title: "Success" }; + return { status: "success", message: "Data source is working" }; }); }; diff --git a/public/app/plugins/datasource/prometheus/datasource.ts b/public/app/plugins/datasource/prometheus/datasource.ts index 4b4bfb4cdde..dd071d09fe6 100644 --- a/public/app/plugins/datasource/prometheus/datasource.ts +++ b/public/app/plugins/datasource/prometheus/datasource.ts @@ -241,7 +241,7 @@ export class PrometheusDatasource { testDatasource() { return this.metricFindQuery('metrics(.*)').then(function() { - return { status: 'success', message: 'Data source is working', title: 'Success' }; + return { status: 'success', message: 'Data source is working'}; }); } diff --git a/public/sass/_variables.dark.scss b/public/sass/_variables.dark.scss index cea26ba73ed..4de87a0aaf0 100644 --- a/public/sass/_variables.dark.scss +++ b/public/sass/_variables.dark.scss @@ -103,7 +103,7 @@ $tight-form-func-bg: #333; $tight-form-func-highlight-bg: #444; $modal-background: $black; -$code-tag-bg: $dark-5; +$code-tag-bg: $gray-1; $code-tag-border: lighten($code-tag-bg, 2%); @@ -238,17 +238,15 @@ $paginationActiveBackground: $blue; // Form states and alerts // ------------------------- -$state-warning-text: $warn; -$state-warning-bg: $brand-warning; -$error-text-color: #E84D4D; -$success-text-color: #12D95A; +$warning-text-color: $warn; +$error-text-color: #E84D4D; +$success-text-color: #12D95A; +$info-text-color: $blue-dark; -//$alert-error-bg: linear-gradient(90deg, #d94636, #e55f39); $alert-error-bg: linear-gradient(90deg, #d44939, #e0603d); $alert-success-bg: linear-gradient(90deg, #3aa655, #47b274); - -$infoText: $blue-dark; -$infoBackground: $blue-dark; +$alert-warning-bg: linear-gradient(90deg, #d44939, #e0603d); +$alert-info-bg: linear-gradient(100deg, #1a4552, #00374a); // popover $popover-bg: $panel-bg; @@ -278,7 +276,7 @@ $card-background-hover: linear-gradient(135deg, #343434, #262626); $card-shadow: -1px -1px 0 0 hsla(0, 0%, 100%, .1), 1px 1px 0 0 rgba(0, 0, 0, .3); // info box -$info-box-background: linear-gradient(100deg, #1a4552, #0b2127); +$info-box-background: linear-gradient(100deg, #1a4552, #00374a); // footer $footer-link-color: $gray-1; diff --git a/public/sass/_variables.light.scss b/public/sass/_variables.light.scss index d90eadf500d..533daec705b 100644 --- a/public/sass/_variables.light.scss +++ b/public/sass/_variables.light.scss @@ -259,16 +259,15 @@ $paginationActiveBackground: $blue; // Form states and alerts // ------------------------- -$state-warning-text: lighten($orange, 10%); -$state-warning-bg: $orange; +$warning-text-color: lighten($orange, 10%); $error-text-color: lighten($red, 10%); $success-text-color: lighten($green, 10%); +$info-text-color: $blue; $alert-error-bg: linear-gradient(90deg, #d44939, #e0603d); $alert-success-bg: linear-gradient(90deg, #3aa655, #47b274); - -$infoText: $blue; -$infoBackground: $blue-dark; +$alert-warning-bg: linear-gradient(90deg, #d44939, #e0603d); +$alert-info-bg: $blue-dark; // popover $popover-bg: $gray-5; diff --git a/public/sass/base/_type.scss b/public/sass/base/_type.scss index 62c8fc6b3b8..4edddd7721f 100644 --- a/public/sass/base/_type.scss +++ b/public/sass/base/_type.scss @@ -31,17 +31,17 @@ cite { font-style: normal; } a.muted:hover, a.muted:focus { color: darken($text-muted, 10%); } -.text-warning { color: $state-warning-text; } +.text-warning { color: $warning-text-color; } a.text-warning:hover, -a.text-warning:focus { color: darken($state-warning-text, 10%); } +a.text-warning:focus { color: darken($warning-text-color, 10%); } .text-error { color: $error-text-color; } a.text-error:hover, a.text-error:focus { color: darken($error-text-color, 10%); } -.text-info { color: $infoText; } +.text-info { color: $info-text-color; } a.text-info:hover, -a.text-info:focus { color: darken($infoText, 10%); } +a.text-info:focus { color: darken($info-text-color, 10%); } .text-success { color: $success-text-color; } a.text-success:hover, @@ -130,7 +130,7 @@ small, mark, .mark { padding: .2em; - background-color: $state-warning-bg; + background: $alert-warning-bg; } diff --git a/public/sass/components/_alerts.scss b/public/sass/components/_alerts.scss index 79d9afef50d..4ea30a45c53 100644 --- a/public/sass/components/_alerts.scss +++ b/public/sass/components/_alerts.scss @@ -7,10 +7,10 @@ // ------------------------- .alert { - padding: 1.5rem 2rem 1.5rem 1.5rem; + padding: 1.25rem 2rem 1.25rem 1.5rem; margin-bottom: $line-height-base; text-shadow: 0 2px 0 rgba(255,255,255,.5); - background-color: $state-warning-bg; + background: $alert-error-bg; position: relative; color: $white; text-shadow: 0 1px 0 rgba(0,0,0,.2); @@ -32,11 +32,11 @@ } .alert-info { - background: $infoBackground; + background: $alert-info-bg; } .alert-warning { - background-color: $state-warning-bg; + background: $alert-warning-bg; } .page-alert-list { @@ -79,4 +79,4 @@ .alert-body { flex-grow: 1; -} \ No newline at end of file +} From a7b0a01b132b1159691c87f5d1806ba8dcd44083 Mon Sep 17 00:00:00 2001 From: Patrick O'Carroll Date: Tue, 12 Sep 2017 09:07:36 +0200 Subject: [PATCH 25/35] replaced old images and gifs with new ones (#9217) --- docs/sources/features/datasources/graphite.md | 12 +++++++++--- docs/sources/features/datasources/influxdb.md | 4 +++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/sources/features/datasources/graphite.md b/docs/sources/features/datasources/graphite.md index a625b93e8d8..5943de2aead 100644 --- a/docs/sources/features/datasources/graphite.md +++ b/docs/sources/features/datasources/graphite.md @@ -41,7 +41,9 @@ Proxy access means that the Grafana backend will proxy all requests from the bro Click the ``Select metric`` link to start navigating the metric space. One you start you can continue using the mouse or keyboard arrow keys. You can select a wildcard and still continue. -![](/img/docs/animated_gifs/graphite_query1.gif) +{{< docs-imagebox img="/img/docs/v45/graphite_query1_still.png" class="docs-image--center" + animated-gif="/img/docs/v45/graphite_query1.gif" >}} + ### Functions @@ -50,13 +52,17 @@ a function is selected it will be added and your focus will be in the text box o a parameter just click on it and it will turn into a text box. To delete a function click the function name followed by the x icon. -![](/img/docs/animated_gifs/graphite_query2.gif) +{{< docs-imagebox img="/img/docs/v45/graphite_query2_still.png" class="docs-image--center" + animated-gif="/img/docs/v45/graphite_query2.gif" >}} + ### Optional parameters Some functions like aliasByNode support an optional second argument. To add this parameter specify for example 3,-2 as the first parameter and the function editor will adapt and move the -2 to a second parameter. To remove the second optional parameter just click on it and leave it blank and the editor will remove it. -![](/img/docs/animated_gifs/func_editor_optional_params.gif) +{{< docs-imagebox img="/img/docs/v45/graphite_query3_still.png" class="docs-image--center" + animated-gif="/img/docs/v45/graphite_query3.gif" >}} + ### Nested Queries diff --git a/docs/sources/features/datasources/influxdb.md b/docs/sources/features/datasources/influxdb.md index 8f4f5981124..904b732bb3a 100644 --- a/docs/sources/features/datasources/influxdb.md +++ b/docs/sources/features/datasources/influxdb.md @@ -41,7 +41,9 @@ mode is also more secure as the username & password will never reach the browser ## Query Editor -![](/assets/img/blog/v2.6/influxdb_editor_v3.gif) +{{< docs-imagebox img="/img/docs/v45/influxdb_query_still.png" class="docs-image--center" + animated-gif="/img/docs/v45/influxdb_query.gif" >}} + You find the InfluxDB editor in the metrics tab in Graph or Singlestat panel's edit mode. You enter edit mode by clicking the panel title, then edit. The editor allows you to select metrics and tags. From 0e18c82d9558af4578895e3cf1bfda45c48a307f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 12 Sep 2017 09:21:17 +0200 Subject: [PATCH 26/35] style: corrected indentation in sass file --- public/sass/components/_alerts.scss | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/public/sass/components/_alerts.scss b/public/sass/components/_alerts.scss index 4ea30a45c53..1766e06e837 100644 --- a/public/sass/components/_alerts.scss +++ b/public/sass/components/_alerts.scss @@ -67,14 +67,14 @@ } .alert-icon { - padding: 0 1rem 0 0; - display: flex; - align-items: center; - justify-content: center; - width: 2.5rem; - .fa { - font-size: 1.5rem; - } + padding: 0 1rem 0 0; + display: flex; + align-items: center; + justify-content: center; + width: 2.5rem; + .fa { + font-size: 1.5rem; + } } .alert-body { From ff4cd1aef6f51022514415bde7b84491d283d8ee Mon Sep 17 00:00:00 2001 From: Daniel Lee Date: Tue, 12 Sep 2017 09:24:40 +0200 Subject: [PATCH 27/35] influxdb: small css fix for order by in query editor --- .../app/plugins/datasource/influxdb/partials/query.editor.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/influxdb/partials/query.editor.html b/public/app/plugins/datasource/influxdb/partials/query.editor.html index 70830d8c2a9..9454a6abde7 100644 --- a/public/app/plugins/datasource/influxdb/partials/query.editor.html +++ b/public/app/plugins/datasource/influxdb/partials/query.editor.html @@ -92,7 +92,7 @@
- +
From 665fef01145d12e1a5734828ff34534d2d8342bb Mon Sep 17 00:00:00 2001 From: Daniel Lee Date: Tue, 12 Sep 2017 10:31:13 +0200 Subject: [PATCH 28/35] docs: kiosk mode options add to playlist doc --- docs/sources/reference/playlist.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/sources/reference/playlist.md b/docs/sources/reference/playlist.md index e2d59bc322d..3ecad5be310 100644 --- a/docs/sources/reference/playlist.md +++ b/docs/sources/reference/playlist.md @@ -43,3 +43,25 @@ Playlists can also be manually controlled utilizing the Playlist controls at the Click the stop button to stop the Playlist, and exit to the current Dashboard. Click the next button to advance to the next Dashboard in the Playlist. Click the back button to rewind to the previous Dashboard in the Playlist. + +## TV or Kiosk Mode + +In TV mode the top navbar, row & panel controls will all fade to transparent. + +This happens automatically after one minute of user inactivity but can also be toggled manually +with the `d v` sequence shortcut. Any mouse movement or keyboard action will +restore navbar & controls. + +Another feature is the kiosk mode - in kiosk mode the navbar is completely hidden/removed from view. This can be enabled with the `d k` +shortcut. + +To put a playlist into kiosk mode, use the `d k` shortcut after the playlist has started. The same shortcut will toggle the playlist out of kiosk mode. + +### Linking to the Playlist in Kiosk Mode + +If you want to create a link to the playlist with kiosk mode enabled: + +1. Copy the Start Url (by right clicking on the Play button and choosing Copy link address). +2. Add the `?kiosk` parameter to the url. + +For example, to open the first playlist on the Grafana Play site in kiosk mode: [http://play.grafana.org/playlists/play/1?kiosk](http://play.grafana.org/playlists/play/1?kiosk) From e16cadaa276cb621ccbe6349e8ac93991e50864e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 12 Sep 2017 10:31:53 +0200 Subject: [PATCH 29/35] docs: minor update --- docs/sources/features/panels/graph.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/docs/sources/features/panels/graph.md b/docs/sources/features/panels/graph.md index 5dbf307b484..726a11bec3a 100644 --- a/docs/sources/features/panels/graph.md +++ b/docs/sources/features/panels/graph.md @@ -50,15 +50,11 @@ populate the template variable to a desired value from the link. The metrics tab defines what series data and sources to render. Each datasource provides different options. -## Axes & Grid +## Axes ![](/img/docs/v43/graph_axes_grid_options.png) -The Axes & Grid tab controls the display of axes, grids and legend. - -### Axes - -The ``Left Y`` and ``Right Y`` can be customized using: +The Axes tab controls the display of axes, grids and legend. The ``Left Y`` and ``Right Y`` can be customized using: - ``Unit`` - The display unit for the Y value - ``Grid Max`` - The maximum Y value. (default auto) From 3c162301580d60d18f902d9b60c8ce41927eb000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 12 Sep 2017 11:05:32 +0200 Subject: [PATCH 30/35] prometheus: added completer unit test, #9208 --- .../prometheus/specs/completer_specs.ts | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 public/app/plugins/datasource/prometheus/specs/completer_specs.ts diff --git a/public/app/plugins/datasource/prometheus/specs/completer_specs.ts b/public/app/plugins/datasource/prometheus/specs/completer_specs.ts new file mode 100644 index 00000000000..903ce0b5d3b --- /dev/null +++ b/public/app/plugins/datasource/prometheus/specs/completer_specs.ts @@ -0,0 +1,27 @@ +import {describe, beforeEach, it, sinon, expect} from 'test/lib/common'; + +import {PromCompleter} from '../completer'; +import {PrometheusDatasource} from '../datasource'; + +describe('Prometheus editor completer', function() { + + let editor = {}; + let session = { + getTokenAt: sinon.stub().returns({}), + getLine: sinon.stub().returns(""), + }; + + let datasourceStub = {}; + let completer = new PromCompleter(datasourceStub); + + describe("When inside brackets", () => { + + it("Should return range vectors", () => { + completer.getCompletions(editor, session, 10, "[", (s, res) => { + expect(res[0]).to.eql({caption: '1s', value: '[1s', meta: 'range vector'}); + }); + }); + + }); + +}); From 379f984293b7aa9fae3985a54e98321b9fdf730e Mon Sep 17 00:00:00 2001 From: Daniel Lee Date: Tue, 12 Sep 2017 11:07:20 +0200 Subject: [PATCH 31/35] docs: windows - add note about ini comments --- docs/sources/installation/windows.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sources/installation/windows.md b/docs/sources/installation/windows.md index 97d17a2ca8e..112838d530a 100644 --- a/docs/sources/installation/windows.md +++ b/docs/sources/installation/windows.md @@ -27,7 +27,7 @@ this folder to anywhere you want Grafana to run from. Go into the The default Grafana port is `3000`, this port requires extra permissions on windows. Edit `custom.ini` and uncomment the `http_port` -configuration option and change it to something like `8080` or similar. +configuration option (`;` is the comment character in ini files) and change it to something like `8080` or similar. That port should not require extra Windows privileges. Start Grafana by executing `grafana-server.exe`, preferably from the From 968ba30fa52c5a547cd9809fc201406638490b09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 12 Sep 2017 11:36:30 +0200 Subject: [PATCH 32/35] ux: increased code editor auto complete width from 320px to 550px, fixes #9203 --- public/sass/components/_code_editor.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/sass/components/_code_editor.scss b/public/sass/components/_code_editor.scss index 4a13d4aa811..0ef7e7a11c2 100644 --- a/public/sass/components/_code_editor.scss +++ b/public/sass/components/_code_editor.scss @@ -28,7 +28,7 @@ background-color: $dropdownBackground !important; color: $dropdownLinkColor !important; border: 1px solid $dropdownBorder !important; - width: 320px !important; + width: 550px !important; .ace_scroller { .ace_selected, .ace_active-line, .ace_line-hover { From b349b3ef5574a797d69cb28d9023aa1e98ba0b8b Mon Sep 17 00:00:00 2001 From: Mitsuhiro Tanda Date: Wed, 13 Sep 2017 16:29:53 +0900 Subject: [PATCH 33/35] provide ace editor for external datasource plugin (#9224) --- .../app/core/components/code_editor/code_editor.ts | 13 +++++++++---- .../datasource/prometheus}/mode-prometheus.js | 0 .../prometheus/partials/query.editor.html | 2 +- .../datasource/prometheus}/snippets/prometheus.js | 0 4 files changed, 10 insertions(+), 5 deletions(-) rename public/app/{core/components/code_editor => plugins/datasource/prometheus}/mode-prometheus.js (100%) rename public/app/{core/components/code_editor => plugins/datasource/prometheus}/snippets/prometheus.js (100%) diff --git a/public/app/core/components/code_editor/code_editor.ts b/public/app/core/components/code_editor/code_editor.ts index 7c41eb3b3a2..61ebb17d9b3 100644 --- a/public/app/core/components/code_editor/code_editor.ts +++ b/public/app/core/components/code_editor/code_editor.ts @@ -40,11 +40,11 @@ const DEFAULT_MAX_LINES = 10; const DEFAULT_TAB_SIZE = 2; const DEFAULT_BEHAVIOURS = true; -const GRAFANA_MODULES = ['mode-prometheus', 'snippets-prometheus', 'theme-grafana-dark']; +const GRAFANA_MODULES = ['theme-grafana-dark']; const GRAFANA_MODULE_BASE = "public/app/core/components/code_editor/"; // Trick for loading additional modules -function setModuleUrl(moduleType, name) { +function setModuleUrl(moduleType, name, pluginBaseUrl = null) { let baseUrl = ACE_SRC_BASE; let aceModeName = `ace/${moduleType}/${name}`; let moduleName = `${moduleType}-${name}`; @@ -54,6 +54,10 @@ function setModuleUrl(moduleType, name) { baseUrl = GRAFANA_MODULE_BASE; } + if (pluginBaseUrl) { + baseUrl = pluginBaseUrl + '/'; + } + if (moduleType === 'snippets') { componentName = `${moduleType}/${name}.js`; } @@ -159,8 +163,8 @@ function link(scope, elem, attrs) { function setLangMode(lang) { let aceModeName = `ace/mode/${lang}`; - setModuleUrl("mode", lang); - setModuleUrl("snippets", lang); + setModuleUrl("mode", lang, scope.datasource.meta.baseUrl || null); + setModuleUrl("snippets", lang, scope.datasource.meta.baseUrl || null); editorSession.setMode(aceModeName); ace.config.loadModule("ace/ext/language_tools", (language_tools) => { @@ -210,6 +214,7 @@ export function codeEditorDirective() { template: editorTemplate, scope: { content: "=", + datasource: "=", codeEditorFocus: "<", onChange: "&", getCompleter: "&" diff --git a/public/app/core/components/code_editor/mode-prometheus.js b/public/app/plugins/datasource/prometheus/mode-prometheus.js similarity index 100% rename from public/app/core/components/code_editor/mode-prometheus.js rename to public/app/plugins/datasource/prometheus/mode-prometheus.js diff --git a/public/app/plugins/datasource/prometheus/partials/query.editor.html b/public/app/plugins/datasource/prometheus/partials/query.editor.html index a34a752bd95..9b06d4116f4 100644 --- a/public/app/plugins/datasource/prometheus/partials/query.editor.html +++ b/public/app/plugins/datasource/prometheus/partials/query.editor.html @@ -1,7 +1,7 @@
-
diff --git a/public/app/core/components/code_editor/snippets/prometheus.js b/public/app/plugins/datasource/prometheus/snippets/prometheus.js similarity index 100% rename from public/app/core/components/code_editor/snippets/prometheus.js rename to public/app/plugins/datasource/prometheus/snippets/prometheus.js From 73248d6687aad2533c1c155958c7080b8f46be2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 13 Sep 2017 09:48:50 +0200 Subject: [PATCH 34/35] fixes for metrics tab when data source was not found --- public/app/features/panel/metrics_tab.ts | 17 ++++++++++------- .../features/panel/partials/metrics_tab.html | 6 +++--- public/sass/components/_alerts.scss | 4 ++-- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/public/app/features/panel/metrics_tab.ts b/public/app/features/panel/metrics_tab.ts index 4feaf516438..53d53cdbbff 100644 --- a/public/app/features/panel/metrics_tab.ts +++ b/public/app/features/panel/metrics_tab.ts @@ -9,7 +9,7 @@ export class MetricsTabCtrl { panel: any; panelCtrl: any; datasources: any[]; - current: any; + datasourceInstance: any; nextRefId: string; dashboard: DashboardModel; panelDsValue: any; @@ -29,23 +29,26 @@ export class MetricsTabCtrl { this.panel = this.panelCtrl.panel; this.dashboard = this.panelCtrl.dashboard; this.datasources = datasourceSrv.getMetricSources(); - this.panelDsValue = this.panelCtrl.panel.datasource || null; + this.panelDsValue = this.panelCtrl.panel.datasource; for (let ds of this.datasources) { if (ds.value === this.panelDsValue) { - this.current = ds; + this.datasourceInstance = ds; } } this.addQueryDropdown = {text: 'Add Query', value: null, fake: true}; + // update next ref id this.panelCtrl.nextRefId = this.dashboard.getNextQueryLetter(this.panel); this.updateDatasourceOptions(); } updateDatasourceOptions() { - this.hasQueryHelp = this.current.meta.hasQueryHelp; - this.queryOptions = this.current.meta.queryOptions; + if (this.datasourceInstance) { + this.hasQueryHelp = this.datasourceInstance.meta.hasQueryHelp; + this.queryOptions = this.datasourceInstance.meta.queryOptions; + } } getOptions(includeBuiltin) { @@ -61,7 +64,7 @@ export class MetricsTabCtrl { return; } - this.current = option.datasource; + this.datasourceInstance = option.datasource; this.panelCtrl.setDatasource(option.datasource); this.updateDatasourceOptions(); } @@ -85,7 +88,7 @@ export class MetricsTabCtrl { this.queryTroubleshooterOpen = false; this.helpOpen = !this.helpOpen; - this.backendSrv.get(`/api/plugins/${this.current.meta.id}/markdown/query_help`).then(res => { + this.backendSrv.get(`/api/plugins/${this.datasourceInstance.meta.id}/markdown/query_help`).then(res => { var md = new Remarkable(); this.helpHtml = this.$sce.trustAsHtml(md.render(res)); }); diff --git a/public/app/features/panel/partials/metrics_tab.html b/public/app/features/panel/partials/metrics_tab.html index c3643152716..03a2c374a14 100644 --- a/public/app/features/panel/partials/metrics_tab.html +++ b/public/app/features/panel/partials/metrics_tab.html @@ -73,7 +73,7 @@
-
+
@@ -89,11 +89,11 @@ {{ctrl.panelCtrl.nextRefId}} - -