Skip to content

Commit 6f7c591

Browse files
committed
[dashboard] fix Adhoc dataviews from ES|QL charts are being filtered out in the KQL search bar (#238731)
Closes #236288 ### Background #225705 fixed an issue where controls where getting created with adhoc data views. This fix cause regression #236288. Instead of filtering out adhoc data views from dashboard.dataViews$, the fix should occur in the control group level and ignore adhoc data views when suggesting the data view when creating a control. ### Test instructions * install sample web logs and wait until its install - web logs is expected to be default data view * install sample flights data set * create new dashboard * add ESQL panel with statement `FROM kibana_sample_data_flights | LIMIT 10` * click into unified search query bar. Verify typeahead is populated from `flights` data view. * Add new control to dashboard. Ensure suggested data view is `Kibana Sample Data Logs` - meaning the control suggested the default data view and not the adhoc flights data view from the lens panel. (cherry picked from commit 01e67c3)
1 parent 1c08202 commit 6f7c591

3 files changed

Lines changed: 3 additions & 6 deletions

File tree

src/platform/packages/shared/presentation/presentation_publishing/interfaces/publishes_data_views.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ import { DataView } from '@kbn/data-views-plugin/common';
1111
import { PublishingSubject } from '../publishing_subject';
1212

1313
/**
14-
* This API publishes a list of data views that it uses. Note that this should not contain any
15-
* ad-hoc data views.
14+
* This API publishes a list of data views that it uses.
1615
*/
1716
export interface PublishesDataViews {
1817
dataViews$: PublishingSubject<DataView[] | undefined>;

src/platform/plugins/shared/controls/public/control_group/get_control_group_factory.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ export const getControlGroupEmbeddableFactory = () => {
168168
isEditingEnabled: () => true,
169169
openAddDataControlFlyout: (settings) => {
170170
const parentDataViewId = apiPublishesDataViews(parentApi)
171-
? parentApi.dataViews$.value?.[0]?.id
171+
? parentApi.dataViews$.value?.find((dataView) => dataView.isPersisted())?.id
172172
: undefined;
173173
const newControlState = controlsManager.getNewControlState();
174174

src/platform/plugins/shared/dashboard/public/dashboard_api/data_views_manager.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ export function initializeDataViewsManager(
4343
const dataViewsSubscription = combineLatest([controlGroupDataViewsPipe, childDataViewsPipe])
4444
.pipe(
4545
switchMap(async ([controlGroupDataViews, childDataViews]) => {
46-
const allDataViews = [...(controlGroupDataViews ?? []), ...childDataViews].filter(
47-
(dataView) => dataView.isPersisted()
48-
);
46+
const allDataViews = [...(controlGroupDataViews ?? []), ...childDataViews];
4947

5048
if (allDataViews.length === 0) {
5149
try {

0 commit comments

Comments
 (0)