Deprecate browser access mode for the Graphite data source. (#38783)

* Deprecate browser access mode for Graphite

* Update docs

* Update copy
This commit is contained in:
Piotr Jamróz 2021-09-02 10:16:17 +02:00 committed by GitHub
parent ae702caec6
commit f941390631
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 26 deletions

View File

@ -18,32 +18,21 @@ Refer to [Add a data source]({{< relref "add-a-data-source.md" >}}) for instruct
To access Graphite settings, hover your mouse over the **Configuration** (gear) icon, then click **Data Sources**, and then click the Graphite data source. To access Graphite settings, hover your mouse over the **Configuration** (gear) icon, then click **Data Sources**, and then click the Graphite data source.
| Name | Description | | Name | Description |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | | --------------------- | ------------------------------------------------------------------------------------- |
| `Name` | The data source name. This is how you refer to the data source in panels and queries. | | `Name` | The data source name. This is how you refer to the data source in panels and queries. |
| `Default` | Default data source means that it will be pre-selected for new panels. | | `Default` | Default data source means that it will be pre-selected for new panels. |
| `URL` | The HTTP protocol, IP, and port of your graphite-web or graphite-api install. | | `URL` | The HTTP protocol, IP, and port of your graphite-web or graphite-api install. |
| `Access` | Server (default) = URL needs to be accessible from the Grafana backend/server, Browser = URL needs to be accessible from the browser. | | `Auth` | Refer to [Authentication]({{< relref "../auth/_index.md" >}}) for more information. |
| `Auth` | Refer to [Authentication]({{< relref "../auth/_index.md" >}}) for more information. | | `Basic Auth` | Enable basic authentication to the data source. |
| `Basic Auth` | Enable basic authentication to the data source. | | `User` | User name for basic authentication. |
| `User` | User name for basic authentication. | | `Password` | Password for basic authentication. |
| `Password` | Password for basic authentication. | | `Custom HTTP Headers` | Click **Add header** to add a custom HTTP header. |
| `Custom HTTP Headers` | Click **Add header** to add a custom HTTP header. | | `Header` | Enter the custom header name. |
| `Header` | Enter the custom header name. | | `Value` | Enter the custom header value. |
| `Value` | Enter the custom header value. |
| `Graphite details` | | `Graphite details` |
| `Version` | Select your version of Graphite. | | `Version` | Select your version of Graphite. |
| `Type` | Select your type of Graphite. | | `Type` | Select your type of Graphite. |
Access mode controls how requests to the data source will be handled. Server should be the preferred way if nothing else is stated.
### Server access mode (default)
All requests will be made from the browser to Grafana backend/server which in turn will forward the requests to the data source and by that circumvent possible Cross-Origin Resource Sharing (CORS) requirements. The URL needs to be accessible from the Grafana backend/server if you select this access mode.
### Browser access mode
All requests will be made from the browser directly to the data source and may be subject to Cross-Origin Resource Sharing (CORS) requirements. The URL needs to be accessible from the browser if you select this access mode.
## Graphite query editor ## Graphite query editor

View File

@ -1,5 +1,5 @@
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { DataSourceHttpSettings, InlineFormLabel, LegacyForms } from '@grafana/ui'; import { Alert, DataSourceHttpSettings, InlineFormLabel, LegacyForms } from '@grafana/ui';
const { Select, Switch } = LegacyForms; const { Select, Switch } = LegacyForms;
import { import {
DataSourcePluginOptionsEditorProps, DataSourcePluginOptionsEditorProps,
@ -61,6 +61,12 @@ export class ConfigEditor extends PureComponent<Props, State> {
return ( return (
<> <>
{options.access === 'direct' && (
<Alert title="Deprecation Notice" severity="warning">
This data source uses browser access mode. This mode is deprecated and will be removed in the future. Please
use server access mode instead.
</Alert>
)}
<DataSourceHttpSettings <DataSourceHttpSettings
defaultUrl="http://localhost:8080" defaultUrl="http://localhost:8080"
dataSourceConfig={options} dataSourceConfig={options}