Docs: updated packages reference docs for 7.1.0-beta1. (#25958)

This commit is contained in:
Marcus Andersson
2020-07-01 09:12:35 +02:00
committed by GitHub
parent e93640878d
commit 83df83fa42
97 changed files with 1369 additions and 206 deletions
+2 -2
View File
@@ -23,7 +23,7 @@ A library containing services, configurations etc. used to interact with the Gra
| Enumeration | Description |
| --- | --- |
| [EchoEventType](./echoeventtype/) | Supported echo event types that can be sent via the [EchoSrv](./runtime/echosrv.md)<!-- -->. |
| [HealthStatus](./healthstatus/) | Describes the current healt status of a data source plugin. |
| [HealthStatus](./healthstatus/) | Describes the current health status of a data source plugin. |
| [MetaAnalyticsEventName](./metaanalyticseventname/) | The meta analytics events that can be added to the echo service. |
## Functions
@@ -35,7 +35,7 @@ A library containing services, configurations etc. used to interact with the Gra
| [getEchoSrv()](./getechosrv/) | Used to retrieve the [EchoSrv](./runtime/echosrv.md) that can be used to report events to registered echo backends. |
| [getLocationSrv()](./getlocationsrv/) | Used to retrieve the [LocationSrv](./runtime/locationsrv.md) that can be used to automatically navigate the user to a new place in Grafana. |
| [loadPluginCss(options)](./loadplugincss/) | Use this to load css for a Grafana plugin by specifying a [PluginCssOptions](./runtime/plugincssoptions.md) containing styling for the dark and the light theme. |
| [toDataQueryError(err)](./todataqueryerror/) | Convert an object into a DataQueryError -- if this is an HTTP response, it will put the correct values in the error filds |
| [toDataQueryError(err)](./todataqueryerror/) | Convert an object into a DataQueryError -- if this is an HTTP response, it will put the correct values in the error field |
| [toDataQueryResponse(res)](./todataqueryresponse/) | Parse the results from \`<!-- -->/api/ds/query |
## Interfaces
@@ -33,13 +33,13 @@ import { DataSourceSrv } from '@grafana/runtime';
<b>Signature</b>
```typescript
get(name?: string, scopedVars?: ScopedVars): Promise<DataSourceApi>;
get(name?: string | null, scopedVars?: ScopedVars): Promise<DataSourceApi>;
```
<b>Parameters</b>
| Parameter | Type | Description |
| --- | --- | --- |
| name | <code>string</code> | name of the datasource plugin you want to use. |
| name | <code>string &#124; null</code> | name of the datasource plugin you want to use. |
| scopedVars | <code>ScopedVars</code> | variables used to interpolate a templated passed as name. |
<b>Returns:</b>
@@ -31,10 +31,12 @@ import { DataSourceWithBackend } from '@grafana/runtime';
| Method | Modifiers | Description |
| --- | --- | --- |
| [applyTemplateVariables(query)](#applytemplatevariables-method) | | Override to apply template variables |
| [applyTemplateVariables(query, scopedVars)](#applytemplatevariables-method) | | Override to apply template variables. The result is usually also <code>TQuery</code>, but sometimes this can be used to modify the query structure before sending to the backend.<!-- -->NOTE: if you do modify the structure or use template variables, alerting queries may not work as expected |
| [callHealthCheck()](#callhealthcheck-method) | | Run the datasource healthcheck |
| [filterQuery(query)](#filterquery-method) | | Override to skip executing a query |
| [getResource(path, params)](#getresource-method) | | Make a GET request to the datasource resource path |
| [postResource(path, body)](#postresource-method) | | Send a POST request to the datasource resource path |
| [processResponse(res)](#processresponse-method) | | Optionally augment the response before returning the results to the |
| [query(request)](#query-method) | | Ideally final -- any other implementation may not work as expected |
| [testDatasource()](#testdatasource-method) | | Checks the plugin health |
@@ -55,23 +57,26 @@ constructor(instanceSettings: DataSourceInstanceSettings<TOptions>);
### applyTemplateVariables method
Override to apply template variables
Override to apply template variables. The result is usually also `TQuery`<!-- -->, but sometimes this can be used to modify the query structure before sending to the backend.
NOTE: if you do modify the structure or use template variables, alerting queries may not work as expected
<b>Signature</b>
```typescript
/** @virtual */
applyTemplateVariables(query: DataQuery): DataQuery;
applyTemplateVariables(query: TQuery, scopedVars: ScopedVars): Record<string, any>;
```
<b>Parameters</b>
| Parameter | Type | Description |
| --- | --- | --- |
| query | <code>DataQuery</code> | |
| query | <code>TQuery</code> | |
| scopedVars | <code>ScopedVars</code> | |
<b>Returns:</b>
`DataQuery`
`Record<string, any>`
### callHealthCheck method
@@ -86,6 +91,26 @@ callHealthCheck(): Promise<HealthCheckResult>;
`Promise<HealthCheckResult>`
### filterQuery method
Override to skip executing a query
<b>Signature</b>
```typescript
/** @virtual */
filterQuery?(query: TQuery): boolean;
```
<b>Parameters</b>
| Parameter | Type | Description |
| --- | --- | --- |
| query | <code>TQuery</code> | |
<b>Returns:</b>
`boolean`
### getResource method
Make a GET request to the datasource resource path
@@ -126,6 +151,25 @@ postResource(path: string, body?: any): Promise<any>;
`Promise<any>`
### processResponse method
Optionally augment the response before returning the results to the
<b>Signature</b>
```typescript
processResponse?(res: DataQueryResponse): Promise<DataQueryResponse>;
```
<b>Parameters</b>
| Parameter | Type | Description |
| --- | --- | --- |
| res | <code>DataQueryResponse</code> | |
<b>Returns:</b>
`Promise<DataQueryResponse>`
### query method
Ideally final -- any other implementation may not work as expected
@@ -133,13 +177,13 @@ Ideally final -- any other implementation may not work as expected
<b>Signature</b>
```typescript
query(request: DataQueryRequest): Observable<DataQueryResponse>;
query(request: DataQueryRequest<TQuery>): Observable<DataQueryResponse>;
```
<b>Parameters</b>
| Parameter | Type | Description |
| --- | --- | --- |
| request | <code>DataQueryRequest</code> | |
| request | <code>DataQueryRequest&lt;TQuery&gt;</code> | |
<b>Returns:</b>
@@ -35,6 +35,7 @@ import { GrafanaBootConfig } from '@grafana/runtime';
| [alertingNoDataOrNullValues](#alertingnodataornullvalues-property) | | <code>string</code> | |
| [allowOrgCreate](#alloworgcreate-property) | | <code>boolean</code> | |
| [appSubUrl](#appsuburl-property) | | <code>string</code> | |
| [appUrl](#appurl-property) | | <code>string</code> | |
| [authProxyEnabled](#authproxyenabled-property) | | <code>boolean</code> | |
| [autoAssignOrg](#autoassignorg-property) | | <code>boolean</code> | |
| [bootData](#bootdata-property) | | <code>any</code> | |
@@ -131,6 +132,14 @@ allowOrgCreate: boolean;
appSubUrl: string;
```
### appUrl property
<b>Signature</b>
```typescript
appUrl: string;
```
### authProxyEnabled property
<b>Signature</b>
@@ -11,7 +11,7 @@ type = "docs"
### HealthStatus enum
Describes the current healt status of a data source plugin.
Describes the current health status of a data source plugin.
<b>Signature</b>
@@ -16,7 +16,7 @@ Used to register echo backends that will receive Grafana echo events during appl
<b>Signature</b>
```typescript
registerEchoBackend: (backend: EchoBackend<any, any>) => void
registerEchoBackend: (backend: EchoBackend) => void
```
<b>Import</b>
@@ -11,7 +11,7 @@ type = "docs"
### toDataQueryError() function
Convert an object into a DataQueryError -- if this is an HTTP response, it will put the correct values in the error filds
Convert an object into a DataQueryError -- if this is an HTTP response, it will put the correct values in the error field
<b>Signature</b>