@grafana/plugin-ui 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -0
- package/dist/8x/fixtures/index.js +7 -0
- package/dist/8x/fixtures/index.js.map +1 -0
- package/dist/8x/fixtures/select.js +43 -0
- package/dist/8x/fixtures/select.js.map +1 -0
- package/dist/8x/index.js +5 -0
- package/dist/8x/index.js.map +1 -0
- package/dist/components/AsyncButtonCascader/AsyncButtonCascader.js +34 -0
- package/dist/components/AsyncButtonCascader/AsyncButtonCascader.js.map +1 -0
- package/dist/components/Cascader/Cascader.js +6 -0
- package/dist/components/Cascader/Cascader.js.map +1 -0
- package/dist/components/DataLinks/DataLink.js +79 -0
- package/dist/components/DataLinks/DataLink.js.map +1 -0
- package/dist/components/DataLinks/DataLinks.js +59 -0
- package/dist/components/DataLinks/DataLinks.js.map +1 -0
- package/dist/components/DataLinks/index.js +7 -0
- package/dist/components/DataLinks/index.js.map +1 -0
- package/dist/components/DataLinks/types.js +3 -0
- package/dist/components/DataLinks/types.js.map +1 -0
- package/dist/components/DataSourcePicker/DataSourcePicker.js +90 -0
- package/dist/components/DataSourcePicker/DataSourcePicker.js.map +1 -0
- package/dist/components/DatePicker/DatePicker.js +29 -0
- package/dist/components/DatePicker/DatePicker.js.map +1 -0
- package/dist/components/DatePicker/styles.js +156 -0
- package/dist/components/DatePicker/styles.js.map +1 -0
- package/dist/components/DatePickerWithInput/DatePickerWithInput.js +19 -0
- package/dist/components/DatePickerWithInput/DatePickerWithInput.js.map +1 -0
- package/dist/components/DatePickerWithInput/style.css +6 -0
- package/dist/components/DebounceInput/DebounceInput.js +17 -0
- package/dist/components/DebounceInput/DebounceInput.js.map +1 -0
- package/dist/components/Plugins/PluginSignatureBadge.js +65 -0
- package/dist/components/Plugins/PluginSignatureBadge.js.map +1 -0
- package/dist/components/QueryEditor/AccessoryButton.js +21 -0
- package/dist/components/QueryEditor/AccessoryButton.js.map +1 -0
- package/dist/components/QueryEditor/ConfirmModal.js +28 -0
- package/dist/components/QueryEditor/ConfirmModal.js.map +1 -0
- package/dist/components/QueryEditor/DatasetSelector.js +36 -0
- package/dist/components/QueryEditor/DatasetSelector.js.map +1 -0
- package/dist/components/QueryEditor/EditorField.js +51 -0
- package/dist/components/QueryEditor/EditorField.js.map +1 -0
- package/dist/components/QueryEditor/EditorFieldGroup.js +11 -0
- package/dist/components/QueryEditor/EditorFieldGroup.js.map +1 -0
- package/dist/components/QueryEditor/EditorHeader.js +23 -0
- package/dist/components/QueryEditor/EditorHeader.js.map +1 -0
- package/dist/components/QueryEditor/EditorList.js +28 -0
- package/dist/components/QueryEditor/EditorList.js.map +1 -0
- package/dist/components/QueryEditor/EditorRow.js +24 -0
- package/dist/components/QueryEditor/EditorRow.js.map +1 -0
- package/dist/components/QueryEditor/EditorRows.js +11 -0
- package/dist/components/QueryEditor/EditorRows.js.map +1 -0
- package/dist/components/QueryEditor/EditorSwitch.js +24 -0
- package/dist/components/QueryEditor/EditorSwitch.js.map +1 -0
- package/dist/components/QueryEditor/ErrorBoundary.js +23 -0
- package/dist/components/QueryEditor/ErrorBoundary.js.map +1 -0
- package/dist/components/QueryEditor/FlexItem.js +10 -0
- package/dist/components/QueryEditor/FlexItem.js.map +1 -0
- package/dist/components/QueryEditor/InlineSelect.js +60 -0
- package/dist/components/QueryEditor/InlineSelect.js.map +1 -0
- package/dist/components/QueryEditor/InputGroup.js +46 -0
- package/dist/components/QueryEditor/InputGroup.js.map +1 -0
- package/dist/components/QueryEditor/QueryEditor.js +73 -0
- package/dist/components/QueryEditor/QueryEditor.js.map +1 -0
- package/dist/components/QueryEditor/QueryHeader.js +92 -0
- package/dist/components/QueryEditor/QueryHeader.js.map +1 -0
- package/dist/components/QueryEditor/Space.js +36 -0
- package/dist/components/QueryEditor/Space.js.map +1 -0
- package/dist/components/QueryEditor/Stack.js +27 -0
- package/dist/components/QueryEditor/Stack.js.map +1 -0
- package/dist/components/QueryEditor/TableSelector.js +20 -0
- package/dist/components/QueryEditor/TableSelector.js.map +1 -0
- package/dist/components/QueryEditor/defaults.js +20 -0
- package/dist/components/QueryEditor/defaults.js.map +1 -0
- package/dist/components/QueryEditor/expressions.js +18 -0
- package/dist/components/QueryEditor/expressions.js.map +1 -0
- package/dist/components/QueryEditor/index.js +35 -0
- package/dist/components/QueryEditor/index.js.map +1 -0
- package/dist/components/QueryEditor/query-editor-raw/QueryEditorRaw.js +21 -0
- package/dist/components/QueryEditor/query-editor-raw/QueryEditorRaw.js.map +1 -0
- package/dist/components/QueryEditor/query-editor-raw/QueryToolbox.js +59 -0
- package/dist/components/QueryEditor/query-editor-raw/QueryToolbox.js.map +1 -0
- package/dist/components/QueryEditor/query-editor-raw/QueryValidator.js +79 -0
- package/dist/components/QueryEditor/query-editor-raw/QueryValidator.js.map +1 -0
- package/dist/components/QueryEditor/query-editor-raw/RawEditor.js +60 -0
- package/dist/components/QueryEditor/query-editor-raw/RawEditor.js.map +1 -0
- package/dist/components/QueryEditor/types.js +21 -0
- package/dist/components/QueryEditor/types.js.map +1 -0
- package/dist/components/QueryEditor/utils/formatSQL.js +13 -0
- package/dist/components/QueryEditor/utils/formatSQL.js.map +1 -0
- package/dist/components/QueryEditor/utils/sql.utils.js +94 -0
- package/dist/components/QueryEditor/utils/sql.utils.js.map +1 -0
- package/dist/components/QueryEditor/utils/useSqlChange.js +16 -0
- package/dist/components/QueryEditor/utils/useSqlChange.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/AwesomeQueryBuilder.js +109 -0
- package/dist/components/QueryEditor/visual-query-builder/AwesomeQueryBuilder.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/EditorField.js +51 -0
- package/dist/components/QueryEditor/visual-query-builder/EditorField.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/EditorRow.js +24 -0
- package/dist/components/QueryEditor/visual-query-builder/EditorRow.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/EditorRows.js +11 -0
- package/dist/components/QueryEditor/visual-query-builder/EditorRows.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/GroupByRow.js +33 -0
- package/dist/components/QueryEditor/visual-query-builder/GroupByRow.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/OrderByRow.js +50 -0
- package/dist/components/QueryEditor/visual-query-builder/OrderByRow.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/Preview.js +28 -0
- package/dist/components/QueryEditor/visual-query-builder/Preview.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/SQLGroupByRow.js +13 -0
- package/dist/components/QueryEditor/visual-query-builder/SQLGroupByRow.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/SQLOrderByRow.js +34 -0
- package/dist/components/QueryEditor/visual-query-builder/SQLOrderByRow.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/SQLSelectRow.js +19 -0
- package/dist/components/QueryEditor/visual-query-builder/SQLSelectRow.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/SQLWhereRow.js +35 -0
- package/dist/components/QueryEditor/visual-query-builder/SQLWhereRow.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/SelectRow.js +68 -0
- package/dist/components/QueryEditor/visual-query-builder/SelectRow.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/Stack.js +27 -0
- package/dist/components/QueryEditor/visual-query-builder/Stack.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/VisualEditor.js +38 -0
- package/dist/components/QueryEditor/visual-query-builder/VisualEditor.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/WhereRow.js +67 -0
- package/dist/components/QueryEditor/visual-query-builder/WhereRow.js.map +1 -0
- package/dist/components/QueryEditor/visual-query-builder/index.js +6 -0
- package/dist/components/QueryEditor/visual-query-builder/index.js.map +1 -0
- package/dist/components/QueryEditorRow/QueryEditorRow.js +17 -0
- package/dist/components/QueryEditorRow/QueryEditorRow.js.map +1 -0
- package/dist/components/Segment/Segment.js +18 -0
- package/dist/components/Segment/Segment.js.map +1 -0
- package/dist/components/index.js +25 -0
- package/dist/components/index.js.map +1 -0
- package/dist/datasource/SqlDatasource.js +161 -0
- package/dist/datasource/SqlDatasource.js.map +1 -0
- package/dist/datasource/constants.js +19 -0
- package/dist/datasource/constants.js.map +1 -0
- package/dist/hooks/useDebounce.js +19 -0
- package/dist/hooks/useDebounce.js.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/src/8x/fixtures/index.d.ts +1 -0
- package/dist/src/8x/fixtures/select.d.ts +11 -0
- package/dist/src/8x/index.d.ts +1 -0
- package/dist/src/components/AsyncButtonCascader/AsyncButtonCascader.d.ts +18 -0
- package/dist/src/components/Cascader/Cascader.d.ts +1 -0
- package/dist/src/components/DataLinks/DataLink.d.ts +13 -0
- package/dist/src/components/DataLinks/DataLinks.d.ts +8 -0
- package/dist/src/components/DataLinks/index.d.ts +3 -0
- package/dist/src/components/DataLinks/types.d.ts +7 -0
- package/dist/src/components/DataSourcePicker/DataSourcePicker.d.ts +34 -0
- package/dist/src/components/DatePicker/DatePicker.d.ts +8 -0
- package/dist/src/components/DatePicker/styles.d.ts +11 -0
- package/dist/src/components/DatePickerWithInput/DatePickerWithInput.d.ts +9 -0
- package/dist/src/components/DebounceInput/DebounceInput.d.ts +8 -0
- package/dist/src/components/Plugins/PluginSignatureBadge.d.ts +9 -0
- package/dist/src/components/QueryEditor/AccessoryButton.d.ts +6 -0
- package/dist/src/components/QueryEditor/ConfirmModal.d.ts +9 -0
- package/dist/src/components/QueryEditor/DatasetSelector.d.ts +12 -0
- package/dist/src/components/QueryEditor/EditorField.d.ts +11 -0
- package/dist/src/components/QueryEditor/EditorFieldGroup.d.ts +5 -0
- package/dist/src/components/QueryEditor/EditorHeader.d.ts +5 -0
- package/dist/src/components/QueryEditor/EditorList.d.ts +8 -0
- package/dist/src/components/QueryEditor/EditorRow.d.ts +5 -0
- package/dist/src/components/QueryEditor/EditorRows.d.ts +5 -0
- package/dist/src/components/QueryEditor/EditorSwitch.d.ts +3 -0
- package/dist/src/components/QueryEditor/ErrorBoundary.d.ts +14 -0
- package/dist/src/components/QueryEditor/FlexItem.d.ts +7 -0
- package/dist/src/components/QueryEditor/InlineSelect.d.ts +7 -0
- package/dist/src/components/QueryEditor/InputGroup.d.ts +5 -0
- package/dist/src/components/QueryEditor/QueryEditor.d.ts +7 -0
- package/dist/src/components/QueryEditor/QueryHeader.d.ts +15 -0
- package/dist/src/components/QueryEditor/Space.d.ts +14 -0
- package/dist/src/components/QueryEditor/Stack.d.ts +9 -0
- package/dist/src/components/QueryEditor/TableSelector.d.ts +12 -0
- package/dist/src/components/QueryEditor/defaults.d.ts +3 -0
- package/dist/src/components/QueryEditor/expressions.d.ts +50 -0
- package/dist/src/components/QueryEditor/index.d.ts +16 -0
- package/dist/src/components/QueryEditor/query-editor-raw/QueryEditorRaw.d.ts +15 -0
- package/dist/src/components/QueryEditor/query-editor-raw/QueryToolbox.d.ts +11 -0
- package/dist/src/components/QueryEditor/query-editor-raw/QueryValidator.d.ts +10 -0
- package/dist/src/components/QueryEditor/query-editor-raw/RawEditor.d.ts +10 -0
- package/dist/src/components/QueryEditor/types.d.ts +149 -0
- package/dist/src/components/QueryEditor/utils/formatSQL.d.ts +1 -0
- package/dist/src/components/QueryEditor/utils/sql.utils.d.ts +13 -0
- package/dist/src/components/QueryEditor/utils/useSqlChange.d.ts +10 -0
- package/dist/src/components/QueryEditor/visual-query-builder/AwesomeQueryBuilder.d.ts +7 -0
- package/dist/src/components/QueryEditor/visual-query-builder/EditorField.d.ts +11 -0
- package/dist/src/components/QueryEditor/visual-query-builder/EditorRow.d.ts +5 -0
- package/dist/src/components/QueryEditor/visual-query-builder/EditorRows.d.ts +5 -0
- package/dist/src/components/QueryEditor/visual-query-builder/GroupByRow.d.ts +10 -0
- package/dist/src/components/QueryEditor/visual-query-builder/OrderByRow.d.ts +11 -0
- package/dist/src/components/QueryEditor/visual-query-builder/Preview.d.ts +6 -0
- package/dist/src/components/QueryEditor/visual-query-builder/SQLGroupByRow.d.ts +12 -0
- package/dist/src/components/QueryEditor/visual-query-builder/SQLOrderByRow.d.ts +12 -0
- package/dist/src/components/QueryEditor/visual-query-builder/SQLSelectRow.d.ts +12 -0
- package/dist/src/components/QueryEditor/visual-query-builder/SQLWhereRow.d.ts +12 -0
- package/dist/src/components/QueryEditor/visual-query-builder/SelectRow.d.ts +11 -0
- package/dist/src/components/QueryEditor/visual-query-builder/Stack.d.ts +9 -0
- package/dist/src/components/QueryEditor/visual-query-builder/VisualEditor.d.ts +14 -0
- package/dist/src/components/QueryEditor/visual-query-builder/WhereRow.d.ts +10 -0
- package/dist/src/components/QueryEditor/visual-query-builder/index.d.ts +1 -0
- package/dist/src/components/QueryEditorRow/QueryEditorRow.d.ts +8 -0
- package/dist/src/components/Segment/Segment.d.ts +8 -0
- package/dist/src/components/index.d.ts +11 -0
- package/dist/src/datasource/SqlDatasource.d.ts +64 -0
- package/dist/src/datasource/constants.d.ts +1 -0
- package/dist/src/hooks/useDebounce.d.ts +2 -0
- package/dist/src/index.d.ts +11 -0
- package/dist/src/test/mocks/DataQuery.d.ts +2 -0
- package/dist/src/test/mocks/Datasource.d.ts +4 -0
- package/dist/src/test/mocks/Plugin.d.ts +10 -0
- package/dist/src/test/mocks/QueryEditorProps.d.ts +4 -0
- package/dist/src/test/mocks/TestDatasource.d.ts +6 -0
- package/dist/src/test/mocks/index.d.ts +5 -0
- package/dist/src/test/mocks/style.d.ts +1 -0
- package/dist/src/test/mocks/utils.d.ts +18 -0
- package/dist/src/test/setupTests.d.ts +1 -0
- package/dist/src/unreleasedComponents/index.d.ts +1 -0
- package/dist/src/utils/compatFeatures.d.ts +9 -0
- package/dist/src/utils/compatibility.d.ts +12 -0
- package/dist/src/utils/index.d.ts +3 -0
- package/dist/src/utils/testDatasource.d.ts +19 -0
- package/dist/test/mocks/DataQuery.js +14 -0
- package/dist/test/mocks/DataQuery.js.map +1 -0
- package/dist/test/mocks/Datasource.js +73 -0
- package/dist/test/mocks/Datasource.js.map +1 -0
- package/dist/test/mocks/Plugin.js +114 -0
- package/dist/test/mocks/Plugin.js.map +1 -0
- package/dist/test/mocks/QueryEditorProps.js +47 -0
- package/dist/test/mocks/QueryEditorProps.js.map +1 -0
- package/dist/test/mocks/TestDatasource.js +24 -0
- package/dist/test/mocks/TestDatasource.js.map +1 -0
- package/dist/test/mocks/index.js +9 -0
- package/dist/test/mocks/index.js.map +1 -0
- package/dist/test/mocks/style.js +5 -0
- package/dist/test/mocks/style.js.map +1 -0
- package/dist/test/mocks/utils.js +48 -0
- package/dist/test/mocks/utils.js.map +1 -0
- package/dist/test/setupTests.js +17 -0
- package/dist/test/setupTests.js.map +1 -0
- package/dist/unreleasedComponents/index.js +3 -0
- package/dist/unreleasedComponents/index.js.map +1 -0
- package/dist/utils/compatFeatures.js +20 -0
- package/dist/utils/compatFeatures.js.map +1 -0
- package/dist/utils/compatibility.js +28 -0
- package/dist/utils/compatibility.js.map +1 -0
- package/dist/utils/index.js +8 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/testDatasource.js +30 -0
- package/dist/utils/testDatasource.js.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { JsonTree } from 'react-awesome-query-builder';
|
|
2
|
+
import { DataFrame, DataQuery, DataSourceJsonData, MetricFindValue, SelectableValue, TimeRange } from '@grafana/data';
|
|
3
|
+
import { QueryWithDefaults } from './defaults';
|
|
4
|
+
import { QueryEditorFunctionExpression, QueryEditorGroupByExpression, QueryEditorPropertyExpression } from './expressions';
|
|
5
|
+
import { CompletionItemKind, LanguageCompletionProvider } from '@grafana/experimental';
|
|
6
|
+
export interface SqlQueryForInterpolation {
|
|
7
|
+
dataset?: string;
|
|
8
|
+
alias?: string;
|
|
9
|
+
format?: QueryFormat;
|
|
10
|
+
rawSql?: string;
|
|
11
|
+
refId: string;
|
|
12
|
+
hide?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface SQLConnectionLimits {
|
|
15
|
+
maxOpenConns: number;
|
|
16
|
+
maxIdleConns: number;
|
|
17
|
+
connMaxLifetime: number;
|
|
18
|
+
}
|
|
19
|
+
export interface SQLOptions extends SQLConnectionLimits, DataSourceJsonData {
|
|
20
|
+
tlsAuth: boolean;
|
|
21
|
+
tlsAuthWithCACert: boolean;
|
|
22
|
+
timezone: string;
|
|
23
|
+
tlsSkipVerify: boolean;
|
|
24
|
+
user: string;
|
|
25
|
+
database: string;
|
|
26
|
+
url: string;
|
|
27
|
+
timeInterval: string;
|
|
28
|
+
}
|
|
29
|
+
export declare enum QueryFormat {
|
|
30
|
+
Timeseries = "time_series",
|
|
31
|
+
Table = "table"
|
|
32
|
+
}
|
|
33
|
+
export declare enum EditorMode {
|
|
34
|
+
Builder = "builder",
|
|
35
|
+
Code = "code"
|
|
36
|
+
}
|
|
37
|
+
export interface SQLQuery extends DataQuery {
|
|
38
|
+
alias?: string;
|
|
39
|
+
format?: QueryFormat;
|
|
40
|
+
rawSql?: string;
|
|
41
|
+
dataset?: string;
|
|
42
|
+
table?: string;
|
|
43
|
+
sql?: SQLExpression;
|
|
44
|
+
editorMode?: EditorMode;
|
|
45
|
+
rawQuery?: boolean;
|
|
46
|
+
}
|
|
47
|
+
export interface NameValue {
|
|
48
|
+
name: string;
|
|
49
|
+
value: string;
|
|
50
|
+
}
|
|
51
|
+
export declare type SQLFilters = NameValue[];
|
|
52
|
+
export interface SQLExpression {
|
|
53
|
+
columns?: QueryEditorFunctionExpression[];
|
|
54
|
+
whereJsonTree?: JsonTree;
|
|
55
|
+
whereString?: string;
|
|
56
|
+
filters?: SQLFilters;
|
|
57
|
+
groupBy?: QueryEditorGroupByExpression[];
|
|
58
|
+
orderBy?: QueryEditorPropertyExpression;
|
|
59
|
+
orderByDirection?: 'ASC' | 'DESC';
|
|
60
|
+
limit?: number;
|
|
61
|
+
offset?: number;
|
|
62
|
+
}
|
|
63
|
+
export interface TableSchema {
|
|
64
|
+
name?: string;
|
|
65
|
+
schema?: TableFieldSchema[];
|
|
66
|
+
}
|
|
67
|
+
export interface TableFieldSchema {
|
|
68
|
+
name: string;
|
|
69
|
+
description?: string;
|
|
70
|
+
type: string;
|
|
71
|
+
repeated: boolean;
|
|
72
|
+
schema: TableFieldSchema[];
|
|
73
|
+
}
|
|
74
|
+
export interface QueryRowFilter {
|
|
75
|
+
filter: boolean;
|
|
76
|
+
group: boolean;
|
|
77
|
+
order: boolean;
|
|
78
|
+
preview: boolean;
|
|
79
|
+
}
|
|
80
|
+
export declare const QUERY_FORMAT_OPTIONS: {
|
|
81
|
+
label: string;
|
|
82
|
+
value: QueryFormat;
|
|
83
|
+
}[];
|
|
84
|
+
export declare const toOption: (value: string) => SelectableValue<string>;
|
|
85
|
+
export interface ResourceSelectorProps {
|
|
86
|
+
disabled?: boolean;
|
|
87
|
+
className?: string;
|
|
88
|
+
applyDefault?: boolean;
|
|
89
|
+
}
|
|
90
|
+
export declare type RAQBFieldTypes = 'text' | 'number' | 'boolean' | 'datetime' | 'date' | 'time';
|
|
91
|
+
export interface SQLSelectableValue extends SelectableValue {
|
|
92
|
+
type?: string;
|
|
93
|
+
raqbFieldType?: RAQBFieldTypes;
|
|
94
|
+
}
|
|
95
|
+
export interface Aggregate {
|
|
96
|
+
id: string;
|
|
97
|
+
name: string;
|
|
98
|
+
description?: string;
|
|
99
|
+
}
|
|
100
|
+
export interface DB {
|
|
101
|
+
init?: (datasourceId?: string) => Promise<boolean>;
|
|
102
|
+
datasets: () => Promise<string[]>;
|
|
103
|
+
tables: (dataset?: string) => Promise<string[]>;
|
|
104
|
+
fields: (query: SQLQuery, order?: boolean) => Promise<SQLSelectableValue[]>;
|
|
105
|
+
validateQuery: (query: SQLQuery, range?: TimeRange) => Promise<ValidationResults>;
|
|
106
|
+
dsID: () => number;
|
|
107
|
+
dispose?: (dsID?: string) => void;
|
|
108
|
+
lookup: (path?: string) => Promise<Array<{
|
|
109
|
+
name: string;
|
|
110
|
+
completion: string;
|
|
111
|
+
}>>;
|
|
112
|
+
getSqlCompletionProvider: () => LanguageCompletionProvider;
|
|
113
|
+
toRawSql?: (query: SQLQuery) => string;
|
|
114
|
+
functions: () => Promise<Aggregate[]>;
|
|
115
|
+
labels: Map<string, string>;
|
|
116
|
+
}
|
|
117
|
+
export interface QueryEditorProps {
|
|
118
|
+
db: DB;
|
|
119
|
+
query: QueryWithDefaults;
|
|
120
|
+
onChange: (query: SQLQuery) => void;
|
|
121
|
+
range?: TimeRange;
|
|
122
|
+
}
|
|
123
|
+
export interface ValidationResults {
|
|
124
|
+
query: SQLQuery;
|
|
125
|
+
rawSql?: string;
|
|
126
|
+
error: string;
|
|
127
|
+
isError: boolean;
|
|
128
|
+
isValid: boolean;
|
|
129
|
+
statistics?: {
|
|
130
|
+
TotalBytesProcessed: number;
|
|
131
|
+
} | null;
|
|
132
|
+
}
|
|
133
|
+
export interface SqlQueryModel {
|
|
134
|
+
interpolate: () => string;
|
|
135
|
+
quoteLiteral: (v: string) => string;
|
|
136
|
+
}
|
|
137
|
+
export interface ResponseParser {
|
|
138
|
+
transformMetricFindResponse: (frame: DataFrame) => MetricFindValue[];
|
|
139
|
+
}
|
|
140
|
+
export interface MetaDefinition {
|
|
141
|
+
name: string;
|
|
142
|
+
completion?: string;
|
|
143
|
+
kind: CompletionItemKind;
|
|
144
|
+
}
|
|
145
|
+
export interface SQLConnectionLimits {
|
|
146
|
+
maxOpenConns: number;
|
|
147
|
+
maxIdleConns: number;
|
|
148
|
+
connMaxLifetime: number;
|
|
149
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function formatSQL(q: string): any;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { QueryEditorFunctionExpression, QueryEditorGroupByExpression, QueryEditorPropertyExpression } from '../expressions';
|
|
2
|
+
import { SQLQuery, SQLExpression } from '../types';
|
|
3
|
+
export declare function defaultToRawSql({ sql, dataset, table }: SQLQuery): string;
|
|
4
|
+
export declare const haveColumns: (columns: SQLExpression['columns']) => columns is QueryEditorFunctionExpression[];
|
|
5
|
+
/**
|
|
6
|
+
* Creates a GroupByExpression for a specified field
|
|
7
|
+
*/
|
|
8
|
+
export declare function setGroupByField(field?: string): QueryEditorGroupByExpression;
|
|
9
|
+
/**
|
|
10
|
+
* Creates a PropertyExpression for a specified field
|
|
11
|
+
*/
|
|
12
|
+
export declare function setPropertyField(field?: string): QueryEditorPropertyExpression;
|
|
13
|
+
export declare function createFunctionField(functionName?: string): QueryEditorFunctionExpression;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DB, SQLExpression, SQLQuery } from '../types';
|
|
2
|
+
interface UseSqlChange {
|
|
3
|
+
db: DB;
|
|
4
|
+
query: SQLQuery;
|
|
5
|
+
onQueryChange: (query: SQLQuery) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function useSqlChange({ query, onQueryChange, db }: UseSqlChange): {
|
|
8
|
+
onSqlChange: (sql: SQLExpression) => void;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Config, JsonItem, JsonTree, Settings, Widgets } from 'react-awesome-query-builder';
|
|
2
|
+
export declare const emptyInitValue: JsonItem;
|
|
3
|
+
export declare const emptyInitTree: JsonTree;
|
|
4
|
+
export declare const widgets: Widgets;
|
|
5
|
+
export declare const settings: Settings;
|
|
6
|
+
export declare const raqbConfig: Config;
|
|
7
|
+
export type { Config };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React, { ComponentProps } from 'react';
|
|
2
|
+
import { Field, PopoverContent } from '@grafana/ui';
|
|
3
|
+
interface EditorFieldProps extends ComponentProps<typeof Field> {
|
|
4
|
+
label: string;
|
|
5
|
+
children: React.ReactElement;
|
|
6
|
+
width?: number | string;
|
|
7
|
+
optional?: boolean;
|
|
8
|
+
tooltip?: PopoverContent;
|
|
9
|
+
}
|
|
10
|
+
export declare const EditorField: React.FC<EditorFieldProps>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SelectableValue } from '@grafana/data';
|
|
3
|
+
import { SQLExpression } from '../types';
|
|
4
|
+
interface GroupByRowProps {
|
|
5
|
+
sql: SQLExpression;
|
|
6
|
+
onSqlChange: (sql: SQLExpression) => void;
|
|
7
|
+
columns?: Array<SelectableValue<string>>;
|
|
8
|
+
}
|
|
9
|
+
export declare function GroupByRow({ sql, columns, onSqlChange }: GroupByRowProps): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SelectableValue } from '@grafana/data';
|
|
3
|
+
import { SQLExpression } from '../types';
|
|
4
|
+
declare type OrderByRowProps = {
|
|
5
|
+
sql: SQLExpression;
|
|
6
|
+
onSqlChange: (sql: SQLExpression) => void;
|
|
7
|
+
columns?: Array<SelectableValue<string>>;
|
|
8
|
+
showOffset?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare function OrderByRow({ sql, onSqlChange, columns, showOffset }: OrderByRowProps): JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SelectableValue } from '@grafana/data';
|
|
3
|
+
import { QueryWithDefaults } from '../defaults';
|
|
4
|
+
import { SQLQuery, DB } from '../types';
|
|
5
|
+
interface SQLGroupByRowProps {
|
|
6
|
+
fields: SelectableValue[];
|
|
7
|
+
query: QueryWithDefaults;
|
|
8
|
+
onQueryChange: (query: SQLQuery) => void;
|
|
9
|
+
db: DB;
|
|
10
|
+
}
|
|
11
|
+
export declare function SQLGroupByRow({ fields, query, onQueryChange, db }: SQLGroupByRowProps): JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SelectableValue } from '@grafana/data';
|
|
3
|
+
import { QueryWithDefaults } from '../defaults';
|
|
4
|
+
import { SQLQuery, DB } from '../types';
|
|
5
|
+
declare type SQLOrderByRowProps = {
|
|
6
|
+
fields: SelectableValue[];
|
|
7
|
+
query: QueryWithDefaults;
|
|
8
|
+
onQueryChange: (query: SQLQuery) => void;
|
|
9
|
+
db: DB;
|
|
10
|
+
};
|
|
11
|
+
export declare function SQLOrderByRow({ fields, query, onQueryChange, db }: SQLOrderByRowProps): JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SelectableValue } from '@grafana/data';
|
|
3
|
+
import { QueryWithDefaults } from '../defaults';
|
|
4
|
+
import { SQLQuery, DB } from '../types';
|
|
5
|
+
interface SQLSelectRowProps {
|
|
6
|
+
fields: SelectableValue[];
|
|
7
|
+
query: QueryWithDefaults;
|
|
8
|
+
onQueryChange: (query: SQLQuery) => void;
|
|
9
|
+
db: DB;
|
|
10
|
+
}
|
|
11
|
+
export declare function SQLSelectRow({ fields, query, onQueryChange, db }: SQLSelectRowProps): JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SelectableValue } from '@grafana/data';
|
|
3
|
+
import { QueryWithDefaults } from '../defaults';
|
|
4
|
+
import { SQLQuery, DB } from '../types';
|
|
5
|
+
interface WhereRowProps {
|
|
6
|
+
query: QueryWithDefaults;
|
|
7
|
+
fields: SelectableValue[];
|
|
8
|
+
onQueryChange: (query: SQLQuery) => void;
|
|
9
|
+
db: DB;
|
|
10
|
+
}
|
|
11
|
+
export declare function SQLWhereRow({ query, fields, onQueryChange, db }: WhereRowProps): JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SelectableValue } from '@grafana/data';
|
|
3
|
+
import { SQLExpression } from '../types';
|
|
4
|
+
interface SelectRowProps {
|
|
5
|
+
sql: SQLExpression;
|
|
6
|
+
onSqlChange: (sql: SQLExpression) => void;
|
|
7
|
+
columns?: Array<SelectableValue<string>>;
|
|
8
|
+
functions?: Array<SelectableValue<string>>;
|
|
9
|
+
}
|
|
10
|
+
export declare function SelectRow({ sql, columns, onSqlChange, functions }: SelectRowProps): JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DB, QueryEditorProps, QueryRowFilter } from '../types';
|
|
3
|
+
import { SQLQuery } from '../types';
|
|
4
|
+
import { TimeRange } from '@grafana/data';
|
|
5
|
+
interface VisualEditorProps extends QueryEditorProps {
|
|
6
|
+
query: SQLQuery;
|
|
7
|
+
db: DB;
|
|
8
|
+
queryRowFilter: QueryRowFilter;
|
|
9
|
+
onChange: (q: SQLQuery) => void;
|
|
10
|
+
onValidate: (isValid: boolean) => void;
|
|
11
|
+
range?: TimeRange;
|
|
12
|
+
}
|
|
13
|
+
export declare const VisualEditor: React.FC<VisualEditorProps>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Config } from 'react-awesome-query-builder';
|
|
3
|
+
import { SQLExpression } from '../types';
|
|
4
|
+
interface SQLBuilderWhereRowProps {
|
|
5
|
+
sql: SQLExpression;
|
|
6
|
+
onSqlChange: (sql: SQLExpression) => void;
|
|
7
|
+
config?: Partial<Config>;
|
|
8
|
+
}
|
|
9
|
+
export declare function WhereRow({ sql, config, onSqlChange }: SQLBuilderWhereRowProps): JSX.Element | null;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { GroupByRow } from './GroupByRow';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SegmentSyncProps as GrafanaSegmentProps } from '@grafana/ui/components/Segment/Segment';
|
|
3
|
+
export interface SegmentProps<T> extends Omit<GrafanaSegmentProps<T>, 'onChange'> {
|
|
4
|
+
value: T;
|
|
5
|
+
onDebounce: (debouncedSegment?: T) => void;
|
|
6
|
+
delay?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function Segment<T>(props: SegmentProps<T>): JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { AsyncButtonCascader } from './AsyncButtonCascader/AsyncButtonCascader';
|
|
2
|
+
export { QueryEditorRow } from './QueryEditorRow/QueryEditorRow';
|
|
3
|
+
export { DebounceInput, DebounceInputProps, } from './DebounceInput/DebounceInput';
|
|
4
|
+
export { Segment, SegmentProps, } from './Segment/Segment';
|
|
5
|
+
export { DatePicker, DatePickerProps } from './DatePicker/DatePicker';
|
|
6
|
+
export { DatePickerWithInput, DatePickerWithInputProps, formatDate, } from './DatePickerWithInput/DatePickerWithInput';
|
|
7
|
+
export * from './DataSourcePicker/DataSourcePicker';
|
|
8
|
+
export * from './DataLinks';
|
|
9
|
+
export * from './Cascader/Cascader';
|
|
10
|
+
export { InlineSwitch, CertificationKey } from '@grafana/ui';
|
|
11
|
+
export * from './QueryEditor';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { DataFrameView, DataSourceInstanceSettings, DataSourceRef, MetricFindValue, ScopedVars, TimeRange, VariableModel } from '@grafana/data';
|
|
2
|
+
import { DataSourceWithBackend, TemplateSrv } from '@grafana/runtime';
|
|
3
|
+
import { SQLQuery, SQLOptions, DB, SqlQueryModel, ResponseParser } from '../components/QueryEditor/types';
|
|
4
|
+
export interface SearchFilterOptions {
|
|
5
|
+
searchFilter?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface VariableWithMultiSupport extends VariableWithOptions {
|
|
8
|
+
multi: boolean;
|
|
9
|
+
includeAll: boolean;
|
|
10
|
+
allValue?: string | null;
|
|
11
|
+
}
|
|
12
|
+
export interface VariableWithOptions extends VariableModel {
|
|
13
|
+
current: VariableOption;
|
|
14
|
+
options: VariableOption[];
|
|
15
|
+
query: string;
|
|
16
|
+
}
|
|
17
|
+
export interface VariableOption {
|
|
18
|
+
selected: boolean;
|
|
19
|
+
text: string | string[];
|
|
20
|
+
value: string | string[];
|
|
21
|
+
isNone?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare abstract class SqlDatasource extends DataSourceWithBackend<SQLQuery, SQLOptions> {
|
|
24
|
+
protected readonly templateSrv: TemplateSrv;
|
|
25
|
+
id: number;
|
|
26
|
+
name: string;
|
|
27
|
+
interval: string;
|
|
28
|
+
db: DB;
|
|
29
|
+
annotations: {};
|
|
30
|
+
constructor(instanceSettings: DataSourceInstanceSettings<SQLOptions>, templateSrv?: TemplateSrv);
|
|
31
|
+
abstract getDB(dsID?: number): DB;
|
|
32
|
+
abstract getQueryModel(target?: SQLQuery, templateSrv?: TemplateSrv, scopedVars?: ScopedVars): SqlQueryModel;
|
|
33
|
+
abstract getResponseParser(): ResponseParser;
|
|
34
|
+
interpolateVariable: (value: string | string[] | number, variable: VariableWithMultiSupport) => string | number;
|
|
35
|
+
interpolateVariablesInQueries(queries: SQLQuery[], scopedVars: ScopedVars): SQLQuery[];
|
|
36
|
+
filterQuery(query: SQLQuery): boolean;
|
|
37
|
+
applyTemplateVariables(target: SQLQuery, scopedVars: ScopedVars): Record<string, string | DataSourceRef | SQLQuery['format']>;
|
|
38
|
+
clean(value: string): string;
|
|
39
|
+
metricFindQuery(query: string, optionalOptions?: MetricFindQueryOptions): Promise<MetricFindValue[]>;
|
|
40
|
+
runSql<T>(query: string, options?: RunSQLOptions): Promise<DataFrameView<T>>;
|
|
41
|
+
private runMetaQuery;
|
|
42
|
+
testDatasource(): Promise<{
|
|
43
|
+
status: string;
|
|
44
|
+
message: string;
|
|
45
|
+
}>;
|
|
46
|
+
targetContainsTemplate(target: SQLQuery): boolean;
|
|
47
|
+
}
|
|
48
|
+
interface RunSQLOptions extends MetricFindQueryOptions {
|
|
49
|
+
refId?: string;
|
|
50
|
+
}
|
|
51
|
+
interface MetricFindQueryOptions extends SearchFilterOptions {
|
|
52
|
+
range?: TimeRange;
|
|
53
|
+
}
|
|
54
|
+
export declare const SEARCH_FILTER_VARIABLE = "__searchFilter";
|
|
55
|
+
export declare const containsSearchFilter: (query: string | unknown) => boolean;
|
|
56
|
+
export interface SearchFilterOptions {
|
|
57
|
+
searchFilter?: string;
|
|
58
|
+
}
|
|
59
|
+
export declare const getSearchFilterScopedVar: (args: {
|
|
60
|
+
query: string;
|
|
61
|
+
wildcardChar: string;
|
|
62
|
+
options?: SearchFilterOptions;
|
|
63
|
+
}) => ScopedVars;
|
|
64
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MACRO_NAMES: string[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A library containing the different design components of the Grafana plugins ecosystem.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
export * from './components';
|
|
7
|
+
export * from './unreleasedComponents';
|
|
8
|
+
export * from './test/mocks';
|
|
9
|
+
export * from './utils';
|
|
10
|
+
export { SqlDatasource } from './datasource/SqlDatasource';
|
|
11
|
+
export { selectOption, generateOptions } from './8x';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DataSourceInstanceSettings } from '@grafana/data';
|
|
2
|
+
import { DataSourceWithBackend } from '@grafana/runtime';
|
|
3
|
+
export declare const mockDatasource: () => DataSourceWithBackend;
|
|
4
|
+
export declare const mockDatasourceInstanceSettings: () => DataSourceInstanceSettings;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DataSourcePluginMeta, PluginMetaInfo, PluginMeta, PluginState, PluginSignatureStatus, PluginInclude, PluginIncludeType, PluginDependencies, PluginType } from '@grafana/data';
|
|
2
|
+
export declare const mockDataSourcePluginMeta: () => DataSourcePluginMeta;
|
|
3
|
+
export declare const mockPluginMetaInfo: () => PluginMetaInfo;
|
|
4
|
+
export declare const mockPluginMeta: () => PluginMeta;
|
|
5
|
+
export declare const mockPluginInclude: () => PluginInclude;
|
|
6
|
+
export declare const mockPluginType: () => PluginType;
|
|
7
|
+
export declare const mockPluginIncludeType: () => PluginIncludeType;
|
|
8
|
+
export declare const mockPluginState: () => PluginState;
|
|
9
|
+
export declare const mockPluginDependencies: () => PluginDependencies;
|
|
10
|
+
export declare const mockPluginSignatureStatus: () => PluginSignatureStatus;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { QueryEditorProps, LoadingState, TimeRange } from '@grafana/data';
|
|
2
|
+
export declare const mockQueryEditorProps: () => QueryEditorProps<any, any, any>;
|
|
3
|
+
export declare const mockLoadingState: () => LoadingState;
|
|
4
|
+
export declare const mockTimeRange: () => TimeRange;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { HealthCheckResult } from "@grafana/runtime";
|
|
2
|
+
import { HealthCheckError, HealthCheckResultDetails, TestDatasourceReturn } from "../../utils/testDatasource";
|
|
3
|
+
export declare const mockTestDatasourceReturn: () => TestDatasourceReturn;
|
|
4
|
+
export declare const mockHealthCheckResult: () => HealthCheckResult;
|
|
5
|
+
export declare const mockHealthCheckDetails: () => HealthCheckResultDetails;
|
|
6
|
+
export declare const mockHealthCheckResultError: (details?: HealthCheckResultDetails) => HealthCheckError;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const style = "style";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const generateBoolean: () => boolean;
|
|
2
|
+
export declare const undefinedOr: (fn: Function) => any;
|
|
3
|
+
export declare const generateArrayOf: (fn: Function, numberOf?: number) => any[];
|
|
4
|
+
/**
|
|
5
|
+
* Opens a Select or MultiSelect dropdown
|
|
6
|
+
*
|
|
7
|
+
* @param {HTMLElement} container The container wrapping the Select or MultiSelect component
|
|
8
|
+
* @param {string} optionLabel The option text we want to type or search
|
|
9
|
+
*/
|
|
10
|
+
export declare const openSelect: (container: HTMLElement, optionLabel?: string) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Selects an option from the Select or MultiSelect component
|
|
13
|
+
*
|
|
14
|
+
* @param {HTMLElement} container The container wrapping the Select or MultiSelect component
|
|
15
|
+
* @param {string} optionLabel The option we want to select
|
|
16
|
+
* @param {boolean} [typeOptionLabel=false] If we should type the optional label after opening - this is useful for AsyncSelect
|
|
17
|
+
*/
|
|
18
|
+
export declare const selectOption: (container: HTMLElement, optionLabel: string, typeOptionLabel?: boolean) => Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseTestDatasource, TestDatasourceReturn } from "./testDatasource";
|
|
2
|
+
/**
|
|
3
|
+
* Calls the override testDatasource function for backwards compatibility if needed.
|
|
4
|
+
*
|
|
5
|
+
* @param baseTestDatasource The original testDatasource function
|
|
6
|
+
* @param toggle Accepts a feature toggle. Defaults to false so it is clear when we want this feature turned on.
|
|
7
|
+
* @returns The result in the expected format for the Grafana version
|
|
8
|
+
*/
|
|
9
|
+
export declare const healthDiagnosticsErrorsCompat: (baseTestDatasource: BaseTestDatasource, toggle?: boolean) => Promise<TestDatasourceReturn>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare enum CompatibilityFeature {
|
|
2
|
+
HEALTH_DIAGNOSTICS_ERRORS = 0
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Checks if the currently running version of Grafana supports the feature.
|
|
6
|
+
*
|
|
7
|
+
* Enables graceful degradation for earlier versions that don't support a given capability.
|
|
8
|
+
*
|
|
9
|
+
* @param feature The feature that requires backwards compatibility
|
|
10
|
+
* @returns True if the Grafana version running can support the feature, otherwise false
|
|
11
|
+
*/
|
|
12
|
+
export declare const hasCompatibility: (feature: CompatibilityFeature) => boolean;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { HealthCheckResult } from '@grafana/runtime';
|
|
2
|
+
export declare type HealthCheckResultDetails = Record<string, any> | undefined;
|
|
3
|
+
export declare class HealthCheckError extends Error {
|
|
4
|
+
details: HealthCheckResultDetails;
|
|
5
|
+
constructor(message: string, details: HealthCheckResultDetails);
|
|
6
|
+
}
|
|
7
|
+
export declare type TestDatasourceReturn = Partial<HealthCheckResult> | Error;
|
|
8
|
+
export declare type BaseTestDatasource = () => Promise<TestDatasourceReturn>;
|
|
9
|
+
/**
|
|
10
|
+
* Override function for testDatasource in Grafana for the health check
|
|
11
|
+
*
|
|
12
|
+
* There is a new error format that is introduced in Grafana 8 which is not backwards compatible by default
|
|
13
|
+
*
|
|
14
|
+
* This transforms the health check result into the old format if Grafana <8 is being used
|
|
15
|
+
*
|
|
16
|
+
* @param baseTestDatasource The original testDatasource function
|
|
17
|
+
* @returns Either the health check result if the health check was successful or an error that is handled later by Grafana
|
|
18
|
+
*/
|
|
19
|
+
export declare const testDatasource: (baseTestDatasource: BaseTestDatasource) => Promise<TestDatasourceReturn>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mockDataQuery = void 0;
|
|
4
|
+
const chance_1 = require("chance");
|
|
5
|
+
const utils_1 = require("./utils");
|
|
6
|
+
const mockDataQuery = () => ({
|
|
7
|
+
refId: (0, chance_1.Chance)().word(),
|
|
8
|
+
hide: false,
|
|
9
|
+
key: (0, chance_1.Chance)().guid(),
|
|
10
|
+
queryType: (0, chance_1.Chance)().word(),
|
|
11
|
+
datasource: (0, utils_1.undefinedOr)(() => (0, chance_1.Chance)().word()),
|
|
12
|
+
});
|
|
13
|
+
exports.mockDataQuery = mockDataQuery;
|
|
14
|
+
//# sourceMappingURL=DataQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataQuery.js","sourceRoot":"","sources":["../../../src/test/mocks/DataQuery.ts"],"names":[],"mappings":";;;AACA,mCAAgC;AAChC,mCAAsC;AAE/B,MAAM,aAAa,GAAG,GAAc,EAAE,CAAC,CAAC;IAC7C,KAAK,EAAE,IAAA,eAAM,GAAE,CAAC,IAAI,EAAE;IACtB,IAAI,EAAE,KAAK;IACX,GAAG,EAAE,IAAA,eAAM,GAAE,CAAC,IAAI,EAAE;IACpB,SAAS,EAAE,IAAA,eAAM,GAAE,CAAC,IAAI,EAAE;IAC1B,UAAU,EAAE,IAAA,mBAAW,EAAC,GAAG,EAAE,CAAC,IAAA,eAAM,GAAE,CAAC,IAAI,EAAE,CAAC;CAC/C,CAAC,CAAC;AANU,QAAA,aAAa,iBAMvB"}
|