Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
import { DataView } from '@kbn/data-views-plugin/common';
import { PublishingSubject } from '../publishing_subject';

/**
* This API publishes a list of data views that it uses. Note that this should not contain any
* ad-hoc data views.
*/
export interface PublishesDataViews {
dataViews$: PublishingSubject<DataView[] | undefined>;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export const getOptionsListControlFactory = (): DataControlFactory<
stateManager,
controlFetch$: (onReload: () => void) => controlGroupApi.controlFetch$(uuid, onReload),
}).subscribe((result) => {
// if there was an error during fetch, set blocking error and return early
// if there was an error during fetch, set suggestion load error and return early
if (Object.hasOwn(result, 'error')) {
dataControl.api.setBlockingError((result as { error: Error }).error);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ export function initializeDataViewsManager(
const dataViewsSubscription = combineLatest([controlGroupDataViewsPipe, childDataViewsPipe])
.pipe(
switchMap(async ([controlGroupDataViews, childDataViews]) => {
const allDataViews = [...(controlGroupDataViews ?? []), ...childDataViews];
const allDataViews = [...(controlGroupDataViews ?? []), ...childDataViews].filter(
(dataView) => dataView.isPersisted()
);

if (allDataViews.length === 0) {
try {
const defaultDataView = await dataService.dataViews.getDefaultDataView();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ export abstract class AbstractDataView {
this.originalSavedObjectBody = this.getAsSavedObjectBody();
};

/**
* Returns true if the data view is persisted, and false if the dataview is adhoc.
*/
isPersisted() {
return typeof this.version === 'string';
}
Expand Down