@grafana/plugin-ui 0.17.10 → 0.18.0
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/dist/cjs/index.cjs +88 -113
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +16 -23
- package/dist/esm/components/DataSourcePicker/DataSourcePicker.js +88 -87
- package/dist/esm/components/DataSourcePicker/DataSourcePicker.js.map +1 -1
- package/dist/esm/index.d.ts +16 -23
- package/dist/esm/index.js +0 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +3 -2
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/resolvePluginName.js +0 -30
- package/dist/esm/components/ConfigEditor/DatasourceConfigWizard/resolvePluginName.js.map +0 -1
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React, { ComponentProps,
|
|
1
|
+
import React, { ComponentProps, ReactElement, ReactNode, Component, ErrorInfo, PureComponent, FunctionComponent, HTMLProps } from 'react';
|
|
2
2
|
import { Input, Segment as Segment$1, monacoTypes, Monaco, ButtonProps, Field, PopoverContent, Switch, SelectCommonProps, InlineLabel } from '@grafana/ui';
|
|
3
|
-
import { DataSourceInstanceSettings,
|
|
4
|
-
import { DataSourceSrv, DataSourceWithBackend, TemplateSrv } from '@grafana/runtime';
|
|
3
|
+
import { DataSourceInstanceSettings, DataSourceJsonData, VariableSuggestion, SelectableValue, TimeRange, DataFrame, MetricFindValue, ThemeSpacingTokens, ScopedVars, VariableModel, DataFrameView, QueryEditorProps as QueryEditorProps$1, DataSourceSettings, RegistryItem, DataSourceApi, Registry, DataQuery as DataQuery$1, PanelData, DataQueryRequest, DataQueryResponse, LoadingState } from '@grafana/data';
|
|
5
4
|
import { JsonTree } from '@react-awesome-query-builder/ui';
|
|
6
5
|
import { DataQuery } from '@grafana/schema';
|
|
6
|
+
import { DataSourceWithBackend, TemplateSrv } from '@grafana/runtime';
|
|
7
7
|
import { SqlLanguage } from 'sql-formatter';
|
|
8
8
|
import { Grammar } from 'prismjs';
|
|
9
9
|
import { Observable } from 'rxjs';
|
|
@@ -46,8 +46,16 @@ interface DatePickerWithInputProps extends Omit<ComponentProps<typeof Input>, 'r
|
|
|
46
46
|
declare const DatePickerWithInput: (props: DatePickerWithInputProps) => React.JSX.Element;
|
|
47
47
|
|
|
48
48
|
interface Props$s {
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Receives the selected data source's list item (`uid`, `type`, `name`, `meta`). Call
|
|
51
|
+
* `getDataSourceInstanceSettings(ds.uid)` from `@grafana/plugin-compat` if you need the full settings.
|
|
52
|
+
*/
|
|
53
|
+
onChange: (ds: Pick<DataSourceInstanceSettings, 'uid' | 'type' | 'name' | 'meta'>) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Reference to the selected data source, resolved the way Grafana does: uid, name, template variable or
|
|
56
|
+
* built-in. `null`/`undefined` resolves to the default data source.
|
|
57
|
+
*/
|
|
58
|
+
current?: string | null;
|
|
51
59
|
hideTextValue?: boolean;
|
|
52
60
|
onBlur?: () => void;
|
|
53
61
|
autoFocus?: boolean;
|
|
@@ -62,20 +70,7 @@ interface Props$s {
|
|
|
62
70
|
pluginId?: string;
|
|
63
71
|
noDefault?: boolean;
|
|
64
72
|
}
|
|
65
|
-
|
|
66
|
-
error?: string;
|
|
67
|
-
}
|
|
68
|
-
declare class DataSourcePicker extends PureComponent<Props$s, State$1> {
|
|
69
|
-
dataSourceSrv: DataSourceSrv;
|
|
70
|
-
static defaultProps: Partial<Props$s>;
|
|
71
|
-
state: State$1;
|
|
72
|
-
constructor(props: Props$s);
|
|
73
|
-
componentDidMount(): void;
|
|
74
|
-
onChange: (item: SelectableValue<string>) => void;
|
|
75
|
-
private getCurrentValue;
|
|
76
|
-
getDataSourceOptions(): Array<SelectableValue<string>>;
|
|
77
|
-
render(): React.JSX.Element;
|
|
78
|
-
}
|
|
73
|
+
declare function DataSourcePicker({ onChange, current: currentProp, hideTextValue, onBlur, autoFocus, openMenuOnFocus, placeholder, noDefault, }: Props$s): React.JSX.Element;
|
|
79
74
|
|
|
80
75
|
type DataLinkConfig = {
|
|
81
76
|
field: string;
|
|
@@ -1522,8 +1517,6 @@ declare function useHealthChecks(): {
|
|
|
1522
1517
|
retry: (uid: string) => void;
|
|
1523
1518
|
};
|
|
1524
1519
|
|
|
1525
|
-
declare function resolvePluginName(pluginType: string): string;
|
|
1526
|
-
|
|
1527
1520
|
type UseDatasourceSchemaResult = {
|
|
1528
1521
|
schema: DatasourceConfigSchema | null;
|
|
1529
1522
|
loading: boolean;
|
|
@@ -2019,5 +2012,5 @@ interface RequestLoopOptions<TQuery extends DataQuery$1 = DataQuery$1> {
|
|
|
2019
2012
|
*/
|
|
2020
2013
|
declare function getRequestLooper<T extends DataQuery$1 = DataQuery$1>(req: DataQueryRequest<T>, options: RequestLoopOptions<T>): Observable<DataQueryResponse>;
|
|
2021
2014
|
|
|
2022
|
-
export { AUTH_GROUP_IDS, AccessoryButton, AdvancedHttpSettings, Auth, AuthMethod, BINARY_OPERATIONS_KEY, CatalogSelector, CompletionItemInsertTextRule, CompletionItemKind, CompletionItemPriority, ConfigDescriptionLink, ConfigSection, ConfigSubSection, ConnectionSettings, CustomHeadersSettings, DataLink, DataLinks, DataSourceDescription, DataSourcePicker, DatasetSelector, DatasourceConfigWizard, DatasourceErrorBoundary, DatasourceWithAsyncBackend, DatePicker, DatePickerWithInput, DebounceInput, EditorField, EditorFieldGroup, EditorHeader, EditorList, EditorMode, EditorRow, EditorRows, EditorStack, EditorSwitch, FlexItem, GroupByRow, InlineSelect, InputGroup, LabelFilters, LinkedToken, MacroType, OperationExplainedBox, OperationList, OperationListExplained, OperationsEditorRow, OperatorType, QUERY_FORMAT_OPTIONS, QueryBuilderHints, QueryEditorMode, QueryEditorModeToggle, QueryEditorRow, QueryFormat, QueryHeaderSwitch, QueryModellerBase, QueryOptionGroup, ROOT_CONFIG_FIELDS, RawQuery, RunQueryButton, RunQueryButtons, SQLEditor, SQLEditorMode, SQLEditorTestUtils, SecureSocksProxyToggle, Segment, Space, SqlDatasource, SqlQueryEditor, StatementPosition, SuggestionKind, TLSSettings, TableSelector, TokenType, buildCelContext, buildCloneDatasourcePayload, buildCreateDatasourcePayload, buildUpdateDatasourcePayload, clearExpressionCache, computeVirtualFieldValues, convertLegacyAuthProps, datasourceToProvisioningYaml, evaluateCelDirect, evaluateCelExpression, evaluateComputedRead, evaluateDependsOn, extractFieldRefs, fetchConfigSchema, formKey, formatDate, formatYamlDiff, generateLLMHint, generateProvisioningTemplate, generateTroubleshootingFields, getConfigSchema, getRequestLooper, getStandardSQLCompletionProvider, getWatchedValue, language as grafanaStandardSQLLanguage, conf as grafanaStandardSQLLanguageConf, isAuthGroupId, isValidCelExpression, parseDependsOn, resolveActiveOverride, resolveGroups,
|
|
2023
|
-
export type { Aggregate, AllowedValuesValidationRule, Props$c as AuthProps, BaseFieldRef, BaseValidationRule, ColumnDefinition, ComputedMapping, ConfigField, ConfigGroup, CustomMeta, CustomValidationRule, DB, DataLinkConfig, DatasourceConfigSchema, DatasourceConfigWizardProps, DatasourceHealth, DatePickerProps, DatePickerWithInputProps, DebounceInputProps, DirectMapping, Expression, FieldEffect, FieldItemSchema, FieldKind, FieldOption, FieldOverride, FieldPack, FieldPackID, FieldPatch, FieldRelationship, FieldUI, FieldValidationRule, FormState, HealthState, IndexedPairMapping, Instruction, ItemCountValidationRule, LanguageCompletionProvider, LanguageDefinition, LengthValidationRule, MappingField, MetaDefinition, NameValue, PatternValidationRule, PositionContext, Props$s as Props, QueryBuilderLabelFilter, QueryBuilderOperation, QueryBuilderOperationDefinition, QueryBuilderOperationParamDef, QueryBuilderOperationParamEditorProps, QueryBuilderOperationParamValue, QueryEditorProps, QueryRowFilter, QueryStats, QueryWithDefaults, RAQBFieldTypes, RangeValidationRule, RelationshipType, RequestLoopOptions, ResolvedGroup, ResourceSelectorProps, ResponseParser, Role, RunQueryButtonsProps, RunningQueryInfo, SQLConnectionLimits, SQLExpression, SQLFilters, SQLMonarchLanguage, SQLOptions, SQLQuery, SQLSelectableValue, SchemaDefinition, SecureFieldState, SegmentProps, SqlQueryForInterpolation, SqlQueryModel,
|
|
2015
|
+
export { AUTH_GROUP_IDS, AccessoryButton, AdvancedHttpSettings, Auth, AuthMethod, BINARY_OPERATIONS_KEY, CatalogSelector, CompletionItemInsertTextRule, CompletionItemKind, CompletionItemPriority, ConfigDescriptionLink, ConfigSection, ConfigSubSection, ConnectionSettings, CustomHeadersSettings, DataLink, DataLinks, DataSourceDescription, DataSourcePicker, DatasetSelector, DatasourceConfigWizard, DatasourceErrorBoundary, DatasourceWithAsyncBackend, DatePicker, DatePickerWithInput, DebounceInput, EditorField, EditorFieldGroup, EditorHeader, EditorList, EditorMode, EditorRow, EditorRows, EditorStack, EditorSwitch, FlexItem, GroupByRow, InlineSelect, InputGroup, LabelFilters, LinkedToken, MacroType, OperationExplainedBox, OperationList, OperationListExplained, OperationsEditorRow, OperatorType, QUERY_FORMAT_OPTIONS, QueryBuilderHints, QueryEditorMode, QueryEditorModeToggle, QueryEditorRow, QueryFormat, QueryHeaderSwitch, QueryModellerBase, QueryOptionGroup, ROOT_CONFIG_FIELDS, RawQuery, RunQueryButton, RunQueryButtons, SQLEditor, SQLEditorMode, SQLEditorTestUtils, SecureSocksProxyToggle, Segment, Space, SqlDatasource, SqlQueryEditor, StatementPosition, SuggestionKind, TLSSettings, TableSelector, TokenType, buildCelContext, buildCloneDatasourcePayload, buildCreateDatasourcePayload, buildUpdateDatasourcePayload, clearExpressionCache, computeVirtualFieldValues, convertLegacyAuthProps, datasourceToProvisioningYaml, evaluateCelDirect, evaluateCelExpression, evaluateComputedRead, evaluateDependsOn, extractFieldRefs, fetchConfigSchema, formKey, formatDate, formatYamlDiff, generateLLMHint, generateProvisioningTemplate, generateTroubleshootingFields, getConfigSchema, getRequestLooper, getStandardSQLCompletionProvider, getWatchedValue, language as grafanaStandardSQLLanguage, conf as grafanaStandardSQLLanguageConf, isAuthGroupId, isValidCelExpression, parseDependsOn, resolveActiveOverride, resolveGroups, resolveRequiredFieldsGroup, toOption, useDatasourceSchema, useHealthChecks };
|
|
2016
|
+
export type { Aggregate, AllowedValuesValidationRule, Props$c as AuthProps, BaseFieldRef, BaseValidationRule, ColumnDefinition, ComputedMapping, ConfigField, ConfigGroup, CustomMeta, CustomValidationRule, DB, DataLinkConfig, DatasourceConfigSchema, DatasourceConfigWizardProps, DatasourceHealth, DatePickerProps, DatePickerWithInputProps, DebounceInputProps, DirectMapping, Expression, FieldEffect, FieldItemSchema, FieldKind, FieldOption, FieldOverride, FieldPack, FieldPackID, FieldPatch, FieldRelationship, FieldUI, FieldValidationRule, FormState, HealthState, IndexedPairMapping, Instruction, ItemCountValidationRule, LanguageCompletionProvider, LanguageDefinition, LengthValidationRule, MappingField, MetaDefinition, NameValue, PatternValidationRule, PositionContext, Props$s as Props, QueryBuilderLabelFilter, QueryBuilderOperation, QueryBuilderOperationDefinition, QueryBuilderOperationParamDef, QueryBuilderOperationParamEditorProps, QueryBuilderOperationParamValue, QueryEditorProps, QueryRowFilter, QueryStats, QueryWithDefaults, RAQBFieldTypes, RangeValidationRule, RelationshipType, RequestLoopOptions, ResolvedGroup, ResourceSelectorProps, ResponseParser, Role, RunQueryButtonsProps, RunningQueryInfo, SQLConnectionLimits, SQLExpression, SQLFilters, SQLMonarchLanguage, SQLOptions, SQLQuery, SQLSelectableValue, SchemaDefinition, SecureFieldState, SegmentProps, SqlQueryForInterpolation, SqlQueryModel, StatementPlacementProvider, StorageMapping, SuggestionKindProvider, Props$f as TLSSettingsProps, TableDefinition, TableFieldSchema, TableIdentifier, TableSchema, TargetLocation, TestQueryModel, UIComponent, UIWidth, ValidationResults, ValueType, VisualQuery, VisualQueryBinary, VisualQueryModeller };
|
|
@@ -1,103 +1,104 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { Select, Stack } from '@grafana/ui';
|
|
3
3
|
import '@grafana/data';
|
|
4
4
|
import { selectors } from '@grafana/e2e-selectors';
|
|
5
|
+
import { useDataSourceInstanceList, useDataSourceInstanceListItem } from '@grafana/plugin-compat/datasources';
|
|
5
6
|
import { isUnsignedPluginSignature, PluginSignatureBadge } from '../Plugins/PluginSignatureBadge.js';
|
|
6
|
-
import { getDataSourceSrv } from '@grafana/runtime';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
8
|
+
function DataSourcePicker({
|
|
9
|
+
onChange,
|
|
10
|
+
current: currentProp,
|
|
11
|
+
hideTextValue,
|
|
12
|
+
onBlur,
|
|
13
|
+
autoFocus = false,
|
|
14
|
+
openMenuOnFocus = false,
|
|
15
|
+
placeholder = "Select datasource",
|
|
16
|
+
noDefault
|
|
17
|
+
}) {
|
|
18
|
+
const current = currentProp != null ? currentProp : null;
|
|
19
|
+
const showNoDatasources = !current && !!noDefault;
|
|
20
|
+
const { items, isLoading: isListLoading, error: listError } = useDataSourceInstanceList();
|
|
21
|
+
const currentResult = useDataSourceInstanceListItem(current);
|
|
22
|
+
const selected = currentResult.item;
|
|
23
|
+
const isCurrentLoading = !showNoDatasources && currentResult.isLoading;
|
|
24
|
+
const isLoading = isListLoading || isCurrentLoading;
|
|
25
|
+
const notFound = !selected && !isCurrentLoading && !showNoDatasources;
|
|
26
|
+
const handleChange = (option) => {
|
|
27
|
+
const item = items.find((ds) => ds.uid === option.value);
|
|
28
|
+
if (item) {
|
|
29
|
+
onChange(item);
|
|
29
30
|
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
31
|
+
};
|
|
32
|
+
const options = items.map((ds) => ({
|
|
33
|
+
value: ds.uid,
|
|
34
|
+
label: ds.name,
|
|
35
|
+
imgUrl: ds.meta.info.logos.small,
|
|
36
|
+
meta: ds.meta
|
|
37
|
+
}));
|
|
38
|
+
const value = getCurrentValue({ current, selected, notFound, showNoDatasources, hideTextValue });
|
|
39
|
+
const invalid = !!listError || notFound;
|
|
40
|
+
return /* @__PURE__ */ React.createElement("div", { "aria-label": selectors.components.DataSourcePicker.container }, /* @__PURE__ */ React.createElement(
|
|
41
|
+
Select,
|
|
42
|
+
{
|
|
43
|
+
className: "ds-picker select-container",
|
|
44
|
+
isMulti: false,
|
|
45
|
+
isClearable: false,
|
|
46
|
+
backspaceRemovesValue: false,
|
|
47
|
+
onChange: handleChange,
|
|
48
|
+
options,
|
|
49
|
+
isLoading,
|
|
50
|
+
autoFocus,
|
|
51
|
+
onBlur,
|
|
52
|
+
openMenuOnFocus,
|
|
53
|
+
maxMenuHeight: 500,
|
|
54
|
+
placeholder,
|
|
55
|
+
noOptionsMessage: listError ? "Could not load data sources" : "No datasources found",
|
|
56
|
+
value,
|
|
57
|
+
invalid,
|
|
58
|
+
"aria-invalid": invalid,
|
|
59
|
+
getOptionLabel: (o) => {
|
|
60
|
+
if (o.meta && isUnsignedPluginSignature(o.meta.signature) && o !== value) {
|
|
61
|
+
return /* @__PURE__ */ React.createElement(Stack, { alignItems: "center", justifyContent: "space-between" }, /* @__PURE__ */ React.createElement("span", null, o.label), " ", /* @__PURE__ */ React.createElement(PluginSignatureBadge, { status: o.meta.signature }));
|
|
62
|
+
}
|
|
63
|
+
return o.label || "";
|
|
64
|
+
}
|
|
47
65
|
}
|
|
66
|
+
));
|
|
67
|
+
}
|
|
68
|
+
function getCurrentValue({
|
|
69
|
+
current,
|
|
70
|
+
selected,
|
|
71
|
+
notFound,
|
|
72
|
+
showNoDatasources,
|
|
73
|
+
hideTextValue
|
|
74
|
+
}) {
|
|
75
|
+
if (showNoDatasources) {
|
|
48
76
|
return {
|
|
49
|
-
label:
|
|
50
|
-
value: (current != null ? current : "no name") + " - not found",
|
|
51
|
-
imgUrl: "",
|
|
52
|
-
hideText: hideTextValue
|
|
77
|
+
label: "No datasources found"
|
|
53
78
|
};
|
|
54
79
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
value: ds.uid,
|
|
58
|
-
label: ds.name,
|
|
59
|
-
imgUrl: ds.meta.info.logos.small,
|
|
60
|
-
meta: ds.meta
|
|
61
|
-
}));
|
|
62
|
-
return options;
|
|
80
|
+
if (selected) {
|
|
81
|
+
return toOption$1(selected, hideTextValue);
|
|
63
82
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const { error } = this.state;
|
|
67
|
-
const options = this.getDataSourceOptions();
|
|
68
|
-
const value = this.getCurrentValue();
|
|
69
|
-
return /* @__PURE__ */ React.createElement("div", { "aria-label": selectors.components.DataSourcePicker.container }, /* @__PURE__ */ React.createElement(
|
|
70
|
-
Select,
|
|
71
|
-
{
|
|
72
|
-
className: "ds-picker select-container",
|
|
73
|
-
isMulti: false,
|
|
74
|
-
isClearable: false,
|
|
75
|
-
backspaceRemovesValue: false,
|
|
76
|
-
onChange: this.onChange,
|
|
77
|
-
options,
|
|
78
|
-
autoFocus,
|
|
79
|
-
onBlur,
|
|
80
|
-
openMenuOnFocus,
|
|
81
|
-
maxMenuHeight: 500,
|
|
82
|
-
placeholder,
|
|
83
|
-
noOptionsMessage: "No datasources found",
|
|
84
|
-
value,
|
|
85
|
-
invalid: !!error,
|
|
86
|
-
getOptionLabel: (o) => {
|
|
87
|
-
if (o.meta && isUnsignedPluginSignature(o.meta.signature) && o !== value) {
|
|
88
|
-
return /* @__PURE__ */ React.createElement(Stack, { alignItems: "center", justifyContent: "space-between" }, /* @__PURE__ */ React.createElement("span", null, o.label), " ", /* @__PURE__ */ React.createElement(PluginSignatureBadge, { status: o.meta.signature }));
|
|
89
|
-
}
|
|
90
|
-
return o.label || "";
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
));
|
|
83
|
+
if (!notFound) {
|
|
84
|
+
return void 0;
|
|
94
85
|
}
|
|
86
|
+
return {
|
|
87
|
+
label: (current != null ? current : "no name") + " - not found",
|
|
88
|
+
value: (current != null ? current : "no name") + " - not found",
|
|
89
|
+
imgUrl: "",
|
|
90
|
+
hideText: hideTextValue
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function toOption$1(ds, hideTextValue) {
|
|
94
|
+
return {
|
|
95
|
+
label: ds.name.substr(0, 37),
|
|
96
|
+
value: ds.name,
|
|
97
|
+
imgUrl: ds.meta.info.logos.small,
|
|
98
|
+
hideText: hideTextValue,
|
|
99
|
+
meta: ds.meta
|
|
100
|
+
};
|
|
95
101
|
}
|
|
96
|
-
__publicField$6(DataSourcePicker, "defaultProps", {
|
|
97
|
-
autoFocus: false,
|
|
98
|
-
openMenuOnFocus: false,
|
|
99
|
-
placeholder: "Select datasource"
|
|
100
|
-
});
|
|
101
102
|
|
|
102
103
|
export { DataSourcePicker };
|
|
103
104
|
//# sourceMappingURL=DataSourcePicker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataSourcePicker.js","sources":["../../../../src/components/DataSourcePicker/DataSourcePicker.tsx"],"sourcesContent":["import React
|
|
1
|
+
{"version":3,"file":"DataSourcePicker.js","sources":["../../../../src/components/DataSourcePicker/DataSourcePicker.tsx"],"sourcesContent":["import React from 'react';\nimport { Stack, Select } from '@grafana/ui';\nimport { type DataSourceInstanceSettings, type SelectableValue } from '@grafana/data';\nimport { selectors } from '@grafana/e2e-selectors';\nimport { useDataSourceInstanceList, useDataSourceInstanceListItem } from '@grafana/plugin-compat/datasources';\nimport { isUnsignedPluginSignature, PluginSignatureBadge } from '../Plugins/PluginSignatureBadge';\n\nexport interface Props {\n // Mirrors `DataSourceInstanceListItem` instead of importing it: `@grafana/data` only exports it from 13.3,\n // so with our `^13.0.0` peer range consumers on 13.0–13.2 would get `any`. Callbacks typed with the real\n // `DataSourceInstanceListItem` (13.3+) still fit because the shapes are identical.\n /**\n * Receives the selected data source's list item (`uid`, `type`, `name`, `meta`). Call\n * `getDataSourceInstanceSettings(ds.uid)` from `@grafana/plugin-compat` if you need the full settings.\n */\n onChange: (ds: Pick<DataSourceInstanceSettings, 'uid' | 'type' | 'name' | 'meta'>) => void;\n /**\n * Reference to the selected data source, resolved the way Grafana does: uid, name, template variable or\n * built-in. `null`/`undefined` resolves to the default data source.\n */\n current?: string | null;\n hideTextValue?: boolean;\n onBlur?: () => void;\n autoFocus?: boolean;\n openMenuOnFocus?: boolean;\n placeholder?: string;\n tracing?: boolean;\n mixed?: boolean;\n dashboard?: boolean;\n metrics?: boolean;\n annotations?: boolean;\n variables?: boolean;\n pluginId?: string;\n noDefault?: boolean;\n}\n\ntype DataSourceListItem = Parameters<Props['onChange']>[0];\n\nexport function DataSourcePicker({\n onChange,\n current: currentProp,\n hideTextValue,\n onBlur,\n autoFocus = false,\n openMenuOnFocus = false,\n placeholder = 'Select datasource',\n noDefault,\n}: Props) {\n const current = currentProp ?? null;\n const showNoDatasources = !current && !!noDefault;\n const { items, isLoading: isListLoading, error: listError } = useDataSourceInstanceList();\n const currentResult = useDataSourceInstanceListItem(current);\n const selected: DataSourceListItem | undefined = currentResult.item;\n const isCurrentLoading = !showNoDatasources && currentResult.isLoading;\n const isLoading = isListLoading || isCurrentLoading;\n const notFound = !selected && !isCurrentLoading && !showNoDatasources;\n\n const handleChange = (option: SelectableValue<string>) => {\n const item = items.find((ds) => ds.uid === option.value);\n if (item) {\n onChange(item);\n }\n };\n\n const options: Array<SelectableValue<string>> = items.map((ds) => ({\n value: ds.uid,\n label: ds.name,\n imgUrl: ds.meta.info.logos.small,\n meta: ds.meta,\n }));\n\n const value = getCurrentValue({ current, selected, notFound, showNoDatasources, hideTextValue });\n const invalid = !!listError || notFound;\n\n return (\n <div aria-label={selectors.components.DataSourcePicker.container}>\n <Select\n className=\"ds-picker select-container\"\n isMulti={false}\n isClearable={false}\n backspaceRemovesValue={false}\n onChange={handleChange}\n options={options}\n isLoading={isLoading}\n autoFocus={autoFocus}\n onBlur={onBlur}\n openMenuOnFocus={openMenuOnFocus}\n maxMenuHeight={500}\n placeholder={placeholder}\n noOptionsMessage={listError ? 'Could not load data sources' : 'No datasources found'}\n value={value}\n invalid={invalid}\n aria-invalid={invalid}\n getOptionLabel={(o) => {\n if (o.meta && isUnsignedPluginSignature(o.meta.signature) && o !== value) {\n return (\n <Stack alignItems=\"center\" justifyContent=\"space-between\">\n <span>{o.label}</span> <PluginSignatureBadge status={o.meta.signature} />\n </Stack>\n );\n }\n return o.label || '';\n }}\n />\n </div>\n );\n}\n\nfunction getCurrentValue({\n current,\n selected,\n notFound,\n showNoDatasources,\n hideTextValue,\n}: {\n current: string | null;\n selected?: DataSourceListItem;\n notFound: boolean;\n showNoDatasources: boolean;\n hideTextValue?: boolean;\n}): SelectableValue<string> | undefined {\n if (showNoDatasources) {\n return {\n label: 'No datasources found',\n };\n }\n\n if (selected) {\n return toOption(selected, hideTextValue);\n }\n\n if (!notFound) {\n return undefined;\n }\n\n return {\n label: (current ?? 'no name') + ' - not found',\n value: (current ?? 'no name') + ' - not found',\n imgUrl: '',\n hideText: hideTextValue,\n };\n}\n\nfunction toOption(ds: DataSourceListItem, hideTextValue?: boolean): SelectableValue<string> {\n return {\n label: ds.name.substr(0, 37),\n value: ds.name,\n imgUrl: ds.meta.info.logos.small,\n hideText: hideTextValue,\n meta: ds.meta,\n };\n}\n"],"names":["toOption"],"mappings":";;;;;;;AAsCO,SAAS,gBAAA,CAAiB;AAAA,EAC/B,QAAA;AAAA,EACA,OAAA,EAAS,WAAA;AAAA,EACT,aAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA,GAAY,KAAA;AAAA,EACZ,eAAA,GAAkB,KAAA;AAAA,EAClB,WAAA,GAAc,mBAAA;AAAA,EACd;AACF,CAAA,EAAU;AACR,EAAA,MAAM,UAAU,WAAA,IAAA,IAAA,GAAA,WAAA,GAAe,IAAA;AAC/B,EAAA,MAAM,iBAAA,GAAoB,CAAC,OAAA,IAAW,CAAC,CAAC,SAAA;AACxC,EAAA,MAAM,EAAE,KAAA,EAAO,SAAA,EAAW,eAAe,KAAA,EAAO,SAAA,KAAc,yBAAA,EAA0B;AACxF,EAAA,MAAM,aAAA,GAAgB,8BAA8B,OAAO,CAAA;AAC3D,EAAA,MAAM,WAA2C,aAAA,CAAc,IAAA;AAC/D,EAAA,MAAM,gBAAA,GAAmB,CAAC,iBAAA,IAAqB,aAAA,CAAc,SAAA;AAC7D,EAAA,MAAM,YAAY,aAAA,IAAiB,gBAAA;AACnC,EAAA,MAAM,QAAA,GAAW,CAAC,QAAA,IAAY,CAAC,oBAAoB,CAAC,iBAAA;AAEpD,EAAA,MAAM,YAAA,GAAe,CAAC,MAAA,KAAoC;AACxD,IAAA,MAAM,IAAA,GAAO,MAAM,IAAA,CAAK,CAAC,OAAO,EAAA,CAAG,GAAA,KAAQ,OAAO,KAAK,CAAA;AACvD,IAAA,IAAI,IAAA,EAAM;AACR,MAAA,QAAA,CAAS,IAAI,CAAA;AAAA,IACf;AAAA,EACF,CAAA;AAEA,EAAA,MAAM,OAAA,GAA0C,KAAA,CAAM,GAAA,CAAI,CAAC,EAAA,MAAQ;AAAA,IACjE,OAAO,EAAA,CAAG,GAAA;AAAA,IACV,OAAO,EAAA,CAAG,IAAA;AAAA,IACV,MAAA,EAAQ,EAAA,CAAG,IAAA,CAAK,IAAA,CAAK,KAAA,CAAM,KAAA;AAAA,IAC3B,MAAM,EAAA,CAAG;AAAA,GACX,CAAE,CAAA;AAEF,EAAA,MAAM,KAAA,GAAQ,gBAAgB,EAAE,OAAA,EAAS,UAAU,QAAA,EAAU,iBAAA,EAAmB,eAAe,CAAA;AAC/F,EAAA,MAAM,OAAA,GAAU,CAAC,CAAC,SAAA,IAAa,QAAA;AAE/B,EAAA,2CACG,KAAA,EAAA,EAAI,YAAA,EAAY,SAAA,CAAU,UAAA,CAAW,iBAAiB,SAAA,EAAA,kBACrD,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAU,4BAAA;AAAA,MACV,OAAA,EAAS,KAAA;AAAA,MACT,WAAA,EAAa,KAAA;AAAA,MACb,qBAAA,EAAuB,KAAA;AAAA,MACvB,QAAA,EAAU,YAAA;AAAA,MACV,OAAA;AAAA,MACA,SAAA;AAAA,MACA,SAAA;AAAA,MACA,MAAA;AAAA,MACA,eAAA;AAAA,MACA,aAAA,EAAe,GAAA;AAAA,MACf,WAAA;AAAA,MACA,gBAAA,EAAkB,YAAY,6BAAA,GAAgC,sBAAA;AAAA,MAC9D,KAAA;AAAA,MACA,OAAA;AAAA,MACA,cAAA,EAAc,OAAA;AAAA,MACd,cAAA,EAAgB,CAAC,CAAA,KAAM;AACrB,QAAA,IAAI,CAAA,CAAE,QAAQ,yBAAA,CAA0B,CAAA,CAAE,KAAK,SAAS,CAAA,IAAK,MAAM,KAAA,EAAO;AACxE,UAAA,2CACG,KAAA,EAAA,EAAM,UAAA,EAAW,UAAS,cAAA,EAAe,eAAA,EAAA,sCACvC,MAAA,EAAA,IAAA,EAAM,CAAA,CAAE,KAAM,CAAA,EAAO,qBAAC,KAAA,CAAA,aAAA,CAAC,oBAAA,EAAA,EAAqB,QAAQ,CAAA,CAAE,IAAA,CAAK,WAAW,CACzE,CAAA;AAAA,QAEJ;AACA,QAAA,OAAO,EAAE,KAAA,IAAS,EAAA;AAAA,MACpB;AAAA;AAAA,GAEJ,CAAA;AAEJ;AAEA,SAAS,eAAA,CAAgB;AAAA,EACvB,OAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,iBAAA;AAAA,EACA;AACF,CAAA,EAMwC;AACtC,EAAA,IAAI,iBAAA,EAAmB;AACrB,IAAA,OAAO;AAAA,MACL,KAAA,EAAO;AAAA,KACT;AAAA,EACF;AAEA,EAAA,IAAI,QAAA,EAAU;AACZ,IAAA,OAAOA,UAAA,CAAS,UAAU,aAAa,CAAA;AAAA,EACzC;AAEA,EAAA,IAAI,CAAC,QAAA,EAAU;AACb,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,OAAO;AAAA,IACL,KAAA,EAAA,CAAQ,4BAAW,SAAA,IAAa,cAAA;AAAA,IAChC,KAAA,EAAA,CAAQ,4BAAW,SAAA,IAAa,cAAA;AAAA,IAChC,MAAA,EAAQ,EAAA;AAAA,IACR,QAAA,EAAU;AAAA,GACZ;AACF;AAEA,SAASA,UAAA,CAAS,IAAwB,aAAA,EAAkD;AAC1F,EAAA,OAAO;AAAA,IACL,KAAA,EAAO,EAAA,CAAG,IAAA,CAAK,MAAA,CAAO,GAAG,EAAE,CAAA;AAAA,IAC3B,OAAO,EAAA,CAAG,IAAA;AAAA,IACV,MAAA,EAAQ,EAAA,CAAG,IAAA,CAAK,IAAA,CAAK,KAAA,CAAM,KAAA;AAAA,IAC3B,QAAA,EAAU,aAAA;AAAA,IACV,MAAM,EAAA,CAAG;AAAA,GACX;AACF;;;;"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React, { ComponentProps,
|
|
1
|
+
import React, { ComponentProps, ReactElement, ReactNode, Component, ErrorInfo, PureComponent, FunctionComponent, HTMLProps } from 'react';
|
|
2
2
|
import { Input, Segment as Segment$1, monacoTypes, Monaco, ButtonProps, Field, PopoverContent, Switch, SelectCommonProps, InlineLabel } from '@grafana/ui';
|
|
3
|
-
import { DataSourceInstanceSettings,
|
|
4
|
-
import { DataSourceSrv, DataSourceWithBackend, TemplateSrv } from '@grafana/runtime';
|
|
3
|
+
import { DataSourceInstanceSettings, DataSourceJsonData, VariableSuggestion, SelectableValue, TimeRange, DataFrame, MetricFindValue, ThemeSpacingTokens, ScopedVars, VariableModel, DataFrameView, QueryEditorProps as QueryEditorProps$1, DataSourceSettings, RegistryItem, DataSourceApi, Registry, DataQuery as DataQuery$1, PanelData, DataQueryRequest, DataQueryResponse, LoadingState } from '@grafana/data';
|
|
5
4
|
import { JsonTree } from '@react-awesome-query-builder/ui';
|
|
6
5
|
import { DataQuery } from '@grafana/schema';
|
|
6
|
+
import { DataSourceWithBackend, TemplateSrv } from '@grafana/runtime';
|
|
7
7
|
import { SqlLanguage } from 'sql-formatter';
|
|
8
8
|
import { Grammar } from 'prismjs';
|
|
9
9
|
import { Observable } from 'rxjs';
|
|
@@ -46,8 +46,16 @@ interface DatePickerWithInputProps extends Omit<ComponentProps<typeof Input>, 'r
|
|
|
46
46
|
declare const DatePickerWithInput: (props: DatePickerWithInputProps) => React.JSX.Element;
|
|
47
47
|
|
|
48
48
|
interface Props$s {
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Receives the selected data source's list item (`uid`, `type`, `name`, `meta`). Call
|
|
51
|
+
* `getDataSourceInstanceSettings(ds.uid)` from `@grafana/plugin-compat` if you need the full settings.
|
|
52
|
+
*/
|
|
53
|
+
onChange: (ds: Pick<DataSourceInstanceSettings, 'uid' | 'type' | 'name' | 'meta'>) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Reference to the selected data source, resolved the way Grafana does: uid, name, template variable or
|
|
56
|
+
* built-in. `null`/`undefined` resolves to the default data source.
|
|
57
|
+
*/
|
|
58
|
+
current?: string | null;
|
|
51
59
|
hideTextValue?: boolean;
|
|
52
60
|
onBlur?: () => void;
|
|
53
61
|
autoFocus?: boolean;
|
|
@@ -62,20 +70,7 @@ interface Props$s {
|
|
|
62
70
|
pluginId?: string;
|
|
63
71
|
noDefault?: boolean;
|
|
64
72
|
}
|
|
65
|
-
|
|
66
|
-
error?: string;
|
|
67
|
-
}
|
|
68
|
-
declare class DataSourcePicker extends PureComponent<Props$s, State$1> {
|
|
69
|
-
dataSourceSrv: DataSourceSrv;
|
|
70
|
-
static defaultProps: Partial<Props$s>;
|
|
71
|
-
state: State$1;
|
|
72
|
-
constructor(props: Props$s);
|
|
73
|
-
componentDidMount(): void;
|
|
74
|
-
onChange: (item: SelectableValue<string>) => void;
|
|
75
|
-
private getCurrentValue;
|
|
76
|
-
getDataSourceOptions(): Array<SelectableValue<string>>;
|
|
77
|
-
render(): React.JSX.Element;
|
|
78
|
-
}
|
|
73
|
+
declare function DataSourcePicker({ onChange, current: currentProp, hideTextValue, onBlur, autoFocus, openMenuOnFocus, placeholder, noDefault, }: Props$s): React.JSX.Element;
|
|
79
74
|
|
|
80
75
|
type DataLinkConfig = {
|
|
81
76
|
field: string;
|
|
@@ -1522,8 +1517,6 @@ declare function useHealthChecks(): {
|
|
|
1522
1517
|
retry: (uid: string) => void;
|
|
1523
1518
|
};
|
|
1524
1519
|
|
|
1525
|
-
declare function resolvePluginName(pluginType: string): string;
|
|
1526
|
-
|
|
1527
1520
|
type UseDatasourceSchemaResult = {
|
|
1528
1521
|
schema: DatasourceConfigSchema | null;
|
|
1529
1522
|
loading: boolean;
|
|
@@ -2019,5 +2012,5 @@ interface RequestLoopOptions<TQuery extends DataQuery$1 = DataQuery$1> {
|
|
|
2019
2012
|
*/
|
|
2020
2013
|
declare function getRequestLooper<T extends DataQuery$1 = DataQuery$1>(req: DataQueryRequest<T>, options: RequestLoopOptions<T>): Observable<DataQueryResponse>;
|
|
2021
2014
|
|
|
2022
|
-
export { AUTH_GROUP_IDS, AccessoryButton, AdvancedHttpSettings, Auth, AuthMethod, BINARY_OPERATIONS_KEY, CatalogSelector, CompletionItemInsertTextRule, CompletionItemKind, CompletionItemPriority, ConfigDescriptionLink, ConfigSection, ConfigSubSection, ConnectionSettings, CustomHeadersSettings, DataLink, DataLinks, DataSourceDescription, DataSourcePicker, DatasetSelector, DatasourceConfigWizard, DatasourceErrorBoundary, DatasourceWithAsyncBackend, DatePicker, DatePickerWithInput, DebounceInput, EditorField, EditorFieldGroup, EditorHeader, EditorList, EditorMode, EditorRow, EditorRows, EditorStack, EditorSwitch, FlexItem, GroupByRow, InlineSelect, InputGroup, LabelFilters, LinkedToken, MacroType, OperationExplainedBox, OperationList, OperationListExplained, OperationsEditorRow, OperatorType, QUERY_FORMAT_OPTIONS, QueryBuilderHints, QueryEditorMode, QueryEditorModeToggle, QueryEditorRow, QueryFormat, QueryHeaderSwitch, QueryModellerBase, QueryOptionGroup, ROOT_CONFIG_FIELDS, RawQuery, RunQueryButton, RunQueryButtons, SQLEditor, SQLEditorMode, SQLEditorTestUtils, SecureSocksProxyToggle, Segment, Space, SqlDatasource, SqlQueryEditor, StatementPosition, SuggestionKind, TLSSettings, TableSelector, TokenType, buildCelContext, buildCloneDatasourcePayload, buildCreateDatasourcePayload, buildUpdateDatasourcePayload, clearExpressionCache, computeVirtualFieldValues, convertLegacyAuthProps, datasourceToProvisioningYaml, evaluateCelDirect, evaluateCelExpression, evaluateComputedRead, evaluateDependsOn, extractFieldRefs, fetchConfigSchema, formKey, formatDate, formatYamlDiff, generateLLMHint, generateProvisioningTemplate, generateTroubleshootingFields, getConfigSchema, getRequestLooper, getStandardSQLCompletionProvider, getWatchedValue, language as grafanaStandardSQLLanguage, conf as grafanaStandardSQLLanguageConf, isAuthGroupId, isValidCelExpression, parseDependsOn, resolveActiveOverride, resolveGroups,
|
|
2023
|
-
export type { Aggregate, AllowedValuesValidationRule, Props$c as AuthProps, BaseFieldRef, BaseValidationRule, ColumnDefinition, ComputedMapping, ConfigField, ConfigGroup, CustomMeta, CustomValidationRule, DB, DataLinkConfig, DatasourceConfigSchema, DatasourceConfigWizardProps, DatasourceHealth, DatePickerProps, DatePickerWithInputProps, DebounceInputProps, DirectMapping, Expression, FieldEffect, FieldItemSchema, FieldKind, FieldOption, FieldOverride, FieldPack, FieldPackID, FieldPatch, FieldRelationship, FieldUI, FieldValidationRule, FormState, HealthState, IndexedPairMapping, Instruction, ItemCountValidationRule, LanguageCompletionProvider, LanguageDefinition, LengthValidationRule, MappingField, MetaDefinition, NameValue, PatternValidationRule, PositionContext, Props$s as Props, QueryBuilderLabelFilter, QueryBuilderOperation, QueryBuilderOperationDefinition, QueryBuilderOperationParamDef, QueryBuilderOperationParamEditorProps, QueryBuilderOperationParamValue, QueryEditorProps, QueryRowFilter, QueryStats, QueryWithDefaults, RAQBFieldTypes, RangeValidationRule, RelationshipType, RequestLoopOptions, ResolvedGroup, ResourceSelectorProps, ResponseParser, Role, RunQueryButtonsProps, RunningQueryInfo, SQLConnectionLimits, SQLExpression, SQLFilters, SQLMonarchLanguage, SQLOptions, SQLQuery, SQLSelectableValue, SchemaDefinition, SecureFieldState, SegmentProps, SqlQueryForInterpolation, SqlQueryModel,
|
|
2015
|
+
export { AUTH_GROUP_IDS, AccessoryButton, AdvancedHttpSettings, Auth, AuthMethod, BINARY_OPERATIONS_KEY, CatalogSelector, CompletionItemInsertTextRule, CompletionItemKind, CompletionItemPriority, ConfigDescriptionLink, ConfigSection, ConfigSubSection, ConnectionSettings, CustomHeadersSettings, DataLink, DataLinks, DataSourceDescription, DataSourcePicker, DatasetSelector, DatasourceConfigWizard, DatasourceErrorBoundary, DatasourceWithAsyncBackend, DatePicker, DatePickerWithInput, DebounceInput, EditorField, EditorFieldGroup, EditorHeader, EditorList, EditorMode, EditorRow, EditorRows, EditorStack, EditorSwitch, FlexItem, GroupByRow, InlineSelect, InputGroup, LabelFilters, LinkedToken, MacroType, OperationExplainedBox, OperationList, OperationListExplained, OperationsEditorRow, OperatorType, QUERY_FORMAT_OPTIONS, QueryBuilderHints, QueryEditorMode, QueryEditorModeToggle, QueryEditorRow, QueryFormat, QueryHeaderSwitch, QueryModellerBase, QueryOptionGroup, ROOT_CONFIG_FIELDS, RawQuery, RunQueryButton, RunQueryButtons, SQLEditor, SQLEditorMode, SQLEditorTestUtils, SecureSocksProxyToggle, Segment, Space, SqlDatasource, SqlQueryEditor, StatementPosition, SuggestionKind, TLSSettings, TableSelector, TokenType, buildCelContext, buildCloneDatasourcePayload, buildCreateDatasourcePayload, buildUpdateDatasourcePayload, clearExpressionCache, computeVirtualFieldValues, convertLegacyAuthProps, datasourceToProvisioningYaml, evaluateCelDirect, evaluateCelExpression, evaluateComputedRead, evaluateDependsOn, extractFieldRefs, fetchConfigSchema, formKey, formatDate, formatYamlDiff, generateLLMHint, generateProvisioningTemplate, generateTroubleshootingFields, getConfigSchema, getRequestLooper, getStandardSQLCompletionProvider, getWatchedValue, language as grafanaStandardSQLLanguage, conf as grafanaStandardSQLLanguageConf, isAuthGroupId, isValidCelExpression, parseDependsOn, resolveActiveOverride, resolveGroups, resolveRequiredFieldsGroup, toOption, useDatasourceSchema, useHealthChecks };
|
|
2016
|
+
export type { Aggregate, AllowedValuesValidationRule, Props$c as AuthProps, BaseFieldRef, BaseValidationRule, ColumnDefinition, ComputedMapping, ConfigField, ConfigGroup, CustomMeta, CustomValidationRule, DB, DataLinkConfig, DatasourceConfigSchema, DatasourceConfigWizardProps, DatasourceHealth, DatePickerProps, DatePickerWithInputProps, DebounceInputProps, DirectMapping, Expression, FieldEffect, FieldItemSchema, FieldKind, FieldOption, FieldOverride, FieldPack, FieldPackID, FieldPatch, FieldRelationship, FieldUI, FieldValidationRule, FormState, HealthState, IndexedPairMapping, Instruction, ItemCountValidationRule, LanguageCompletionProvider, LanguageDefinition, LengthValidationRule, MappingField, MetaDefinition, NameValue, PatternValidationRule, PositionContext, Props$s as Props, QueryBuilderLabelFilter, QueryBuilderOperation, QueryBuilderOperationDefinition, QueryBuilderOperationParamDef, QueryBuilderOperationParamEditorProps, QueryBuilderOperationParamValue, QueryEditorProps, QueryRowFilter, QueryStats, QueryWithDefaults, RAQBFieldTypes, RangeValidationRule, RelationshipType, RequestLoopOptions, ResolvedGroup, ResourceSelectorProps, ResponseParser, Role, RunQueryButtonsProps, RunningQueryInfo, SQLConnectionLimits, SQLExpression, SQLFilters, SQLMonarchLanguage, SQLOptions, SQLQuery, SQLSelectableValue, SchemaDefinition, SecureFieldState, SegmentProps, SqlQueryForInterpolation, SqlQueryModel, StatementPlacementProvider, StorageMapping, SuggestionKindProvider, Props$f as TLSSettingsProps, TableDefinition, TableFieldSchema, TableIdentifier, TableSchema, TargetLocation, TestQueryModel, UIComponent, UIWidth, ValidationResults, ValueType, VisualQuery, VisualQueryBinary, VisualQueryModeller };
|
package/dist/esm/index.js
CHANGED
|
@@ -40,7 +40,6 @@ export { AdvancedHttpSettings } from './components/ConfigEditor/AdvancedSettings
|
|
|
40
40
|
export { DatasourceConfigWizard } from './components/ConfigEditor/DatasourceConfigWizard/DatasourceConfigWizard.js';
|
|
41
41
|
export { DatasourceErrorBoundary } from './components/ConfigEditor/DatasourceConfigWizard/DatasourceErrorBoundary.js';
|
|
42
42
|
export { useHealthChecks } from './components/ConfigEditor/DatasourceConfigWizard/hooks/useHealthChecks.js';
|
|
43
|
-
export { resolvePluginName } from './components/ConfigEditor/DatasourceConfigWizard/resolvePluginName.js';
|
|
44
43
|
export { fetchConfigSchema, useDatasourceSchema } from './components/ConfigEditor/DatasourceConfigWizard/hooks/useDatasourceSchema.js';
|
|
45
44
|
export { buildCelContext, clearExpressionCache, evaluateCelDirect, evaluateCelExpression, extractFieldRefs, isValidCelExpression } from './components/ConfigEditor/DatasourceConfigWizard/cel.js';
|
|
46
45
|
export { AUTH_GROUP_IDS, computeVirtualFieldValues, evaluateComputedRead, evaluateDependsOn, formKey, getWatchedValue, isAuthGroupId, parseDependsOn, resolveActiveOverride, resolveGroups, resolveRequiredFieldsGroup } from './components/ConfigEditor/DatasourceConfigWizard/config.js';
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/plugin-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+ssh://git@github.com/grafana/plugin-ui.git"
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
76
|
"@emotion/css": "11.13.5",
|
|
77
|
+
"@grafana/plugin-compat": "0.11.0",
|
|
77
78
|
"@hello-pangea/dnd": "17.0.0",
|
|
78
79
|
"@marcbachmann/cel-js": "7.6.1",
|
|
79
80
|
"@react-awesome-query-builder/ui": "6.6.15",
|
|
@@ -136,7 +137,7 @@
|
|
|
136
137
|
"fast-glob": "3.3.3",
|
|
137
138
|
"jest": "29.7.0",
|
|
138
139
|
"jest-environment-jsdom": "29.7.0",
|
|
139
|
-
"jest-fetch-mock": "
|
|
140
|
+
"jest-fetch-mock": "4.2.0",
|
|
140
141
|
"lefthook": "2.1.10",
|
|
141
142
|
"mockdate": "3.0.5",
|
|
142
143
|
"monaco-editor": "0.34.1",
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { getDataSourceSrv } from '@grafana/runtime';
|
|
2
|
-
|
|
3
|
-
let pluginNameCache = null;
|
|
4
|
-
function buildPluginNameCache() {
|
|
5
|
-
var _a;
|
|
6
|
-
if (pluginNameCache) {
|
|
7
|
-
return pluginNameCache;
|
|
8
|
-
}
|
|
9
|
-
const map = /* @__PURE__ */ new Map();
|
|
10
|
-
try {
|
|
11
|
-
const list = getDataSourceSrv().getList();
|
|
12
|
-
for (const ds of list) {
|
|
13
|
-
if (((_a = ds.meta) == null ? void 0 : _a.name) && ds.type && !map.has(ds.type)) {
|
|
14
|
-
map.set(ds.type, ds.meta.name);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
} catch (ex) {
|
|
18
|
-
console.error(ex);
|
|
19
|
-
}
|
|
20
|
-
pluginNameCache = map;
|
|
21
|
-
return map;
|
|
22
|
-
}
|
|
23
|
-
function resolvePluginName(pluginType) {
|
|
24
|
-
var _a;
|
|
25
|
-
const cache = buildPluginNameCache();
|
|
26
|
-
return (_a = cache.get(pluginType)) != null ? _a : pluginType;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export { resolvePluginName };
|
|
30
|
-
//# sourceMappingURL=resolvePluginName.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolvePluginName.js","sources":["../../../../../src/components/ConfigEditor/DatasourceConfigWizard/resolvePluginName.ts"],"sourcesContent":["import { getDataSourceSrv } from '@grafana/runtime';\n\nlet pluginNameCache: Map<string, string> | null = null;\n\nfunction buildPluginNameCache(): Map<string, string> {\n if (pluginNameCache) {\n return pluginNameCache;\n }\n const map = new Map<string, string>();\n try {\n const list = getDataSourceSrv().getList();\n for (const ds of list) {\n if (ds.meta?.name && ds.type && !map.has(ds.type)) {\n map.set(ds.type, ds.meta.name);\n }\n }\n } catch (ex) {\n console.error(ex);\n }\n pluginNameCache = map;\n return map;\n}\n\nexport function resolvePluginName(pluginType: string): string {\n const cache = buildPluginNameCache();\n return cache.get(pluginType) ?? pluginType;\n}\n"],"names":[],"mappings":";;AAEA,IAAI,eAAA,GAA8C,IAAA;AAElD,SAAS,oBAAA,GAA4C;AAJrD,EAAA,IAAA,EAAA;AAKE,EAAA,IAAI,eAAA,EAAiB;AACnB,IAAA,OAAO,eAAA;AAAA,EACT;AACA,EAAA,MAAM,GAAA,uBAAU,GAAA,EAAoB;AACpC,EAAA,IAAI;AACF,IAAA,MAAM,IAAA,GAAO,gBAAA,EAAiB,CAAE,OAAA,EAAQ;AACxC,IAAA,KAAA,MAAW,MAAM,IAAA,EAAM;AACrB,MAAA,IAAA,CAAA,CAAI,EAAA,GAAA,EAAA,CAAG,IAAA,KAAH,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAS,IAAA,KAAQ,EAAA,CAAG,IAAA,IAAQ,CAAC,GAAA,CAAI,GAAA,CAAI,EAAA,CAAG,IAAI,CAAA,EAAG;AACjD,QAAA,GAAA,CAAI,GAAA,CAAI,EAAA,CAAG,IAAA,EAAM,EAAA,CAAG,KAAK,IAAI,CAAA;AAAA,MAC/B;AAAA,IACF;AAAA,EACF,SAAS,EAAA,EAAI;AACX,IAAA,OAAA,CAAQ,MAAM,EAAE,CAAA;AAAA,EAClB;AACA,EAAA,eAAA,GAAkB,GAAA;AAClB,EAAA,OAAO,GAAA;AACT;AAEO,SAAS,kBAAkB,UAAA,EAA4B;AAvB9D,EAAA,IAAA,EAAA;AAwBE,EAAA,MAAM,QAAQ,oBAAA,EAAqB;AACnC,EAAA,OAAA,CAAO,EAAA,GAAA,KAAA,CAAM,GAAA,CAAI,UAAU,CAAA,KAApB,IAAA,GAAA,EAAA,GAAyB,UAAA;AAClC;;;;"}
|