From 7f8576ee37a2392e840bccc726e7bd6706c4fbdc Mon Sep 17 00:00:00 2001 From: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com> Date: Thu, 19 Aug 2021 07:43:41 -0400 Subject: [PATCH] Postgres: For template queries return [] and not error (#38060) * Postgres: For template queries return [] and not error * remove the console error * update mssql and mysql Co-authored-by: Ying WANG --- CONTRIBUTING.md | 2 ++ docs/README.md | 7 ++++--- docs/sources/administration/security.md | 2 +- docs/sources/troubleshooting/diagnostics.md | 2 +- public/app/plugins/datasource/mssql/datasource.ts | 3 +++ public/app/plugins/datasource/mysql/datasource.ts | 3 +++ public/app/plugins/datasource/postgres/datasource.ts | 7 +++++-- 7 files changed, 19 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d6e8ec71223..fa22f27da04 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -26,10 +26,12 @@ Report a bug by submitting a [bug report](https://github.com/grafana/grafana/iss Follow the issue template and add additional information that will help us replicate the problem. For data visualization issues: + - Query results from the inspect drawer (data tab & query inspector) - Panel settings can be extracted in the panel inspect drawer JSON tab For a dashboard related issues: + - Dashboard JSON can be found in the dashboard settings JSON model view For authentication and alerting Grafana server logs are useful. diff --git a/docs/README.md b/docs/README.md index 2fbc3b3e5f5..793a0eceea2 100644 --- a/docs/README.md +++ b/docs/README.md @@ -25,6 +25,7 @@ Edit content in the `sources` directory. Use the Hugo shortcode [relref](https://gohugo.io/content-management/cross-references/#use-ref-and-relref) any time you are linking to other internal docs pages. Syntax is: + ``` {{< relref "example.md" >}} ``` @@ -33,7 +34,7 @@ You might need to add more context for the link (containing folders and so on, ` ### Managing redirects -When moving content around or removing pages it's important that users following old links are properly redirected to the new location. We do this using the [aliases](https://gohugo.io/content-management/urls/#aliases) feature in Hugo. +When moving content around or removing pages it's important that users following old links are properly redirected to the new location. We do this using the [aliases](https://gohugo.io/content-management/urls/#aliases) feature in Hugo. If you are moving a page, add an `aliases` entry in the front matter referencing the old location of the page which will redirect the old url to the new location. @@ -57,7 +58,7 @@ Images are currently hosted in the grafana/website repo. When a PR is merged with changes in the `docs/sources` directory, those changes are automatically synced by a GitHub action (`.github/workflows/publish.yml`) to the grafana/website repo. -* A PR that targets the `main` branch syncs to the `content/docs/grafana/next` directory in the `website` repository, and publishes to `https://grafana.com/docs/grafana/next/`. -* A PR targeting the `latest/current` release branch syncs to the `content/docs/grafana/latest` directory in the `website` repository, and publishes to `https://grafana.com/docs/grafana/latest/`. +- A PR that targets the `main` branch syncs to the `content/docs/grafana/next` directory in the `website` repository, and publishes to `https://grafana.com/docs/grafana/next/`. +- A PR targeting the `latest/current` release branch syncs to the `content/docs/grafana/latest` directory in the `website` repository, and publishes to `https://grafana.com/docs/grafana/latest/`. Once the sync is complete, the website will automatically publish to production - no further action is needed. diff --git a/docs/sources/administration/security.md b/docs/sources/administration/security.md index fb55b64ebc3..a3db8176d5f 100644 --- a/docs/sources/administration/security.md +++ b/docs/sources/administration/security.md @@ -20,7 +20,7 @@ You can configure Grafana to only allow certain IP addresses or hostnames to be The request security configuration option allows users to limit requests from the Grafana server. It targets requests that are generated by users. For more information, refer to [Request security]({{< relref "../enterprise/request-security.md" >}}) in [Grafana Enterprise]({{< relref "../enterprise" >}}). -> **Note:** Request security is available in Grafana Enterprise v7.4 and later versions. +> **Note:** Request security is available in Grafana Enterprise v7.4 and later versions. ## Firewall rules diff --git a/docs/sources/troubleshooting/diagnostics.md b/docs/sources/troubleshooting/diagnostics.md index 1471a217e4c..65cac5ab1c7 100644 --- a/docs/sources/troubleshooting/diagnostics.md +++ b/docs/sources/troubleshooting/diagnostics.md @@ -53,4 +53,4 @@ go tool trace 2019/11/24 22:20:42 Opening browser. Trace viewer is listening on http://127.0.0.1:39735 ``` -For more information about how to analyze trace files, refer to [Go command trace](https://golang.org/cmd/trace/). \ No newline at end of file +For more information about how to analyze trace files, refer to [Go command trace](https://golang.org/cmd/trace/). diff --git a/public/app/plugins/datasource/mssql/datasource.ts b/public/app/plugins/datasource/mssql/datasource.ts index 1587ffd0d4d..7dad40d0cd9 100644 --- a/public/app/plugins/datasource/mssql/datasource.ts +++ b/public/app/plugins/datasource/mssql/datasource.ts @@ -147,6 +147,9 @@ export class MssqlDatasource extends DataSourceWithBackend { return this.responseParser.transformMetricFindResponse(rsp); + }), + catchError((err) => { + return of([]); }) ) ); diff --git a/public/app/plugins/datasource/mysql/datasource.ts b/public/app/plugins/datasource/mysql/datasource.ts index ede1de31de7..8a176e2ebbe 100644 --- a/public/app/plugins/datasource/mysql/datasource.ts +++ b/public/app/plugins/datasource/mysql/datasource.ts @@ -157,6 +157,9 @@ export class MysqlDatasource extends DataSourceWithBackend { return this.responseParser.transformMetricFindResponse(rsp); + }), + catchError((err) => { + return of([]); }) ) ); diff --git a/public/app/plugins/datasource/postgres/datasource.ts b/public/app/plugins/datasource/postgres/datasource.ts index c0aa4fac0b8..7b3339aae32 100644 --- a/public/app/plugins/datasource/postgres/datasource.ts +++ b/public/app/plugins/datasource/postgres/datasource.ts @@ -1,6 +1,6 @@ import { map as _map } from 'lodash'; -import { lastValueFrom } from 'rxjs'; -import { map } from 'rxjs/operators'; +import { lastValueFrom, of } from 'rxjs'; +import { map, catchError } from 'rxjs/operators'; import { BackendDataSourceResponse, DataSourceWithBackend, FetchResponse, getBackendSrv } from '@grafana/runtime'; import { AnnotationEvent, DataSourceInstanceSettings, MetricFindValue, ScopedVars } from '@grafana/data'; @@ -159,6 +159,9 @@ export class PostgresDatasource extends DataSourceWithBackend { return this.responseParser.transformMetricFindResponse(rsp); + }), + catchError((err) => { + return of([]); }) ) );