Skip to content

Commit

Permalink
If I create a viz with the string mode and a wildcard e.g. kibana_sa…
Browse files Browse the repository at this point in the history
…mple*, the index patterns are not communicated correctly to the dashboard.
  • Loading branch information
alexwizp committed Mar 25, 2021
1 parent 9715acc commit 59d3e7d
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/plugins/vis_type_timeseries/public/metrics_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n';

import { TSVB_EDITOR_NAME } from './application';
import { PANEL_TYPES } from '../common/panel_types';
import { fetchIndexPattern } from '../common/index_patterns_utils';
import { isStringTypeIndexPattern } from '../common/index_patterns_utils';
import { toExpressionAst } from './to_ast';
import { VIS_EVENT_TO_TRIGGER, VisGroups, VisParams } from '../../visualizations/public';
import { getDataStart } from './services';
Expand Down Expand Up @@ -79,8 +79,18 @@ export const metricsVisDefinition = {
inspectorAdapters: {},
getUsedIndexPattern: async (params: VisParams) => {
const { indexPatterns } = getDataStart();
const { indexPattern } = await fetchIndexPattern(params.index_pattern, indexPatterns);
const indexPatternValue = params.index_pattern;

return indexPattern ? [indexPattern] : [];
if (indexPatternValue) {
if (isStringTypeIndexPattern(indexPatternValue)) {
return await indexPatterns.find(indexPatternValue);
}

if (indexPatternValue.id) {
return [await indexPatterns.get(indexPatternValue.id)];
}
}

return [await indexPatterns.getDefault()];
},
};

0 comments on commit 59d3e7d

Please sign in to comment.