Skip to content

Commit

Permalink
[Vega] fix requesting not permitted or used data views (elastic#130878)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <[email protected]>
(cherry picked from commit 98041ca)

# Conflicts:
#	src/plugins/vis_types/vega/public/lib/extract_index_pattern.ts
#	src/plugins/vis_types/vega/public/vega_view/vega_base_view.js
  • Loading branch information
mbondyra committed May 3, 2022
1 parent 960121d commit c5040fc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/plugins/vis_types/vega/public/data_model/search_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const extendSearchParamsWithRuntimeFields = async (
let runtimeMappings = requestParams.body?.runtime_mappings;

if (!runtimeMappings) {
const indexPattern = (await indexPatterns.find(indexPatternString)).find(
const indexPattern = (await indexPatterns.find(indexPatternString, 1)).find(
(index) => index.title === indexPatternString
);
runtimeMappings = indexPattern?.getComputedFields().runtimeFields;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ export const extractIndexPatternsFromSpec = async (spec: VegaSpec) => {
await Promise.all(
data.reduce<Array<Promise<IndexPattern[]>>>((accumulator, currentValue) => {
if (currentValue.url?.index) {
accumulator.push(indexPatterns.find(currentValue.url.index));
accumulator.push(indexPatterns.find(currentValue.url.index, 1));
}

return accumulator;
}, [])
)
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/vis_types/vega/public/vega_view/vega_base_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export class VegaBaseView {
let idxObj;

if (index) {
[idxObj] = await indexPatterns.find(index);
[idxObj] = await indexPatterns.find(index, 1);
if (!idxObj) {
throw new Error(
i18n.translate('visTypeVega.vegaParser.baseView.indexNotFoundErrorMessage', {
Expand Down Expand Up @@ -466,7 +466,7 @@ export class VegaBaseView {
console.log('%cWelcome to Kibana Vega Plugin!', 'font-size: 16px; font-weight: bold;');
console.log(
'You can access the Vega view with VEGA_DEBUG. ' +
'Learn more at https://vega.github.io/vega/docs/api/debugging/.'
'Learn more at https://vega.github.io/vega/docs/api/debugging/.'
);
}
const debugObj = {};
Expand Down

0 comments on commit c5040fc

Please sign in to comment.