mirror of
https://github.com/elastic/kibana.git
synced 2025-06-28 03:01:21 -04:00
[Discover] Split saved searches out of discover plugin (#138388)
This commit is contained in:
parent
945d456e71
commit
fcf3b8bb21
74 changed files with 217 additions and 76 deletions
|
@ -1341,7 +1341,7 @@ module.exports = {
|
||||||
* Discover overrides
|
* Discover overrides
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
files: ['src/plugins/discover/**/*.{ts,tsx}'],
|
files: ['src/plugins/discover/**/*.{ts,tsx}', 'src/plugins/saved_search/**/*.{ts,tsx}'],
|
||||||
rules: {
|
rules: {
|
||||||
'@typescript-eslint/no-explicit-any': 'error',
|
'@typescript-eslint/no-explicit-any': 'error',
|
||||||
'@typescript-eslint/ban-ts-comment': [
|
'@typescript-eslint/ban-ts-comment': [
|
||||||
|
|
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
# Data Discovery
|
# Data Discovery
|
||||||
/src/plugins/discover/ @elastic/kibana-data-discovery
|
/src/plugins/discover/ @elastic/kibana-data-discovery
|
||||||
|
/src/plugins/saved_search/ @elastic/kibana-data-discovery
|
||||||
/x-pack/plugins/discover_enhanced/ @elastic/kibana-data-discovery
|
/x-pack/plugins/discover_enhanced/ @elastic/kibana-data-discovery
|
||||||
/test/functional/apps/discover/ @elastic/kibana-data-discovery
|
/test/functional/apps/discover/ @elastic/kibana-data-discovery
|
||||||
/x-pack/plugins/graph/ @elastic/kibana-data-discovery
|
/x-pack/plugins/graph/ @elastic/kibana-data-discovery
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
"dataViews": "src/plugins/data_views",
|
"dataViews": "src/plugins/data_views",
|
||||||
"devTools": "src/plugins/dev_tools",
|
"devTools": "src/plugins/dev_tools",
|
||||||
"discover": "src/plugins/discover",
|
"discover": "src/plugins/discover",
|
||||||
|
"savedSearch": "src/plugins/saved_search",
|
||||||
"embeddableApi": "src/plugins/embeddable",
|
"embeddableApi": "src/plugins/embeddable",
|
||||||
"embeddableExamples": "examples/embeddable_examples",
|
"embeddableExamples": "examples/embeddable_examples",
|
||||||
"esQuery": "packages/kbn-es-query/src",
|
"esQuery": "packages/kbn-es-query/src",
|
||||||
|
|
|
@ -246,6 +246,10 @@ Content is fetched from the remote (https://feeds.elastic.co) once a day, with p
|
||||||
oss plugins.
|
oss plugins.
|
||||||
|
|
||||||
|
|
||||||
|
|{kib-repo}blob/{branch}/src/plugins/saved_search/README.md[savedSearch]
|
||||||
|
|Contains the saved search saved object definition and helpers.
|
||||||
|
|
||||||
|
|
||||||
|{kib-repo}blob/{branch}/src/plugins/screenshot_mode/README.md[screenshotMode]
|
|{kib-repo}blob/{branch}/src/plugins/screenshot_mode/README.md[screenshotMode]
|
||||||
|The service exposed by this plugin informs consumers whether they should optimize for non-interactivity. In this way plugins can avoid loading unnecessary code, data or other services.
|
|The service exposed by this plugin informs consumers whether they should optimize for non-interactivity. In this way plugins can avoid loading unnecessary code, data or other services.
|
||||||
|
|
||||||
|
|
|
@ -120,6 +120,7 @@ pageLoadAssetSize:
|
||||||
controls: 40000
|
controls: 40000
|
||||||
expressionPartitionVis: 26338
|
expressionPartitionVis: 26338
|
||||||
sharedUX: 16225
|
sharedUX: 16225
|
||||||
|
savedSearch: 16225
|
||||||
ux: 20784
|
ux: 20784
|
||||||
sessionView: 77750
|
sessionView: 77750
|
||||||
cloudSecurityPosture: 19109
|
cloudSecurityPosture: 19109
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
"expressions"
|
"expressions"
|
||||||
],
|
],
|
||||||
"optionalPlugins": ["home", "share", "usageCollection", "spaces", "triggersActionsUi"],
|
"optionalPlugins": ["home", "share", "usageCollection", "spaces", "triggersActionsUi"],
|
||||||
"requiredBundles": ["kibanaUtils", "kibanaReact", "dataViews", "unifiedSearch"],
|
"requiredBundles": ["kibanaUtils", "kibanaReact", "dataViews", "unifiedSearch", "savedSearch"],
|
||||||
"extraPublicDirs": ["common"],
|
"extraPublicDirs": ["common"],
|
||||||
"owner": {
|
"owner": {
|
||||||
"name": "Data Discovery",
|
"name": "Data Discovery",
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Side Public License, v 1.
|
* Side Public License, v 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { SavedSearch } from '../services/saved_searches';
|
import { SavedSearch } from '@kbn/saved-search-plugin/public';
|
||||||
import { createSearchSourceMock } from '@kbn/data-plugin/public/mocks';
|
import { createSearchSourceMock } from '@kbn/data-plugin/public/mocks';
|
||||||
import { dataViewMock } from './data_view';
|
import { dataViewMock } from './data_view';
|
||||||
import { dataViewWithTimefieldMock } from './data_view_with_timefield';
|
import { dataViewWithTimefieldMock } from './data_view_with_timefield';
|
||||||
|
|
|
@ -18,8 +18,8 @@ import {
|
||||||
} from '@elastic/eui';
|
} from '@elastic/eui';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import type { DataView } from '@kbn/data-views-plugin/public';
|
import type { DataView } from '@kbn/data-views-plugin/public';
|
||||||
|
import { SavedSearch } from '@kbn/saved-search-plugin/public';
|
||||||
import { HitsCounter } from '../hits_counter';
|
import { HitsCounter } from '../hits_counter';
|
||||||
import { SavedSearch } from '../../../../services/saved_searches';
|
|
||||||
import { GetStateReturn } from '../../services/discover_state';
|
import { GetStateReturn } from '../../services/discover_state';
|
||||||
import { DiscoverHistogram } from './histogram';
|
import { DiscoverHistogram } from './histogram';
|
||||||
import { DataCharts$, DataTotalHits$ } from '../../hooks/use_saved_search';
|
import { DataCharts$, DataTotalHits$ } from '../../hooks/use_saved_search';
|
||||||
|
|
|
@ -17,9 +17,9 @@ import {
|
||||||
IEmbeddable,
|
IEmbeddable,
|
||||||
isErrorEmbeddable,
|
isErrorEmbeddable,
|
||||||
} from '@kbn/embeddable-plugin/public';
|
} from '@kbn/embeddable-plugin/public';
|
||||||
|
import type { SavedSearch } from '@kbn/saved-search-plugin/public';
|
||||||
import { useDiscoverServices } from '../../../../hooks/use_discover_services';
|
import { useDiscoverServices } from '../../../../hooks/use_discover_services';
|
||||||
import { FIELD_STATISTICS_LOADED } from './constants';
|
import { FIELD_STATISTICS_LOADED } from './constants';
|
||||||
import type { SavedSearch } from '../../../../services/saved_searches';
|
|
||||||
import type { GetStateReturn } from '../../services/discover_state';
|
import type { GetStateReturn } from '../../services/discover_state';
|
||||||
import { AvailableFields$, DataRefetch$ } from '../../hooks/use_saved_search';
|
import { AvailableFields$, DataRefetch$ } from '../../hooks/use_saved_search';
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ import {
|
||||||
} from '@elastic/eui';
|
} from '@elastic/eui';
|
||||||
import { FormattedMessage } from '@kbn/i18n-react';
|
import { FormattedMessage } from '@kbn/i18n-react';
|
||||||
import { DataView } from '@kbn/data-views-plugin/public';
|
import { DataView } from '@kbn/data-views-plugin/public';
|
||||||
|
import { SavedSearch } from '@kbn/saved-search-plugin/public';
|
||||||
import { useDiscoverServices } from '../../../../hooks/use_discover_services';
|
import { useDiscoverServices } from '../../../../hooks/use_discover_services';
|
||||||
import { DocViewFilterFn } from '../../../../services/doc_views/doc_views_types';
|
import { DocViewFilterFn } from '../../../../services/doc_views/doc_views_types';
|
||||||
import { DiscoverGrid } from '../../../../components/discover_grid/discover_grid';
|
import { DiscoverGrid } from '../../../../components/discover_grid/discover_grid';
|
||||||
|
@ -27,7 +28,6 @@ import {
|
||||||
HIDE_ANNOUNCEMENTS,
|
HIDE_ANNOUNCEMENTS,
|
||||||
} from '../../../../../common';
|
} from '../../../../../common';
|
||||||
import { useColumns } from '../../../../hooks/use_data_grid_columns';
|
import { useColumns } from '../../../../hooks/use_data_grid_columns';
|
||||||
import { SavedSearch } from '../../../../services/saved_searches';
|
|
||||||
import { DataDocuments$, DataDocumentsMsg, RecordRawType } from '../../hooks/use_saved_search';
|
import { DataDocuments$, DataDocumentsMsg, RecordRawType } from '../../hooks/use_saved_search';
|
||||||
import { AppState, GetStateReturn } from '../../services/discover_state';
|
import { AppState, GetStateReturn } from '../../services/discover_state';
|
||||||
import { useDataState } from '../../hooks/use_data_state';
|
import { useDataState } from '../../hooks/use_data_state';
|
||||||
|
|
|
@ -42,12 +42,12 @@ import { useColumns } from '../../../../hooks/use_data_grid_columns';
|
||||||
import { DiscoverDocuments } from './discover_documents';
|
import { DiscoverDocuments } from './discover_documents';
|
||||||
import { FetchStatus } from '../../../types';
|
import { FetchStatus } from '../../../types';
|
||||||
import { useDataState } from '../../hooks/use_data_state';
|
import { useDataState } from '../../hooks/use_data_state';
|
||||||
import { SavedSearchURLConflictCallout } from '../../../../services/saved_searches';
|
|
||||||
import { FieldStatisticsTable } from '../field_stats_table';
|
import { FieldStatisticsTable } from '../field_stats_table';
|
||||||
import { VIEW_MODE } from '../../../../components/view_mode_toggle';
|
import { VIEW_MODE } from '../../../../components/view_mode_toggle';
|
||||||
import { DOCUMENTS_VIEW_CLICK, FIELD_STATISTICS_VIEW_CLICK } from '../field_stats_table/constants';
|
import { DOCUMENTS_VIEW_CLICK, FIELD_STATISTICS_VIEW_CLICK } from '../field_stats_table/constants';
|
||||||
import { hasActiveFilter } from './utils';
|
import { hasActiveFilter } from './utils';
|
||||||
import { getRawRecordType } from '../../utils/get_raw_record_type';
|
import { getRawRecordType } from '../../utils/get_raw_record_type';
|
||||||
|
import { SavedSearchURLConflictCallout } from '../../../../components/saved_search_url_conflict_callout/saved_search_url_conflict_callout';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Local storage key for sidebar persistence state
|
* Local storage key for sidebar persistence state
|
||||||
|
|
|
@ -11,10 +11,10 @@ import type { SavedObject } from '@kbn/data-plugin/public';
|
||||||
import type { DataView, DataViewAttributes } from '@kbn/data-views-plugin/public';
|
import type { DataView, DataViewAttributes } from '@kbn/data-views-plugin/public';
|
||||||
import { ISearchSource } from '@kbn/data-plugin/public';
|
import { ISearchSource } from '@kbn/data-plugin/public';
|
||||||
import { RequestAdapter } from '@kbn/inspector-plugin/common';
|
import { RequestAdapter } from '@kbn/inspector-plugin/common';
|
||||||
|
import { SavedSearch } from '@kbn/saved-search-plugin/public';
|
||||||
import { DataTableRecord } from '../../../../types';
|
import { DataTableRecord } from '../../../../types';
|
||||||
import { AppState, GetStateReturn } from '../../services/discover_state';
|
import { AppState, GetStateReturn } from '../../services/discover_state';
|
||||||
import { DataRefetch$, SavedSearchData } from '../../hooks/use_saved_search';
|
import { DataRefetch$, SavedSearchData } from '../../hooks/use_saved_search';
|
||||||
import { SavedSearch } from '../../../../services/saved_searches';
|
|
||||||
|
|
||||||
export interface DiscoverLayoutProps {
|
export interface DiscoverLayoutProps {
|
||||||
dataView: DataView;
|
dataView: DataView;
|
||||||
|
|
|
@ -11,10 +11,10 @@ import type { ISearchSource } from '@kbn/data-plugin/public';
|
||||||
import type { DataView } from '@kbn/data-views-plugin/public';
|
import type { DataView } from '@kbn/data-views-plugin/public';
|
||||||
import { unhashUrl } from '@kbn/kibana-utils-plugin/public';
|
import { unhashUrl } from '@kbn/kibana-utils-plugin/public';
|
||||||
import type { TopNavMenuData } from '@kbn/navigation-plugin/public';
|
import type { TopNavMenuData } from '@kbn/navigation-plugin/public';
|
||||||
|
import { SavedSearch } from '@kbn/saved-search-plugin/public';
|
||||||
import { showOpenSearchPanel } from './show_open_search_panel';
|
import { showOpenSearchPanel } from './show_open_search_panel';
|
||||||
import { getSharingData, showPublicUrlSwitch } from '../../../../utils/get_sharing_data';
|
import { getSharingData, showPublicUrlSwitch } from '../../../../utils/get_sharing_data';
|
||||||
import { DiscoverServices } from '../../../../build_services';
|
import { DiscoverServices } from '../../../../build_services';
|
||||||
import { SavedSearch } from '../../../../services/saved_searches';
|
|
||||||
import { onSaveSearch } from './on_save_search';
|
import { onSaveSearch } from './on_save_search';
|
||||||
import { GetStateReturn } from '../../services/discover_state';
|
import { GetStateReturn } from '../../services/discover_state';
|
||||||
import { openOptionsPopover } from './open_options_popover';
|
import { openOptionsPopover } from './open_options_popover';
|
||||||
|
|
|
@ -10,7 +10,7 @@ import React from 'react';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { SavedObjectSaveModal, showSaveModal, OnSaveProps } from '@kbn/saved-objects-plugin/public';
|
import { SavedObjectSaveModal, showSaveModal, OnSaveProps } from '@kbn/saved-objects-plugin/public';
|
||||||
import { DataView } from '@kbn/data-views-plugin/public';
|
import { DataView } from '@kbn/data-views-plugin/public';
|
||||||
import { SavedSearch, SaveSavedSearchOptions } from '../../../../services/saved_searches';
|
import { SavedSearch, SaveSavedSearchOptions } from '@kbn/saved-search-plugin/public';
|
||||||
import { DiscoverServices } from '../../../../build_services';
|
import { DiscoverServices } from '../../../../build_services';
|
||||||
import { GetStateReturn } from '../../services/discover_state';
|
import { GetStateReturn } from '../../services/discover_state';
|
||||||
import { setBreadcrumbsTitle } from '../../../../utils/breadcrumbs';
|
import { setBreadcrumbsTitle } from '../../../../utils/breadcrumbs';
|
||||||
|
|
|
@ -9,14 +9,15 @@ import React, { useCallback, useEffect, useState } from 'react';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
import type { DataViewAttributes } from '@kbn/data-views-plugin/public';
|
import type { DataViewAttributes } from '@kbn/data-views-plugin/public';
|
||||||
import type { SavedObject } from '@kbn/data-plugin/public';
|
import type { SavedObject } from '@kbn/data-plugin/public';
|
||||||
|
import { SavedSearch } from '@kbn/saved-search-plugin/public';
|
||||||
import { DiscoverLayout } from './components/layout';
|
import { DiscoverLayout } from './components/layout';
|
||||||
import { setBreadcrumbsTitle } from '../../utils/breadcrumbs';
|
import { setBreadcrumbsTitle } from '../../utils/breadcrumbs';
|
||||||
import { addHelpMenuToAppChrome } from '../../components/help_menu/help_menu_util';
|
import { addHelpMenuToAppChrome } from '../../components/help_menu/help_menu_util';
|
||||||
import { useDiscoverState } from './hooks/use_discover_state';
|
import { useDiscoverState } from './hooks/use_discover_state';
|
||||||
import { useUrl } from './hooks/use_url';
|
import { useUrl } from './hooks/use_url';
|
||||||
import { SavedSearch, useSavedSearchAliasMatchRedirect } from '../../services/saved_searches';
|
|
||||||
import { useDiscoverServices } from '../../hooks/use_discover_services';
|
import { useDiscoverServices } from '../../hooks/use_discover_services';
|
||||||
import { DataTableRecord } from '../../types';
|
import { DataTableRecord } from '../../types';
|
||||||
|
import { useSavedSearchAliasMatchRedirect } from '../../hooks/saved_search_alias_match_redirect';
|
||||||
|
|
||||||
const DiscoverLayoutMemoized = React.memo(DiscoverLayout);
|
const DiscoverLayoutMemoized = React.memo(DiscoverLayout);
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ import {
|
||||||
SavedSearch,
|
SavedSearch,
|
||||||
getSavedSearch,
|
getSavedSearch,
|
||||||
getSavedSearchFullPathUrl,
|
getSavedSearchFullPathUrl,
|
||||||
} from '../../services/saved_searches';
|
} from '@kbn/saved-search-plugin/public';
|
||||||
import { getState } from './services/discover_state';
|
import { getState } from './services/discover_state';
|
||||||
import { loadDataView, resolveDataView } from './utils/resolve_data_view';
|
import { loadDataView, resolveDataView } from './utils/resolve_data_view';
|
||||||
import { DiscoverMainApp } from './discover_main_app';
|
import { DiscoverMainApp } from './discover_main_app';
|
||||||
|
|
|
@ -16,10 +16,10 @@ import {
|
||||||
AggregateQuery,
|
AggregateQuery,
|
||||||
Query,
|
Query,
|
||||||
} from '@kbn/es-query';
|
} from '@kbn/es-query';
|
||||||
|
import { SavedSearch, getSavedSearch } from '@kbn/saved-search-plugin/public';
|
||||||
import { getState } from '../services/discover_state';
|
import { getState } from '../services/discover_state';
|
||||||
import { getStateDefaults } from '../utils/get_state_defaults';
|
import { getStateDefaults } from '../utils/get_state_defaults';
|
||||||
import { DiscoverServices } from '../../../build_services';
|
import { DiscoverServices } from '../../../build_services';
|
||||||
import { SavedSearch, getSavedSearch } from '../../../services/saved_searches';
|
|
||||||
import { loadDataView } from '../utils/resolve_data_view';
|
import { loadDataView } from '../utils/resolve_data_view';
|
||||||
import { useSavedSearch as useSavedSearchData, DataDocumentsMsg } from './use_saved_search';
|
import { useSavedSearch as useSavedSearchData, DataDocumentsMsg } from './use_saved_search';
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import { BehaviorSubject, Subject } from 'rxjs';
|
||||||
import type { AutoRefreshDoneFn } from '@kbn/data-plugin/public';
|
import type { AutoRefreshDoneFn } from '@kbn/data-plugin/public';
|
||||||
import { ISearchSource } from '@kbn/data-plugin/public';
|
import { ISearchSource } from '@kbn/data-plugin/public';
|
||||||
import { RequestAdapter } from '@kbn/inspector-plugin/public';
|
import { RequestAdapter } from '@kbn/inspector-plugin/public';
|
||||||
|
import { SavedSearch } from '@kbn/saved-search-plugin/public';
|
||||||
import { getRawRecordType } from '../utils/get_raw_record_type';
|
import { getRawRecordType } from '../utils/get_raw_record_type';
|
||||||
import { DiscoverServices } from '../../../build_services';
|
import { DiscoverServices } from '../../../build_services';
|
||||||
import { DiscoverSearchSessionManager } from '../services/discover_search_session';
|
import { DiscoverSearchSessionManager } from '../services/discover_search_session';
|
||||||
|
@ -22,7 +23,6 @@ import { fetchAll } from '../utils/fetch_all';
|
||||||
import { useBehaviorSubject } from './use_behavior_subject';
|
import { useBehaviorSubject } from './use_behavior_subject';
|
||||||
import { sendResetMsg } from './use_saved_search_messages';
|
import { sendResetMsg } from './use_saved_search_messages';
|
||||||
import { getFetch$ } from '../utils/get_fetch_observable';
|
import { getFetch$ } from '../utils/get_fetch_observable';
|
||||||
import { SavedSearch } from '../../../services/saved_searches';
|
|
||||||
import type { DataTableRecord } from '../../../types';
|
import type { DataTableRecord } from '../../../types';
|
||||||
|
|
||||||
export interface SavedSearchData {
|
export interface SavedSearchData {
|
||||||
|
|
|
@ -8,13 +8,13 @@
|
||||||
import { useMemo, useEffect } from 'react';
|
import { useMemo, useEffect } from 'react';
|
||||||
import { History } from 'history';
|
import { History } from 'history';
|
||||||
import { noSearchSessionStorageCapabilityMessage } from '@kbn/data-plugin/public';
|
import { noSearchSessionStorageCapabilityMessage } from '@kbn/data-plugin/public';
|
||||||
|
import { SavedSearch } from '@kbn/saved-search-plugin/public';
|
||||||
import { DiscoverSearchSessionManager } from '../services/discover_search_session';
|
import { DiscoverSearchSessionManager } from '../services/discover_search_session';
|
||||||
import {
|
import {
|
||||||
createSearchSessionRestorationDataProvider,
|
createSearchSessionRestorationDataProvider,
|
||||||
GetStateReturn,
|
GetStateReturn,
|
||||||
} from '../services/discover_state';
|
} from '../services/discover_state';
|
||||||
import { DiscoverServices } from '../../../build_services';
|
import { DiscoverServices } from '../../../build_services';
|
||||||
import { SavedSearch } from '../../../services/saved_searches';
|
|
||||||
|
|
||||||
export function useSearchSession({
|
export function useSearchSession({
|
||||||
services,
|
services,
|
||||||
|
|
|
@ -14,7 +14,7 @@ import {
|
||||||
} from './discover_state';
|
} from './discover_state';
|
||||||
import { createBrowserHistory, History } from 'history';
|
import { createBrowserHistory, History } from 'history';
|
||||||
import { dataPluginMock } from '@kbn/data-plugin/public/mocks';
|
import { dataPluginMock } from '@kbn/data-plugin/public/mocks';
|
||||||
import type { SavedSearch } from '../../../services/saved_searches';
|
import type { SavedSearch } from '@kbn/saved-search-plugin/public';
|
||||||
import { SEARCH_FIELDS_FROM_SOURCE } from '../../../../common';
|
import { SEARCH_FIELDS_FROM_SOURCE } from '../../../../common';
|
||||||
|
|
||||||
let history: History;
|
let history: History;
|
||||||
|
|
|
@ -36,8 +36,8 @@ import {
|
||||||
syncQueryStateWithUrl,
|
syncQueryStateWithUrl,
|
||||||
} from '@kbn/data-plugin/public';
|
} from '@kbn/data-plugin/public';
|
||||||
import { DataView } from '@kbn/data-views-plugin/public';
|
import { DataView } from '@kbn/data-views-plugin/public';
|
||||||
|
import { SavedSearch } from '@kbn/saved-search-plugin/public';
|
||||||
import { DiscoverGridSettings } from '../../../components/discover_grid/types';
|
import { DiscoverGridSettings } from '../../../components/discover_grid/types';
|
||||||
import { SavedSearch } from '../../../services/saved_searches';
|
|
||||||
import { handleSourceColumnState } from '../../../utils/state_helpers';
|
import { handleSourceColumnState } from '../../../utils/state_helpers';
|
||||||
import { DISCOVER_APP_LOCATOR, DiscoverAppLocatorParams } from '../../../locator';
|
import { DISCOVER_APP_LOCATOR, DiscoverAppLocatorParams } from '../../../locator';
|
||||||
import { VIEW_MODE } from '../../../components/view_mode_toggle';
|
import { VIEW_MODE } from '../../../components/view_mode_toggle';
|
||||||
|
|
|
@ -9,6 +9,7 @@ import { DataPublicPluginStart, ISearchSource } from '@kbn/data-plugin/public';
|
||||||
import { Adapters } from '@kbn/inspector-plugin/common';
|
import { Adapters } from '@kbn/inspector-plugin/common';
|
||||||
import { ReduxLikeStateContainer } from '@kbn/kibana-utils-plugin/common';
|
import { ReduxLikeStateContainer } from '@kbn/kibana-utils-plugin/common';
|
||||||
import { DataViewType } from '@kbn/data-views-plugin/public';
|
import { DataViewType } from '@kbn/data-views-plugin/public';
|
||||||
|
import type { SavedSearch, SortOrder } from '@kbn/saved-search-plugin/public';
|
||||||
import { getRawRecordType } from './get_raw_record_type';
|
import { getRawRecordType } from './get_raw_record_type';
|
||||||
import {
|
import {
|
||||||
sendCompleteMsg,
|
sendCompleteMsg,
|
||||||
|
@ -19,7 +20,6 @@ import {
|
||||||
sendResetMsg,
|
sendResetMsg,
|
||||||
} from '../hooks/use_saved_search_messages';
|
} from '../hooks/use_saved_search_messages';
|
||||||
import { updateSearchSource } from './update_search_source';
|
import { updateSearchSource } from './update_search_source';
|
||||||
import type { SavedSearch, SortOrder } from '../../../services/saved_searches';
|
|
||||||
import { fetchDocuments } from './fetch_documents';
|
import { fetchDocuments } from './fetch_documents';
|
||||||
import { fetchTotalHits } from './fetch_total_hits';
|
import { fetchTotalHits } from './fetch_total_hits';
|
||||||
import { fetchChart } from './fetch_chart';
|
import { fetchChart } from './fetch_chart';
|
||||||
|
|
|
@ -10,13 +10,13 @@ import { cloneDeep, isEqual } from 'lodash';
|
||||||
import { IUiSettingsClient } from '@kbn/core/public';
|
import { IUiSettingsClient } from '@kbn/core/public';
|
||||||
import { DataPublicPluginStart } from '@kbn/data-plugin/public';
|
import { DataPublicPluginStart } from '@kbn/data-plugin/public';
|
||||||
import { Storage } from '@kbn/kibana-utils-plugin/public';
|
import { Storage } from '@kbn/kibana-utils-plugin/public';
|
||||||
|
import { SavedSearch } from '@kbn/saved-search-plugin/public';
|
||||||
import {
|
import {
|
||||||
DEFAULT_COLUMNS_SETTING,
|
DEFAULT_COLUMNS_SETTING,
|
||||||
DOC_HIDE_TIME_COLUMN_SETTING,
|
DOC_HIDE_TIME_COLUMN_SETTING,
|
||||||
SEARCH_FIELDS_FROM_SOURCE,
|
SEARCH_FIELDS_FROM_SOURCE,
|
||||||
SORT_DEFAULT_ORDER_SETTING,
|
SORT_DEFAULT_ORDER_SETTING,
|
||||||
} from '../../../../common';
|
} from '../../../../common';
|
||||||
import { SavedSearch } from '../../../services/saved_searches';
|
|
||||||
|
|
||||||
import { AppState } from '../services/discover_state';
|
import { AppState } from '../services/discover_state';
|
||||||
import { getDefaultSort, getSortArray } from '../../../components/doc_table';
|
import { getDefaultSort, getSortArray } from '../../../components/doc_table';
|
||||||
|
|
|
@ -8,12 +8,12 @@
|
||||||
import { isOfAggregateQueryType } from '@kbn/es-query';
|
import { isOfAggregateQueryType } from '@kbn/es-query';
|
||||||
import { DataView } from '@kbn/data-views-plugin/public';
|
import { DataView } from '@kbn/data-views-plugin/public';
|
||||||
import { SavedObjectSaveOpts } from '@kbn/saved-objects-plugin/public';
|
import { SavedObjectSaveOpts } from '@kbn/saved-objects-plugin/public';
|
||||||
|
import { SavedSearch } from '@kbn/saved-search-plugin/public';
|
||||||
|
import type { SortOrder } from '@kbn/saved-search-plugin/public';
|
||||||
|
import { saveSavedSearch } from '@kbn/saved-search-plugin/public';
|
||||||
import { updateSearchSource } from './update_search_source';
|
import { updateSearchSource } from './update_search_source';
|
||||||
import { SavedSearch } from '../../../services/saved_searches';
|
|
||||||
import { AppState } from '../services/discover_state';
|
import { AppState } from '../services/discover_state';
|
||||||
import type { SortOrder } from '../../../services/saved_searches';
|
|
||||||
import { DiscoverServices } from '../../../build_services';
|
import { DiscoverServices } from '../../../build_services';
|
||||||
import { saveSavedSearch } from '../../../services/saved_searches';
|
|
||||||
/**
|
/**
|
||||||
* Helper function to update and persist the given savedSearch
|
* Helper function to update and persist the given savedSearch
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
import { updateSearchSource } from './update_search_source';
|
import { updateSearchSource } from './update_search_source';
|
||||||
import { createSearchSourceMock } from '@kbn/data-plugin/common/search/search_source/mocks';
|
import { createSearchSourceMock } from '@kbn/data-plugin/common/search/search_source/mocks';
|
||||||
import { dataViewMock } from '../../../__mocks__/data_view';
|
import { dataViewMock } from '../../../__mocks__/data_view';
|
||||||
import type { SortOrder } from '../../../services/saved_searches';
|
import type { SortOrder } from '@kbn/saved-search-plugin/public';
|
||||||
import { discoverServiceMock } from '../../../__mocks__/services';
|
import { discoverServiceMock } from '../../../__mocks__/services';
|
||||||
|
|
||||||
describe('updateSearchSource', () => {
|
describe('updateSearchSource', () => {
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
import { ISearchSource } from '@kbn/data-plugin/public';
|
import { ISearchSource } from '@kbn/data-plugin/public';
|
||||||
import { DataViewType, DataView } from '@kbn/data-views-plugin/public';
|
import { DataViewType, DataView } from '@kbn/data-views-plugin/public';
|
||||||
|
import type { SortOrder } from '@kbn/saved-search-plugin/public';
|
||||||
import { SORT_DEFAULT_ORDER_SETTING } from '../../../../common';
|
import { SORT_DEFAULT_ORDER_SETTING } from '../../../../common';
|
||||||
import type { SortOrder } from '../../../services/saved_searches';
|
|
||||||
import { DiscoverServices } from '../../../build_services';
|
import { DiscoverServices } from '../../../build_services';
|
||||||
import { getSortForSearchSource } from '../../../components/doc_table';
|
import { getSortForSearchSource } from '../../../components/doc_table';
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,9 @@ import type { History } from 'history';
|
||||||
|
|
||||||
import { mountWithIntl } from '@kbn/test-jest-helpers';
|
import { mountWithIntl } from '@kbn/test-jest-helpers';
|
||||||
import { SavedSearchURLConflictCallout } from './saved_search_url_conflict_callout';
|
import { SavedSearchURLConflictCallout } from './saved_search_url_conflict_callout';
|
||||||
import type { SavedSearch } from './types';
|
|
||||||
|
|
||||||
import { spacesPluginMock } from '@kbn/spaces-plugin/public/mocks';
|
import { spacesPluginMock } from '@kbn/spaces-plugin/public/mocks';
|
||||||
|
import { SavedSearch } from '@kbn/saved-search-plugin/public';
|
||||||
|
|
||||||
describe('SavedSearchURLConflictCallout', () => {
|
describe('SavedSearchURLConflictCallout', () => {
|
||||||
let spaces: ReturnType<typeof spacesPluginMock.createStartContract>;
|
let spaces: ReturnType<typeof spacesPluginMock.createStartContract>;
|
|
@ -9,9 +9,7 @@
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import type { History } from 'history';
|
import type { History } from 'history';
|
||||||
import type { SpacesApi } from '@kbn/spaces-plugin/public';
|
import type { SpacesApi } from '@kbn/spaces-plugin/public';
|
||||||
import { getSavedSearchUrl } from './saved_searches_utils';
|
import { getSavedSearchUrl, SavedSearch } from '@kbn/saved-search-plugin/public';
|
||||||
|
|
||||||
import type { SavedSearch } from './types';
|
|
||||||
|
|
||||||
interface SavedSearchURLConflictCalloutProps {
|
interface SavedSearchURLConflictCalloutProps {
|
||||||
savedSearch?: SavedSearch;
|
savedSearch?: SavedSearch;
|
|
@ -32,11 +32,11 @@ import { ISearchSource } from '@kbn/data-plugin/public';
|
||||||
import { DataView, DataViewField } from '@kbn/data-views-plugin/public';
|
import { DataView, DataViewField } from '@kbn/data-views-plugin/public';
|
||||||
import { UiActionsStart } from '@kbn/ui-actions-plugin/public';
|
import { UiActionsStart } from '@kbn/ui-actions-plugin/public';
|
||||||
import { KibanaContextProvider, KibanaThemeProvider } from '@kbn/kibana-react-plugin/public';
|
import { KibanaContextProvider, KibanaThemeProvider } from '@kbn/kibana-react-plugin/public';
|
||||||
|
import { SavedSearch } from '@kbn/saved-search-plugin/public';
|
||||||
import { RecordRawType } from '../application/main/hooks/use_saved_search';
|
import { RecordRawType } from '../application/main/hooks/use_saved_search';
|
||||||
import { buildDataTableRecord } from '../utils/build_data_record';
|
import { buildDataTableRecord } from '../utils/build_data_record';
|
||||||
import { DataTableRecord, EsHitRecord } from '../types';
|
import { DataTableRecord, EsHitRecord } from '../types';
|
||||||
import { ISearchEmbeddable, SearchInput, SearchOutput } from './types';
|
import { ISearchEmbeddable, SearchInput, SearchOutput } from './types';
|
||||||
import { SavedSearch } from '../services/saved_searches';
|
|
||||||
import { SEARCH_EMBEDDABLE_TYPE } from './constants';
|
import { SEARCH_EMBEDDABLE_TYPE } from './constants';
|
||||||
import { DiscoverServices } from '../build_services';
|
import { DiscoverServices } from '../build_services';
|
||||||
import { SavedSearchEmbeddableComponent } from './saved_search_embeddable_component';
|
import { SavedSearchEmbeddableComponent } from './saved_search_embeddable_component';
|
||||||
|
|
|
@ -16,14 +16,14 @@ import {
|
||||||
|
|
||||||
import type { TimeRange } from '@kbn/es-query';
|
import type { TimeRange } from '@kbn/es-query';
|
||||||
|
|
||||||
import { SearchInput, SearchOutput } from './types';
|
|
||||||
import { SEARCH_EMBEDDABLE_TYPE } from './constants';
|
|
||||||
import { SavedSearchEmbeddable } from './saved_search_embeddable';
|
|
||||||
import {
|
import {
|
||||||
getSavedSearch,
|
getSavedSearch,
|
||||||
getSavedSearchUrl,
|
getSavedSearchUrl,
|
||||||
throwErrorOnSavedSearchUrlConflict,
|
throwErrorOnSavedSearchUrlConflict,
|
||||||
} from '../services/saved_searches';
|
} from '@kbn/saved-search-plugin/public';
|
||||||
|
import { SearchInput, SearchOutput } from './types';
|
||||||
|
import { SEARCH_EMBEDDABLE_TYPE } from './constants';
|
||||||
|
import { SavedSearchEmbeddable } from './saved_search_embeddable';
|
||||||
import { DiscoverServices } from '../build_services';
|
import { DiscoverServices } from '../build_services';
|
||||||
|
|
||||||
interface StartServices {
|
interface StartServices {
|
||||||
|
|
|
@ -14,7 +14,7 @@ import {
|
||||||
} from '@kbn/embeddable-plugin/public';
|
} from '@kbn/embeddable-plugin/public';
|
||||||
import type { Filter, TimeRange, Query } from '@kbn/es-query';
|
import type { Filter, TimeRange, Query } from '@kbn/es-query';
|
||||||
import { DataView } from '@kbn/data-views-plugin/public';
|
import { DataView } from '@kbn/data-views-plugin/public';
|
||||||
import { SavedSearch } from '../services/saved_searches';
|
import { SavedSearch } from '@kbn/saved-search-plugin/public';
|
||||||
import { SortOrder } from '../components/doc_table/components/table_header/helpers';
|
import { SortOrder } from '../components/doc_table/components/table_header/helpers';
|
||||||
|
|
||||||
export interface SearchInput extends EmbeddableInput {
|
export interface SearchInput extends EmbeddableInput {
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import { createSearchSourceMock } from '@kbn/data-plugin/common/search/search_source/mocks';
|
import { createSearchSourceMock } from '@kbn/data-plugin/common/search/search_source/mocks';
|
||||||
import { updateSearchSource } from './update_search_source';
|
import { updateSearchSource } from './update_search_source';
|
||||||
import { dataViewMock } from '../../__mocks__/data_view';
|
import { dataViewMock } from '../../__mocks__/data_view';
|
||||||
import type { SortOrder } from '../../services/saved_searches';
|
import type { SortOrder } from '@kbn/saved-search-plugin/public';
|
||||||
|
|
||||||
describe('updateSearchSource', () => {
|
describe('updateSearchSource', () => {
|
||||||
const defaults = {
|
const defaults = {
|
||||||
|
|
|
@ -10,9 +10,9 @@ import { ApplicationStart } from '@kbn/core/public';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { IEmbeddable, ViewMode } from '@kbn/embeddable-plugin/public';
|
import { IEmbeddable, ViewMode } from '@kbn/embeddable-plugin/public';
|
||||||
import { Action } from '@kbn/ui-actions-plugin/public';
|
import { Action } from '@kbn/ui-actions-plugin/public';
|
||||||
|
import { getSavedSearchUrl } from '@kbn/saved-search-plugin/public';
|
||||||
import { SavedSearchEmbeddable } from './saved_search_embeddable';
|
import { SavedSearchEmbeddable } from './saved_search_embeddable';
|
||||||
import { SEARCH_EMBEDDABLE_TYPE } from '../../common';
|
import { SEARCH_EMBEDDABLE_TYPE } from '../../common';
|
||||||
import { getSavedSearchUrl } from '../services/saved_searches';
|
|
||||||
|
|
||||||
export const ACTION_VIEW_SAVED_SEARCH = 'ACTION_VIEW_SAVED_SEARCH';
|
export const ACTION_VIEW_SAVED_SEARCH = 'ACTION_VIEW_SAVED_SEARCH';
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { renderHook } from '@testing-library/react-hooks';
|
||||||
import type { History } from 'history';
|
import type { History } from 'history';
|
||||||
|
|
||||||
import { useSavedSearchAliasMatchRedirect } from './saved_search_alias_match_redirect';
|
import { useSavedSearchAliasMatchRedirect } from './saved_search_alias_match_redirect';
|
||||||
import type { SavedSearch } from './types';
|
import type { SavedSearch } from '@kbn/saved-search-plugin/public';
|
||||||
|
|
||||||
import { spacesPluginMock } from '@kbn/spaces-plugin/public/mocks';
|
import { spacesPluginMock } from '@kbn/spaces-plugin/public/mocks';
|
||||||
|
|
|
@ -10,9 +10,7 @@ import type { History } from 'history';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import type { SpacesApi } from '@kbn/spaces-plugin/public';
|
import type { SpacesApi } from '@kbn/spaces-plugin/public';
|
||||||
import { getSavedSearchUrl } from './saved_searches_utils';
|
import { getSavedSearchUrl, SavedSearch } from '@kbn/saved-search-plugin/public';
|
||||||
|
|
||||||
import type { SavedSearch } from './types';
|
|
||||||
|
|
||||||
interface SavedSearchAliasMatchRedirectProps {
|
interface SavedSearchAliasMatchRedirectProps {
|
||||||
savedSearch?: SavedSearch;
|
savedSearch?: SavedSearch;
|
|
@ -9,15 +9,6 @@
|
||||||
import { PluginInitializerContext } from '@kbn/core/public';
|
import { PluginInitializerContext } from '@kbn/core/public';
|
||||||
import { DiscoverPlugin } from './plugin';
|
import { DiscoverPlugin } from './plugin';
|
||||||
|
|
||||||
export type { SavedSearch } from './services/saved_searches';
|
|
||||||
export {
|
|
||||||
getSavedSearch,
|
|
||||||
getSavedSearchFullPathUrl,
|
|
||||||
getSavedSearchUrl,
|
|
||||||
getSavedSearchUrlConflictMessage,
|
|
||||||
throwErrorOnSavedSearchUrlConflict,
|
|
||||||
} from './services/saved_searches';
|
|
||||||
|
|
||||||
export type { DiscoverSetup, DiscoverStart } from './plugin';
|
export type { DiscoverSetup, DiscoverStart } from './plugin';
|
||||||
export function plugin(initializerContext: PluginInitializerContext) {
|
export function plugin(initializerContext: PluginInitializerContext) {
|
||||||
return new DiscoverPlugin(initializerContext);
|
return new DiscoverPlugin(initializerContext);
|
||||||
|
@ -29,3 +20,16 @@ export { loadSharingDataHelpers } from './utils';
|
||||||
|
|
||||||
export { DISCOVER_APP_LOCATOR } from './locator';
|
export { DISCOVER_APP_LOCATOR } from './locator';
|
||||||
export type { DiscoverAppLocator, DiscoverAppLocatorParams } from './locator';
|
export type { DiscoverAppLocator, DiscoverAppLocatorParams } from './locator';
|
||||||
|
|
||||||
|
// re-export types and static functions to give other plugins time to migrate away
|
||||||
|
export {
|
||||||
|
SavedSearch,
|
||||||
|
getSavedSearch,
|
||||||
|
getSavedSearchFullPathUrl,
|
||||||
|
getSavedSearchUrl,
|
||||||
|
getSavedSearchUrlConflictMessage,
|
||||||
|
throwErrorOnSavedSearchUrlConflict,
|
||||||
|
VIEW_MODE,
|
||||||
|
DiscoverGridSettings,
|
||||||
|
DiscoverGridSettingsColumn,
|
||||||
|
} from '@kbn/saved-search-plugin/public';
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
import { ChromeStart } from '@kbn/core/public';
|
import { ChromeStart } from '@kbn/core/public';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import { SavedSearch } from '../services/saved_searches';
|
import { SavedSearch } from '@kbn/saved-search-plugin/public';
|
||||||
|
|
||||||
export function getRootBreadcrumbs(breadcrumb?: string) {
|
export function getRootBreadcrumbs(breadcrumb?: string) {
|
||||||
return [
|
return [
|
||||||
|
|
|
@ -14,12 +14,12 @@ import type {
|
||||||
SerializedSearchSourceFields,
|
SerializedSearchSourceFields,
|
||||||
} from '@kbn/data-plugin/public';
|
} from '@kbn/data-plugin/public';
|
||||||
import type { Filter } from '@kbn/es-query';
|
import type { Filter } from '@kbn/es-query';
|
||||||
|
import type { SavedSearch, SortOrder } from '@kbn/saved-search-plugin/public';
|
||||||
import {
|
import {
|
||||||
DOC_HIDE_TIME_COLUMN_SETTING,
|
DOC_HIDE_TIME_COLUMN_SETTING,
|
||||||
SEARCH_FIELDS_FROM_SOURCE,
|
SEARCH_FIELDS_FROM_SOURCE,
|
||||||
SORT_DEFAULT_ORDER_SETTING,
|
SORT_DEFAULT_ORDER_SETTING,
|
||||||
} from '../../common';
|
} from '../../common';
|
||||||
import type { SavedSearch, SortOrder } from '../services/saved_searches';
|
|
||||||
import { getSortForSearchSource } from '../components/doc_table';
|
import { getSortForSearchSource } from '../components/doc_table';
|
||||||
import { AppState, isEqualFilters } from '../application/main/services/discover_state';
|
import { AppState, isEqualFilters } from '../application/main/services/discover_state';
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ import type { PluginSetup as DataPluginSetup } from '@kbn/data-plugin/server';
|
||||||
import type { HomeServerPluginSetup } from '@kbn/home-plugin/server';
|
import type { HomeServerPluginSetup } from '@kbn/home-plugin/server';
|
||||||
import { getUiSettings } from './ui_settings';
|
import { getUiSettings } from './ui_settings';
|
||||||
import { capabilitiesProvider } from './capabilities_provider';
|
import { capabilitiesProvider } from './capabilities_provider';
|
||||||
import { getSavedSearchObjectType } from './saved_objects';
|
|
||||||
import { registerSampleData } from './sample_data';
|
import { registerSampleData } from './sample_data';
|
||||||
|
|
||||||
export class DiscoverServerPlugin implements Plugin<object, object> {
|
export class DiscoverServerPlugin implements Plugin<object, object> {
|
||||||
|
@ -22,12 +21,8 @@ export class DiscoverServerPlugin implements Plugin<object, object> {
|
||||||
home?: HomeServerPluginSetup;
|
home?: HomeServerPluginSetup;
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
const getSearchSourceMigrations = plugins.data.search.searchSource.getAllMigrations.bind(
|
|
||||||
plugins.data.search.searchSource
|
|
||||||
);
|
|
||||||
core.capabilities.registerProvider(capabilitiesProvider);
|
core.capabilities.registerProvider(capabilitiesProvider);
|
||||||
core.uiSettings.register(getUiSettings(core.docLinks));
|
core.uiSettings.register(getUiSettings(core.docLinks));
|
||||||
core.savedObjects.registerType(getSavedSearchObjectType(getSearchSourceMigrations));
|
|
||||||
|
|
||||||
if (plugins.home) {
|
if (plugins.home) {
|
||||||
registerSampleData(plugins.home.sampleData);
|
registerSampleData(plugins.home.sampleData);
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import type { SampleDataRegistrySetup } from '@kbn/home-plugin/server';
|
import type { SampleDataRegistrySetup } from '@kbn/home-plugin/server';
|
||||||
|
import { getSavedSearchFullPathUrl } from '@kbn/saved-search-plugin/common';
|
||||||
import { APP_ICON } from '../../common';
|
import { APP_ICON } from '../../common';
|
||||||
import { getSavedSearchFullPathUrl } from '../../common/services/saved_searches';
|
|
||||||
|
|
||||||
function getDiscoverPathForSampleDataset(objId: string) {
|
function getDiscoverPathForSampleDataset(objId: string) {
|
||||||
// TODO: remove the time range from the URL query when saved search objects start supporting time range configuration
|
// TODO: remove the time range from the URL query when saved search objects start supporting time range configuration
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
"references": [
|
"references": [
|
||||||
{ "path": "../../core/tsconfig.json" },
|
{ "path": "../../core/tsconfig.json" },
|
||||||
{ "path": "../charts/tsconfig.json" },
|
{ "path": "../charts/tsconfig.json" },
|
||||||
|
{ "path": "../saved_search/tsconfig.json" },
|
||||||
{ "path": "../data/tsconfig.json" },
|
{ "path": "../data/tsconfig.json" },
|
||||||
{ "path": "../expressions/tsconfig.json" },
|
{ "path": "../expressions/tsconfig.json" },
|
||||||
{ "path": "../embeddable/tsconfig.json" },
|
{ "path": "../embeddable/tsconfig.json" },
|
||||||
|
|
3
src/plugins/saved_search/README.md
Normal file
3
src/plugins/saved_search/README.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# Saved search
|
||||||
|
|
||||||
|
Contains the saved search saved object definition and helpers.
|
19
src/plugins/saved_search/jest.config.js
Normal file
19
src/plugins/saved_search/jest.config.js
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
/*
|
||||||
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||||
|
* or more contributor license agreements. Licensed under the Elastic License
|
||||||
|
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||||
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||||
|
* Side Public License, v 1.
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
preset: '@kbn/test',
|
||||||
|
rootDir: '../../..',
|
||||||
|
roots: ['<rootDir>/src/plugins/saved_search'],
|
||||||
|
testRunner: 'jasmine2',
|
||||||
|
coverageDirectory: '<rootDir>/target/kibana-coverage/jest/src/plugins/saved_search',
|
||||||
|
coverageReporters: ['text', 'html'],
|
||||||
|
collectCoverageFrom: [
|
||||||
|
'<rootDir>/src/plugins/saved_search/{common,public,server}/**/*.{js,ts,tsx}',
|
||||||
|
],
|
||||||
|
};
|
16
src/plugins/saved_search/kibana.json
Normal file
16
src/plugins/saved_search/kibana.json
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"id": "savedSearch",
|
||||||
|
"version": "kibana",
|
||||||
|
"server": true,
|
||||||
|
"ui": true,
|
||||||
|
"requiredPlugins": [
|
||||||
|
"data"
|
||||||
|
],
|
||||||
|
"requiredBundles": ["kibanaUtils"],
|
||||||
|
"extraPublicDirs": ["common"],
|
||||||
|
"owner": {
|
||||||
|
"name": "Data Discovery",
|
||||||
|
"githubTeam": "kibana-data-discovery"
|
||||||
|
},
|
||||||
|
"description": "This plugin contains the definition and helper methods around saved searches, used by discover and visualizations."
|
||||||
|
}
|
29
src/plugins/saved_search/public/index.ts
Normal file
29
src/plugins/saved_search/public/index.ts
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||||
|
* or more contributor license agreements. Licensed under the Elastic License
|
||||||
|
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||||
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||||
|
* Side Public License, v 1.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type { SavedSearch, SaveSavedSearchOptions, SortOrder } from './services/saved_searches';
|
||||||
|
export {
|
||||||
|
getSavedSearch,
|
||||||
|
getSavedSearchFullPathUrl,
|
||||||
|
getSavedSearchUrl,
|
||||||
|
getSavedSearchUrlConflictMessage,
|
||||||
|
throwErrorOnSavedSearchUrlConflict,
|
||||||
|
saveSavedSearch,
|
||||||
|
} from './services/saved_searches';
|
||||||
|
export type {
|
||||||
|
DiscoverGridSettings,
|
||||||
|
DiscoverGridSettingsColumn,
|
||||||
|
} from './services/saved_searches/types';
|
||||||
|
export { VIEW_MODE } from './services/saved_searches/types';
|
||||||
|
|
||||||
|
export function plugin() {
|
||||||
|
return {
|
||||||
|
setup: () => {},
|
||||||
|
start: () => {},
|
||||||
|
};
|
||||||
|
}
|
|
@ -13,8 +13,6 @@ export {
|
||||||
getSavedSearchUrlConflictMessage,
|
getSavedSearchUrlConflictMessage,
|
||||||
throwErrorOnSavedSearchUrlConflict,
|
throwErrorOnSavedSearchUrlConflict,
|
||||||
} from './saved_searches_utils';
|
} from './saved_searches_utils';
|
||||||
export { useSavedSearchAliasMatchRedirect } from './saved_search_alias_match_redirect';
|
|
||||||
export { SavedSearchURLConflictCallout } from './saved_search_url_conflict_callout';
|
|
||||||
export type { SaveSavedSearchOptions } from './save_saved_searches';
|
export type { SaveSavedSearchOptions } from './save_saved_searches';
|
||||||
export { saveSavedSearch } from './save_saved_searches';
|
export { saveSavedSearch } from './save_saved_searches';
|
||||||
export { SAVED_SEARCH_TYPE } from './constants';
|
export { SAVED_SEARCH_TYPE } from './constants';
|
|
@ -8,13 +8,10 @@
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
import type { SavedSearchAttributes, SavedSearch } from './types';
|
import type { SavedSearchAttributes, SavedSearch } from './types';
|
||||||
|
|
||||||
export {
|
export { getSavedSearchUrl, getSavedSearchFullPathUrl } from '../../../common';
|
||||||
getSavedSearchUrl,
|
|
||||||
getSavedSearchFullPathUrl,
|
|
||||||
} from '../../../common/services/saved_searches';
|
|
||||||
|
|
||||||
export const getSavedSearchUrlConflictMessage = async (savedSearch: SavedSearch) =>
|
export const getSavedSearchUrlConflictMessage = async (savedSearch: SavedSearch) =>
|
||||||
i18n.translate('discover.savedSearchEmbeddable.legacyURLConflict.errorMessage', {
|
i18n.translate('savedSearch.legacyURLConflict.errorMessage', {
|
||||||
defaultMessage: `This search has the same URL as a legacy alias. Disable the alias to resolve this error : {json}`,
|
defaultMessage: `This search has the same URL as a legacy alias. Disable the alias to resolve this error : {json}`,
|
||||||
values: {
|
values: {
|
||||||
json: savedSearch.sharingSavedObjectProps?.errorJSON,
|
json: savedSearch.sharingSavedObjectProps?.errorJSON,
|
|
@ -8,8 +8,19 @@
|
||||||
|
|
||||||
import type { ResolvedSimpleSavedObject } from '@kbn/core/public';
|
import type { ResolvedSimpleSavedObject } from '@kbn/core/public';
|
||||||
import type { ISearchSource } from '@kbn/data-plugin/public';
|
import type { ISearchSource } from '@kbn/data-plugin/public';
|
||||||
import { DiscoverGridSettingsColumn } from '../../components/discover_grid/types';
|
|
||||||
import { VIEW_MODE } from '../../components/view_mode_toggle';
|
export enum VIEW_MODE {
|
||||||
|
DOCUMENT_LEVEL = 'documents',
|
||||||
|
AGGREGATED_LEVEL = 'aggregated',
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DiscoverGridSettings {
|
||||||
|
columns?: Record<string, DiscoverGridSettingsColumn>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DiscoverGridSettingsColumn {
|
||||||
|
width?: number;
|
||||||
|
}
|
||||||
|
|
||||||
/** @internal **/
|
/** @internal **/
|
||||||
export interface SavedSearchAttributes {
|
export interface SavedSearchAttributes {
|
11
src/plugins/saved_search/server/index.ts
Normal file
11
src/plugins/saved_search/server/index.ts
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
/*
|
||||||
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||||
|
* or more contributor license agreements. Licensed under the Elastic License
|
||||||
|
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||||
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||||
|
* Side Public License, v 1.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { SavedSearchServerPlugin } from './plugin';
|
||||||
|
|
||||||
|
export const plugin = () => new SavedSearchServerPlugin();
|
33
src/plugins/saved_search/server/plugin.ts
Normal file
33
src/plugins/saved_search/server/plugin.ts
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||||
|
* or more contributor license agreements. Licensed under the Elastic License
|
||||||
|
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||||
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||||
|
* Side Public License, v 1.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { CoreSetup, CoreStart, Plugin } from '@kbn/core/server';
|
||||||
|
import type { PluginSetup as DataPluginSetup } from '@kbn/data-plugin/server';
|
||||||
|
import { getSavedSearchObjectType } from './saved_objects';
|
||||||
|
|
||||||
|
export class SavedSearchServerPlugin implements Plugin<object, object> {
|
||||||
|
public setup(
|
||||||
|
core: CoreSetup,
|
||||||
|
plugins: {
|
||||||
|
data: DataPluginSetup;
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
const getSearchSourceMigrations = plugins.data.search.searchSource.getAllMigrations.bind(
|
||||||
|
plugins.data.search.searchSource
|
||||||
|
);
|
||||||
|
core.savedObjects.registerType(getSavedSearchObjectType(getSearchSourceMigrations));
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
public start(core: CoreStart) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
public stop() {}
|
||||||
|
}
|
21
src/plugins/saved_search/tsconfig.json
Normal file
21
src/plugins/saved_search/tsconfig.json
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"extends": "../../../tsconfig.base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "./target/types",
|
||||||
|
"emitDeclarationOnly": true,
|
||||||
|
"declaration": true,
|
||||||
|
"declarationMap": true
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"common/**/*",
|
||||||
|
"public/**/*",
|
||||||
|
"server/**/*",
|
||||||
|
"../../../typings/**/*",
|
||||||
|
],
|
||||||
|
"references": [
|
||||||
|
{ "path": "../../core/tsconfig.json" },
|
||||||
|
{ "path": "../data/tsconfig.json" },
|
||||||
|
{ "path": "../kibana_utils/tsconfig.json" },
|
||||||
|
{ "path": "../../../x-pack/plugins/spaces/tsconfig.json" }
|
||||||
|
]
|
||||||
|
}
|
|
@ -19,7 +19,7 @@
|
||||||
"dataViewEditor"
|
"dataViewEditor"
|
||||||
],
|
],
|
||||||
"optionalPlugins": ["home", "share", "spaces", "savedObjectsTaggingOss"],
|
"optionalPlugins": ["home", "share", "spaces", "savedObjectsTaggingOss"],
|
||||||
"requiredBundles": ["kibanaUtils", "discover", "kibanaReact"],
|
"requiredBundles": ["kibanaUtils", "savedSearch", "kibanaReact"],
|
||||||
"extraPublicDirs": ["common/constants", "common/utils", "common/expression_functions"],
|
"extraPublicDirs": ["common/constants", "common/utils", "common/expression_functions"],
|
||||||
"owner": {
|
"owner": {
|
||||||
"name": "Vis Editors",
|
"name": "Vis Editors",
|
||||||
|
|
|
@ -26,7 +26,7 @@ import {
|
||||||
getSavedSearch,
|
getSavedSearch,
|
||||||
SavedSearch,
|
SavedSearch,
|
||||||
throwErrorOnSavedSearchUrlConflict,
|
throwErrorOnSavedSearchUrlConflict,
|
||||||
} from '@kbn/discover-plugin/public';
|
} from '@kbn/saved-search-plugin/public';
|
||||||
import { PersistedState } from './persisted_state';
|
import { PersistedState } from './persisted_state';
|
||||||
import {
|
import {
|
||||||
getTypes,
|
getTypes,
|
||||||
|
|
|
@ -37,7 +37,7 @@ import type { UrlForwardingStart } from '@kbn/url-forwarding-plugin/public';
|
||||||
import type { PresentationUtilPluginStart } from '@kbn/presentation-util-plugin/public';
|
import type { PresentationUtilPluginStart } from '@kbn/presentation-util-plugin/public';
|
||||||
import type { SpacesPluginStart } from '@kbn/spaces-plugin/public';
|
import type { SpacesPluginStart } from '@kbn/spaces-plugin/public';
|
||||||
import type { SavedObjectsTaggingApi } from '@kbn/saved-objects-tagging-oss-plugin/public';
|
import type { SavedObjectsTaggingApi } from '@kbn/saved-objects-tagging-oss-plugin/public';
|
||||||
import type { SavedSearch } from '@kbn/discover-plugin/public';
|
import type { SavedSearch } from '@kbn/saved-search-plugin/public';
|
||||||
import type {
|
import type {
|
||||||
Vis,
|
Vis,
|
||||||
VisualizeEmbeddableContract,
|
VisualizeEmbeddableContract,
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* Side Public License, v 1.
|
* Side Public License, v 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { getSavedSearch } from '@kbn/discover-plugin/public';
|
import { getSavedSearch } from '@kbn/saved-search-plugin/public';
|
||||||
import type { VisualizeInput, VisSavedObject, Vis, VisParams } from '../..';
|
import type { VisualizeInput, VisSavedObject, Vis, VisParams } from '../..';
|
||||||
import {
|
import {
|
||||||
getVisualizationInstance,
|
getVisualizationInstance,
|
||||||
|
@ -38,7 +38,7 @@ jest.mock('../../vis_async', () => ({
|
||||||
}));
|
}));
|
||||||
const { createVisAsync } = jest.requireMock('../../vis_async');
|
const { createVisAsync } = jest.requireMock('../../vis_async');
|
||||||
|
|
||||||
jest.mock('@kbn/discover-plugin/public', () => ({
|
jest.mock('@kbn/saved-search-plugin/public', () => ({
|
||||||
getSavedSearch: jest.fn().mockResolvedValue({
|
getSavedSearch: jest.fn().mockResolvedValue({
|
||||||
id: 'savedSearch',
|
id: 'savedSearch',
|
||||||
title: 'savedSearchTitle',
|
title: 'savedSearchTitle',
|
||||||
|
|
|
@ -13,7 +13,7 @@ import {
|
||||||
getSavedSearch,
|
getSavedSearch,
|
||||||
SavedSearch,
|
SavedSearch,
|
||||||
throwErrorOnSavedSearchUrlConflict,
|
throwErrorOnSavedSearchUrlConflict,
|
||||||
} from '@kbn/discover-plugin/public';
|
} from '@kbn/saved-search-plugin/public';
|
||||||
import { createVisAsync } from '../../vis_async';
|
import { createVisAsync } from '../../vis_async';
|
||||||
import { convertToSerializedVis, getSavedVisualization } from '../../utils/saved_visualize_utils';
|
import { convertToSerializedVis, getSavedVisualization } from '../../utils/saved_visualize_utils';
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
{ "path": "../saved_objects_tagging_oss/tsconfig.json" },
|
{ "path": "../saved_objects_tagging_oss/tsconfig.json" },
|
||||||
{ "path": "../kibana_utils/tsconfig.json" },
|
{ "path": "../kibana_utils/tsconfig.json" },
|
||||||
{ "path": "../kibana_react/tsconfig.json" },
|
{ "path": "../kibana_react/tsconfig.json" },
|
||||||
{ "path": "../discover/tsconfig.json" },
|
{ "path": "../saved_search/tsconfig.json" },
|
||||||
{ "path": "../url_forwarding/tsconfig.json" },
|
{ "path": "../url_forwarding/tsconfig.json" },
|
||||||
{ "path": "../navigation/tsconfig.json" },
|
{ "path": "../navigation/tsconfig.json" },
|
||||||
{ "path": "../home/tsconfig.json" },
|
{ "path": "../home/tsconfig.json" },
|
||||||
|
|
|
@ -145,6 +145,8 @@
|
||||||
"@kbn/saved-objects-tagging-oss-plugin/*": ["src/plugins/saved_objects_tagging_oss/*"],
|
"@kbn/saved-objects-tagging-oss-plugin/*": ["src/plugins/saved_objects_tagging_oss/*"],
|
||||||
"@kbn/saved-objects-plugin": ["src/plugins/saved_objects"],
|
"@kbn/saved-objects-plugin": ["src/plugins/saved_objects"],
|
||||||
"@kbn/saved-objects-plugin/*": ["src/plugins/saved_objects/*"],
|
"@kbn/saved-objects-plugin/*": ["src/plugins/saved_objects/*"],
|
||||||
|
"@kbn/saved-search-plugin": ["src/plugins/saved_search"],
|
||||||
|
"@kbn/saved-search-plugin/*": ["src/plugins/saved_search/*"],
|
||||||
"@kbn/screenshot-mode-plugin": ["src/plugins/screenshot_mode"],
|
"@kbn/screenshot-mode-plugin": ["src/plugins/screenshot_mode"],
|
||||||
"@kbn/screenshot-mode-plugin/*": ["src/plugins/screenshot_mode/*"],
|
"@kbn/screenshot-mode-plugin/*": ["src/plugins/screenshot_mode/*"],
|
||||||
"@kbn/share-plugin": ["src/plugins/share"],
|
"@kbn/share-plugin": ["src/plugins/share"],
|
||||||
|
|
|
@ -3189,7 +3189,6 @@
|
||||||
"discover.savedSearch.savedObjectName": "Recherche enregistrée",
|
"discover.savedSearch.savedObjectName": "Recherche enregistrée",
|
||||||
"discover.savedSearchAliasMatchRedirect.objectNoun": "Recherche {savedSearch}",
|
"discover.savedSearchAliasMatchRedirect.objectNoun": "Recherche {savedSearch}",
|
||||||
"discover.savedSearchEmbeddable.action.viewSavedSearch.displayName": "Ouvrir dans Discover",
|
"discover.savedSearchEmbeddable.action.viewSavedSearch.displayName": "Ouvrir dans Discover",
|
||||||
"discover.savedSearchEmbeddable.legacyURLConflict.errorMessage": "Cette recherche a la même URL qu'un alias hérité. Désactiver l'alias pour résoudre cette erreur : {json}",
|
|
||||||
"discover.savedSearchURLConflictCallout.objectNoun": "Recherche {savedSearch}",
|
"discover.savedSearchURLConflictCallout.objectNoun": "Recherche {savedSearch}",
|
||||||
"discover.searchGenerationWithDescription": "Tableau généré par la recherche {searchTitle}",
|
"discover.searchGenerationWithDescription": "Tableau généré par la recherche {searchTitle}",
|
||||||
"discover.searchGenerationWithDescriptionGrid": "Tableau généré par la recherche {searchTitle} ({searchDescription})",
|
"discover.searchGenerationWithDescriptionGrid": "Tableau généré par la recherche {searchTitle} ({searchDescription})",
|
||||||
|
|
|
@ -3187,7 +3187,6 @@
|
||||||
"discover.savedSearch.savedObjectName": "保存検索",
|
"discover.savedSearch.savedObjectName": "保存検索",
|
||||||
"discover.savedSearchAliasMatchRedirect.objectNoun": "{savedSearch}検索",
|
"discover.savedSearchAliasMatchRedirect.objectNoun": "{savedSearch}検索",
|
||||||
"discover.savedSearchEmbeddable.action.viewSavedSearch.displayName": "Discoverで開く",
|
"discover.savedSearchEmbeddable.action.viewSavedSearch.displayName": "Discoverで開く",
|
||||||
"discover.savedSearchEmbeddable.legacyURLConflict.errorMessage": "この検索にはレガシーエイリアスと同じURLがあります。このエラーを解決するには、エイリアスを無効にしてください:{json}",
|
|
||||||
"discover.savedSearchURLConflictCallout.objectNoun": "{savedSearch}検索",
|
"discover.savedSearchURLConflictCallout.objectNoun": "{savedSearch}検索",
|
||||||
"discover.searchGenerationWithDescription": "検索{searchTitle}で生成されたテーブル",
|
"discover.searchGenerationWithDescription": "検索{searchTitle}で生成されたテーブル",
|
||||||
"discover.searchGenerationWithDescriptionGrid": "検索{searchTitle}で生成されたテーブル({searchDescription})",
|
"discover.searchGenerationWithDescriptionGrid": "検索{searchTitle}で生成されたテーブル({searchDescription})",
|
||||||
|
|
|
@ -3190,7 +3190,6 @@
|
||||||
"discover.savedSearch.savedObjectName": "已保存搜索",
|
"discover.savedSearch.savedObjectName": "已保存搜索",
|
||||||
"discover.savedSearchAliasMatchRedirect.objectNoun": "{savedSearch} 搜索",
|
"discover.savedSearchAliasMatchRedirect.objectNoun": "{savedSearch} 搜索",
|
||||||
"discover.savedSearchEmbeddable.action.viewSavedSearch.displayName": "在 Discover 中打开",
|
"discover.savedSearchEmbeddable.action.viewSavedSearch.displayName": "在 Discover 中打开",
|
||||||
"discover.savedSearchEmbeddable.legacyURLConflict.errorMessage": "此搜索具有与旧版别名相同的 URL。请禁用别名以解决此错误:{json}",
|
|
||||||
"discover.savedSearchURLConflictCallout.objectNoun": "{savedSearch} 搜索",
|
"discover.savedSearchURLConflictCallout.objectNoun": "{savedSearch} 搜索",
|
||||||
"discover.searchGenerationWithDescription": "搜索 {searchTitle} 生成的表",
|
"discover.searchGenerationWithDescription": "搜索 {searchTitle} 生成的表",
|
||||||
"discover.searchGenerationWithDescriptionGrid": "搜索 {searchTitle} 生成的表({searchDescription})",
|
"discover.searchGenerationWithDescriptionGrid": "搜索 {searchTitle} 生成的表({searchDescription})",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue