[TSVB] Fix pinned filters not showing in TSVB (#109223)
Closes: #17025 Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
178b56980f
commit
d717521ad0
5 changed files with 16 additions and 20 deletions
|
@ -12,9 +12,8 @@ import { share } from 'rxjs/operators';
|
||||||
import { isEqual, isEmpty, debounce } from 'lodash';
|
import { isEqual, isEmpty, debounce } from 'lodash';
|
||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
import type { IUiSettingsClient } from 'kibana/public';
|
import type { IUiSettingsClient } from 'kibana/public';
|
||||||
import {
|
import type {
|
||||||
Vis,
|
Vis,
|
||||||
PersistedState,
|
|
||||||
VisualizeEmbeddableContract,
|
VisualizeEmbeddableContract,
|
||||||
} from '../../../../../plugins/visualizations/public';
|
} from '../../../../../plugins/visualizations/public';
|
||||||
import { KibanaContextProvider } from '../../../../../plugins/kibana_react/public';
|
import { KibanaContextProvider } from '../../../../../plugins/kibana_react/public';
|
||||||
|
@ -31,8 +30,9 @@ import { TIME_RANGE_DATA_MODES, TIME_RANGE_MODE_KEY } from '../../../common/enum
|
||||||
import { VisPicker } from './vis_picker';
|
import { VisPicker } from './vis_picker';
|
||||||
import { fetchFields, VisFields } from '../lib/fetch_fields';
|
import { fetchFields, VisFields } from '../lib/fetch_fields';
|
||||||
import { getDataStart, getCoreStart } from '../../services';
|
import { getDataStart, getCoreStart } from '../../services';
|
||||||
import { TimeseriesVisParams } from '../../types';
|
import type { TimeseriesVisParams } from '../../types';
|
||||||
import { UseIndexPatternModeCallout } from './use_index_patter_mode_callout';
|
import { UseIndexPatternModeCallout } from './use_index_patter_mode_callout';
|
||||||
|
import type { EditorRenderProps } from '../../../../visualize/public';
|
||||||
|
|
||||||
const VIS_STATE_DEBOUNCE_DELAY = 200;
|
const VIS_STATE_DEBOUNCE_DELAY = 200;
|
||||||
const APP_NAME = 'VisEditor';
|
const APP_NAME = 'VisEditor';
|
||||||
|
@ -42,7 +42,9 @@ export interface TimeseriesEditorProps {
|
||||||
embeddableHandler: VisualizeEmbeddableContract;
|
embeddableHandler: VisualizeEmbeddableContract;
|
||||||
eventEmitter: EventEmitter;
|
eventEmitter: EventEmitter;
|
||||||
timeRange: TimeRange;
|
timeRange: TimeRange;
|
||||||
uiState: PersistedState;
|
filters: EditorRenderProps['filters'];
|
||||||
|
query: EditorRenderProps['query'];
|
||||||
|
uiState: EditorRenderProps['uiState'];
|
||||||
vis: Vis<TimeseriesVisParams>;
|
vis: Vis<TimeseriesVisParams>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,6 +191,8 @@ export class VisEditor extends Component<TimeseriesEditorProps, TimeseriesEditor
|
||||||
eventEmitter={this.props.eventEmitter}
|
eventEmitter={this.props.eventEmitter}
|
||||||
vis={this.props.vis}
|
vis={this.props.vis}
|
||||||
timeRange={this.props.timeRange}
|
timeRange={this.props.timeRange}
|
||||||
|
filters={this.props.filters}
|
||||||
|
query={this.props.query}
|
||||||
uiState={this.props.uiState}
|
uiState={this.props.uiState}
|
||||||
onCommit={this.handleCommit}
|
onCommit={this.handleCommit}
|
||||||
onToggleAutoApply={this.handleAutoApplyToggle}
|
onToggleAutoApply={this.handleAutoApplyToggle}
|
||||||
|
|
|
@ -98,11 +98,8 @@ class VisEditorVisualizationUI extends Component {
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
if (this._handler) {
|
if (this._handler) {
|
||||||
this._handler.updateInput({
|
const { timeRange, filters, query } = this.props;
|
||||||
timeRange: this.props.timeRange,
|
this._handler.updateInput({ timeRange, filters, query });
|
||||||
filters: this.props.filters || [],
|
|
||||||
query: this.props.query,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ export class EditorController implements IEditorController {
|
||||||
private embeddableHandler: VisualizeEmbeddableContract
|
private embeddableHandler: VisualizeEmbeddableContract
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
render({ timeRange, uiState }: EditorRenderProps) {
|
render({ timeRange, uiState, filters, query }: EditorRenderProps) {
|
||||||
const I18nContext = getI18n().Context;
|
const I18nContext = getI18n().Context;
|
||||||
|
|
||||||
render(
|
render(
|
||||||
|
@ -38,6 +38,8 @@ export class EditorController implements IEditorController {
|
||||||
embeddableHandler={this.embeddableHandler}
|
embeddableHandler={this.embeddableHandler}
|
||||||
eventEmitter={this.eventEmitter}
|
eventEmitter={this.eventEmitter}
|
||||||
uiState={uiState}
|
uiState={uiState}
|
||||||
|
filters={filters}
|
||||||
|
query={query}
|
||||||
/>
|
/>
|
||||||
</I18nContext>,
|
</I18nContext>,
|
||||||
this.el
|
this.el
|
||||||
|
|
|
@ -105,8 +105,8 @@ export const metricsVisDefinition: VisTypeDefinition<
|
||||||
editor: TSVB_EDITOR_NAME,
|
editor: TSVB_EDITOR_NAME,
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
showQueryBar: false,
|
showQueryBar: true,
|
||||||
showFilterBar: false,
|
showFilterBar: true,
|
||||||
showIndexSelection: false,
|
showIndexSelection: false,
|
||||||
},
|
},
|
||||||
toExpressionAst,
|
toExpressionAst,
|
||||||
|
@ -117,6 +117,7 @@ export const metricsVisDefinition: VisTypeDefinition<
|
||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
inspectorAdapters: {},
|
inspectorAdapters: {},
|
||||||
|
requiresSearch: true,
|
||||||
getUsedIndexPattern: async (params: VisParams) => {
|
getUsedIndexPattern: async (params: VisParams) => {
|
||||||
const { indexPatterns } = getDataStart();
|
const { indexPatterns } = getDataStart();
|
||||||
const indexPatternValue = params.index_pattern;
|
const indexPatternValue = params.index_pattern;
|
||||||
|
|
|
@ -340,14 +340,6 @@ export class VisualizeEmbeddable
|
||||||
data: { timeFieldName: this.vis.data.indexPattern?.timeFieldName!, ...event.data },
|
data: { timeFieldName: this.vis.data.indexPattern?.timeFieldName!, ...event.data },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
// do not trigger the filter click event if the filter bar is not visible
|
|
||||||
if (
|
|
||||||
triggerId === VIS_EVENT_TO_TRIGGER.filter &&
|
|
||||||
!this.input.id &&
|
|
||||||
!this.vis.type.options.showFilterBar
|
|
||||||
) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
getUiActions().getTrigger(triggerId).exec(context);
|
getUiActions().getTrigger(triggerId).exec(context);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue