Skip to content

Commit

Permalink
hide esql based saved searches in ml & transforms
Browse files Browse the repository at this point in the history
  • Loading branch information
rbrtj committed Oct 4, 2024
1 parent 1f77490 commit 4a61045
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { EuiCallOut, EuiPageBody, EuiPanel, EuiSpacer } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { getNestedProperty } from '@kbn/ml-nested-property';
import { SavedObjectFinder } from '@kbn/saved-objects-finder-plugin/public';
import type { SavedObjectCommon } from '@kbn/saved-objects-finder-plugin/common';
import type { FinderAttributes, SavedObjectCommon } from '@kbn/saved-objects-finder-plugin/common';
import { CreateDataViewButton } from '../../../../../components/create_data_view_button';
import { useMlKibana, useNavigateToPath } from '../../../../../contexts/kibana';
import { useToastNotificationService } from '../../../../../services/toast_notification_service';
Expand All @@ -22,6 +22,8 @@ import {

const fixedPageSize: number = 20;

type SavedObject = SavedObjectCommon<FinderAttributes & { isTextBasedQuery?: boolean }>;

export const SourceSelection: FC = () => {
const {
services: {
Expand All @@ -41,7 +43,7 @@ export const SourceSelection: FC = () => {
id: string,
type: string,
fullName?: string,
savedObject?: SavedObjectCommon
savedObject?: SavedObject
) => {
// Kibana data views including `:` are cross-cluster search indices
// and are not supported by Data Frame Analytics yet. For saved searches
Expand Down Expand Up @@ -142,6 +144,9 @@ export const SourceSelection: FC = () => {
defaultMessage: 'Saved search',
}
),
showSavedObject: (savedObject: SavedObject) =>
// ES|QL Based saved searches are not supported in DFA, filter them out
savedObject.attributes.isTextBasedQuery !== true,
},
{
type: 'index-pattern',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ import { FormattedMessage } from '@kbn/i18n-react';
import { SavedObjectFinder } from '@kbn/saved-objects-finder-plugin/public';
import { type DataViewEditorService as DataViewEditorServiceSpec } from '@kbn/data-view-editor-plugin/public';
import { INDEX_PATTERN_TYPE } from '@kbn/data-views-plugin/public';
import type { FinderAttributes, SavedObjectCommon } from '@kbn/saved-objects-finder-plugin/common';
import { createPath } from '../../routing/router';
import { ML_PAGES } from '../../../../common/constants/locator';
import { DataDriftIndexPatternsEditor } from './data_drift_index_patterns_editor';

import { MlPageHeader } from '../../components/page_header';
import { useMlKibana, useNavigateToPath } from '../../contexts/kibana';

type SavedObject = SavedObjectCommon<FinderAttributes & { isTextBasedQuery?: boolean }>;

export const DataDriftIndexOrSearchRedirect: FC = () => {
const navigateToPath = useNavigateToPath();
const { contentManagement, uiSettings } = useMlKibana().services;
Expand Down Expand Up @@ -65,6 +69,9 @@ export const DataDriftIndexOrSearchRedirect: FC = () => {
defaultMessage: 'Saved search',
}
),
showSavedObject: (savedObject: SavedObject) =>
// ES|QL Based saved searches are not supported in Data Drift, filter them out
savedObject.attributes.isTextBasedQuery !== true,
},
{
type: 'index-pattern',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { EuiFlexGroup, EuiPageBody, EuiPanel } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import { SavedObjectFinder } from '@kbn/saved-objects-finder-plugin/public';
import type { FinderAttributes, SavedObjectCommon } from '@kbn/saved-objects-finder-plugin/common';
import { CreateDataViewButton } from '../../../../components/create_data_view_button';
import { useMlKibana, useNavigateToPath } from '../../../../contexts/kibana';
import { MlPageHeader } from '../../../../components/page_header';
Expand All @@ -21,6 +22,8 @@ export interface PageProps {

const RESULTS_PER_PAGE = 20;

type SavedObject = SavedObjectCommon<FinderAttributes & { isTextBasedQuery?: boolean }>;

export const Page: FC<PageProps> = ({
nextStepPath,
extraButtons,
Expand Down Expand Up @@ -69,6 +72,9 @@ export const Page: FC<PageProps> = ({
defaultMessage: 'Saved search',
}
),
showSavedObject: (savedObject: SavedObject) =>
// ES|QL Based saved searches are not supported across ML, filter them out
savedObject.attributes.isTextBasedQuery !== true,
},
{
type: 'index-pattern',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { FormattedMessage } from '@kbn/i18n-react';
import React, { type FC, Fragment } from 'react';

import { SavedObjectFinder } from '@kbn/saved-objects-finder-plugin/public';
import type { FinderAttributes, SavedObjectCommon } from '@kbn/saved-objects-finder-plugin/common';
import { useAppDependencies } from '../../../../app_dependencies';

interface SearchSelectionProps {
Expand All @@ -19,6 +20,8 @@ interface SearchSelectionProps {
canEditDataView: boolean;
}

type SavedObject = SavedObjectCommon<FinderAttributes & { isTextBasedQuery?: boolean }>;

const fixedPageSize: number = 8;

export const SearchSelection: FC<SearchSelectionProps> = ({
Expand Down Expand Up @@ -64,6 +67,9 @@ export const SearchSelection: FC<SearchSelectionProps> = ({
defaultMessage: 'Saved search',
}
),
showSavedObject: (savedObject: SavedObject) =>
// ES|QL Based saved searches are not supported in transforms, filter them out
savedObject.attributes.isTextBasedQuery !== true,
},
{
type: 'index-pattern',
Expand Down

0 comments on commit 4a61045

Please sign in to comment.