@grafana/aws-sdk 0.0.34 → 0.0.35
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.
|
@@ -182,7 +182,7 @@ var ConnectionConfig = function (props) {
|
|
|
182
182
|
React__default.createElement(ui.InlineField, { label: "Authentication Provider", labelWidth: 28, tooltip: "Specify which AWS credentials chain to use." },
|
|
183
183
|
React__default.createElement(ui.Select, { "aria-label": "Authentication Provider", className: "width-30", value: currentProvider, options: awsAuthProviderOptions.filter(function (opt) { return awsAllowedAuthProviders.includes(opt.value); }), defaultValue: options.jsonData.authType, onChange: function (option) {
|
|
184
184
|
data.onUpdateDatasourceJsonDataOptionSelect(props, 'authType')(option);
|
|
185
|
-
} })),
|
|
185
|
+
}, menuShouldPortal: true })),
|
|
186
186
|
options.jsonData.authType === 'credentials' && (React__default.createElement(ui.InlineField, { label: "Credentials Profile Name", labelWidth: 28, tooltip: "Credentials profile name, as specified in ~/.aws/credentials, leave blank for default." },
|
|
187
187
|
React__default.createElement(ui.Input, { "aria-label": "Credentials Profile Name", className: "width-30", placeholder: "default", value: profile, onChange: data.onUpdateDatasourceJsonDataOption(props, 'profile') }))),
|
|
188
188
|
options.jsonData.authType === 'keys' && (React__default.createElement(React__default.Fragment, null,
|
|
@@ -200,7 +200,7 @@ var ConnectionConfig = function (props) {
|
|
|
200
200
|
!skipEndpoint && (React__default.createElement(ui.InlineField, { label: "Endpoint", labelWidth: 28, tooltip: "Optionally, specify a custom endpoint for the service" },
|
|
201
201
|
React__default.createElement(ui.Input, { "aria-label": "Endpoint", className: "width-30", placeholder: (_j = props.defaultEndpoint) !== null && _j !== void 0 ? _j : 'https://{service}.{region}.amazonaws.com', value: options.jsonData.endpoint || '', onChange: data.onUpdateDatasourceJsonDataOption(props, 'endpoint') }))),
|
|
202
202
|
React__default.createElement(ui.InlineField, { label: "Default Region", labelWidth: 28, tooltip: "Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region." },
|
|
203
|
-
React__default.createElement(ui.Select, { "aria-label": "Default Region", className: "width-30", value: regions.find(function (region) { return region.value === options.jsonData.defaultRegion; }), options: regions, defaultValue: options.jsonData.defaultRegion, allowCustomValue: true, onChange: data.onUpdateDatasourceJsonDataOptionSelect(props, 'defaultRegion'), formatCreateLabel: function (r) { return "Use region: " + r; } })),
|
|
203
|
+
React__default.createElement(ui.Select, { "aria-label": "Default Region", className: "width-30", value: regions.find(function (region) { return region.value === options.jsonData.defaultRegion; }), options: regions, defaultValue: options.jsonData.defaultRegion, allowCustomValue: true, onChange: data.onUpdateDatasourceJsonDataOptionSelect(props, 'defaultRegion'), formatCreateLabel: function (r) { return "Use region: " + r; }, menuShouldPortal: true })),
|
|
204
204
|
props.children));
|
|
205
205
|
};
|
|
206
206
|
|
|
@@ -310,14 +310,13 @@ function ResourceSelector(props) {
|
|
|
310
310
|
}); };
|
|
311
311
|
return (React__default.createElement(ui.InlineField, { label: props.label, labelWidth: props.labelWidth, tooltip: props.tooltip, hidden: props.hidden },
|
|
312
312
|
React__default.createElement("div", { "data-testid": props['data-testid'], title: props.title },
|
|
313
|
-
React__default.createElement(ui.Select, { "aria-label": props.label, options: options,
|
|
313
|
+
React__default.createElement(ui.Select, __assign({}, props, { "aria-label": props.label, options: options, onChange: onChange, isLoading: isLoading, className: props.className || 'min-width-6', onOpenMenu: function () { return props.fetch && onClick(); }, menuShouldPortal: true })))));
|
|
314
314
|
}
|
|
315
315
|
|
|
316
316
|
function ConfigSelect(props) {
|
|
317
317
|
var jsonData = props.options.jsonData;
|
|
318
318
|
var commonProps = {
|
|
319
319
|
title: jsonData.defaultRegion ? '' : 'select a default region',
|
|
320
|
-
disabled: !jsonData.defaultRegion,
|
|
321
320
|
labelWidth: 28,
|
|
322
321
|
className: 'width-30',
|
|
323
322
|
};
|
|
@@ -330,7 +329,7 @@ function ConfigSelect(props) {
|
|
|
330
329
|
props.options.jsonData.externalId,
|
|
331
330
|
props.options.jsonData.profile,
|
|
332
331
|
].concat(props.dependencies);
|
|
333
|
-
return (React__default.createElement(ResourceSelector, __assign({ label: props.label, "data-testid": props['data-testid'], onChange: props.onChange, fetch: props.fetch, value: props.value, saveOptions: props.saveOptions, dependencies: dependencies, hidden: props.hidden, disabled: props.disabled }, commonProps)));
|
|
332
|
+
return (React__default.createElement(ResourceSelector, __assign({ label: props.label, "data-testid": props['data-testid'], onChange: props.onChange, fetch: props.fetch, value: props.value, saveOptions: props.saveOptions, dependencies: dependencies, hidden: props.hidden, disabled: props.disabled || !jsonData.defaultRegion, allowCustomValue: props.allowCustomValue, autoFocus: props.autoFocus, backspaceRemovesValue: props.backspaceRemovesValue, className: props.className, invalid: props.invalid, isClearable: props.isClearable, isMulti: props.isMulti, inputId: props.inputId, showAllSelectedWhenOpen: props.showAllSelectedWhenOpen, maxMenuHeight: props.maxMenuHeight, minMenuHeight: props.minMenuHeight, maxVisibleValues: props.maxVisibleValues, menuPlacement: props.menuPlacement, menuPosition: props.menuPosition, noOptionsMessage: props.noOptionsMessage, onBlur: props.onBlur, onCreateOption: props.onCreateOption, onInputChange: props.onInputChange, placeholder: props.placeholder, width: props.width, isOptionDisabled: props.isOptionDisabled }, commonProps)));
|
|
334
333
|
}
|
|
335
334
|
|
|
336
335
|
function InlineInput(props) {
|
|
@@ -363,7 +362,7 @@ function FormatSelect(props) {
|
|
|
363
362
|
props.onRunQuery();
|
|
364
363
|
};
|
|
365
364
|
return (React__default.createElement(ui.InlineField, { label: "Format as", labelWidth: 11 },
|
|
366
|
-
React__default.createElement(ui.Select, { "aria-label": "Format as", options: props.options, value: props.query.format, onChange: onChangeFormat, className: "width-12" })));
|
|
365
|
+
React__default.createElement(ui.Select, { "aria-label": "Format as", options: props.options, value: props.query.format, onChange: onChangeFormat, className: "width-12", menuShouldPortal: true })));
|
|
367
366
|
}
|
|
368
367
|
|
|
369
368
|
(function (FillValueOptions) {
|
|
@@ -395,7 +394,7 @@ function FillValueSelect(props) {
|
|
|
395
394
|
// Keep the fillMode.value in case FillValueOptions.Value mode is selected back
|
|
396
395
|
fillMode: __assign(__assign({}, props.query.fillMode), { mode: value }) }));
|
|
397
396
|
props.onRunQuery();
|
|
398
|
-
}, className: "width-12" })),
|
|
397
|
+
}, className: "width-12", menuShouldPortal: true })),
|
|
399
398
|
((_c = props.query.fillMode) === null || _c === void 0 ? void 0 : _c.mode) === exports.FillValueOptions.Value && (React__default.createElement(ui.InlineField, { label: "Value", labelWidth: 11 },
|
|
400
399
|
React__default.createElement(ui.Input, { type: "number", "aria-label": "Value", value: props.query.fillMode.value, onChange: function (_a) {
|
|
401
400
|
var currentTarget = _a.currentTarget;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.development.js","sources":["../src/regions.ts","../src/types.ts","../src/providers.ts","../src/ConnectionConfig.tsx","../src/sql/types.ts","../src/sql/ResourceSelector.tsx","../src/sql/ConfigEditor/ConfigSelect.tsx","../src/sql/ConfigEditor/InlineInput.tsx","../src/sql/QueryEditor/QueryCodeEditor.tsx","../src/sql/QueryEditor/FormatSelect.tsx","../src/sql/QueryEditor/FillValueSelect.tsx","../src/sql/utils/utils.ts"],"sourcesContent":["export const standardRegions: string[] = [\n 'af-south-1',\n 'ap-east-1',\n 'ap-northeast-1',\n 'ap-northeast-2',\n 'ap-northeast-3',\n 'ap-south-1',\n 'ap-southeast-1',\n 'ap-southeast-2',\n 'ca-central-1',\n 'cn-north-1',\n 'cn-northwest-1',\n 'eu-central-1',\n 'eu-north-1',\n 'eu-west-1',\n 'eu-west-2',\n 'eu-west-3',\n 'me-south-1',\n 'sa-east-1',\n 'us-east-1',\n 'us-east-2',\n 'us-gov-east-1',\n 'us-gov-west-1',\n 'us-iso-east-1',\n 'us-isob-east-1',\n 'us-west-1',\n 'us-west-2',\n];\n","import { DataSourceJsonData, DataSourceSettings } from '@grafana/data';\n\nexport enum AwsAuthType {\n Keys = 'keys',\n Credentials = 'credentials',\n Default = 'default', // was 'arn',\n EC2IAMRole = 'ec2_iam_role',\n /**\n * @deprecated use default\n */\n ARN = 'arn',\n}\n\nexport interface AwsAuthDataSourceJsonData extends DataSourceJsonData {\n authType?: AwsAuthType;\n assumeRoleArn?: string;\n externalId?: string;\n profile?: string; // Credentials profile name, as specified in ~/.aws/credentials\n defaultRegion?: string; // region if it is not defined by your credentials file\n endpoint?: string;\n}\n\nexport interface AwsAuthDataSourceSecureJsonData {\n accessKey?: string;\n secretKey?: string;\n sessionToken?: string;\n}\n\nexport type AwsAuthDataSourceSettings = DataSourceSettings<AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData>;\n","import { SelectableValue } from '@grafana/data';\nimport { AwsAuthType } from './types';\n\nexport const awsAuthProviderOptions = [\n {\n label: 'Workspace IAM Role',\n value: AwsAuthType.EC2IAMRole,\n },\n {\n label: 'AWS SDK Default',\n value: AwsAuthType.Default,\n },\n {\n label: 'Access & secret key',\n value: AwsAuthType.Keys,\n },\n {\n label: 'Credentials file',\n value: AwsAuthType.Credentials,\n },\n] as Array<SelectableValue<AwsAuthType>>;\n","import React, { FC, useEffect, useState } from 'react';\nimport { Input, Select, InlineField, ButtonGroup, ToolbarButton, FieldSet } from '@grafana/ui';\nimport {\n DataSourcePluginOptionsEditorProps,\n onUpdateDatasourceJsonDataOptionSelect,\n onUpdateDatasourceResetOption,\n onUpdateDatasourceJsonDataOption,\n onUpdateDatasourceSecureJsonDataOption,\n} from '@grafana/data';\n\nimport { standardRegions } from './regions';\nimport { AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData, AwsAuthType } from './types';\nimport { awsAuthProviderOptions } from './providers';\n\nconst toOption = (value: string) => ({ value, label: value });\n\nexport interface ConnectionConfigProps<J = AwsAuthDataSourceJsonData, S = AwsAuthDataSourceSecureJsonData>\n extends DataSourcePluginOptionsEditorProps<J, S> {\n standardRegions?: string[];\n loadRegions?: () => Promise<string[]>;\n defaultEndpoint?: string;\n skipHeader?: boolean;\n skipEndpoint?: boolean;\n children?: React.ReactNode;\n}\n\nexport const ConnectionConfig: FC<ConnectionConfigProps> = (props: ConnectionConfigProps) => {\n const [regions, setRegions] = useState((props.standardRegions || standardRegions).map(toOption));\n const { loadRegions, onOptionsChange, skipHeader = false, skipEndpoint = false } = props;\n const options = props.options;\n let profile = options.jsonData.profile;\n if (profile === undefined) {\n profile = options.database;\n }\n\n const settings = (window as any).grafanaBootData.settings;\n const awsAllowedAuthProviders = settings.awsAllowedAuthProviders ?? [\n AwsAuthType.Default,\n AwsAuthType.Keys,\n AwsAuthType.Credentials,\n ];\n const awsAssumeRoleEnabled = settings.awsAssumeRoleEnabled ?? true;\n\n const currentProvider = awsAuthProviderOptions.find((p) => p.value === options.jsonData.authType);\n\n useEffect(() => {\n // Make sure a authType exists in the current model\n if (!currentProvider && awsAllowedAuthProviders.length) {\n onOptionsChange({\n ...options,\n jsonData: {\n ...options.jsonData,\n authType: awsAllowedAuthProviders[0],\n },\n });\n }\n }, [currentProvider, options, onOptionsChange]);\n\n useEffect(() => {\n if (!loadRegions) {\n return;\n }\n\n loadRegions().then((regions) => setRegions(regions.map(toOption)));\n }, [loadRegions]);\n\n return (\n <FieldSet label={skipHeader ? '' : 'Connection Details'} data-testid=\"connection-config\">\n <InlineField\n label=\"Authentication Provider\"\n labelWidth={28}\n tooltip=\"Specify which AWS credentials chain to use.\"\n >\n <Select\n aria-label=\"Authentication Provider\"\n className=\"width-30\"\n value={currentProvider}\n options={awsAuthProviderOptions.filter((opt) => awsAllowedAuthProviders.includes(opt.value!))}\n defaultValue={options.jsonData.authType}\n onChange={(option) => {\n onUpdateDatasourceJsonDataOptionSelect(props, 'authType')(option);\n }}\n />\n </InlineField>\n {options.jsonData.authType === 'credentials' && (\n <InlineField\n label=\"Credentials Profile Name\"\n labelWidth={28}\n tooltip=\"Credentials profile name, as specified in ~/.aws/credentials, leave blank for default.\"\n >\n <Input\n aria-label=\"Credentials Profile Name\"\n className=\"width-30\"\n placeholder=\"default\"\n value={profile}\n onChange={onUpdateDatasourceJsonDataOption(props, 'profile')}\n />\n </InlineField>\n )}\n\n {options.jsonData.authType === 'keys' && (\n <>\n <InlineField label=\"Access Key ID\" labelWidth={28}>\n {props.options.secureJsonFields?.accessKey ? (\n <ButtonGroup className=\"width-30\">\n <Input disabled placeholder=\"Configured\" />\n <ToolbarButton\n icon=\"edit\"\n tooltip=\"Edit Access Key ID\"\n type=\"button\"\n onClick={onUpdateDatasourceResetOption(props as any, 'accessKey')}\n />\n </ButtonGroup>\n ) : (\n <Input\n aria-label=\"Access Key ID\"\n className=\"width-30\"\n value={options.secureJsonData?.accessKey ?? ''}\n onChange={onUpdateDatasourceSecureJsonDataOption(props, 'accessKey')}\n />\n )}\n </InlineField>\n\n <InlineField label=\"Secret Access Key\" labelWidth={28}>\n {props.options.secureJsonFields?.secretKey ? (\n <ButtonGroup className=\"width-30\">\n <Input disabled placeholder=\"Configured\" />\n <ToolbarButton\n icon=\"edit\"\n type=\"button\"\n tooltip=\"Edit Secret Access Key\"\n onClick={onUpdateDatasourceResetOption(props as any, 'secretKey')}\n />\n </ButtonGroup>\n ) : (\n <Input\n aria-label=\"Secret Access Key\"\n className=\"width-30\"\n value={options.secureJsonData?.secretKey ?? ''}\n onChange={onUpdateDatasourceSecureJsonDataOption(props, 'secretKey')}\n />\n )}\n </InlineField>\n </>\n )}\n\n {awsAssumeRoleEnabled && (\n <>\n <InlineField\n label=\"Assume Role ARN\"\n labelWidth={28}\n tooltip=\"Optionally, specify the ARN of a role to assume. Specifying a role here will ensure that the selected authentication provider is used to assume the specified role rather than using the credentials directly. Leave blank if you don't need to assume a role at all\"\n >\n <Input\n aria-label=\"Assume Role ARN\"\n className=\"width-30\"\n placeholder=\"arn:aws:iam:*\"\n value={options.jsonData.assumeRoleArn || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'assumeRoleArn')}\n />\n </InlineField>\n <InlineField\n label=\"External ID\"\n labelWidth={28}\n tooltip=\"If you are assuming a role in another account, that has been created with an external ID, specify the external ID here.\"\n >\n <Input\n aria-label=\"External ID\"\n className=\"width-30\"\n placeholder=\"External ID\"\n value={options.jsonData.externalId || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'externalId')}\n />\n </InlineField>\n </>\n )}\n {!skipEndpoint && (\n <InlineField label=\"Endpoint\" labelWidth={28} tooltip=\"Optionally, specify a custom endpoint for the service\">\n <Input\n aria-label=\"Endpoint\"\n className=\"width-30\"\n placeholder={props.defaultEndpoint ?? 'https://{service}.{region}.amazonaws.com'}\n value={options.jsonData.endpoint || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'endpoint')}\n />\n </InlineField>\n )}\n <InlineField\n label=\"Default Region\"\n labelWidth={28}\n tooltip=\"Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region.\"\n >\n <Select\n aria-label=\"Default Region\"\n className=\"width-30\"\n value={regions.find((region) => region.value === options.jsonData.defaultRegion)}\n options={regions}\n defaultValue={options.jsonData.defaultRegion}\n allowCustomValue={true}\n onChange={onUpdateDatasourceJsonDataOptionSelect(props, 'defaultRegion')}\n formatCreateLabel={(r) => `Use region: ${r}`}\n />\n </InlineField>\n {props.children}\n </FieldSet>\n );\n};\n","import { DataQuery } from '@grafana/data';\nimport { FillValueOptions } from './QueryEditor/FillValueSelect';\n\nexport const defaultKey = '__default';\n\nexport interface SQLQuery extends DataQuery {\n rawSQL: string;\n format?: number;\n fillMode?: { mode: FillValueOptions; value?: number };\n}\n","import { SelectableValue } from '@grafana/data';\nimport { InlineField, Select } from '@grafana/ui';\nimport { isEqual } from 'lodash';\nimport React, { useEffect, useMemo, useState } from 'react';\n\nimport { defaultKey } from './types';\n\nexport type ResourceSelectorProps = {\n value: string | null;\n onChange: (e: SelectableValue<string> | null) => void;\n dependencies?: Array<string | null | undefined>;\n tooltip?: string;\n label?: string;\n 'data-testid'?: string;\n hidden?: boolean;\n // Options only needed for QueryEditor\n default?: string;\n // Options only needed for the ConfigEditor\n title?: string;\n disabled?: boolean;\n labelWidth?: number;\n className?: string;\n saveOptions?: () => Promise<void>;\n // Either set a way of fetching resources or the resource list\n fetch?: () => Promise<Array<string | SelectableValue<string>>>;\n resources?: string[];\n};\n\nexport function ResourceSelector(props: ResourceSelectorProps) {\n const [resource, setResource] = useState<string | null>(props.value || props.default || null);\n const [resources, setResources] = useState<Array<string | SelectableValue>>(resource ? [resource] : []);\n const [dependencies, setDependencies] = useState(props.dependencies);\n const [isLoading, setIsLoading] = useState(false);\n const [fetched, setFetched] = useState(false);\n const defaultOpts = useMemo(() => {\n const opts: Array<SelectableValue<string>> = [\n {\n label: `default (${props.default})`,\n value: defaultKey,\n description: `Default value set in the data source`,\n },\n ];\n if (props.value && props.value !== defaultKey) {\n opts.push({ label: props.value, value: props.value });\n }\n return opts;\n }, [props.default, props.value]);\n const [options, setOptions] = useState<Array<SelectableValue<string>>>(props.default ? defaultOpts : []);\n useEffect(() => {\n if (props.resources !== undefined) {\n setResources(props.resources);\n }\n }, [props.resources]);\n useEffect(() => {\n const newOptions: Array<SelectableValue<string>> = props.default ? defaultOpts : [];\n if (resources.length) {\n resources.forEach((r) => {\n const value = typeof r === 'string' ? r : r.value;\n if (!newOptions.find((o) => o.value === value)) {\n typeof r === 'string' ? newOptions.push({ label: r, value: r }) : newOptions.push(r);\n }\n });\n setOptions(newOptions);\n } else {\n setOptions([]);\n }\n }, [resources, defaultOpts, props.default]);\n\n useEffect(() => {\n // A change in the dependencies cause a state clean-up\n if (!isEqual(props.dependencies, dependencies)) {\n setFetched(false);\n setResource(null);\n props.onChange(null);\n setDependencies(props.dependencies);\n }\n }, [props, dependencies]);\n\n const fetch = async () => {\n if (fetched) {\n return;\n }\n if (props.saveOptions) {\n await props.saveOptions();\n }\n try {\n const resources = await props.fetch();\n setResources(resources);\n } finally {\n setFetched(true);\n }\n };\n\n const onChange = (e: SelectableValue<string>) => {\n props.onChange(e);\n if (e.value) {\n setResource(e.value);\n }\n };\n const onClick = async () => {\n setIsLoading(true);\n try {\n await fetch();\n } finally {\n setIsLoading(false);\n }\n };\n\n return (\n <InlineField label={props.label} labelWidth={props.labelWidth} tooltip={props.tooltip} hidden={props.hidden}>\n <div data-testid={props['data-testid']} title={props.title}>\n <Select\n aria-label={props.label}\n options={options}\n value={props.value}\n onChange={onChange}\n isLoading={isLoading}\n className={props.className || 'min-width-6'}\n disabled={props.disabled}\n onOpenMenu={() => props.fetch && onClick()}\n />\n </div>\n </InlineField>\n );\n}\n","import React from 'react';\nimport { DataSourcePluginOptionsEditorProps, SelectableValue } from '@grafana/data';\nimport { AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData } from '../../types';\nimport { ResourceSelector } from '../ResourceSelector';\n\nexport interface ConfigSelectProps\n extends DataSourcePluginOptionsEditorProps<AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData> {\n value: string;\n fetch: () => Promise<Array<string | SelectableValue<string>>>;\n onChange: (e: SelectableValue<string> | null) => void;\n dependencies?: string[];\n label?: string;\n 'data-testid'?: string;\n hidden?: boolean;\n disabled?: boolean;\n saveOptions: () => Promise<void>;\n}\n\nexport function ConfigSelect(props: ConfigSelectProps) {\n const { jsonData } = props.options;\n const commonProps = {\n title: jsonData.defaultRegion ? '' : 'select a default region',\n disabled: !jsonData.defaultRegion,\n labelWidth: 28,\n className: 'width-30',\n };\n // Any change in the AWS connection details will affect selectors\n const dependencies: string[] = [\n props.options.jsonData.assumeRoleArn,\n props.options.jsonData.authType,\n props.options.jsonData.defaultRegion,\n props.options.jsonData.endpoint,\n props.options.jsonData.externalId,\n props.options.jsonData.profile,\n ].concat(props.dependencies);\n return (\n <ResourceSelector\n label={props.label}\n data-testid={props['data-testid']}\n onChange={props.onChange}\n fetch={props.fetch}\n value={props.value}\n saveOptions={props.saveOptions}\n dependencies={dependencies}\n hidden={props.hidden}\n disabled={props.disabled}\n {...commonProps}\n />\n );\n}\n","import React from 'react';\nimport { DataSourcePluginOptionsEditorProps } from '@grafana/data';\nimport { AwsAuthDataSourceSecureJsonData } from '../../types';\nimport { InlineField, Input } from '@grafana/ui';\nimport { FormEvent } from 'react-dom/node_modules/@types/react';\n\nexport interface InlineInputProps extends DataSourcePluginOptionsEditorProps<{}, AwsAuthDataSourceSecureJsonData> {\n value: string;\n onChange: (e: FormEvent<HTMLInputElement>) => void;\n label?: string;\n tooltip?: string;\n placeholder?: string;\n 'data-testid'?: string;\n hidden?: boolean;\n disabled?: boolean;\n}\n\nexport function InlineInput(props: InlineInputProps) {\n return (\n <InlineField\n label={props.label}\n labelWidth={28}\n tooltip={props.tooltip}\n hidden={props.hidden}\n disabled={props.disabled}\n >\n <Input\n data-testid={props['data-testid']}\n className=\"width-30\"\n value={props.value}\n onChange={props.onChange}\n placeholder={props.placeholder}\n disabled={props.disabled}\n />\n </InlineField>\n );\n}\n","import { defaults } from 'lodash';\n\nimport React, { useRef, useEffect } from 'react';\nimport { CodeEditor, CodeEditorSuggestionItem } from '@grafana/ui';\nimport { DataQuery } from '@grafana/data';\nimport { MonacoOptions } from '@grafana/ui/components/Monaco/types';\n\ntype EditorProps = {\n width?: number | string;\n height?: number | string;\n readOnly?: boolean;\n showMiniMap?: boolean;\n showLineNumbers?: boolean;\n monacoOptions?: MonacoOptions;\n};\n\ntype Props<TQuery extends DataQuery> = {\n query: TQuery;\n language: string;\n editorProps?: EditorProps;\n onChange: (value: TQuery) => void;\n onRunQuery: () => void;\n getSuggestions: (query: TQuery) => CodeEditorSuggestionItem[];\n};\n\nexport function QueryCodeEditor<TQuery extends DataQuery>(props: Props<TQuery>) {\n const { getSuggestions, query } = props;\n const { rawSQL } = defaults(props.query, { rawSQL: '' });\n const onRawSqlChange = (rawSQL: string) => {\n const query = {\n ...props.query,\n rawSQL,\n };\n props.onChange(query);\n props.onRunQuery();\n };\n\n // Use a reference for suggestions because a bug in CodeEditor getSuggestions\n // https://github.com/grafana/grafana/issues/40121\n // It was been fixed in 8.3 but keeping the workaround here to support older\n // versions.\n const suggestionsRef = useRef<CodeEditorSuggestionItem[]>([]);\n useEffect(() => {\n suggestionsRef.current = getSuggestions(query);\n }, [getSuggestions, query]);\n\n return (\n <CodeEditor\n language={props.language}\n value={rawSQL}\n onBlur={onRawSqlChange}\n showMiniMap={false}\n showLineNumbers={true}\n getSuggestions={() => suggestionsRef.current}\n height=\"240px\"\n {...props.editorProps}\n />\n );\n}\n","import React from 'react';\nimport { DataQuery, SelectableValue } from '@grafana/data';\nimport { InlineField, Select } from '@grafana/ui';\n\nexport type FormatSelectProps<TQuery extends DataQuery, FormatOptions> = {\n query: TQuery;\n options: Array<SelectableValue<FormatOptions>>;\n onChange: (value: TQuery) => void;\n onRunQuery: () => void;\n};\n\nexport function FormatSelect<TQuery extends DataQuery & Record<string, any>, FormatOptions>(\n props: FormatSelectProps<TQuery, FormatOptions>\n) {\n const onChangeFormat = (e: SelectableValue<FormatOptions>) => {\n props.onChange({\n ...props.query,\n format: e.value || 0,\n });\n props.onRunQuery();\n };\n return (\n <InlineField label=\"Format as\" labelWidth={11}>\n <Select\n aria-label=\"Format as\"\n options={props.options}\n value={props.query.format}\n onChange={onChangeFormat}\n className=\"width-12\"\n />\n </InlineField>\n );\n}\n","import React from 'react';\nimport { DataQuery, SelectableValue } from '@grafana/data';\nimport { InlineField, Input, Select } from '@grafana/ui';\n\nexport enum FillValueOptions {\n Previous,\n Null,\n Value,\n}\n\nexport const SelectableFillValueOptions: Array<SelectableValue<FillValueOptions>> = [\n {\n label: 'Previous Value',\n value: FillValueOptions.Previous,\n },\n {\n label: 'NULL',\n value: FillValueOptions.Null,\n },\n {\n label: 'Value',\n value: FillValueOptions.Value,\n },\n];\n\nexport type FillValueSelectProps<TQuery extends DataQuery> = {\n query: TQuery;\n onChange: (value: TQuery) => void;\n onRunQuery: () => void;\n};\n\nexport function FillValueSelect<TQuery extends DataQuery & Record<string, any>>(props: FillValueSelectProps<TQuery>) {\n return (\n <>\n <InlineField label=\"Fill value\" tooltip=\"value to fill missing points\">\n <Select\n aria-label=\"Fill value\"\n options={SelectableFillValueOptions}\n value={props.query.fillMode?.mode ?? FillValueOptions.Previous}\n onChange={({ value }) => {\n props.onChange({\n ...props.query,\n // Keep the fillMode.value in case FillValueOptions.Value mode is selected back\n fillMode: { ...props.query.fillMode, mode: value },\n });\n props.onRunQuery();\n }}\n className=\"width-12\"\n />\n </InlineField>\n {props.query.fillMode?.mode === FillValueOptions.Value && (\n <InlineField label=\"Value\" labelWidth={11}>\n <Input\n type=\"number\"\n aria-label=\"Value\"\n value={props.query.fillMode.value}\n onChange={({ currentTarget }: React.FormEvent<HTMLInputElement>) =>\n props.onChange({\n ...props.query,\n fillMode: {\n mode: FillValueOptions.Value,\n value: currentTarget.valueAsNumber,\n },\n })\n }\n onBlur={() => props.onRunQuery()}\n />\n </InlineField>\n )}\n </>\n );\n}\n","import { ScopedVars, VariableModel } from '@grafana/data';\nimport { SQLQuery } from '../types';\nimport { CodeEditorSuggestionItem, CodeEditorSuggestionItemKind } from '@grafana/ui';\n\n/**\n * Do not execute queries that do not exist yet\n */\nexport function filterSQLQuery(query: SQLQuery): boolean {\n return !!query.rawSQL;\n}\n\nexport function applySQLTemplateVariables(\n query: SQLQuery,\n scopedVars: ScopedVars,\n getTemplateSrv: () => any\n): SQLQuery {\n const templateSrv = getTemplateSrv();\n return {\n ...query,\n rawSQL: templateSrv.replace(query.rawSQL, scopedVars, interpolateVariable),\n };\n}\n\nfunction interpolateVariable(value: string | string[]) {\n if (typeof value === 'string') {\n return value;\n }\n\n const quotedValues = value.map((v) => {\n return quoteLiteral(v);\n });\n return quotedValues.join(',');\n}\n\nfunction quoteLiteral(value: any) {\n return \"'\" + String(value).replace(/'/g, \"''\") + \"'\";\n}\n\nexport const appendTemplateVariablesAsSuggestions = (getTemplateSrv: () => any, sugs: CodeEditorSuggestionItem[]) => {\n const templateSrv = getTemplateSrv();\n const templateSugs: CodeEditorSuggestionItem[] = [];\n templateSrv.getVariables().forEach((variable: VariableModel) => {\n const label = '$' + variable.name;\n let val = templateSrv.replace(label);\n if (val === label) {\n val = '';\n }\n templateSugs.push({\n label,\n kind: CodeEditorSuggestionItemKind.Text,\n detail: `(Template Variable) ${val}`,\n });\n });\n\n return sugs.concat(templateSugs);\n};\n"],"names":["AwsAuthType","useState","useEffect","React","FieldSet","InlineField","Select","onUpdateDatasourceJsonDataOptionSelect","Input","onUpdateDatasourceJsonDataOption","ButtonGroup","ToolbarButton","onUpdateDatasourceResetOption","onUpdateDatasourceSecureJsonDataOption","useMemo","isEqual","defaults","useRef","CodeEditor","FillValueOptions","CodeEditorSuggestionItemKind"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAa,eAAe,GAAa;IACvC,YAAY;IACZ,WAAW;IACX,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,YAAY;IACZ,gBAAgB;IAChB,gBAAgB;IAChB,cAAc;IACd,YAAY;IACZ,gBAAgB;IAChB,cAAc;IACd,YAAY;IACZ,WAAW;IACX,WAAW;IACX,WAAW;IACX,YAAY;IACZ,WAAW;IACX,WAAW;IACX,WAAW;IACX,eAAe;IACf,eAAe;IACf,eAAe;IACf,gBAAgB;IAChB,WAAW;IACX,WAAW;;;ACxBb,WAAY,WAAW;IACrB,4BAAa,CAAA;IACb,0CAA2B,CAAA;IAC3B,kCAAmB,CAAA;IACnB,0CAA2B,CAAA;;;;IAI3B,0BAAW,CAAA;AACb,CAAC,EATWA,mBAAW,KAAXA,mBAAW;;ICCV,sBAAsB,GAAG;IACpC;QACE,KAAK,EAAE,oBAAoB;QAC3B,KAAK,EAAEA,mBAAW,CAAC,UAAU;KAC9B;IACD;QACE,KAAK,EAAE,iBAAiB;QACxB,KAAK,EAAEA,mBAAW,CAAC,OAAO;KAC3B;IACD;QACE,KAAK,EAAE,qBAAqB;QAC5B,KAAK,EAAEA,mBAAW,CAAC,IAAI;KACxB;IACD;QACE,KAAK,EAAE,kBAAkB;QACzB,KAAK,EAAEA,mBAAW,CAAC,WAAW;KAC/B;;;ACLH,IAAM,Q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C;QACrC,IAAI,GAAG,KAAK,KAAK,EAAE;YACjB,GAAG,GAAG,EAAE,CAAC;SACV;QACD,YAAY,CAAC,IAAI,CAAC;YAChB,KAAK,OAAA;YACL,IAAI,EAAEC,+BAA4B,CAAC,IAAI;YACvC,MAAM,EAAE,yBAAuB,GAAK;SACrC,CAAC,CAAC;KACJ,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;AACnC;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.development.js","sources":["../src/regions.ts","../src/types.ts","../src/providers.ts","../src/ConnectionConfig.tsx","../src/sql/types.ts","../src/sql/ResourceSelector.tsx","../src/sql/ConfigEditor/ConfigSelect.tsx","../src/sql/ConfigEditor/InlineInput.tsx","../src/sql/QueryEditor/QueryCodeEditor.tsx","../src/sql/QueryEditor/FormatSelect.tsx","../src/sql/QueryEditor/FillValueSelect.tsx","../src/sql/utils/utils.ts"],"sourcesContent":["export const standardRegions: string[] = [\n 'af-south-1',\n 'ap-east-1',\n 'ap-northeast-1',\n 'ap-northeast-2',\n 'ap-northeast-3',\n 'ap-south-1',\n 'ap-southeast-1',\n 'ap-southeast-2',\n 'ca-central-1',\n 'cn-north-1',\n 'cn-northwest-1',\n 'eu-central-1',\n 'eu-north-1',\n 'eu-west-1',\n 'eu-west-2',\n 'eu-west-3',\n 'me-south-1',\n 'sa-east-1',\n 'us-east-1',\n 'us-east-2',\n 'us-gov-east-1',\n 'us-gov-west-1',\n 'us-iso-east-1',\n 'us-isob-east-1',\n 'us-west-1',\n 'us-west-2',\n];\n","import { DataSourceJsonData, DataSourceSettings } from '@grafana/data';\n\nexport enum AwsAuthType {\n Keys = 'keys',\n Credentials = 'credentials',\n Default = 'default', // was 'arn',\n EC2IAMRole = 'ec2_iam_role',\n /**\n * @deprecated use default\n */\n ARN = 'arn',\n}\n\nexport interface AwsAuthDataSourceJsonData extends DataSourceJsonData {\n authType?: AwsAuthType;\n assumeRoleArn?: string;\n externalId?: string;\n profile?: string; // Credentials profile name, as specified in ~/.aws/credentials\n defaultRegion?: string; // region if it is not defined by your credentials file\n endpoint?: string;\n}\n\nexport interface AwsAuthDataSourceSecureJsonData {\n accessKey?: string;\n secretKey?: string;\n sessionToken?: string;\n}\n\nexport type AwsAuthDataSourceSettings = DataSourceSettings<AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData>;\n","import { SelectableValue } from '@grafana/data';\nimport { AwsAuthType } from './types';\n\nexport const awsAuthProviderOptions = [\n {\n label: 'Workspace IAM Role',\n value: AwsAuthType.EC2IAMRole,\n },\n {\n label: 'AWS SDK Default',\n value: AwsAuthType.Default,\n },\n {\n label: 'Access & secret key',\n value: AwsAuthType.Keys,\n },\n {\n label: 'Credentials file',\n value: AwsAuthType.Credentials,\n },\n] as Array<SelectableValue<AwsAuthType>>;\n","import React, { FC, useEffect, useState } from 'react';\nimport { Input, Select, InlineField, ButtonGroup, ToolbarButton, FieldSet } from '@grafana/ui';\nimport {\n DataSourcePluginOptionsEditorProps,\n onUpdateDatasourceJsonDataOptionSelect,\n onUpdateDatasourceResetOption,\n onUpdateDatasourceJsonDataOption,\n onUpdateDatasourceSecureJsonDataOption,\n} from '@grafana/data';\n\nimport { standardRegions } from './regions';\nimport { AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData, AwsAuthType } from './types';\nimport { awsAuthProviderOptions } from './providers';\n\nconst toOption = (value: string) => ({ value, label: value });\n\nexport interface ConnectionConfigProps<J = AwsAuthDataSourceJsonData, S = AwsAuthDataSourceSecureJsonData>\n extends DataSourcePluginOptionsEditorProps<J, S> {\n standardRegions?: string[];\n loadRegions?: () => Promise<string[]>;\n defaultEndpoint?: string;\n skipHeader?: boolean;\n skipEndpoint?: boolean;\n children?: React.ReactNode;\n}\n\nexport const ConnectionConfig: FC<ConnectionConfigProps> = (props: ConnectionConfigProps) => {\n const [regions, setRegions] = useState((props.standardRegions || standardRegions).map(toOption));\n const { loadRegions, onOptionsChange, skipHeader = false, skipEndpoint = false } = props;\n const options = props.options;\n let profile = options.jsonData.profile;\n if (profile === undefined) {\n profile = options.database;\n }\n\n const settings = (window as any).grafanaBootData.settings;\n const awsAllowedAuthProviders = settings.awsAllowedAuthProviders ?? [\n AwsAuthType.Default,\n AwsAuthType.Keys,\n AwsAuthType.Credentials,\n ];\n const awsAssumeRoleEnabled = settings.awsAssumeRoleEnabled ?? true;\n\n const currentProvider = awsAuthProviderOptions.find((p) => p.value === options.jsonData.authType);\n\n useEffect(() => {\n // Make sure a authType exists in the current model\n if (!currentProvider && awsAllowedAuthProviders.length) {\n onOptionsChange({\n ...options,\n jsonData: {\n ...options.jsonData,\n authType: awsAllowedAuthProviders[0],\n },\n });\n }\n }, [currentProvider, options, onOptionsChange]);\n\n useEffect(() => {\n if (!loadRegions) {\n return;\n }\n\n loadRegions().then((regions) => setRegions(regions.map(toOption)));\n }, [loadRegions]);\n\n return (\n <FieldSet label={skipHeader ? '' : 'Connection Details'} data-testid=\"connection-config\">\n <InlineField\n label=\"Authentication Provider\"\n labelWidth={28}\n tooltip=\"Specify which AWS credentials chain to use.\"\n >\n <Select\n aria-label=\"Authentication Provider\"\n className=\"width-30\"\n value={currentProvider}\n options={awsAuthProviderOptions.filter((opt) => awsAllowedAuthProviders.includes(opt.value!))}\n defaultValue={options.jsonData.authType}\n onChange={(option) => {\n onUpdateDatasourceJsonDataOptionSelect(props, 'authType')(option);\n }}\n menuShouldPortal={true}\n />\n </InlineField>\n {options.jsonData.authType === 'credentials' && (\n <InlineField\n label=\"Credentials Profile Name\"\n labelWidth={28}\n tooltip=\"Credentials profile name, as specified in ~/.aws/credentials, leave blank for default.\"\n >\n <Input\n aria-label=\"Credentials Profile Name\"\n className=\"width-30\"\n placeholder=\"default\"\n value={profile}\n onChange={onUpdateDatasourceJsonDataOption(props, 'profile')}\n />\n </InlineField>\n )}\n\n {options.jsonData.authType === 'keys' && (\n <>\n <InlineField label=\"Access Key ID\" labelWidth={28}>\n {props.options.secureJsonFields?.accessKey ? (\n <ButtonGroup className=\"width-30\">\n <Input disabled placeholder=\"Configured\" />\n <ToolbarButton\n icon=\"edit\"\n tooltip=\"Edit Access Key ID\"\n type=\"button\"\n onClick={onUpdateDatasourceResetOption(props as any, 'accessKey')}\n />\n </ButtonGroup>\n ) : (\n <Input\n aria-label=\"Access Key ID\"\n className=\"width-30\"\n value={options.secureJsonData?.accessKey ?? ''}\n onChange={onUpdateDatasourceSecureJsonDataOption(props, 'accessKey')}\n />\n )}\n </InlineField>\n\n <InlineField label=\"Secret Access Key\" labelWidth={28}>\n {props.options.secureJsonFields?.secretKey ? (\n <ButtonGroup className=\"width-30\">\n <Input disabled placeholder=\"Configured\" />\n <ToolbarButton\n icon=\"edit\"\n type=\"button\"\n tooltip=\"Edit Secret Access Key\"\n onClick={onUpdateDatasourceResetOption(props as any, 'secretKey')}\n />\n </ButtonGroup>\n ) : (\n <Input\n aria-label=\"Secret Access Key\"\n className=\"width-30\"\n value={options.secureJsonData?.secretKey ?? ''}\n onChange={onUpdateDatasourceSecureJsonDataOption(props, 'secretKey')}\n />\n )}\n </InlineField>\n </>\n )}\n\n {awsAssumeRoleEnabled && (\n <>\n <InlineField\n label=\"Assume Role ARN\"\n labelWidth={28}\n tooltip=\"Optionally, specify the ARN of a role to assume. Specifying a role here will ensure that the selected authentication provider is used to assume the specified role rather than using the credentials directly. Leave blank if you don't need to assume a role at all\"\n >\n <Input\n aria-label=\"Assume Role ARN\"\n className=\"width-30\"\n placeholder=\"arn:aws:iam:*\"\n value={options.jsonData.assumeRoleArn || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'assumeRoleArn')}\n />\n </InlineField>\n <InlineField\n label=\"External ID\"\n labelWidth={28}\n tooltip=\"If you are assuming a role in another account, that has been created with an external ID, specify the external ID here.\"\n >\n <Input\n aria-label=\"External ID\"\n className=\"width-30\"\n placeholder=\"External ID\"\n value={options.jsonData.externalId || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'externalId')}\n />\n </InlineField>\n </>\n )}\n {!skipEndpoint && (\n <InlineField label=\"Endpoint\" labelWidth={28} tooltip=\"Optionally, specify a custom endpoint for the service\">\n <Input\n aria-label=\"Endpoint\"\n className=\"width-30\"\n placeholder={props.defaultEndpoint ?? 'https://{service}.{region}.amazonaws.com'}\n value={options.jsonData.endpoint || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'endpoint')}\n />\n </InlineField>\n )}\n <InlineField\n label=\"Default Region\"\n labelWidth={28}\n tooltip=\"Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region.\"\n >\n <Select\n aria-label=\"Default Region\"\n className=\"width-30\"\n value={regions.find((region) => region.value === options.jsonData.defaultRegion)}\n options={regions}\n defaultValue={options.jsonData.defaultRegion}\n allowCustomValue={true}\n onChange={onUpdateDatasourceJsonDataOptionSelect(props, 'defaultRegion')}\n formatCreateLabel={(r) => `Use region: ${r}`}\n menuShouldPortal={true}\n />\n </InlineField>\n {props.children}\n </FieldSet>\n );\n};\n","import { DataQuery } from '@grafana/data';\nimport { FillValueOptions } from './QueryEditor/FillValueSelect';\n\nexport const defaultKey = '__default';\n\nexport interface SQLQuery extends DataQuery {\n rawSQL: string;\n format?: number;\n fillMode?: { mode: FillValueOptions; value?: number };\n}\n","import { SelectableValue } from '@grafana/data';\nimport { InlineField, Select } from '@grafana/ui';\nimport { SelectCommonProps } from '@grafana/ui/components/Select/types';\nimport { isEqual } from 'lodash';\nimport React, { useEffect, useMemo, useState } from 'react';\n\nimport { defaultKey } from './types';\n\nexport interface ResourceSelectorProps extends SelectCommonProps<string> {\n value: string | null;\n dependencies?: Array<string | null | undefined>;\n tooltip?: string;\n label?: string;\n 'data-testid'?: string;\n hidden?: boolean;\n // Options only needed for QueryEditor\n default?: string;\n // Options only needed for the ConfigEditor\n title?: string;\n labelWidth?: number;\n saveOptions?: () => Promise<void>;\n // Either set a way of fetching resources or the resource list\n fetch?: () => Promise<Array<string | SelectableValue<string>>>;\n resources?: string[];\n}\n\nexport function ResourceSelector(props: ResourceSelectorProps) {\n const [resource, setResource] = useState<string | null>(props.value || props.default || null);\n const [resources, setResources] = useState<Array<string | SelectableValue>>(resource ? [resource] : []);\n const [dependencies, setDependencies] = useState(props.dependencies);\n const [isLoading, setIsLoading] = useState(false);\n const [fetched, setFetched] = useState(false);\n const defaultOpts = useMemo(() => {\n const opts: Array<SelectableValue<string>> = [\n {\n label: `default (${props.default})`,\n value: defaultKey,\n description: `Default value set in the data source`,\n },\n ];\n if (props.value && props.value !== defaultKey) {\n opts.push({ label: props.value, value: props.value });\n }\n return opts;\n }, [props.default, props.value]);\n const [options, setOptions] = useState<Array<SelectableValue<string>>>(props.default ? defaultOpts : []);\n useEffect(() => {\n if (props.resources !== undefined) {\n setResources(props.resources);\n }\n }, [props.resources]);\n useEffect(() => {\n const newOptions: Array<SelectableValue<string>> = props.default ? defaultOpts : [];\n if (resources.length) {\n resources.forEach((r) => {\n const value = typeof r === 'string' ? r : r.value;\n if (!newOptions.find((o) => o.value === value)) {\n typeof r === 'string' ? newOptions.push({ label: r, value: r }) : newOptions.push(r);\n }\n });\n setOptions(newOptions);\n } else {\n setOptions([]);\n }\n }, [resources, defaultOpts, props.default]);\n\n useEffect(() => {\n // A change in the dependencies cause a state clean-up\n if (!isEqual(props.dependencies, dependencies)) {\n setFetched(false);\n setResource(null);\n props.onChange(null);\n setDependencies(props.dependencies);\n }\n }, [props, dependencies]);\n\n const fetch = async () => {\n if (fetched) {\n return;\n }\n if (props.saveOptions) {\n await props.saveOptions();\n }\n try {\n const resources = await props.fetch();\n setResources(resources);\n } finally {\n setFetched(true);\n }\n };\n\n const onChange = (e: SelectableValue<string>) => {\n props.onChange(e);\n if (e.value) {\n setResource(e.value);\n }\n };\n const onClick = async () => {\n setIsLoading(true);\n try {\n await fetch();\n } finally {\n setIsLoading(false);\n }\n };\n\n return (\n <InlineField label={props.label} labelWidth={props.labelWidth} tooltip={props.tooltip} hidden={props.hidden}>\n <div data-testid={props['data-testid']} title={props.title}>\n <Select\n {...props}\n aria-label={props.label}\n options={options}\n onChange={onChange}\n isLoading={isLoading}\n className={props.className || 'min-width-6'}\n onOpenMenu={() => props.fetch && onClick()}\n menuShouldPortal={true}\n />\n </div>\n </InlineField>\n );\n}\n","import React from 'react';\nimport { DataSourcePluginOptionsEditorProps, SelectableValue } from '@grafana/data';\nimport { InputActionMeta } from '@grafana/ui/components/Select/types';\nimport { AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData } from '../../types';\nimport { ResourceSelector } from '../ResourceSelector';\n\nexport interface ConfigSelectProps\n extends DataSourcePluginOptionsEditorProps<AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData> {\n value: string;\n fetch: () => Promise<Array<string | SelectableValue<string>>>;\n onChange: (e: SelectableValue<string> | null) => void;\n dependencies?: string[];\n label?: string;\n 'data-testid'?: string;\n hidden?: boolean;\n disabled?: boolean;\n allowCustomValue?: boolean;\n saveOptions: () => Promise<void>;\n autoFocus?: boolean;\n backspaceRemovesValue?: boolean;\n className?: string;\n invalid?: boolean;\n isClearable?: boolean;\n isMulti?: boolean;\n inputId?: string;\n showAllSelectedWhenOpen?: boolean;\n maxMenuHeight?: number;\n minMenuHeight?: number;\n maxVisibleValues?: number;\n menuPlacement?: 'auto' | 'bottom' | 'top';\n menuPosition?: 'fixed' | 'absolute';\n noOptionsMessage?: string;\n onBlur?: () => void;\n onCreateOption?: (value: string) => void;\n onInputChange?: (value: string, actionMeta: InputActionMeta) => void;\n placeholder?: string;\n width?: number;\n isOptionDisabled?: () => boolean;\n}\n\nexport function ConfigSelect(props: ConfigSelectProps) {\n const { jsonData } = props.options;\n const commonProps = {\n title: jsonData.defaultRegion ? '' : 'select a default region',\n labelWidth: 28,\n className: 'width-30',\n };\n // Any change in the AWS connection details will affect selectors\n const dependencies: string[] = [\n props.options.jsonData.assumeRoleArn,\n props.options.jsonData.authType,\n props.options.jsonData.defaultRegion,\n props.options.jsonData.endpoint,\n props.options.jsonData.externalId,\n props.options.jsonData.profile,\n ].concat(props.dependencies);\n return (\n <ResourceSelector\n label={props.label}\n data-testid={props['data-testid']}\n onChange={props.onChange}\n fetch={props.fetch}\n value={props.value}\n saveOptions={props.saveOptions}\n dependencies={dependencies}\n hidden={props.hidden}\n disabled={props.disabled || !jsonData.defaultRegion}\n allowCustomValue={props.allowCustomValue}\n autoFocus={props.autoFocus}\n backspaceRemovesValue={props.backspaceRemovesValue}\n className={props.className}\n invalid={props.invalid}\n isClearable={props.isClearable}\n isMulti={props.isMulti}\n inputId={props.inputId}\n showAllSelectedWhenOpen={props.showAllSelectedWhenOpen}\n maxMenuHeight={props.maxMenuHeight}\n minMenuHeight={props.minMenuHeight}\n maxVisibleValues={props.maxVisibleValues}\n menuPlacement={props.menuPlacement}\n menuPosition={props.menuPosition}\n noOptionsMessage={props.noOptionsMessage}\n onBlur={props.onBlur}\n onCreateOption={props.onCreateOption}\n onInputChange={props.onInputChange}\n placeholder={props.placeholder}\n width={props.width}\n isOptionDisabled={props.isOptionDisabled}\n {...commonProps}\n />\n );\n}\n","import React from 'react';\nimport { DataSourcePluginOptionsEditorProps } from '@grafana/data';\nimport { AwsAuthDataSourceSecureJsonData } from '../../types';\nimport { InlineField, Input } from '@grafana/ui';\nimport { FormEvent } from 'react-dom/node_modules/@types/react';\n\nexport interface InlineInputProps extends DataSourcePluginOptionsEditorProps<{}, AwsAuthDataSourceSecureJsonData> {\n value: string;\n onChange: (e: FormEvent<HTMLInputElement>) => void;\n label?: string;\n tooltip?: string;\n placeholder?: string;\n 'data-testid'?: string;\n hidden?: boolean;\n disabled?: boolean;\n}\n\nexport function InlineInput(props: InlineInputProps) {\n return (\n <InlineField\n label={props.label}\n labelWidth={28}\n tooltip={props.tooltip}\n hidden={props.hidden}\n disabled={props.disabled}\n >\n <Input\n data-testid={props['data-testid']}\n className=\"width-30\"\n value={props.value}\n onChange={props.onChange}\n placeholder={props.placeholder}\n disabled={props.disabled}\n />\n </InlineField>\n );\n}\n","import { defaults } from 'lodash';\n\nimport React, { useRef, useEffect } from 'react';\nimport { CodeEditor, CodeEditorSuggestionItem } from '@grafana/ui';\nimport { DataQuery } from '@grafana/data';\nimport { MonacoOptions } from '@grafana/ui/components/Monaco/types';\n\ntype EditorProps = {\n width?: number | string;\n height?: number | string;\n readOnly?: boolean;\n showMiniMap?: boolean;\n showLineNumbers?: boolean;\n monacoOptions?: MonacoOptions;\n};\n\ntype Props<TQuery extends DataQuery> = {\n query: TQuery;\n language: string;\n editorProps?: EditorProps;\n onChange: (value: TQuery) => void;\n onRunQuery: () => void;\n getSuggestions: (query: TQuery) => CodeEditorSuggestionItem[];\n};\n\nexport function QueryCodeEditor<TQuery extends DataQuery>(props: Props<TQuery>) {\n const { getSuggestions, query } = props;\n const { rawSQL } = defaults(props.query, { rawSQL: '' });\n const onRawSqlChange = (rawSQL: string) => {\n const query = {\n ...props.query,\n rawSQL,\n };\n props.onChange(query);\n props.onRunQuery();\n };\n\n // Use a reference for suggestions because a bug in CodeEditor getSuggestions\n // https://github.com/grafana/grafana/issues/40121\n // It was been fixed in 8.3 but keeping the workaround here to support older\n // versions.\n const suggestionsRef = useRef<CodeEditorSuggestionItem[]>([]);\n useEffect(() => {\n suggestionsRef.current = getSuggestions(query);\n }, [getSuggestions, query]);\n\n return (\n <CodeEditor\n language={props.language}\n value={rawSQL}\n onBlur={onRawSqlChange}\n showMiniMap={false}\n showLineNumbers={true}\n getSuggestions={() => suggestionsRef.current}\n height=\"240px\"\n {...props.editorProps}\n />\n );\n}\n","import React from 'react';\nimport { DataQuery, SelectableValue } from '@grafana/data';\nimport { InlineField, Select } from '@grafana/ui';\n\nexport type FormatSelectProps<TQuery extends DataQuery, FormatOptions> = {\n query: TQuery;\n options: Array<SelectableValue<FormatOptions>>;\n onChange: (value: TQuery) => void;\n onRunQuery: () => void;\n};\n\nexport function FormatSelect<TQuery extends DataQuery & Record<string, any>, FormatOptions>(\n props: FormatSelectProps<TQuery, FormatOptions>\n) {\n const onChangeFormat = (e: SelectableValue<FormatOptions>) => {\n props.onChange({\n ...props.query,\n format: e.value || 0,\n });\n props.onRunQuery();\n };\n return (\n <InlineField label=\"Format as\" labelWidth={11}>\n <Select\n aria-label=\"Format as\"\n options={props.options}\n value={props.query.format}\n onChange={onChangeFormat}\n className=\"width-12\"\n menuShouldPortal={true}\n />\n </InlineField>\n );\n}\n","import React from 'react';\nimport { DataQuery, SelectableValue } from '@grafana/data';\nimport { InlineField, Input, Select } from '@grafana/ui';\n\nexport enum FillValueOptions {\n Previous,\n Null,\n Value,\n}\n\nexport const SelectableFillValueOptions: Array<SelectableValue<FillValueOptions>> = [\n {\n label: 'Previous Value',\n value: FillValueOptions.Previous,\n },\n {\n label: 'NULL',\n value: FillValueOptions.Null,\n },\n {\n label: 'Value',\n value: FillValueOptions.Value,\n },\n];\n\nexport type FillValueSelectProps<TQuery extends DataQuery> = {\n query: TQuery;\n onChange: (value: TQuery) => void;\n onRunQuery: () => void;\n};\n\nexport function FillValueSelect<TQuery extends DataQuery & Record<string, any>>(props: FillValueSelectProps<TQuery>) {\n return (\n <>\n <InlineField label=\"Fill value\" tooltip=\"value to fill missing points\">\n <Select\n aria-label=\"Fill value\"\n options={SelectableFillValueOptions}\n value={props.query.fillMode?.mode ?? FillValueOptions.Previous}\n onChange={({ value }) => {\n props.onChange({\n ...props.query,\n // Keep the fillMode.value in case FillValueOptions.Value mode is selected back\n fillMode: { ...props.query.fillMode, mode: value },\n });\n props.onRunQuery();\n }}\n className=\"width-12\"\n menuShouldPortal={true}\n />\n </InlineField>\n {props.query.fillMode?.mode === FillValueOptions.Value && (\n <InlineField label=\"Value\" labelWidth={11}>\n <Input\n type=\"number\"\n aria-label=\"Value\"\n value={props.query.fillMode.value}\n onChange={({ currentTarget }: React.FormEvent<HTMLInputElement>) =>\n props.onChange({\n ...props.query,\n fillMode: {\n mode: FillValueOptions.Value,\n value: currentTarget.valueAsNumber,\n },\n })\n }\n onBlur={() => props.onRunQuery()}\n />\n </InlineField>\n )}\n </>\n );\n}\n","import { ScopedVars, VariableModel } from '@grafana/data';\nimport { SQLQuery } from '../types';\nimport { CodeEditorSuggestionItem, CodeEditorSuggestionItemKind } from '@grafana/ui';\n\n/**\n * Do not execute queries that do not exist yet\n */\nexport function filterSQLQuery(query: SQLQuery): boolean {\n return !!query.rawSQL;\n}\n\nexport function applySQLTemplateVariables(\n query: SQLQuery,\n scopedVars: ScopedVars,\n getTemplateSrv: () => any\n): SQLQuery {\n const templateSrv = getTemplateSrv();\n return {\n ...query,\n rawSQL: templateSrv.replace(query.rawSQL, scopedVars, interpolateVariable),\n };\n}\n\nfunction interpolateVariable(value: string | string[]) {\n if (typeof value === 'string') {\n return value;\n }\n\n const quotedValues = value.map((v) => {\n return quoteLiteral(v);\n });\n return quotedValues.join(',');\n}\n\nfunction quoteLiteral(value: any) {\n return \"'\" + String(value).replace(/'/g, \"''\") + \"'\";\n}\n\nexport const appendTemplateVariablesAsSuggestions = (getTemplateSrv: () => any, sugs: CodeEditorSuggestionItem[]) => {\n const templateSrv = getTemplateSrv();\n const templateSugs: CodeEditorSuggestionItem[] = [];\n templateSrv.getVariables().forEach((variable: VariableModel) => {\n const label = '$' + variable.name;\n let val = templateSrv.replace(label);\n if (val === label) {\n val = '';\n }\n templateSugs.push({\n label,\n kind: CodeEditorSuggestionItemKind.Text,\n detail: `(Template Variable) ${val}`,\n });\n });\n\n return sugs.concat(templateSugs);\n};\n"],"names":["AwsAuthType","useState","useEffect","React","FieldSet","InlineField","Select","onUpdateDatasourceJsonDataOptionSelect","Input","onUpdateDatasourceJsonDataOption","ButtonGroup","ToolbarButton","onUpdateDatasourceResetOption","onUpdateDatasourceSecureJsonDataOption","useMemo","isEqual","defaults","useRef","CodeEditor","FillValueOptions","CodeEditorSuggestionItemKind"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAa,eAAe,GAAa;IACv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C9B,OAAO,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,GAAG,CAAC;AACvD,CAAC;IAEY,oCAAoC,GAAG,UAAC,cAAyB,EAAE,IAAgC;IAC9G,IAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,IAAM,YAAY,GAA+B,EAAE,CAAC;IACpD,WAAW,CAAC,YAAY,EAAE,CAAC,OAAO,CAAC,UAAC,QAAuB;QACzD,IAAM,KAAK,GAAG,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC;QAClC,IAAI,GAAG,GAAG,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACrC,IAAI,GAAG,KAAK,KAAK,EAAE;YACjB,GAAG,GAAG,EAAE,CAAC;SACV;QACD,YAAY,CAAC,IAAI,CAAC;YAChB,KAAK,OAAA;YACL,IAAI,EAAEC,+BAA4B,CAAC,IAAI;YACvC,MAAM,EAAE,yBAAuB,GAAK;SACrC,CAAC,CAAC;KACJ,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;AACnC;;;;;;;;;;;;;;;"}
|
package/dist/index.production.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),a=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,n=require("@grafana/ui"),l=require("@grafana/data"),o=require("lodash"),r=function(){return(r=Object.assign||function(e){for(var t,a=1,n=arguments.length;a<n;a++)for(var l in t=arguments[a])Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l]);return e}).apply(this,arguments)};function i(e,t,a,n){return new(a||(a=Promise))((function(l,o){function r(e){try{s(n.next(e))}catch(e){o(e)}}function i(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?l(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(r,i)}s((n=n.apply(e,t||[])).next())}))}function s(e,t){var a,n,l,o,r={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(o){return function(i){return function(o){if(a)throw new TypeError("Generator is already executing.");for(;r;)try{if(a=1,n&&(l=2&o[0]?n.return:o[0]?n.throw||((l=n.return)&&l.call(n),0):n.next)&&!(l=l.call(n,o[1])).done)return l;switch(n=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return r.label++,{value:o[1],done:!1};case 5:r.label++,n=o[1],o=[0];continue;case 7:o=r.ops.pop(),r.trys.pop();continue;default:if(!(l=r.trys,(l=l.length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){r=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){r.label=o[1];break}if(6===o[0]&&r.label<l[1]){r.label=l[1],l=o;break}if(l&&r.label<l[2]){r.label=l[2],r.ops.push(o);break}l[2]&&r.ops.pop(),r.trys.pop();continue}o=t.call(e,r)}catch(e){o=[6,e],n=0}finally{a=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,i])}}}function u(e,t){var a="function"==typeof Symbol&&e[Symbol.iterator];if(!a)return e;var n,l,o=a.call(e),r=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)r.push(n.value)}catch(e){l={error:e}}finally{try{n&&!n.done&&(a=o.return)&&a.call(o)}finally{if(l)throw l.error}}return r}var c,d=["af-south-1","ap-east-1","ap-northeast-1","ap-northeast-2","ap-northeast-3","ap-south-1","ap-southeast-1","ap-southeast-2","ca-central-1","cn-north-1","cn-northwest-1","eu-central-1","eu-north-1","eu-west-1","eu-west-2","eu-west-3","me-south-1","sa-east-1","us-east-1","us-east-2","us-gov-east-1","us-gov-west-1","us-iso-east-1","us-isob-east-1","us-west-1","us-west-2"];(c=exports.AwsAuthType||(exports.AwsAuthType={})).Keys="keys",c.Credentials="credentials",c.Default="default",c.EC2IAMRole="ec2_iam_role",c.ARN="arn";var p,f=[{label:"Workspace IAM Role",value:exports.AwsAuthType.EC2IAMRole},{label:"AWS SDK Default",value:exports.AwsAuthType.Default},{label:"Access & secret key",value:exports.AwsAuthType.Keys},{label:"Credentials file",value:exports.AwsAuthType.Credentials}],h=function(e){return{value:e,label:e}};function v(e){var l=this,r=u(t.useState(e.value||e.default||null),2),c=r[0],d=r[1],p=u(t.useState(c?[c]:[]),2),f=p[0],h=p[1],v=u(t.useState(e.dependencies),2),b=v[0],m=v[1],y=u(t.useState(!1),2),g=y[0],w=y[1],E=u(t.useState(!1),2),D=E[0],S=E[1],A=t.useMemo((function(){var t=[{label:"default ("+e.default+")",value:"__default",description:"Default value set in the data source"}];return e.value&&"__default"!==e.value&&t.push({label:e.value,value:e.value}),t}),[e.default,e.value]),x=u(t.useState(e.default?A:[]),2),C=x[0],I=x[1];t.useEffect((function(){void 0!==e.resources&&h(e.resources)}),[e.resources]),t.useEffect((function(){var t=e.default?A:[];f.length?(f.forEach((function(e){var a="string"==typeof e?e:e.value;t.find((function(e){return e.value===a}))||("string"==typeof e?t.push({label:e,value:e}):t.push(e))})),I(t)):I([])}),[f,A,e.default]),t.useEffect((function(){o.isEqual(e.dependencies,b)||(S(!1),d(null),e.onChange(null),m(e.dependencies))}),[e,b]);return a.createElement(n.InlineField,{label:e.label,labelWidth:e.labelWidth,tooltip:e.tooltip,hidden:e.hidden},a.createElement("div",{"data-testid":e["data-testid"],title:e.title},a.createElement(n.Select,{"aria-label":e.label,options:C,value:e.value,onChange:function(t){e.onChange(t),t.value&&d(t.value)},isLoading:g,className:e.className||"min-width-6",disabled:e.disabled,onOpenMenu:function(){return e.fetch&&i(l,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:w(!0),t.label=1;case 1:return t.trys.push([1,,3,4]),[4,i(l,void 0,void 0,(function(){var t;return s(this,(function(a){switch(a.label){case 0:return D?[2]:e.saveOptions?[4,e.saveOptions()]:[3,2];case 1:a.sent(),a.label=2;case 2:return a.trys.push([2,,4,5]),[4,e.fetch()];case 3:return t=a.sent(),h(t),[3,5];case 4:return S(!0),[7];case 5:return[2]}}))}))];case 2:return t.sent(),[3,4];case 3:return w(!1),[7];case 4:return[2]}}))}))}})))}(p=exports.FillValueOptions||(exports.FillValueOptions={}))[p.Previous=0]="Previous",p[p.Null=1]="Null",p[p.Value=2]="Value";var b=[{label:"Previous Value",value:exports.FillValueOptions.Previous},{label:"NULL",value:exports.FillValueOptions.Null},{label:"Value",value:exports.FillValueOptions.Value}];function m(e){return"string"==typeof e?e:e.map((function(e){return function(e){return"'"+String(e).replace(/'/g,"''")+"'"}(e)})).join(",")}exports.ConfigSelect=function(e){var t=e.options.jsonData,n={title:t.defaultRegion?"":"select a default region",disabled:!t.defaultRegion,labelWidth:28,className:"width-30"},l=[e.options.jsonData.assumeRoleArn,e.options.jsonData.authType,e.options.jsonData.defaultRegion,e.options.jsonData.endpoint,e.options.jsonData.externalId,e.options.jsonData.profile].concat(e.dependencies);return a.createElement(v,r({label:e.label,"data-testid":e["data-testid"],onChange:e.onChange,fetch:e.fetch,value:e.value,saveOptions:e.saveOptions,dependencies:l,hidden:e.hidden,disabled:e.disabled},n))},exports.ConnectionConfig=function(e){var o,i,s,c,p,v,b,m,y,g=u(t.useState((e.standardRegions||d).map(h)),2),w=g[0],E=g[1],D=e.loadRegions,S=e.onOptionsChange,A=e.skipHeader,x=void 0!==A&&A,C=e.skipEndpoint,I=void 0!==C&&C,F=e.options,O=F.jsonData.profile;void 0===O&&(O=F.database);var R=window.grafanaBootData.settings,N=null!==(o=R.awsAllowedAuthProviders)&&void 0!==o?o:[exports.AwsAuthType.Default,exports.AwsAuthType.Keys,exports.AwsAuthType.Credentials],V=null===(i=R.awsAssumeRoleEnabled)||void 0===i||i,j=f.find((function(e){return e.value===F.jsonData.authType}));return t.useEffect((function(){!j&&N.length&&S(r(r({},F),{jsonData:r(r({},F.jsonData),{authType:N[0]})}))}),[j,F,S]),t.useEffect((function(){D&&D().then((function(e){return E(e.map(h))}))}),[D]),a.createElement(n.FieldSet,{label:x?"":"Connection Details","data-testid":"connection-config"},a.createElement(n.InlineField,{label:"Authentication Provider",labelWidth:28,tooltip:"Specify which AWS credentials chain to use."},a.createElement(n.Select,{"aria-label":"Authentication Provider",className:"width-30",value:j,options:f.filter((function(e){return N.includes(e.value)})),defaultValue:F.jsonData.authType,onChange:function(t){l.onUpdateDatasourceJsonDataOptionSelect(e,"authType")(t)}})),"credentials"===F.jsonData.authType&&a.createElement(n.InlineField,{label:"Credentials Profile Name",labelWidth:28,tooltip:"Credentials profile name, as specified in ~/.aws/credentials, leave blank for default."},a.createElement(n.Input,{"aria-label":"Credentials Profile Name",className:"width-30",placeholder:"default",value:O,onChange:l.onUpdateDatasourceJsonDataOption(e,"profile")})),"keys"===F.jsonData.authType&&a.createElement(a.Fragment,null,a.createElement(n.InlineField,{label:"Access Key ID",labelWidth:28},(null===(s=e.options.secureJsonFields)||void 0===s?void 0:s.accessKey)?a.createElement(n.ButtonGroup,{className:"width-30"},a.createElement(n.Input,{disabled:!0,placeholder:"Configured"}),a.createElement(n.ToolbarButton,{icon:"edit",tooltip:"Edit Access Key ID",type:"button",onClick:l.onUpdateDatasourceResetOption(e,"accessKey")})):a.createElement(n.Input,{"aria-label":"Access Key ID",className:"width-30",value:null!==(p=null===(c=F.secureJsonData)||void 0===c?void 0:c.accessKey)&&void 0!==p?p:"",onChange:l.onUpdateDatasourceSecureJsonDataOption(e,"accessKey")})),a.createElement(n.InlineField,{label:"Secret Access Key",labelWidth:28},(null===(v=e.options.secureJsonFields)||void 0===v?void 0:v.secretKey)?a.createElement(n.ButtonGroup,{className:"width-30"},a.createElement(n.Input,{disabled:!0,placeholder:"Configured"}),a.createElement(n.ToolbarButton,{icon:"edit",type:"button",tooltip:"Edit Secret Access Key",onClick:l.onUpdateDatasourceResetOption(e,"secretKey")})):a.createElement(n.Input,{"aria-label":"Secret Access Key",className:"width-30",value:null!==(m=null===(b=F.secureJsonData)||void 0===b?void 0:b.secretKey)&&void 0!==m?m:"",onChange:l.onUpdateDatasourceSecureJsonDataOption(e,"secretKey")}))),V&&a.createElement(a.Fragment,null,a.createElement(n.InlineField,{label:"Assume Role ARN",labelWidth:28,tooltip:"Optionally, specify the ARN of a role to assume. Specifying a role here will ensure that the selected authentication provider is used to assume the specified role rather than using the credentials directly. Leave blank if you don't need to assume a role at all"},a.createElement(n.Input,{"aria-label":"Assume Role ARN",className:"width-30",placeholder:"arn:aws:iam:*",value:F.jsonData.assumeRoleArn||"",onChange:l.onUpdateDatasourceJsonDataOption(e,"assumeRoleArn")})),a.createElement(n.InlineField,{label:"External ID",labelWidth:28,tooltip:"If you are assuming a role in another account, that has been created with an external ID, specify the external ID here."},a.createElement(n.Input,{"aria-label":"External ID",className:"width-30",placeholder:"External ID",value:F.jsonData.externalId||"",onChange:l.onUpdateDatasourceJsonDataOption(e,"externalId")}))),!I&&a.createElement(n.InlineField,{label:"Endpoint",labelWidth:28,tooltip:"Optionally, specify a custom endpoint for the service"},a.createElement(n.Input,{"aria-label":"Endpoint",className:"width-30",placeholder:null!==(y=e.defaultEndpoint)&&void 0!==y?y:"https://{service}.{region}.amazonaws.com",value:F.jsonData.endpoint||"",onChange:l.onUpdateDatasourceJsonDataOption(e,"endpoint")})),a.createElement(n.InlineField,{label:"Default Region",labelWidth:28,tooltip:"Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region."},a.createElement(n.Select,{"aria-label":"Default Region",className:"width-30",value:w.find((function(e){return e.value===F.jsonData.defaultRegion})),options:w,defaultValue:F.jsonData.defaultRegion,allowCustomValue:!0,onChange:l.onUpdateDatasourceJsonDataOptionSelect(e,"defaultRegion"),formatCreateLabel:function(e){return"Use region: "+e}})),e.children)},exports.FillValueSelect=function(e){var t,l,o;return a.createElement(a.Fragment,null,a.createElement(n.InlineField,{label:"Fill value",tooltip:"value to fill missing points"},a.createElement(n.Select,{"aria-label":"Fill value",options:b,value:null!==(l=null===(t=e.query.fillMode)||void 0===t?void 0:t.mode)&&void 0!==l?l:exports.FillValueOptions.Previous,onChange:function(t){var a=t.value;e.onChange(r(r({},e.query),{fillMode:r(r({},e.query.fillMode),{mode:a})})),e.onRunQuery()},className:"width-12"})),(null===(o=e.query.fillMode)||void 0===o?void 0:o.mode)===exports.FillValueOptions.Value&&a.createElement(n.InlineField,{label:"Value",labelWidth:11},a.createElement(n.Input,{type:"number","aria-label":"Value",value:e.query.fillMode.value,onChange:function(t){var a=t.currentTarget;return e.onChange(r(r({},e.query),{fillMode:{mode:exports.FillValueOptions.Value,value:a.valueAsNumber}}))},onBlur:function(){return e.onRunQuery()}})))},exports.FormatSelect=function(e){return a.createElement(n.InlineField,{label:"Format as",labelWidth:11},a.createElement(n.Select,{"aria-label":"Format as",options:e.options,value:e.query.format,onChange:function(t){e.onChange(r(r({},e.query),{format:t.value||0})),e.onRunQuery()},className:"width-12"}))},exports.InlineInput=function(e){return a.createElement(n.InlineField,{label:e.label,labelWidth:28,tooltip:e.tooltip,hidden:e.hidden,disabled:e.disabled},a.createElement(n.Input,{"data-testid":e["data-testid"],className:"width-30",value:e.value,onChange:e.onChange,placeholder:e.placeholder,disabled:e.disabled}))},exports.QueryCodeEditor=function(e){var l=e.getSuggestions,i=e.query,s=o.defaults(e.query,{rawSQL:""}).rawSQL,u=t.useRef([]);return t.useEffect((function(){u.current=l(i)}),[l,i]),a.createElement(n.CodeEditor,r({language:e.language,value:s,onBlur:function(t){var a=r(r({},e.query),{rawSQL:t});e.onChange(a),e.onRunQuery()},showMiniMap:!1,showLineNumbers:!0,getSuggestions:function(){return u.current},height:"240px"},e.editorProps))},exports.ResourceSelector=v,exports.appendTemplateVariablesAsSuggestions=function(e,t){var a=e(),l=[];return a.getVariables().forEach((function(e){var t="$"+e.name,o=a.replace(t);o===t&&(o=""),l.push({label:t,kind:n.CodeEditorSuggestionItemKind.Text,detail:"(Template Variable) "+o})})),t.concat(l)},exports.applySQLTemplateVariables=function(e,t,a){var n=a();return r(r({},e),{rawSQL:n.replace(e.rawSQL,t,m)})},exports.awsAuthProviderOptions=f,exports.filterSQLQuery=function(e){return!!e.rawSQL},exports.standardRegions=d;
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),a=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,n=require("@grafana/ui"),l=require("@grafana/data"),o=require("lodash"),i=function(){return(i=Object.assign||function(e){for(var t,a=1,n=arguments.length;a<n;a++)for(var l in t=arguments[a])Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l]);return e}).apply(this,arguments)};function r(e,t,a,n){return new(a||(a=Promise))((function(l,o){function i(e){try{s(n.next(e))}catch(e){o(e)}}function r(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?l(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(i,r)}s((n=n.apply(e,t||[])).next())}))}function s(e,t){var a,n,l,o,i={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]};return o={next:r(0),throw:r(1),return:r(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function r(o){return function(r){return function(o){if(a)throw new TypeError("Generator is already executing.");for(;i;)try{if(a=1,n&&(l=2&o[0]?n.return:o[0]?n.throw||((l=n.return)&&l.call(n),0):n.next)&&!(l=l.call(n,o[1])).done)return l;switch(n=0,l&&(o=[2&o[0],l.value]),o[0]){case 0:case 1:l=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,n=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(l=i.trys,(l=l.length>0&&l[l.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!l||o[1]>l[0]&&o[1]<l[3])){i.label=o[1];break}if(6===o[0]&&i.label<l[1]){i.label=l[1],l=o;break}if(l&&i.label<l[2]){i.label=l[2],i.ops.push(o);break}l[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],n=0}finally{a=l=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,r])}}}function u(e,t){var a="function"==typeof Symbol&&e[Symbol.iterator];if(!a)return e;var n,l,o=a.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)i.push(n.value)}catch(e){l={error:e}}finally{try{n&&!n.done&&(a=o.return)&&a.call(o)}finally{if(l)throw l.error}}return i}var c,d=["af-south-1","ap-east-1","ap-northeast-1","ap-northeast-2","ap-northeast-3","ap-south-1","ap-southeast-1","ap-southeast-2","ca-central-1","cn-north-1","cn-northwest-1","eu-central-1","eu-north-1","eu-west-1","eu-west-2","eu-west-3","me-south-1","sa-east-1","us-east-1","us-east-2","us-gov-east-1","us-gov-west-1","us-iso-east-1","us-isob-east-1","us-west-1","us-west-2"];(c=exports.AwsAuthType||(exports.AwsAuthType={})).Keys="keys",c.Credentials="credentials",c.Default="default",c.EC2IAMRole="ec2_iam_role",c.ARN="arn";var p,h=[{label:"Workspace IAM Role",value:exports.AwsAuthType.EC2IAMRole},{label:"AWS SDK Default",value:exports.AwsAuthType.Default},{label:"Access & secret key",value:exports.AwsAuthType.Keys},{label:"Credentials file",value:exports.AwsAuthType.Credentials}],f=function(e){return{value:e,label:e}};function v(e){var l=this,c=u(t.useState(e.value||e.default||null),2),d=c[0],p=c[1],h=u(t.useState(d?[d]:[]),2),f=h[0],v=h[1],m=u(t.useState(e.dependencies),2),b=m[0],y=m[1],g=u(t.useState(!1),2),w=g[0],E=g[1],D=u(t.useState(!1),2),S=D[0],C=D[1],x=t.useMemo((function(){var t=[{label:"default ("+e.default+")",value:"__default",description:"Default value set in the data source"}];return e.value&&"__default"!==e.value&&t.push({label:e.value,value:e.value}),t}),[e.default,e.value]),A=u(t.useState(e.default?x:[]),2),I=A[0],O=A[1];t.useEffect((function(){void 0!==e.resources&&v(e.resources)}),[e.resources]),t.useEffect((function(){var t=e.default?x:[];f.length?(f.forEach((function(e){var a="string"==typeof e?e:e.value;t.find((function(e){return e.value===a}))||("string"==typeof e?t.push({label:e,value:e}):t.push(e))})),O(t)):O([])}),[f,x,e.default]),t.useEffect((function(){o.isEqual(e.dependencies,b)||(C(!1),p(null),e.onChange(null),y(e.dependencies))}),[e,b]);return a.createElement(n.InlineField,{label:e.label,labelWidth:e.labelWidth,tooltip:e.tooltip,hidden:e.hidden},a.createElement("div",{"data-testid":e["data-testid"],title:e.title},a.createElement(n.Select,i({},e,{"aria-label":e.label,options:I,onChange:function(t){e.onChange(t),t.value&&p(t.value)},isLoading:w,className:e.className||"min-width-6",onOpenMenu:function(){return e.fetch&&r(l,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:E(!0),t.label=1;case 1:return t.trys.push([1,,3,4]),[4,r(l,void 0,void 0,(function(){var t;return s(this,(function(a){switch(a.label){case 0:return S?[2]:e.saveOptions?[4,e.saveOptions()]:[3,2];case 1:a.sent(),a.label=2;case 2:return a.trys.push([2,,4,5]),[4,e.fetch()];case 3:return t=a.sent(),v(t),[3,5];case 4:return C(!0),[7];case 5:return[2]}}))}))];case 2:return t.sent(),[3,4];case 3:return E(!1),[7];case 4:return[2]}}))}))},menuShouldPortal:!0}))))}(p=exports.FillValueOptions||(exports.FillValueOptions={}))[p.Previous=0]="Previous",p[p.Null=1]="Null",p[p.Value=2]="Value";var m=[{label:"Previous Value",value:exports.FillValueOptions.Previous},{label:"NULL",value:exports.FillValueOptions.Null},{label:"Value",value:exports.FillValueOptions.Value}];function b(e){return"string"==typeof e?e:e.map((function(e){return function(e){return"'"+String(e).replace(/'/g,"''")+"'"}(e)})).join(",")}exports.ConfigSelect=function(e){var t=e.options.jsonData,n={title:t.defaultRegion?"":"select a default region",labelWidth:28,className:"width-30"},l=[e.options.jsonData.assumeRoleArn,e.options.jsonData.authType,e.options.jsonData.defaultRegion,e.options.jsonData.endpoint,e.options.jsonData.externalId,e.options.jsonData.profile].concat(e.dependencies);return a.createElement(v,i({label:e.label,"data-testid":e["data-testid"],onChange:e.onChange,fetch:e.fetch,value:e.value,saveOptions:e.saveOptions,dependencies:l,hidden:e.hidden,disabled:e.disabled||!t.defaultRegion,allowCustomValue:e.allowCustomValue,autoFocus:e.autoFocus,backspaceRemovesValue:e.backspaceRemovesValue,className:e.className,invalid:e.invalid,isClearable:e.isClearable,isMulti:e.isMulti,inputId:e.inputId,showAllSelectedWhenOpen:e.showAllSelectedWhenOpen,maxMenuHeight:e.maxMenuHeight,minMenuHeight:e.minMenuHeight,maxVisibleValues:e.maxVisibleValues,menuPlacement:e.menuPlacement,menuPosition:e.menuPosition,noOptionsMessage:e.noOptionsMessage,onBlur:e.onBlur,onCreateOption:e.onCreateOption,onInputChange:e.onInputChange,placeholder:e.placeholder,width:e.width,isOptionDisabled:e.isOptionDisabled},n))},exports.ConnectionConfig=function(e){var o,r,s,c,p,v,m,b,y,g=u(t.useState((e.standardRegions||d).map(f)),2),w=g[0],E=g[1],D=e.loadRegions,S=e.onOptionsChange,C=e.skipHeader,x=void 0!==C&&C,A=e.skipEndpoint,I=void 0!==A&&A,O=e.options,F=O.jsonData.profile;void 0===F&&(F=O.database);var R=window.grafanaBootData.settings,V=null!==(o=R.awsAllowedAuthProviders)&&void 0!==o?o:[exports.AwsAuthType.Default,exports.AwsAuthType.Keys,exports.AwsAuthType.Credentials],N=null===(r=R.awsAssumeRoleEnabled)||void 0===r||r,j=h.find((function(e){return e.value===O.jsonData.authType}));return t.useEffect((function(){!j&&V.length&&S(i(i({},O),{jsonData:i(i({},O.jsonData),{authType:V[0]})}))}),[j,O,S]),t.useEffect((function(){D&&D().then((function(e){return E(e.map(f))}))}),[D]),a.createElement(n.FieldSet,{label:x?"":"Connection Details","data-testid":"connection-config"},a.createElement(n.InlineField,{label:"Authentication Provider",labelWidth:28,tooltip:"Specify which AWS credentials chain to use."},a.createElement(n.Select,{"aria-label":"Authentication Provider",className:"width-30",value:j,options:h.filter((function(e){return V.includes(e.value)})),defaultValue:O.jsonData.authType,onChange:function(t){l.onUpdateDatasourceJsonDataOptionSelect(e,"authType")(t)},menuShouldPortal:!0})),"credentials"===O.jsonData.authType&&a.createElement(n.InlineField,{label:"Credentials Profile Name",labelWidth:28,tooltip:"Credentials profile name, as specified in ~/.aws/credentials, leave blank for default."},a.createElement(n.Input,{"aria-label":"Credentials Profile Name",className:"width-30",placeholder:"default",value:F,onChange:l.onUpdateDatasourceJsonDataOption(e,"profile")})),"keys"===O.jsonData.authType&&a.createElement(a.Fragment,null,a.createElement(n.InlineField,{label:"Access Key ID",labelWidth:28},(null===(s=e.options.secureJsonFields)||void 0===s?void 0:s.accessKey)?a.createElement(n.ButtonGroup,{className:"width-30"},a.createElement(n.Input,{disabled:!0,placeholder:"Configured"}),a.createElement(n.ToolbarButton,{icon:"edit",tooltip:"Edit Access Key ID",type:"button",onClick:l.onUpdateDatasourceResetOption(e,"accessKey")})):a.createElement(n.Input,{"aria-label":"Access Key ID",className:"width-30",value:null!==(p=null===(c=O.secureJsonData)||void 0===c?void 0:c.accessKey)&&void 0!==p?p:"",onChange:l.onUpdateDatasourceSecureJsonDataOption(e,"accessKey")})),a.createElement(n.InlineField,{label:"Secret Access Key",labelWidth:28},(null===(v=e.options.secureJsonFields)||void 0===v?void 0:v.secretKey)?a.createElement(n.ButtonGroup,{className:"width-30"},a.createElement(n.Input,{disabled:!0,placeholder:"Configured"}),a.createElement(n.ToolbarButton,{icon:"edit",type:"button",tooltip:"Edit Secret Access Key",onClick:l.onUpdateDatasourceResetOption(e,"secretKey")})):a.createElement(n.Input,{"aria-label":"Secret Access Key",className:"width-30",value:null!==(b=null===(m=O.secureJsonData)||void 0===m?void 0:m.secretKey)&&void 0!==b?b:"",onChange:l.onUpdateDatasourceSecureJsonDataOption(e,"secretKey")}))),N&&a.createElement(a.Fragment,null,a.createElement(n.InlineField,{label:"Assume Role ARN",labelWidth:28,tooltip:"Optionally, specify the ARN of a role to assume. Specifying a role here will ensure that the selected authentication provider is used to assume the specified role rather than using the credentials directly. Leave blank if you don't need to assume a role at all"},a.createElement(n.Input,{"aria-label":"Assume Role ARN",className:"width-30",placeholder:"arn:aws:iam:*",value:O.jsonData.assumeRoleArn||"",onChange:l.onUpdateDatasourceJsonDataOption(e,"assumeRoleArn")})),a.createElement(n.InlineField,{label:"External ID",labelWidth:28,tooltip:"If you are assuming a role in another account, that has been created with an external ID, specify the external ID here."},a.createElement(n.Input,{"aria-label":"External ID",className:"width-30",placeholder:"External ID",value:O.jsonData.externalId||"",onChange:l.onUpdateDatasourceJsonDataOption(e,"externalId")}))),!I&&a.createElement(n.InlineField,{label:"Endpoint",labelWidth:28,tooltip:"Optionally, specify a custom endpoint for the service"},a.createElement(n.Input,{"aria-label":"Endpoint",className:"width-30",placeholder:null!==(y=e.defaultEndpoint)&&void 0!==y?y:"https://{service}.{region}.amazonaws.com",value:O.jsonData.endpoint||"",onChange:l.onUpdateDatasourceJsonDataOption(e,"endpoint")})),a.createElement(n.InlineField,{label:"Default Region",labelWidth:28,tooltip:"Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region."},a.createElement(n.Select,{"aria-label":"Default Region",className:"width-30",value:w.find((function(e){return e.value===O.jsonData.defaultRegion})),options:w,defaultValue:O.jsonData.defaultRegion,allowCustomValue:!0,onChange:l.onUpdateDatasourceJsonDataOptionSelect(e,"defaultRegion"),formatCreateLabel:function(e){return"Use region: "+e},menuShouldPortal:!0})),e.children)},exports.FillValueSelect=function(e){var t,l,o;return a.createElement(a.Fragment,null,a.createElement(n.InlineField,{label:"Fill value",tooltip:"value to fill missing points"},a.createElement(n.Select,{"aria-label":"Fill value",options:m,value:null!==(l=null===(t=e.query.fillMode)||void 0===t?void 0:t.mode)&&void 0!==l?l:exports.FillValueOptions.Previous,onChange:function(t){var a=t.value;e.onChange(i(i({},e.query),{fillMode:i(i({},e.query.fillMode),{mode:a})})),e.onRunQuery()},className:"width-12",menuShouldPortal:!0})),(null===(o=e.query.fillMode)||void 0===o?void 0:o.mode)===exports.FillValueOptions.Value&&a.createElement(n.InlineField,{label:"Value",labelWidth:11},a.createElement(n.Input,{type:"number","aria-label":"Value",value:e.query.fillMode.value,onChange:function(t){var a=t.currentTarget;return e.onChange(i(i({},e.query),{fillMode:{mode:exports.FillValueOptions.Value,value:a.valueAsNumber}}))},onBlur:function(){return e.onRunQuery()}})))},exports.FormatSelect=function(e){return a.createElement(n.InlineField,{label:"Format as",labelWidth:11},a.createElement(n.Select,{"aria-label":"Format as",options:e.options,value:e.query.format,onChange:function(t){e.onChange(i(i({},e.query),{format:t.value||0})),e.onRunQuery()},className:"width-12",menuShouldPortal:!0}))},exports.InlineInput=function(e){return a.createElement(n.InlineField,{label:e.label,labelWidth:28,tooltip:e.tooltip,hidden:e.hidden,disabled:e.disabled},a.createElement(n.Input,{"data-testid":e["data-testid"],className:"width-30",value:e.value,onChange:e.onChange,placeholder:e.placeholder,disabled:e.disabled}))},exports.QueryCodeEditor=function(e){var l=e.getSuggestions,r=e.query,s=o.defaults(e.query,{rawSQL:""}).rawSQL,u=t.useRef([]);return t.useEffect((function(){u.current=l(r)}),[l,r]),a.createElement(n.CodeEditor,i({language:e.language,value:s,onBlur:function(t){var a=i(i({},e.query),{rawSQL:t});e.onChange(a),e.onRunQuery()},showMiniMap:!1,showLineNumbers:!0,getSuggestions:function(){return u.current},height:"240px"},e.editorProps))},exports.ResourceSelector=v,exports.appendTemplateVariablesAsSuggestions=function(e,t){var a=e(),l=[];return a.getVariables().forEach((function(e){var t="$"+e.name,o=a.replace(t);o===t&&(o=""),l.push({label:t,kind:n.CodeEditorSuggestionItemKind.Text,detail:"(Template Variable) "+o})})),t.concat(l)},exports.applySQLTemplateVariables=function(e,t,a){var n=a();return i(i({},e),{rawSQL:n.replace(e.rawSQL,t,b)})},exports.awsAuthProviderOptions=h,exports.filterSQLQuery=function(e){return!!e.rawSQL},exports.standardRegions=d;
|
|
2
2
|
//# sourceMappingURL=index.production.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.production.js","sources":["../src/types.ts","../src/regions.ts","../src/sql/QueryEditor/FillValueSelect.tsx","../src/providers.ts","../src/ConnectionConfig.tsx","../src/sql/ResourceSelector.tsx","../src/sql/types.ts","../src/sql/utils/utils.ts","../src/sql/ConfigEditor/ConfigSelect.tsx","../src/sql/QueryEditor/FormatSelect.tsx","../src/sql/ConfigEditor/InlineInput.tsx","../src/sql/QueryEditor/QueryCodeEditor.tsx"],"sourcesContent":["import { DataSourceJsonData, DataSourceSettings } from '@grafana/data';\n\nexport enum AwsAuthType {\n Keys = 'keys',\n Credentials = 'credentials',\n Default = 'default', // was 'arn',\n EC2IAMRole = 'ec2_iam_role',\n /**\n * @deprecated use default\n */\n ARN = 'arn',\n}\n\nexport interface AwsAuthDataSourceJsonData extends DataSourceJsonData {\n authType?: AwsAuthType;\n assumeRoleArn?: string;\n externalId?: string;\n profile?: string; // Credentials profile name, as specified in ~/.aws/credentials\n defaultRegion?: string; // region if it is not defined by your credentials file\n endpoint?: string;\n}\n\nexport interface AwsAuthDataSourceSecureJsonData {\n accessKey?: string;\n secretKey?: string;\n sessionToken?: string;\n}\n\nexport type AwsAuthDataSourceSettings = DataSourceSettings<AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData>;\n","export const standardRegions: string[] = [\n 'af-south-1',\n 'ap-east-1',\n 'ap-northeast-1',\n 'ap-northeast-2',\n 'ap-northeast-3',\n 'ap-south-1',\n 'ap-southeast-1',\n 'ap-southeast-2',\n 'ca-central-1',\n 'cn-north-1',\n 'cn-northwest-1',\n 'eu-central-1',\n 'eu-north-1',\n 'eu-west-1',\n 'eu-west-2',\n 'eu-west-3',\n 'me-south-1',\n 'sa-east-1',\n 'us-east-1',\n 'us-east-2',\n 'us-gov-east-1',\n 'us-gov-west-1',\n 'us-iso-east-1',\n 'us-isob-east-1',\n 'us-west-1',\n 'us-west-2',\n];\n","import React from 'react';\nimport { DataQuery, SelectableValue } from '@grafana/data';\nimport { InlineField, Input, Select } from '@grafana/ui';\n\nexport enum FillValueOptions {\n Previous,\n Null,\n Value,\n}\n\nexport const SelectableFillValueOptions: Array<SelectableValue<FillValueOptions>> = [\n {\n label: 'Previous Value',\n value: FillValueOptions.Previous,\n },\n {\n label: 'NULL',\n value: FillValueOptions.Null,\n },\n {\n label: 'Value',\n value: FillValueOptions.Value,\n },\n];\n\nexport type FillValueSelectProps<TQuery extends DataQuery> = {\n query: TQuery;\n onChange: (value: TQuery) => void;\n onRunQuery: () => void;\n};\n\nexport function FillValueSelect<TQuery extends DataQuery & Record<string, any>>(props: FillValueSelectProps<TQuery>) {\n return (\n <>\n <InlineField label=\"Fill value\" tooltip=\"value to fill missing points\">\n <Select\n aria-label=\"Fill value\"\n options={SelectableFillValueOptions}\n value={props.query.fillMode?.mode ?? FillValueOptions.Previous}\n onChange={({ value }) => {\n props.onChange({\n ...props.query,\n // Keep the fillMode.value in case FillValueOptions.Value mode is selected back\n fillMode: { ...props.query.fillMode, mode: value },\n });\n props.onRunQuery();\n }}\n className=\"width-12\"\n />\n </InlineField>\n {props.query.fillMode?.mode === FillValueOptions.Value && (\n <InlineField label=\"Value\" labelWidth={11}>\n <Input\n type=\"number\"\n aria-label=\"Value\"\n value={props.query.fillMode.value}\n onChange={({ currentTarget }: React.FormEvent<HTMLInputElement>) =>\n props.onChange({\n ...props.query,\n fillMode: {\n mode: FillValueOptions.Value,\n value: currentTarget.valueAsNumber,\n },\n })\n }\n onBlur={() => props.onRunQuery()}\n />\n </InlineField>\n )}\n </>\n );\n}\n","import { SelectableValue } from '@grafana/data';\nimport { AwsAuthType } from './types';\n\nexport const awsAuthProviderOptions = [\n {\n label: 'Workspace IAM Role',\n value: AwsAuthType.EC2IAMRole,\n },\n {\n label: 'AWS SDK Default',\n value: AwsAuthType.Default,\n },\n {\n label: 'Access & secret key',\n value: AwsAuthType.Keys,\n },\n {\n label: 'Credentials file',\n value: AwsAuthType.Credentials,\n },\n] as Array<SelectableValue<AwsAuthType>>;\n","import React, { FC, useEffect, useState } from 'react';\nimport { Input, Select, InlineField, ButtonGroup, ToolbarButton, FieldSet } from '@grafana/ui';\nimport {\n DataSourcePluginOptionsEditorProps,\n onUpdateDatasourceJsonDataOptionSelect,\n onUpdateDatasourceResetOption,\n onUpdateDatasourceJsonDataOption,\n onUpdateDatasourceSecureJsonDataOption,\n} from '@grafana/data';\n\nimport { standardRegions } from './regions';\nimport { AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData, AwsAuthType } from './types';\nimport { awsAuthProviderOptions } from './providers';\n\nconst toOption = (value: string) => ({ value, label: value });\n\nexport interface ConnectionConfigProps<J = AwsAuthDataSourceJsonData, S = AwsAuthDataSourceSecureJsonData>\n extends DataSourcePluginOptionsEditorProps<J, S> {\n standardRegions?: string[];\n loadRegions?: () => Promise<string[]>;\n defaultEndpoint?: string;\n skipHeader?: boolean;\n skipEndpoint?: boolean;\n children?: React.ReactNode;\n}\n\nexport const ConnectionConfig: FC<ConnectionConfigProps> = (props: ConnectionConfigProps) => {\n const [regions, setRegions] = useState((props.standardRegions || standardRegions).map(toOption));\n const { loadRegions, onOptionsChange, skipHeader = false, skipEndpoint = false } = props;\n const options = props.options;\n let profile = options.jsonData.profile;\n if (profile === undefined) {\n profile = options.database;\n }\n\n const settings = (window as any).grafanaBootData.settings;\n const awsAllowedAuthProviders = settings.awsAllowedAuthProviders ?? [\n AwsAuthType.Default,\n AwsAuthType.Keys,\n AwsAuthType.Credentials,\n ];\n const awsAssumeRoleEnabled = settings.awsAssumeRoleEnabled ?? true;\n\n const currentProvider = awsAuthProviderOptions.find((p) => p.value === options.jsonData.authType);\n\n useEffect(() => {\n // Make sure a authType exists in the current model\n if (!currentProvider && awsAllowedAuthProviders.length) {\n onOptionsChange({\n ...options,\n jsonData: {\n ...options.jsonData,\n authType: awsAllowedAuthProviders[0],\n },\n });\n }\n }, [currentProvider, options, onOptionsChange]);\n\n useEffect(() => {\n if (!loadRegions) {\n return;\n }\n\n loadRegions().then((regions) => setRegions(regions.map(toOption)));\n }, [loadRegions]);\n\n return (\n <FieldSet label={skipHeader ? '' : 'Connection Details'} data-testid=\"connection-config\">\n <InlineField\n label=\"Authentication Provider\"\n labelWidth={28}\n tooltip=\"Specify which AWS credentials chain to use.\"\n >\n <Select\n aria-label=\"Authentication Provider\"\n className=\"width-30\"\n value={currentProvider}\n options={awsAuthProviderOptions.filter((opt) => awsAllowedAuthProviders.includes(opt.value!))}\n defaultValue={options.jsonData.authType}\n onChange={(option) => {\n onUpdateDatasourceJsonDataOptionSelect(props, 'authType')(option);\n }}\n />\n </InlineField>\n {options.jsonData.authType === 'credentials' && (\n <InlineField\n label=\"Credentials Profile Name\"\n labelWidth={28}\n tooltip=\"Credentials profile name, as specified in ~/.aws/credentials, leave blank for default.\"\n >\n <Input\n aria-label=\"Credentials Profile Name\"\n className=\"width-30\"\n placeholder=\"default\"\n value={profile}\n onChange={onUpdateDatasourceJsonDataOption(props, 'profile')}\n />\n </InlineField>\n )}\n\n {options.jsonData.authType === 'keys' && (\n <>\n <InlineField label=\"Access Key ID\" labelWidth={28}>\n {props.options.secureJsonFields?.accessKey ? (\n <ButtonGroup className=\"width-30\">\n <Input disabled placeholder=\"Configured\" />\n <ToolbarButton\n icon=\"edit\"\n tooltip=\"Edit Access Key ID\"\n type=\"button\"\n onClick={onUpdateDatasourceResetOption(props as any, 'accessKey')}\n />\n </ButtonGroup>\n ) : (\n <Input\n aria-label=\"Access Key ID\"\n className=\"width-30\"\n value={options.secureJsonData?.accessKey ?? ''}\n onChange={onUpdateDatasourceSecureJsonDataOption(props, 'accessKey')}\n />\n )}\n </InlineField>\n\n <InlineField label=\"Secret Access Key\" labelWidth={28}>\n {props.options.secureJsonFields?.secretKey ? (\n <ButtonGroup className=\"width-30\">\n <Input disabled placeholder=\"Configured\" />\n <ToolbarButton\n icon=\"edit\"\n type=\"button\"\n tooltip=\"Edit Secret Access Key\"\n onClick={onUpdateDatasourceResetOption(props as any, 'secretKey')}\n />\n </ButtonGroup>\n ) : (\n <Input\n aria-label=\"Secret Access Key\"\n className=\"width-30\"\n value={options.secureJsonData?.secretKey ?? ''}\n onChange={onUpdateDatasourceSecureJsonDataOption(props, 'secretKey')}\n />\n )}\n </InlineField>\n </>\n )}\n\n {awsAssumeRoleEnabled && (\n <>\n <InlineField\n label=\"Assume Role ARN\"\n labelWidth={28}\n tooltip=\"Optionally, specify the ARN of a role to assume. Specifying a role here will ensure that the selected authentication provider is used to assume the specified role rather than using the credentials directly. Leave blank if you don't need to assume a role at all\"\n >\n <Input\n aria-label=\"Assume Role ARN\"\n className=\"width-30\"\n placeholder=\"arn:aws:iam:*\"\n value={options.jsonData.assumeRoleArn || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'assumeRoleArn')}\n />\n </InlineField>\n <InlineField\n label=\"External ID\"\n labelWidth={28}\n tooltip=\"If you are assuming a role in another account, that has been created with an external ID, specify the external ID here.\"\n >\n <Input\n aria-label=\"External ID\"\n className=\"width-30\"\n placeholder=\"External ID\"\n value={options.jsonData.externalId || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'externalId')}\n />\n </InlineField>\n </>\n )}\n {!skipEndpoint && (\n <InlineField label=\"Endpoint\" labelWidth={28} tooltip=\"Optionally, specify a custom endpoint for the service\">\n <Input\n aria-label=\"Endpoint\"\n className=\"width-30\"\n placeholder={props.defaultEndpoint ?? 'https://{service}.{region}.amazonaws.com'}\n value={options.jsonData.endpoint || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'endpoint')}\n />\n </InlineField>\n )}\n <InlineField\n label=\"Default Region\"\n labelWidth={28}\n tooltip=\"Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region.\"\n >\n <Select\n aria-label=\"Default Region\"\n className=\"width-30\"\n value={regions.find((region) => region.value === options.jsonData.defaultRegion)}\n options={regions}\n defaultValue={options.jsonData.defaultRegion}\n allowCustomValue={true}\n onChange={onUpdateDatasourceJsonDataOptionSelect(props, 'defaultRegion')}\n formatCreateLabel={(r) => `Use region: ${r}`}\n />\n </InlineField>\n {props.children}\n </FieldSet>\n );\n};\n","import { SelectableValue } from '@grafana/data';\nimport { InlineField, Select } from '@grafana/ui';\nimport { isEqual } from 'lodash';\nimport React, { useEffect, useMemo, useState } from 'react';\n\nimport { defaultKey } from './types';\n\nexport type ResourceSelectorProps = {\n value: string | null;\n onChange: (e: SelectableValue<string> | null) => void;\n dependencies?: Array<string | null | undefined>;\n tooltip?: string;\n label?: string;\n 'data-testid'?: string;\n hidden?: boolean;\n // Options only needed for QueryEditor\n default?: string;\n // Options only needed for the ConfigEditor\n title?: string;\n disabled?: boolean;\n labelWidth?: number;\n className?: string;\n saveOptions?: () => Promise<void>;\n // Either set a way of fetching resources or the resource list\n fetch?: () => Promise<Array<string | SelectableValue<string>>>;\n resources?: string[];\n};\n\nexport function ResourceSelector(props: ResourceSelectorProps) {\n const [resource, setResource] = useState<string | null>(props.value || props.default || null);\n const [resources, setResources] = useState<Array<string | SelectableValue>>(resource ? [resource] : []);\n const [dependencies, setDependencies] = useState(props.dependencies);\n const [isLoading, setIsLoading] = useState(false);\n const [fetched, setFetched] = useState(false);\n const defaultOpts = useMemo(() => {\n const opts: Array<SelectableValue<string>> = [\n {\n label: `default (${props.default})`,\n value: defaultKey,\n description: `Default value set in the data source`,\n },\n ];\n if (props.value && props.value !== defaultKey) {\n opts.push({ label: props.value, value: props.value });\n }\n return opts;\n }, [props.default, props.value]);\n const [options, setOptions] = useState<Array<SelectableValue<string>>>(props.default ? defaultOpts : []);\n useEffect(() => {\n if (props.resources !== undefined) {\n setResources(props.resources);\n }\n }, [props.resources]);\n useEffect(() => {\n const newOptions: Array<SelectableValue<string>> = props.default ? defaultOpts : [];\n if (resources.length) {\n resources.forEach((r) => {\n const value = typeof r === 'string' ? r : r.value;\n if (!newOptions.find((o) => o.value === value)) {\n typeof r === 'string' ? newOptions.push({ label: r, value: r }) : newOptions.push(r);\n }\n });\n setOptions(newOptions);\n } else {\n setOptions([]);\n }\n }, [resources, defaultOpts, props.default]);\n\n useEffect(() => {\n // A change in the dependencies cause a state clean-up\n if (!isEqual(props.dependencies, dependencies)) {\n setFetched(false);\n setResource(null);\n props.onChange(null);\n setDependencies(props.dependencies);\n }\n }, [props, dependencies]);\n\n const fetch = async () => {\n if (fetched) {\n return;\n }\n if (props.saveOptions) {\n await props.saveOptions();\n }\n try {\n const resources = await props.fetch();\n setResources(resources);\n } finally {\n setFetched(true);\n }\n };\n\n const onChange = (e: SelectableValue<string>) => {\n props.onChange(e);\n if (e.value) {\n setResource(e.value);\n }\n };\n const onClick = async () => {\n setIsLoading(true);\n try {\n await fetch();\n } finally {\n setIsLoading(false);\n }\n };\n\n return (\n <InlineField label={props.label} labelWidth={props.labelWidth} tooltip={props.tooltip} hidden={props.hidden}>\n <div data-testid={props['data-testid']} title={props.title}>\n <Select\n aria-label={props.label}\n options={options}\n value={props.value}\n onChange={onChange}\n isLoading={isLoading}\n className={props.className || 'min-width-6'}\n disabled={props.disabled}\n onOpenMenu={() => props.fetch && onClick()}\n />\n </div>\n </InlineField>\n );\n}\n","import { DataQuery } from '@grafana/data';\nimport { FillValueOptions } from './QueryEditor/FillValueSelect';\n\nexport const defaultKey = '__default';\n\nexport interface SQLQuery extends DataQuery {\n rawSQL: string;\n format?: number;\n fillMode?: { mode: FillValueOptions; value?: number };\n}\n","import { ScopedVars, VariableModel } from '@grafana/data';\nimport { SQLQuery } from '../types';\nimport { CodeEditorSuggestionItem, CodeEditorSuggestionItemKind } from '@grafana/ui';\n\n/**\n * Do not execute queries that do not exist yet\n */\nexport function filterSQLQuery(query: SQLQuery): boolean {\n return !!query.rawSQL;\n}\n\nexport function applySQLTemplateVariables(\n query: SQLQuery,\n scopedVars: ScopedVars,\n getTemplateSrv: () => any\n): SQLQuery {\n const templateSrv = getTemplateSrv();\n return {\n ...query,\n rawSQL: templateSrv.replace(query.rawSQL, scopedVars, interpolateVariable),\n };\n}\n\nfunction interpolateVariable(value: string | string[]) {\n if (typeof value === 'string') {\n return value;\n }\n\n const quotedValues = value.map((v) => {\n return quoteLiteral(v);\n });\n return quotedValues.join(',');\n}\n\nfunction quoteLiteral(value: any) {\n return \"'\" + String(value).replace(/'/g, \"''\") + \"'\";\n}\n\nexport const appendTemplateVariablesAsSuggestions = (getTemplateSrv: () => any, sugs: CodeEditorSuggestionItem[]) => {\n const templateSrv = getTemplateSrv();\n const templateSugs: CodeEditorSuggestionItem[] = [];\n templateSrv.getVariables().forEach((variable: VariableModel) => {\n const label = '$' + variable.name;\n let val = templateSrv.replace(label);\n if (val === label) {\n val = '';\n }\n templateSugs.push({\n label,\n kind: CodeEditorSuggestionItemKind.Text,\n detail: `(Template Variable) ${val}`,\n });\n });\n\n return sugs.concat(templateSugs);\n};\n","import React from 'react';\nimport { DataSourcePluginOptionsEditorProps, SelectableValue } from '@grafana/data';\nimport { AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData } from '../../types';\nimport { ResourceSelector } from '../ResourceSelector';\n\nexport interface ConfigSelectProps\n extends DataSourcePluginOptionsEditorProps<AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData> {\n value: string;\n fetch: () => Promise<Array<string | SelectableValue<string>>>;\n onChange: (e: SelectableValue<string> | null) => void;\n dependencies?: string[];\n label?: string;\n 'data-testid'?: string;\n hidden?: boolean;\n disabled?: boolean;\n saveOptions: () => Promise<void>;\n}\n\nexport function ConfigSelect(props: ConfigSelectProps) {\n const { jsonData } = props.options;\n const commonProps = {\n title: jsonData.defaultRegion ? '' : 'select a default region',\n disabled: !jsonData.defaultRegion,\n labelWidth: 28,\n className: 'width-30',\n };\n // Any change in the AWS connection details will affect selectors\n const dependencies: string[] = [\n props.options.jsonData.assumeRoleArn,\n props.options.jsonData.authType,\n props.options.jsonData.defaultRegion,\n props.options.jsonData.endpoint,\n props.options.jsonData.externalId,\n props.options.jsonData.profile,\n ].concat(props.dependencies);\n return (\n <ResourceSelector\n label={props.label}\n data-testid={props['data-testid']}\n onChange={props.onChange}\n fetch={props.fetch}\n value={props.value}\n saveOptions={props.saveOptions}\n dependencies={dependencies}\n hidden={props.hidden}\n disabled={props.disabled}\n {...commonProps}\n />\n );\n}\n","import React from 'react';\nimport { DataQuery, SelectableValue } from '@grafana/data';\nimport { InlineField, Select } from '@grafana/ui';\n\nexport type FormatSelectProps<TQuery extends DataQuery, FormatOptions> = {\n query: TQuery;\n options: Array<SelectableValue<FormatOptions>>;\n onChange: (value: TQuery) => void;\n onRunQuery: () => void;\n};\n\nexport function FormatSelect<TQuery extends DataQuery & Record<string, any>, FormatOptions>(\n props: FormatSelectProps<TQuery, FormatOptions>\n) {\n const onChangeFormat = (e: SelectableValue<FormatOptions>) => {\n props.onChange({\n ...props.query,\n format: e.value || 0,\n });\n props.onRunQuery();\n };\n return (\n <InlineField label=\"Format as\" labelWidth={11}>\n <Select\n aria-label=\"Format as\"\n options={props.options}\n value={props.query.format}\n onChange={onChangeFormat}\n className=\"width-12\"\n />\n </InlineField>\n );\n}\n","import React from 'react';\nimport { DataSourcePluginOptionsEditorProps } from '@grafana/data';\nimport { AwsAuthDataSourceSecureJsonData } from '../../types';\nimport { InlineField, Input } from '@grafana/ui';\nimport { FormEvent } from 'react-dom/node_modules/@types/react';\n\nexport interface InlineInputProps extends DataSourcePluginOptionsEditorProps<{}, AwsAuthDataSourceSecureJsonData> {\n value: string;\n onChange: (e: FormEvent<HTMLInputElement>) => void;\n label?: string;\n tooltip?: string;\n placeholder?: string;\n 'data-testid'?: string;\n hidden?: boolean;\n disabled?: boolean;\n}\n\nexport function InlineInput(props: InlineInputProps) {\n return (\n <InlineField\n label={props.label}\n labelWidth={28}\n tooltip={props.tooltip}\n hidden={props.hidden}\n disabled={props.disabled}\n >\n <Input\n data-testid={props['data-testid']}\n className=\"width-30\"\n value={props.value}\n onChange={props.onChange}\n placeholder={props.placeholder}\n disabled={props.disabled}\n />\n </InlineField>\n );\n}\n","import { defaults } from 'lodash';\n\nimport React, { useRef, useEffect } from 'react';\nimport { CodeEditor, CodeEditorSuggestionItem } from '@grafana/ui';\nimport { DataQuery } from '@grafana/data';\nimport { MonacoOptions } from '@grafana/ui/components/Monaco/types';\n\ntype EditorProps = {\n width?: number | string;\n height?: number | string;\n readOnly?: boolean;\n showMiniMap?: boolean;\n showLineNumbers?: boolean;\n monacoOptions?: MonacoOptions;\n};\n\ntype Props<TQuery extends DataQuery> = {\n query: TQuery;\n language: string;\n editorProps?: EditorProps;\n onChange: (value: TQuery) => void;\n onRunQuery: () => void;\n getSuggestions: (query: TQuery) => CodeEditorSuggestionItem[];\n};\n\nexport function QueryCodeEditor<TQuery extends DataQuery>(props: Props<TQuery>) {\n const { getSuggestions, query } = props;\n const { rawSQL } = defaults(props.query, { rawSQL: '' });\n const onRawSqlChange = (rawSQL: string) => {\n const query = {\n ...props.query,\n rawSQL,\n };\n props.onChange(query);\n props.onRunQuery();\n };\n\n // Use a reference for suggestions because a bug in CodeEditor getSuggestions\n // https://github.com/grafana/grafana/issues/40121\n // It was been fixed in 8.3 but keeping the workaround here to support older\n // versions.\n const suggestionsRef = useRef<CodeEditorSuggestionItem[]>([]);\n useEffect(() => {\n suggestionsRef.current = getSuggestions(query);\n }, [getSuggestions, query]);\n\n return (\n <CodeEditor\n language={props.language}\n value={rawSQL}\n onBlur={onRawSqlChange}\n showMiniMap={false}\n showLineNumbers={true}\n getSuggestions={() => suggestionsRef.current}\n height=\"240px\"\n {...props.editorProps}\n />\n );\n}\n"],"names":["AwsAuthType","standardRegions","FillValueOptions","awsAuthProviderOptions","label","value","EC2IAMRole","Default","Keys","Credentials","toOption","ResourceSelector","props","_a","__read","useState","default","resource","setResource","_b","resources","setResources","_c","dependencies","setDependencies","_d","isLoading","setIsLoading","_e","fetched","setFetched","defaultOpts","useMemo","opts","description","push","_f","options","setOptions","useEffect","undefined","newOptions","length","forEach","r","find","o","isEqual","onChange","React","InlineField","labelWidth","tooltip","hidden","title","Select","e","className","disabled","onOpenMenu","fetch","saveOptions","resources_1","SelectableFillValueOptions","Previous","Null","Value","interpolateVariable","map","v","String","replace","quoteLiteral","join","jsonData","commonProps","defaultRegion","assumeRoleArn","authType","endpoint","externalId","profile","concat","_k","regions","setRegions","loadRegions","onOptionsChange","_l","skipHeader","_m","skipEndpoint","database","settings","window","grafanaBootData","awsAllowedAuthProviders","awsAssumeRoleEnabled","currentProvider","p","then","FieldSet","filter","opt","includes","defaultValue","option","onUpdateDatasourceJsonDataOptionSelect","Input","placeholder","onUpdateDatasourceJsonDataOption","secureJsonFields","accessKey","ButtonGroup","ToolbarButton","icon","type","onClick","onUpdateDatasourceResetOption","secureJsonData","onUpdateDatasourceSecureJsonDataOption","secretKey","defaultEndpoint","region","allowCustomValue","formatCreateLabel","children","query","fillMode","mode","onRunQuery","currentTarget","valueAsNumber","onBlur","format","getSuggestions","rawSQL","defaults","suggestionsRef","useRef","current","CodeEditor","language","showMiniMap","showLineNumbers","height","editorProps","getTemplateSrv","sugs","templateSrv","templateSugs","getVariables","variable","name","val","kind","CodeEditorSuggestionItemKind","Text","detail","scopedVars"],"mappings":"sgEAEYA,ECFCC,EAA4B,CACvC,aACA,YACA,iBACA,iBACA,iBACA,aACA,iBACA,iBACA,eACA,aACA,iBACA,eACA,aACA,YACA,YACA,YACA,aACA,YACA,YACA,YACA,gBACA,gBACA,gBACA,iBACA,YACA,cDxBUD,EAAAA,sBAAAA,qCAEVA,4BACAA,oBACAA,4BAIAA,gBENUE,ECDCC,EAAyB,CACpC,CACEC,MAAO,qBACPC,MAAOL,oBAAYM,YAErB,CACEF,MAAO,kBACPC,MAAOL,oBAAYO,SAErB,CACEH,MAAO,sBACPC,MAAOL,oBAAYQ,MAErB,CACEJ,MAAO,mBACPC,MAAOL,oBAAYS,cCJjBC,EAAW,SAACL,GAAkB,OAAGA,QAAOD,MAAOC,aCcrCM,EAAiBC,GAAjC,WACQC,EAAAC,EAA0BC,WAAwBH,EAAMP,OAASO,EAAMI,SAAW,SAAjFC,OAAUC,OACXC,EAAAL,EAA4BC,WAA0CE,EAAW,CAACA,GAAY,OAA7FG,OAAWC,OAC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1BsJ,IAAQtJ,IACVsJ,EAAM,IAERJ,EAAanH,KAAK,CAChB/B,QACAuJ,KAAMC,+BAA6BC,KACnCC,OAAQ,uBAAuBJ,OAI5BN,EAAKlE,OAAOoE,+CA1CnBvB,EACAgC,EACAZ,GAEA,IAAME,EAAcF,IACpB,cACKpB,IACHS,OAAQa,EAAY9E,QAAQwD,EAAMS,OAAQuB,EAAY5F,uEAZ3B4D,GAC7B,QAASA,EAAMS"}
|
|
1
|
+
{"version":3,"file":"index.production.js","sources":["../src/types.ts","../src/regions.ts","../src/sql/QueryEditor/FillValueSelect.tsx","../src/providers.ts","../src/ConnectionConfig.tsx","../src/sql/ResourceSelector.tsx","../src/sql/types.ts","../src/sql/utils/utils.ts","../src/sql/ConfigEditor/ConfigSelect.tsx","../src/sql/QueryEditor/FormatSelect.tsx","../src/sql/ConfigEditor/InlineInput.tsx","../src/sql/QueryEditor/QueryCodeEditor.tsx"],"sourcesContent":["import { DataSourceJsonData, DataSourceSettings } from '@grafana/data';\n\nexport enum AwsAuthType {\n Keys = 'keys',\n Credentials = 'credentials',\n Default = 'default', // was 'arn',\n EC2IAMRole = 'ec2_iam_role',\n /**\n * @deprecated use default\n */\n ARN = 'arn',\n}\n\nexport interface AwsAuthDataSourceJsonData extends DataSourceJsonData {\n authType?: AwsAuthType;\n assumeRoleArn?: string;\n externalId?: string;\n profile?: string; // Credentials profile name, as specified in ~/.aws/credentials\n defaultRegion?: string; // region if it is not defined by your credentials file\n endpoint?: string;\n}\n\nexport interface AwsAuthDataSourceSecureJsonData {\n accessKey?: string;\n secretKey?: string;\n sessionToken?: string;\n}\n\nexport type AwsAuthDataSourceSettings = DataSourceSettings<AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData>;\n","export const standardRegions: string[] = [\n 'af-south-1',\n 'ap-east-1',\n 'ap-northeast-1',\n 'ap-northeast-2',\n 'ap-northeast-3',\n 'ap-south-1',\n 'ap-southeast-1',\n 'ap-southeast-2',\n 'ca-central-1',\n 'cn-north-1',\n 'cn-northwest-1',\n 'eu-central-1',\n 'eu-north-1',\n 'eu-west-1',\n 'eu-west-2',\n 'eu-west-3',\n 'me-south-1',\n 'sa-east-1',\n 'us-east-1',\n 'us-east-2',\n 'us-gov-east-1',\n 'us-gov-west-1',\n 'us-iso-east-1',\n 'us-isob-east-1',\n 'us-west-1',\n 'us-west-2',\n];\n","import React from 'react';\nimport { DataQuery, SelectableValue } from '@grafana/data';\nimport { InlineField, Input, Select } from '@grafana/ui';\n\nexport enum FillValueOptions {\n Previous,\n Null,\n Value,\n}\n\nexport const SelectableFillValueOptions: Array<SelectableValue<FillValueOptions>> = [\n {\n label: 'Previous Value',\n value: FillValueOptions.Previous,\n },\n {\n label: 'NULL',\n value: FillValueOptions.Null,\n },\n {\n label: 'Value',\n value: FillValueOptions.Value,\n },\n];\n\nexport type FillValueSelectProps<TQuery extends DataQuery> = {\n query: TQuery;\n onChange: (value: TQuery) => void;\n onRunQuery: () => void;\n};\n\nexport function FillValueSelect<TQuery extends DataQuery & Record<string, any>>(props: FillValueSelectProps<TQuery>) {\n return (\n <>\n <InlineField label=\"Fill value\" tooltip=\"value to fill missing points\">\n <Select\n aria-label=\"Fill value\"\n options={SelectableFillValueOptions}\n value={props.query.fillMode?.mode ?? FillValueOptions.Previous}\n onChange={({ value }) => {\n props.onChange({\n ...props.query,\n // Keep the fillMode.value in case FillValueOptions.Value mode is selected back\n fillMode: { ...props.query.fillMode, mode: value },\n });\n props.onRunQuery();\n }}\n className=\"width-12\"\n menuShouldPortal={true}\n />\n </InlineField>\n {props.query.fillMode?.mode === FillValueOptions.Value && (\n <InlineField label=\"Value\" labelWidth={11}>\n <Input\n type=\"number\"\n aria-label=\"Value\"\n value={props.query.fillMode.value}\n onChange={({ currentTarget }: React.FormEvent<HTMLInputElement>) =>\n props.onChange({\n ...props.query,\n fillMode: {\n mode: FillValueOptions.Value,\n value: currentTarget.valueAsNumber,\n },\n })\n }\n onBlur={() => props.onRunQuery()}\n />\n </InlineField>\n )}\n </>\n );\n}\n","import { SelectableValue } from '@grafana/data';\nimport { AwsAuthType } from './types';\n\nexport const awsAuthProviderOptions = [\n {\n label: 'Workspace IAM Role',\n value: AwsAuthType.EC2IAMRole,\n },\n {\n label: 'AWS SDK Default',\n value: AwsAuthType.Default,\n },\n {\n label: 'Access & secret key',\n value: AwsAuthType.Keys,\n },\n {\n label: 'Credentials file',\n value: AwsAuthType.Credentials,\n },\n] as Array<SelectableValue<AwsAuthType>>;\n","import React, { FC, useEffect, useState } from 'react';\nimport { Input, Select, InlineField, ButtonGroup, ToolbarButton, FieldSet } from '@grafana/ui';\nimport {\n DataSourcePluginOptionsEditorProps,\n onUpdateDatasourceJsonDataOptionSelect,\n onUpdateDatasourceResetOption,\n onUpdateDatasourceJsonDataOption,\n onUpdateDatasourceSecureJsonDataOption,\n} from '@grafana/data';\n\nimport { standardRegions } from './regions';\nimport { AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData, AwsAuthType } from './types';\nimport { awsAuthProviderOptions } from './providers';\n\nconst toOption = (value: string) => ({ value, label: value });\n\nexport interface ConnectionConfigProps<J = AwsAuthDataSourceJsonData, S = AwsAuthDataSourceSecureJsonData>\n extends DataSourcePluginOptionsEditorProps<J, S> {\n standardRegions?: string[];\n loadRegions?: () => Promise<string[]>;\n defaultEndpoint?: string;\n skipHeader?: boolean;\n skipEndpoint?: boolean;\n children?: React.ReactNode;\n}\n\nexport const ConnectionConfig: FC<ConnectionConfigProps> = (props: ConnectionConfigProps) => {\n const [regions, setRegions] = useState((props.standardRegions || standardRegions).map(toOption));\n const { loadRegions, onOptionsChange, skipHeader = false, skipEndpoint = false } = props;\n const options = props.options;\n let profile = options.jsonData.profile;\n if (profile === undefined) {\n profile = options.database;\n }\n\n const settings = (window as any).grafanaBootData.settings;\n const awsAllowedAuthProviders = settings.awsAllowedAuthProviders ?? [\n AwsAuthType.Default,\n AwsAuthType.Keys,\n AwsAuthType.Credentials,\n ];\n const awsAssumeRoleEnabled = settings.awsAssumeRoleEnabled ?? true;\n\n const currentProvider = awsAuthProviderOptions.find((p) => p.value === options.jsonData.authType);\n\n useEffect(() => {\n // Make sure a authType exists in the current model\n if (!currentProvider && awsAllowedAuthProviders.length) {\n onOptionsChange({\n ...options,\n jsonData: {\n ...options.jsonData,\n authType: awsAllowedAuthProviders[0],\n },\n });\n }\n }, [currentProvider, options, onOptionsChange]);\n\n useEffect(() => {\n if (!loadRegions) {\n return;\n }\n\n loadRegions().then((regions) => setRegions(regions.map(toOption)));\n }, [loadRegions]);\n\n return (\n <FieldSet label={skipHeader ? '' : 'Connection Details'} data-testid=\"connection-config\">\n <InlineField\n label=\"Authentication Provider\"\n labelWidth={28}\n tooltip=\"Specify which AWS credentials chain to use.\"\n >\n <Select\n aria-label=\"Authentication Provider\"\n className=\"width-30\"\n value={currentProvider}\n options={awsAuthProviderOptions.filter((opt) => awsAllowedAuthProviders.includes(opt.value!))}\n defaultValue={options.jsonData.authType}\n onChange={(option) => {\n onUpdateDatasourceJsonDataOptionSelect(props, 'authType')(option);\n }}\n menuShouldPortal={true}\n />\n </InlineField>\n {options.jsonData.authType === 'credentials' && (\n <InlineField\n label=\"Credentials Profile Name\"\n labelWidth={28}\n tooltip=\"Credentials profile name, as specified in ~/.aws/credentials, leave blank for default.\"\n >\n <Input\n aria-label=\"Credentials Profile Name\"\n className=\"width-30\"\n placeholder=\"default\"\n value={profile}\n onChange={onUpdateDatasourceJsonDataOption(props, 'profile')}\n />\n </InlineField>\n )}\n\n {options.jsonData.authType === 'keys' && (\n <>\n <InlineField label=\"Access Key ID\" labelWidth={28}>\n {props.options.secureJsonFields?.accessKey ? (\n <ButtonGroup className=\"width-30\">\n <Input disabled placeholder=\"Configured\" />\n <ToolbarButton\n icon=\"edit\"\n tooltip=\"Edit Access Key ID\"\n type=\"button\"\n onClick={onUpdateDatasourceResetOption(props as any, 'accessKey')}\n />\n </ButtonGroup>\n ) : (\n <Input\n aria-label=\"Access Key ID\"\n className=\"width-30\"\n value={options.secureJsonData?.accessKey ?? ''}\n onChange={onUpdateDatasourceSecureJsonDataOption(props, 'accessKey')}\n />\n )}\n </InlineField>\n\n <InlineField label=\"Secret Access Key\" labelWidth={28}>\n {props.options.secureJsonFields?.secretKey ? (\n <ButtonGroup className=\"width-30\">\n <Input disabled placeholder=\"Configured\" />\n <ToolbarButton\n icon=\"edit\"\n type=\"button\"\n tooltip=\"Edit Secret Access Key\"\n onClick={onUpdateDatasourceResetOption(props as any, 'secretKey')}\n />\n </ButtonGroup>\n ) : (\n <Input\n aria-label=\"Secret Access Key\"\n className=\"width-30\"\n value={options.secureJsonData?.secretKey ?? ''}\n onChange={onUpdateDatasourceSecureJsonDataOption(props, 'secretKey')}\n />\n )}\n </InlineField>\n </>\n )}\n\n {awsAssumeRoleEnabled && (\n <>\n <InlineField\n label=\"Assume Role ARN\"\n labelWidth={28}\n tooltip=\"Optionally, specify the ARN of a role to assume. Specifying a role here will ensure that the selected authentication provider is used to assume the specified role rather than using the credentials directly. Leave blank if you don't need to assume a role at all\"\n >\n <Input\n aria-label=\"Assume Role ARN\"\n className=\"width-30\"\n placeholder=\"arn:aws:iam:*\"\n value={options.jsonData.assumeRoleArn || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'assumeRoleArn')}\n />\n </InlineField>\n <InlineField\n label=\"External ID\"\n labelWidth={28}\n tooltip=\"If you are assuming a role in another account, that has been created with an external ID, specify the external ID here.\"\n >\n <Input\n aria-label=\"External ID\"\n className=\"width-30\"\n placeholder=\"External ID\"\n value={options.jsonData.externalId || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'externalId')}\n />\n </InlineField>\n </>\n )}\n {!skipEndpoint && (\n <InlineField label=\"Endpoint\" labelWidth={28} tooltip=\"Optionally, specify a custom endpoint for the service\">\n <Input\n aria-label=\"Endpoint\"\n className=\"width-30\"\n placeholder={props.defaultEndpoint ?? 'https://{service}.{region}.amazonaws.com'}\n value={options.jsonData.endpoint || ''}\n onChange={onUpdateDatasourceJsonDataOption(props, 'endpoint')}\n />\n </InlineField>\n )}\n <InlineField\n label=\"Default Region\"\n labelWidth={28}\n tooltip=\"Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region.\"\n >\n <Select\n aria-label=\"Default Region\"\n className=\"width-30\"\n value={regions.find((region) => region.value === options.jsonData.defaultRegion)}\n options={regions}\n defaultValue={options.jsonData.defaultRegion}\n allowCustomValue={true}\n onChange={onUpdateDatasourceJsonDataOptionSelect(props, 'defaultRegion')}\n formatCreateLabel={(r) => `Use region: ${r}`}\n menuShouldPortal={true}\n />\n </InlineField>\n {props.children}\n </FieldSet>\n );\n};\n","import { SelectableValue } from '@grafana/data';\nimport { InlineField, Select } from '@grafana/ui';\nimport { SelectCommonProps } from '@grafana/ui/components/Select/types';\nimport { isEqual } from 'lodash';\nimport React, { useEffect, useMemo, useState } from 'react';\n\nimport { defaultKey } from './types';\n\nexport interface ResourceSelectorProps extends SelectCommonProps<string> {\n value: string | null;\n dependencies?: Array<string | null | undefined>;\n tooltip?: string;\n label?: string;\n 'data-testid'?: string;\n hidden?: boolean;\n // Options only needed for QueryEditor\n default?: string;\n // Options only needed for the ConfigEditor\n title?: string;\n labelWidth?: number;\n saveOptions?: () => Promise<void>;\n // Either set a way of fetching resources or the resource list\n fetch?: () => Promise<Array<string | SelectableValue<string>>>;\n resources?: string[];\n}\n\nexport function ResourceSelector(props: ResourceSelectorProps) {\n const [resource, setResource] = useState<string | null>(props.value || props.default || null);\n const [resources, setResources] = useState<Array<string | SelectableValue>>(resource ? [resource] : []);\n const [dependencies, setDependencies] = useState(props.dependencies);\n const [isLoading, setIsLoading] = useState(false);\n const [fetched, setFetched] = useState(false);\n const defaultOpts = useMemo(() => {\n const opts: Array<SelectableValue<string>> = [\n {\n label: `default (${props.default})`,\n value: defaultKey,\n description: `Default value set in the data source`,\n },\n ];\n if (props.value && props.value !== defaultKey) {\n opts.push({ label: props.value, value: props.value });\n }\n return opts;\n }, [props.default, props.value]);\n const [options, setOptions] = useState<Array<SelectableValue<string>>>(props.default ? defaultOpts : []);\n useEffect(() => {\n if (props.resources !== undefined) {\n setResources(props.resources);\n }\n }, [props.resources]);\n useEffect(() => {\n const newOptions: Array<SelectableValue<string>> = props.default ? defaultOpts : [];\n if (resources.length) {\n resources.forEach((r) => {\n const value = typeof r === 'string' ? r : r.value;\n if (!newOptions.find((o) => o.value === value)) {\n typeof r === 'string' ? newOptions.push({ label: r, value: r }) : newOptions.push(r);\n }\n });\n setOptions(newOptions);\n } else {\n setOptions([]);\n }\n }, [resources, defaultOpts, props.default]);\n\n useEffect(() => {\n // A change in the dependencies cause a state clean-up\n if (!isEqual(props.dependencies, dependencies)) {\n setFetched(false);\n setResource(null);\n props.onChange(null);\n setDependencies(props.dependencies);\n }\n }, [props, dependencies]);\n\n const fetch = async () => {\n if (fetched) {\n return;\n }\n if (props.saveOptions) {\n await props.saveOptions();\n }\n try {\n const resources = await props.fetch();\n setResources(resources);\n } finally {\n setFetched(true);\n }\n };\n\n const onChange = (e: SelectableValue<string>) => {\n props.onChange(e);\n if (e.value) {\n setResource(e.value);\n }\n };\n const onClick = async () => {\n setIsLoading(true);\n try {\n await fetch();\n } finally {\n setIsLoading(false);\n }\n };\n\n return (\n <InlineField label={props.label} labelWidth={props.labelWidth} tooltip={props.tooltip} hidden={props.hidden}>\n <div data-testid={props['data-testid']} title={props.title}>\n <Select\n {...props}\n aria-label={props.label}\n options={options}\n onChange={onChange}\n isLoading={isLoading}\n className={props.className || 'min-width-6'}\n onOpenMenu={() => props.fetch && onClick()}\n menuShouldPortal={true}\n />\n </div>\n </InlineField>\n );\n}\n","import { DataQuery } from '@grafana/data';\nimport { FillValueOptions } from './QueryEditor/FillValueSelect';\n\nexport const defaultKey = '__default';\n\nexport interface SQLQuery extends DataQuery {\n rawSQL: string;\n format?: number;\n fillMode?: { mode: FillValueOptions; value?: number };\n}\n","import { ScopedVars, VariableModel } from '@grafana/data';\nimport { SQLQuery } from '../types';\nimport { CodeEditorSuggestionItem, CodeEditorSuggestionItemKind } from '@grafana/ui';\n\n/**\n * Do not execute queries that do not exist yet\n */\nexport function filterSQLQuery(query: SQLQuery): boolean {\n return !!query.rawSQL;\n}\n\nexport function applySQLTemplateVariables(\n query: SQLQuery,\n scopedVars: ScopedVars,\n getTemplateSrv: () => any\n): SQLQuery {\n const templateSrv = getTemplateSrv();\n return {\n ...query,\n rawSQL: templateSrv.replace(query.rawSQL, scopedVars, interpolateVariable),\n };\n}\n\nfunction interpolateVariable(value: string | string[]) {\n if (typeof value === 'string') {\n return value;\n }\n\n const quotedValues = value.map((v) => {\n return quoteLiteral(v);\n });\n return quotedValues.join(',');\n}\n\nfunction quoteLiteral(value: any) {\n return \"'\" + String(value).replace(/'/g, \"''\") + \"'\";\n}\n\nexport const appendTemplateVariablesAsSuggestions = (getTemplateSrv: () => any, sugs: CodeEditorSuggestionItem[]) => {\n const templateSrv = getTemplateSrv();\n const templateSugs: CodeEditorSuggestionItem[] = [];\n templateSrv.getVariables().forEach((variable: VariableModel) => {\n const label = '$' + variable.name;\n let val = templateSrv.replace(label);\n if (val === label) {\n val = '';\n }\n templateSugs.push({\n label,\n kind: CodeEditorSuggestionItemKind.Text,\n detail: `(Template Variable) ${val}`,\n });\n });\n\n return sugs.concat(templateSugs);\n};\n","import React from 'react';\nimport { DataSourcePluginOptionsEditorProps, SelectableValue } from '@grafana/data';\nimport { InputActionMeta } from '@grafana/ui/components/Select/types';\nimport { AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData } from '../../types';\nimport { ResourceSelector } from '../ResourceSelector';\n\nexport interface ConfigSelectProps\n extends DataSourcePluginOptionsEditorProps<AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData> {\n value: string;\n fetch: () => Promise<Array<string | SelectableValue<string>>>;\n onChange: (e: SelectableValue<string> | null) => void;\n dependencies?: string[];\n label?: string;\n 'data-testid'?: string;\n hidden?: boolean;\n disabled?: boolean;\n allowCustomValue?: boolean;\n saveOptions: () => Promise<void>;\n autoFocus?: boolean;\n backspaceRemovesValue?: boolean;\n className?: string;\n invalid?: boolean;\n isClearable?: boolean;\n isMulti?: boolean;\n inputId?: string;\n showAllSelectedWhenOpen?: boolean;\n maxMenuHeight?: number;\n minMenuHeight?: number;\n maxVisibleValues?: number;\n menuPlacement?: 'auto' | 'bottom' | 'top';\n menuPosition?: 'fixed' | 'absolute';\n noOptionsMessage?: string;\n onBlur?: () => void;\n onCreateOption?: (value: string) => void;\n onInputChange?: (value: string, actionMeta: InputActionMeta) => void;\n placeholder?: string;\n width?: number;\n isOptionDisabled?: () => boolean;\n}\n\nexport function ConfigSelect(props: ConfigSelectProps) {\n const { jsonData } = props.options;\n const commonProps = {\n title: jsonData.defaultRegion ? '' : 'select a default region',\n labelWidth: 28,\n className: 'width-30',\n };\n // Any change in the AWS connection details will affect selectors\n const dependencies: string[] = [\n props.options.jsonData.assumeRoleArn,\n props.options.jsonData.authType,\n props.options.jsonData.defaultRegion,\n props.options.jsonData.endpoint,\n props.options.jsonData.externalId,\n props.options.jsonData.profile,\n ].concat(props.dependencies);\n return (\n <ResourceSelector\n label={props.label}\n data-testid={props['data-testid']}\n onChange={props.onChange}\n fetch={props.fetch}\n value={props.value}\n saveOptions={props.saveOptions}\n dependencies={dependencies}\n hidden={props.hidden}\n disabled={props.disabled || !jsonData.defaultRegion}\n allowCustomValue={props.allowCustomValue}\n autoFocus={props.autoFocus}\n backspaceRemovesValue={props.backspaceRemovesValue}\n className={props.className}\n invalid={props.invalid}\n isClearable={props.isClearable}\n isMulti={props.isMulti}\n inputId={props.inputId}\n showAllSelectedWhenOpen={props.showAllSelectedWhenOpen}\n maxMenuHeight={props.maxMenuHeight}\n minMenuHeight={props.minMenuHeight}\n maxVisibleValues={props.maxVisibleValues}\n menuPlacement={props.menuPlacement}\n menuPosition={props.menuPosition}\n noOptionsMessage={props.noOptionsMessage}\n onBlur={props.onBlur}\n onCreateOption={props.onCreateOption}\n onInputChange={props.onInputChange}\n placeholder={props.placeholder}\n width={props.width}\n isOptionDisabled={props.isOptionDisabled}\n {...commonProps}\n />\n );\n}\n","import React from 'react';\nimport { DataQuery, SelectableValue } from '@grafana/data';\nimport { InlineField, Select } from '@grafana/ui';\n\nexport type FormatSelectProps<TQuery extends DataQuery, FormatOptions> = {\n query: TQuery;\n options: Array<SelectableValue<FormatOptions>>;\n onChange: (value: TQuery) => void;\n onRunQuery: () => void;\n};\n\nexport function FormatSelect<TQuery extends DataQuery & Record<string, any>, FormatOptions>(\n props: FormatSelectProps<TQuery, FormatOptions>\n) {\n const onChangeFormat = (e: SelectableValue<FormatOptions>) => {\n props.onChange({\n ...props.query,\n format: e.value || 0,\n });\n props.onRunQuery();\n };\n return (\n <InlineField label=\"Format as\" labelWidth={11}>\n <Select\n aria-label=\"Format as\"\n options={props.options}\n value={props.query.format}\n onChange={onChangeFormat}\n className=\"width-12\"\n menuShouldPortal={true}\n />\n </InlineField>\n );\n}\n","import React from 'react';\nimport { DataSourcePluginOptionsEditorProps } from '@grafana/data';\nimport { AwsAuthDataSourceSecureJsonData } from '../../types';\nimport { InlineField, Input } from '@grafana/ui';\nimport { FormEvent } from 'react-dom/node_modules/@types/react';\n\nexport interface InlineInputProps extends DataSourcePluginOptionsEditorProps<{}, AwsAuthDataSourceSecureJsonData> {\n value: string;\n onChange: (e: FormEvent<HTMLInputElement>) => void;\n label?: string;\n tooltip?: string;\n placeholder?: string;\n 'data-testid'?: string;\n hidden?: boolean;\n disabled?: boolean;\n}\n\nexport function InlineInput(props: InlineInputProps) {\n return (\n <InlineField\n label={props.label}\n labelWidth={28}\n tooltip={props.tooltip}\n hidden={props.hidden}\n disabled={props.disabled}\n >\n <Input\n data-testid={props['data-testid']}\n className=\"width-30\"\n value={props.value}\n onChange={props.onChange}\n placeholder={props.placeholder}\n disabled={props.disabled}\n />\n </InlineField>\n );\n}\n","import { defaults } from 'lodash';\n\nimport React, { useRef, useEffect } from 'react';\nimport { CodeEditor, CodeEditorSuggestionItem } from '@grafana/ui';\nimport { DataQuery } from '@grafana/data';\nimport { MonacoOptions } from '@grafana/ui/components/Monaco/types';\n\ntype EditorProps = {\n width?: number | string;\n height?: number | string;\n readOnly?: boolean;\n showMiniMap?: boolean;\n showLineNumbers?: boolean;\n monacoOptions?: MonacoOptions;\n};\n\ntype Props<TQuery extends DataQuery> = {\n query: TQuery;\n language: string;\n editorProps?: EditorProps;\n onChange: (value: TQuery) => void;\n onRunQuery: () => void;\n getSuggestions: (query: TQuery) => CodeEditorSuggestionItem[];\n};\n\nexport function QueryCodeEditor<TQuery extends DataQuery>(props: Props<TQuery>) {\n const { getSuggestions, query } = props;\n const { rawSQL } = defaults(props.query, { rawSQL: '' });\n const onRawSqlChange = (rawSQL: string) => {\n const query = {\n ...props.query,\n rawSQL,\n };\n props.onChange(query);\n props.onRunQuery();\n };\n\n // Use a reference for suggestions because a bug in CodeEditor getSuggestions\n // https://github.com/grafana/grafana/issues/40121\n // It was been fixed in 8.3 but keeping the workaround here to support older\n // versions.\n const suggestionsRef = useRef<CodeEditorSuggestionItem[]>([]);\n useEffect(() => {\n suggestionsRef.current = getSuggestions(query);\n }, [getSuggestions, query]);\n\n return (\n <CodeEditor\n language={props.language}\n value={rawSQL}\n onBlur={onRawSqlChange}\n showMiniMap={false}\n showLineNumbers={true}\n getSuggestions={() => suggestionsRef.current}\n height=\"240px\"\n {...props.editorProps}\n />\n );\n}\n"],"names":["AwsAuthType","standardRegions","FillValueOptions","awsAuthProviderOptions","label","value","EC2IAMRole","Default","Keys","Credentials","toOption","ResourceSelector","props","_a","__read","useState","default","resource","setResource","_b","resources","setResources","_c","dependencies","setDependencies","_d","isLoading","setIsLoading","_e","fetched","setFetched","defaultOpts","useMemo","opts","description","push","_f","options","setOptions","useEffect","undefined","newOptions","length","forEach","r","find","o","isEqual","onChange","React","InlineField","labelWidth","tooltip","hidden","title","Select","e","className","onOpenMenu","fetch","saveOptions","resources_1","menuShouldPortal","SelectableFillValueOptions","Previous","Null","Value","interpolateVariable","map","v","String","replace","quoteLiteral","join","jsonData","commonProps","defaultRegion","assumeRoleArn","authType","endpoint","externalId","profile","concat","disabled","allowCustomValue","autoFocus","backspaceRemovesValue","invalid","isClearable","isMulti","inputId","showAllSelectedWhenOpen","maxMenuHeight","minMenuHeight","maxVisibleValues","menuPlacement","menuPosition","noOptionsMessage","onBlur","onCreateOption","onInputChange","placeholder","width","isOptionDisabled","_k","regions","setRegions","loadRegions","onOptionsChange","_l","skipHeader","_m","skipEndpoint","database","settings","window","grafanaBootData","awsAllowedAuthProviders","awsAssumeRoleEnabled","currentProvider","p","then","FieldSet","filter","opt","includes","defaultValue","option","onUpdateDatasourceJsonDataOptionSelect","Input","onUpdateDatasourceJsonDataOption","secureJsonFields","accessKey","ButtonGroup","ToolbarButton","icon","type","onClick","onUpdateDatasourceResetOption","secureJsonData","onUpdateDatasourceSecureJsonDataOption","secretKey","defaultEndpoint","region","formatCreateLabel","children","query","fillMode","mode","onRunQuery","currentTarget","valueAsNumber","format","getSuggestions","rawSQL","defaults","suggestionsRef","useRef","current","CodeEditor","language","showMiniMap","showLineNumbers","height","editorProps","getTemplateSrv","sugs","templateSrv","templateSugs","getVariables","variable","name","val","kind","CodeEditorSuggestionItemKind","Text","detail","scopedVars"],"mappings":"sgEAEYA,ECFCC,EAA4B,CACvC,aACA,YACA,iBACA,iBACA,iBACA,aACA,iBACA,iBACA,eACA,aACA,iBACA,eACA,aACA,YACA,YACA,YACA,aACA,YACA,YACA,YACA,gBACA,gBACA,gBACA,iBACA,YACA,cDxBUD,EAAAA,sBAAAA,qCAEVA,4BACAA,oBACAA,4BAIAA,gBENUE,ECDCC,EAAyB,CACpC,CACEC,MAAO,qBACPC,MAAOL,oBAAYM,YAErB,CACEF,MAAO,kBACPC,MAAOL,oBAAYO,SAErB,CACEH,MAAO,sBACPC,MAAOL,oBAAYQ,MAErB,CACEJ,MAAO,mBACPC,MAAOL,oBAAYS,cCJjBC,EAAW,SAACL,GAAkB,OAAGA,QAAOD,MAAOC,aCYrCM,EAAi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MP,MACb2C,SAAUpC,EAAMoC,SAChBqD,YAAazF,EAAMyF,YACnBlB,SAAUvE,EAAMuE,8CCPkCvE,GAChD,IAAA6I,EAA0B7I,iBAAVsI,EAAUtI,QAC1B8I,EAAWC,WAAS/I,EAAMsI,MAAO,CAAEQ,OAAQ,YAc7CE,EAAiBC,SAAmC,IAK1D,OAJAtH,aAAU,WACRqH,EAAeE,QAAUL,EAAeP,KACvC,CAACO,EAAgBP,IAGlBjG,gBAAC8G,gBACCC,SAAUpJ,EAAMoJ,SAChB3J,MAAOqJ,EACPxD,OAtBmB,SAACwD,GACtB,IAAMR,SACDtI,EAAMsI,QACTQ,WAEF9I,EAAMoC,SAASkG,GACftI,EAAMyI,cAiBJY,aAAa,EACbC,iBAAiB,EACjBT,eAAgB,WAAM,OAAAG,EAAeE,SACrCK,OAAO,SACHvJ,EAAMwJ,uFJjBoC,SAACC,EAA2BC,GAC9E,IAAMC,EAAcF,IACdG,EAA2C,GAcjD,OAbAD,EAAYE,eAAe9H,SAAQ,SAAC+H,GAClC,IAAMtK,EAAQ,IAAMsK,EAASC,KACzBC,EAAML,EAAYhG,QAAQnE,GAC1BwK,IAAQxK,IACVwK,EAAM,IAERJ,EAAarI,KAAK,CAChB/B,QACAyK,KAAMC,+BAA6BC,KACnCC,OAAQ,uBAAuBJ,OAI5BN,EAAKpF,OAAOsF,+CA1CnBtB,EACA+B,EACAZ,GAEA,IAAME,EAAcF,IACpB,cACKnB,IACHQ,OAAQa,EAAYhG,QAAQ2E,EAAMQ,OAAQuB,EAAY9G,uEAZ3B+E,GAC7B,QAASA,EAAMQ"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DataSourcePluginOptionsEditorProps, SelectableValue } from '@grafana/data';
|
|
2
|
+
import { InputActionMeta } from '@grafana/ui/components/Select/types';
|
|
2
3
|
import { AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData } from '../../types';
|
|
3
4
|
export interface ConfigSelectProps extends DataSourcePluginOptionsEditorProps<AwsAuthDataSourceJsonData, AwsAuthDataSourceSecureJsonData> {
|
|
4
5
|
value: string;
|
|
@@ -9,6 +10,27 @@ export interface ConfigSelectProps extends DataSourcePluginOptionsEditorProps<Aw
|
|
|
9
10
|
'data-testid'?: string;
|
|
10
11
|
hidden?: boolean;
|
|
11
12
|
disabled?: boolean;
|
|
13
|
+
allowCustomValue?: boolean;
|
|
12
14
|
saveOptions: () => Promise<void>;
|
|
15
|
+
autoFocus?: boolean;
|
|
16
|
+
backspaceRemovesValue?: boolean;
|
|
17
|
+
className?: string;
|
|
18
|
+
invalid?: boolean;
|
|
19
|
+
isClearable?: boolean;
|
|
20
|
+
isMulti?: boolean;
|
|
21
|
+
inputId?: string;
|
|
22
|
+
showAllSelectedWhenOpen?: boolean;
|
|
23
|
+
maxMenuHeight?: number;
|
|
24
|
+
minMenuHeight?: number;
|
|
25
|
+
maxVisibleValues?: number;
|
|
26
|
+
menuPlacement?: 'auto' | 'bottom' | 'top';
|
|
27
|
+
menuPosition?: 'fixed' | 'absolute';
|
|
28
|
+
noOptionsMessage?: string;
|
|
29
|
+
onBlur?: () => void;
|
|
30
|
+
onCreateOption?: (value: string) => void;
|
|
31
|
+
onInputChange?: (value: string, actionMeta: InputActionMeta) => void;
|
|
32
|
+
placeholder?: string;
|
|
33
|
+
width?: number;
|
|
34
|
+
isOptionDisabled?: () => boolean;
|
|
13
35
|
}
|
|
14
36
|
export declare function ConfigSelect(props: ConfigSelectProps): JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SelectableValue } from '@grafana/data';
|
|
2
|
-
|
|
2
|
+
import { SelectCommonProps } from '@grafana/ui/components/Select/types';
|
|
3
|
+
export interface ResourceSelectorProps extends SelectCommonProps<string> {
|
|
3
4
|
value: string | null;
|
|
4
|
-
onChange: (e: SelectableValue<string> | null) => void;
|
|
5
5
|
dependencies?: Array<string | null | undefined>;
|
|
6
6
|
tooltip?: string;
|
|
7
7
|
label?: string;
|
|
@@ -9,11 +9,9 @@ export declare type ResourceSelectorProps = {
|
|
|
9
9
|
hidden?: boolean;
|
|
10
10
|
default?: string;
|
|
11
11
|
title?: string;
|
|
12
|
-
disabled?: boolean;
|
|
13
12
|
labelWidth?: number;
|
|
14
|
-
className?: string;
|
|
15
13
|
saveOptions?: () => Promise<void>;
|
|
16
14
|
fetch?: () => Promise<Array<string | SelectableValue<string>>>;
|
|
17
15
|
resources?: string[];
|
|
18
|
-
}
|
|
16
|
+
}
|
|
19
17
|
export declare function ResourceSelector(props: ResourceSelectorProps): JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/aws-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.35",
|
|
4
4
|
"description": "Common AWS features for grafana",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"clean": "rimraf ./dist ./compiled",
|
|
11
11
|
"typecheck": "tsc --noEmit",
|
|
12
12
|
"test": "jest --notify --watch",
|
|
13
|
+
"test:coverage": "jest --coverage",
|
|
13
14
|
"test-ci": "grafana-toolkit plugin:test"
|
|
14
15
|
},
|
|
15
16
|
"files": [
|