mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 03:02:31 +08:00

* fixes so we match the transformer based on name properly. * changed the signature on the FieldMatcher. * introduced a names option so you can filter in name specificly. * changed so the matcher UI uses the new options format. * moved the exported functions together. * changing editors a bit. * made the filter by name work with both regex and name filtering. * fixed failing tests and make sure we always parse regex the same way. * removed unused code. * simplified to make the existing field overrides still working. * fixed issue reported by hugo. * added tests for the name matcher. * added tests for filter by name. * added more tests. * generated new version of the packages docs. * fixed spelling error. * regenerated the docs.
161 lines
3.8 KiB
Markdown
161 lines
3.8 KiB
Markdown
+++
|
|
# -----------------------------------------------------------------------
|
|
# Do not edit this file. It is automatically generated by API Documenter.
|
|
# -----------------------------------------------------------------------
|
|
title = "DataSourceWithBackend"
|
|
keywords = ["grafana","documentation","sdk","@grafana/runtime"]
|
|
type = "docs"
|
|
+++
|
|
|
|
## DataSourceWithBackend class
|
|
|
|
Extend this class to implement a data source plugin that is depending on the Grafana backend API.
|
|
|
|
<b>Signature</b>
|
|
|
|
```typescript
|
|
export declare class DataSourceWithBackend<TQuery extends DataQuery = DataQuery, TOptions extends DataSourceJsonData = DataSourceJsonData> extends DataSourceApi<TQuery, TOptions>
|
|
```
|
|
<b>Import</b>
|
|
|
|
```typescript
|
|
import { DataSourceWithBackend } from '@grafana/runtime';
|
|
```
|
|
<b>Constructors</b>
|
|
|
|
| Constructor | Modifiers | Description |
|
|
| --- | --- | --- |
|
|
| [constructor(instanceSettings)](#constructor-instancesettings) | | Constructs a new instance of the <code>DataSourceWithBackend</code> class |
|
|
|
|
<b>Methods</b>
|
|
|
|
| Method | Modifiers | Description |
|
|
| --- | --- | --- |
|
|
| [applyTemplateVariables(query)](#applytemplatevariables-method) | | Override to apply template variables |
|
|
| [callHealthCheck()](#callhealthcheck-method) | | Run the datasource healthcheck |
|
|
| [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 |
|
|
| [query(request)](#query-method) | | Ideally final -- any other implementation may not work as expected |
|
|
| [testDatasource()](#testdatasource-method) | | Checks the plugin health |
|
|
|
|
### constructor(instanceSettings)
|
|
|
|
Constructs a new instance of the `DataSourceWithBackend` class
|
|
|
|
<b>Signature</b>
|
|
|
|
```typescript
|
|
constructor(instanceSettings: DataSourceInstanceSettings<TOptions>);
|
|
```
|
|
<b>Parameters</b>
|
|
|
|
| Parameter | Type | Description |
|
|
| --- | --- | --- |
|
|
| instanceSettings | <code>DataSourceInstanceSettings<TOptions></code> | |
|
|
|
|
### applyTemplateVariables method
|
|
|
|
Override to apply template variables
|
|
|
|
<b>Signature</b>
|
|
|
|
```typescript
|
|
/** @virtual */
|
|
applyTemplateVariables(query: DataQuery): DataQuery;
|
|
```
|
|
<b>Parameters</b>
|
|
|
|
| Parameter | Type | Description |
|
|
| --- | --- | --- |
|
|
| query | <code>DataQuery</code> | |
|
|
|
|
<b>Returns:</b>
|
|
|
|
`DataQuery`
|
|
|
|
### callHealthCheck method
|
|
|
|
Run the datasource healthcheck
|
|
|
|
<b>Signature</b>
|
|
|
|
```typescript
|
|
callHealthCheck(): Promise<HealthCheckResult>;
|
|
```
|
|
<b>Returns:</b>
|
|
|
|
`Promise<HealthCheckResult>`
|
|
|
|
### getResource method
|
|
|
|
Make a GET request to the datasource resource path
|
|
|
|
<b>Signature</b>
|
|
|
|
```typescript
|
|
getResource(path: string, params?: any): Promise<any>;
|
|
```
|
|
<b>Parameters</b>
|
|
|
|
| Parameter | Type | Description |
|
|
| --- | --- | --- |
|
|
| path | <code>string</code> | |
|
|
| params | <code>any</code> | |
|
|
|
|
<b>Returns:</b>
|
|
|
|
`Promise<any>`
|
|
|
|
### postResource method
|
|
|
|
Send a POST request to the datasource resource path
|
|
|
|
<b>Signature</b>
|
|
|
|
```typescript
|
|
postResource(path: string, body?: any): Promise<any>;
|
|
```
|
|
<b>Parameters</b>
|
|
|
|
| Parameter | Type | Description |
|
|
| --- | --- | --- |
|
|
| path | <code>string</code> | |
|
|
| body | <code>any</code> | |
|
|
|
|
<b>Returns:</b>
|
|
|
|
`Promise<any>`
|
|
|
|
### query method
|
|
|
|
Ideally final -- any other implementation may not work as expected
|
|
|
|
<b>Signature</b>
|
|
|
|
```typescript
|
|
query(request: DataQueryRequest): Observable<DataQueryResponse>;
|
|
```
|
|
<b>Parameters</b>
|
|
|
|
| Parameter | Type | Description |
|
|
| --- | --- | --- |
|
|
| request | <code>DataQueryRequest</code> | |
|
|
|
|
<b>Returns:</b>
|
|
|
|
`Observable<DataQueryResponse>`
|
|
|
|
### testDatasource method
|
|
|
|
Checks the plugin health
|
|
|
|
<b>Signature</b>
|
|
|
|
```typescript
|
|
testDatasource(): Promise<any>;
|
|
```
|
|
<b>Returns:</b>
|
|
|
|
`Promise<any>`
|
|
|