CloudWatch Logs: Add selected region to autocomplete requests (#42194)

* Add region to get fields query

* Fix and add tests
This commit is contained in:
Andrej Ocenas
2021-11-26 13:33:34 +01:00
committed by GitHub
parent 879cdcd0c7
commit 802ffa3f03
7 changed files with 95 additions and 51 deletions

View File

@@ -263,7 +263,7 @@ export class CloudWatchLogsQueryField extends React.PureComponent<CloudWatchLogs
};
onTypeahead = async (typeahead: TypeaheadInput): Promise<TypeaheadOutput> => {
const { datasource } = this.props;
const { datasource, query } = this.props;
const { selectedLogGroups } = this.state;
if (!datasource.languageProvider) {
@@ -276,7 +276,12 @@ export class CloudWatchLogsQueryField extends React.PureComponent<CloudWatchLogs
return await cloudwatchLanguageProvider.provideCompletionItems(
{ text, value, prefix, wrapperClasses, labelKey, editor },
{ history, absoluteRange, logGroupNames: selectedLogGroups.map((logGroup) => logGroup.value!) }
{
history,
absoluteRange,
logGroupNames: selectedLogGroups.map((logGroup) => logGroup.value!),
region: query.region,
}
);
};