Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Unified search] Create unified search plugin #127651

Merged
merged 48 commits into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
65fd06b
[Unified search] Create unified search plugin
alexwizp Mar 20, 2022
9e4a1f2
add unified_search into USES_STYLED_COMPONENTS
alexwizp Mar 21, 2022
fde23a5
fix JEST group 4
alexwizp Mar 21, 2022
3733dc0
Merge branch 'main' into issue-move-UI-to-unified_search
kibanamachine Mar 21, 2022
8e4ae65
update limits for data plugin
alexwizp Mar 21, 2022
469dcb2
Merge remote-tracking branch 'upstream/main' into issue-move-UI-to-un…
alexwizp Mar 21, 2022
cbd4497
fix: remove unifiedSearch plugin from x-pack/plugins/file_upload
nlatipov Mar 21, 2022
bda30d0
feat: updated .github/CODEOWNERS and set @elastic/kibana-app-services…
nlatipov Mar 21, 2022
a43b85d
Merge branch 'main' into issue-move-UI-to-unified_search
kibanamachine Mar 22, 2022
de32a7e
Merge branch 'main' into issue-move-UI-to-unified_search
kibanamachine Mar 22, 2022
12c9f70
apply PR comments
alexwizp Mar 23, 2022
edd66f6
Merge branch 'main' into issue-move-UI-to-unified_search
kibanamachine Mar 23, 2022
11c44df
[CI] Auto-commit changed files from 'node scripts/build_plugin_list_d…
kibanamachine Mar 23, 2022
98e4f68
Merge remote-tracking branch 'upstream/main' into issue-move-UI-to-un…
nlatipov Mar 24, 2022
26104b3
feat: moved filter bar, apply filters folders and apply filter action…
nlatipov Mar 24, 2022
5900a75
fix Checks
nlatipov Mar 24, 2022
d730345
fix Checks
nlatipov Mar 24, 2022
fef0147
Merge branch 'issue-move-UI-to-unified_search' of https://github.com/…
nlatipov Mar 24, 2022
3fc8ab1
fix Linting and Default CI Group #16
nlatipov Mar 25, 2022
ca9132d
fix Checks
nlatipov Mar 25, 2022
f8a1a1d
fix Checks
nlatipov Mar 25, 2022
1d111c4
fix Linting (with types)
nlatipov Mar 25, 2022
eafd115
fix show FILTER_BAR
nlatipov Mar 25, 2022
258102d
fix Jest Tests
nlatipov Mar 27, 2022
128c372
Merge branch 'main' into issue-move-UI-to-unified_search
kibanamachine Mar 27, 2022
85e5cae
feat replece indexPatternsContranct in setIndexPatterns to DataViewsC…
nlatipov Mar 28, 2022
10e6764
Merge branch 'issue-move-UI-to-unified_search' of https://github.com/…
nlatipov Mar 28, 2022
2f5e3fb
feat: removed unnecessary interface in unified search
nlatipov Mar 28, 2022
a269c5e
fix Checks
nlatipov Mar 28, 2022
57e33cd
fix Checks
nlatipov Mar 28, 2022
dc22e6a
Merge branch 'main' into issue-move-UI-to-unified_search
kibanamachine Mar 28, 2022
7f180e4
Merge branch 'main' into issue-move-UI-to-unified_search
kibanamachine Mar 28, 2022
ff08ce0
Merge 'upstream/main' into issue-move-UI-to-unified_search
nlatipov Mar 28, 2022
d422200
Merge branch 'main' into issue-move-UI-to-unified_search
nlatipov Mar 29, 2022
f094ecd
Merge remote-tracking branch 'upstream/main' into issue-move-UI-to-un…
nlatipov Mar 29, 2022
5b17156
Merge remote-tracking branch 'upstream/main' into issue-move-UI-to-un…
nlatipov Mar 29, 2022
e423f16
Merge remote-tracking branch 'upstream/main' into issue-move-UI-to-un…
nlatipov Mar 30, 2022
46a8e7e
Merge branch 'main' into issue-move-UI-to-unified_search
kibanamachine Mar 31, 2022
7d7a3a6
Merge remote-tracking branch 'upstream/main' into issue-move-UI-to-un…
nlatipov Mar 31, 2022
f4ca84b
Merge branch 'issue-move-UI-to-unified_search' of https://github.com/…
nlatipov Mar 31, 2022
d9ff6aa
Merge remote-tracking branch 'upstream/main' into issue-move-UI-to-un…
nlatipov Apr 1, 2022
6deb8ae
fix Jest Tests, Checks
nlatipov Apr 1, 2022
1a0eeaa
fix Checks
nlatipov Apr 2, 2022
37367f3
Merge branch 'main' into issue-move-UI-to-unified_search
kibanamachine Apr 4, 2022
3e6d322
Merge remote-tracking branch 'upstream/main' into issue-move-UI-to-un…
nlatipov Apr 4, 2022
4effa45
Merge branch 'issue-move-UI-to-unified_search' of https://github.com/…
nlatipov Apr 4, 2022
b7f97cf
Merge branch 'main' into issue-move-UI-to-unified_search
kibanamachine Apr 4, 2022
72779b5
resolve comments
nlatipov Apr 4, 2022
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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
/src/plugins/bfetch/ @elastic/kibana-app-services
/src/plugins/data_view_management/ @elastic/kibana-app-services
/src/plugins/inspector/ @elastic/kibana-app-services
/src/plugins/unified_search/ @elastic/kibana-app-services
/x-pack/examples/ui_actions_enhanced_examples/ @elastic/kibana-app-services
/x-pack/plugins/data_enhanced/ @elastic/kibana-app-services
/x-pack/plugins/embeddable_enhanced/ @elastic/kibana-app-services
Expand Down
3 changes: 2 additions & 1 deletion .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@
"visTypeVega": "src/plugins/vis_types/vega",
"visTypeVislib": "src/plugins/vis_types/vislib",
"visTypeXy": "src/plugins/vis_types/xy",
"visualizations": "src/plugins/visualizations"
"visualizations": "src/plugins/visualizations",
"unifiedSearch": "src/plugins/unified_search"
},
"translations": []
}
4 changes: 4 additions & 0 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@ In general this plugin provides:
- Exposing a context menu for the user to choose the appropriate action when there are multiple actions attached to a single trigger.


|{kib-repo}blob/{branch}/src/plugins/unified_search/README.md[unifiedSearch]
|A Kibana plugin


|{kib-repo}blob/{branch}/src/plugins/url_forwarding/README.md[urlForwarding]
|This plugins contains helpers to redirect legacy URLs. It can be used to forward old URLs to their new counterparts.

Expand Down
2 changes: 1 addition & 1 deletion examples/search_examples/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"description": "Example plugin of how to use data plugin search services",
"server": true,
"ui": true,
"requiredPlugins": ["navigation", "data", "developerExamples", "kibanaUtils", "share"],
"requiredPlugins": ["navigation", "data", "developerExamples", "kibanaUtils", "share", "unifiedSearch"],
"optionalPlugins": [],
"requiredBundles": ["kibanaReact"],
"owner": {
Expand Down
4 changes: 3 additions & 1 deletion examples/search_examples/public/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const LINKS: ExampleLink[] = [

export const renderApp = (
{ notifications, savedObjects, http, application }: CoreStart,
{ data, navigation }: AppPluginStartDependencies,
{ data, navigation, unifiedSearch }: AppPluginStartDependencies,
{ element, history }: AppMountParameters
) => {
ReactDOM.render(
Expand All @@ -48,13 +48,15 @@ export const renderApp = (
navigation={navigation}
data={data}
http={http}
unifiedSearch={unifiedSearch}
/>
</Route>
<Route path={LINKS[1].path}>
<SearchSessionsExampleApp
navigation={navigation}
notifications={notifications}
data={data}
unifiedSearch={unifiedSearch}
/>
</Route>
<Route path="/" exact={true}>
Expand Down
5 changes: 4 additions & 1 deletion examples/search_examples/public/search/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
isCompleteResponse,
isErrorResponse,
} from '../../../../src/plugins/data/public';
import { UnifiedSearchPublicPluginStart } from '../../../../src/plugins/unified_search/public';
import type { DataViewField, DataView } from '../../../../src/plugins/data_views/public';
import { IMyStrategyResponse } from '../../common/types';
import { AbortError } from '../../../../src/plugins/kibana_utils/common';
Expand All @@ -53,6 +54,7 @@ interface SearchExamplesAppDeps {
http: CoreStart['http'];
navigation: NavigationPublicPluginStart;
data: DataPublicPluginStart;
unifiedSearch: UnifiedSearchPublicPluginStart;
}

function getNumeric(fields?: DataViewField[]) {
Expand Down Expand Up @@ -85,8 +87,9 @@ export const SearchExamplesApp = ({
notifications,
navigation,
data,
unifiedSearch,
}: SearchExamplesAppDeps) => {
const { IndexPatternSelect } = data.ui;
const { IndexPatternSelect } = unifiedSearch.ui;
const [getCool, setGetCool] = useState<boolean>(false);
const [fibonacciN, setFibonacciN] = useState<number>(10);
const [timeTook, setTimeTook] = useState<number | undefined>();
Expand Down
5 changes: 4 additions & 1 deletion examples/search_examples/public/search_sessions/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import {
SearchSessionState,
TimeRange,
} from '../../../../src/plugins/data/public';
import { UnifiedSearchPublicPluginStart } from '../../../../src/plugins/unified_search/public';
import type { DataView, DataViewField } from '../../../../src/plugins/data_views/public';
import {
createStateContainer,
Expand All @@ -60,6 +61,7 @@ interface SearchSessionsExampleAppDeps {
notifications: CoreStart['notifications'];
navigation: NavigationPublicPluginStart;
data: DataPublicPluginStart;
unifiedSearch: UnifiedSearchPublicPluginStart;
}

/**
Expand Down Expand Up @@ -89,8 +91,9 @@ export const SearchSessionsExampleApp = ({
notifications,
navigation,
data,
unifiedSearch,
}: SearchSessionsExampleAppDeps) => {
const { IndexPatternSelect } = data.ui;
const { IndexPatternSelect } = unifiedSearch.ui;

const [isSearching, setIsSearching] = useState<boolean>(false);
const [request, setRequest] = useState<IEsSearchRequest | null>(null);
Expand Down
2 changes: 2 additions & 0 deletions examples/search_examples/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import { NavigationPublicPluginStart } from '../../../src/plugins/navigation/public';
import { DataPublicPluginStart } from '../../../src/plugins/data/public';
import { UnifiedSearchPublicPluginStart } from '../../../src/plugins/unified_search/public';
import { DeveloperExamplesSetup } from '../../developer_examples/public';
import { SharePluginSetup } from '../../../src/plugins/share/public';

Expand All @@ -24,4 +25,5 @@ export interface AppPluginSetupDependencies {
export interface AppPluginStartDependencies {
navigation: NavigationPublicPluginStart;
data: DataPublicPluginStart;
unifiedSearch: UnifiedSearchPublicPluginStart;
}
2 changes: 1 addition & 1 deletion packages/kbn-babel-preset/styled_components_files.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = {
*/
USES_STYLED_COMPONENTS: [
/packages[\/\\]kbn-ui-shared-deps-(npm|src)[\/\\]/,
/src[\/\\]plugins[\/\\](data|kibana_react)[\/\\]/,
/src[\/\\]plugins[\/\\](unified_search|kibana_react)[\/\\]/,
/x-pack[\/\\]plugins[\/\\](apm|beats_management|cases|fleet|infra|lists|observability|osquery|security_solution|timelines|uptime|ux)[\/\\]/,
/x-pack[\/\\]test[\/\\]plugin_functional[\/\\]plugins[\/\\]resolver_test[\/\\]/,
],
Expand Down
3 changes: 2 additions & 1 deletion packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ pageLoadAssetSize:
visTypeMetric: 23332
bfetch: 22837
kibanaUtils: 79713
data: 491273
dataViews: 43532
expressions: 140958
fieldFormats: 65209
Expand All @@ -124,3 +123,5 @@ pageLoadAssetSize:
sessionView: 77750
cloudSecurityPosture: 19109
visTypeGauge: 24113
unifiedSearch: 49195
alexwizp marked this conversation as resolved.
Show resolved Hide resolved
data: 454087
2 changes: 1 addition & 1 deletion src/plugins/data/public/actions/apply_filter_action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { ThemeServiceSetup } from 'kibana/public';
import { toMountPoint } from '../../../kibana_react/public';
import { Action, createAction, IncompatibleActionError } from '../../../ui_actions/public';
import { getOverlays, getIndexPatterns } from '../services';
import { applyFiltersPopover } from '../ui/apply_filters';
import { applyFiltersPopover } from '../apply_filters';
import { Filter, FilterManager, TimefilterContract, esFilters } from '..';

export const ACTION_GLOBAL_APPLY_FILTER = 'ACTION_GLOBAL_APPLY_FILTER';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ import {
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import React, { Component } from 'react';
import { IIndexPattern } from '../..';
import { Filter } from '../../../common';
import { getDisplayValueFromFilter, mapAndFlattenFilters } from '../query';
import { FilterLabel } from '../filter_bar';
import { mapAndFlattenFilters, getDisplayValueFromFilter } from '../../query';
import { Filter, IIndexPattern } from '../../common';

interface Props {
filters: Filter[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import React from 'react';
import { IIndexPattern, Filter } from '../..';
import { IIndexPattern, Filter } from '../../common';

type CancelFnType = () => void;
type SubmitFnType = (filters: Filter[]) => void;
Expand Down
5 changes: 3 additions & 2 deletions src/plugins/data/public/deprecated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ import {
getEsQueryConfig,
} from '../common';

import { FilterLabel, FilterItem } from './ui';

import {
getDisplayValueFromFilter,
generateFilters,
Expand All @@ -63,6 +61,8 @@ import {
convertRangeFilterToTimeRangeString as oldConvertRangeFilterToTimeRangeString,
} from './query';

import { FilterLabel, FilterItem, FilterBar } from './filter_bar';

/**
* @deprecated This import will be removed.
* @removeBy 8.1
Expand Down Expand Up @@ -92,6 +92,7 @@ const convertRangeFilterToTimeRangeString = oldConvertRangeFilterToTimeRangeStri
export const esFilters = {
FilterLabel,
FilterItem,
FilterBar,

FILTERS,
FilterStateStore,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@ import { METRIC_TYPE } from '@kbn/analytics';
import { FilterEditor } from './filter_editor';
import { FILTER_EDITOR_WIDTH, FilterItem } from './filter_item';
import { FilterOptions } from './filter_options';
import { useKibana } from '../../../../kibana_react/public';
import { IDataPluginServices, IIndexPattern } from '../..';
import { useKibana } from '../../../kibana_react/public';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we are not moving the FilterBar into the unified plugin and we are using the esFilters.FilterBar which is deprecated? This set of components should also be moved into the plugin. It is a part of the unified search and not a part of the data plugin

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

our thoughts were to keep the current API for the plugin date, since I see the related code FilterLabel FilterItem lies in the esFilters object. If @ppisljar ok with moving it out of data plugin too, let's do it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unified plugin should have all the UI components that are part of it and FilterBar is def one of them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am ok with moving FilterBar out, lets check if FilterLabel and FilterItem are ever imported from esFilters, else they should be removed from there.

import { IIndexPattern, UI_SETTINGS } from '../../common';
import { IDataPluginServices } from '../types';

import { UI_SETTINGS } from '../../../common';

interface Props {
export interface Props {
filters: Filter[];
onFiltersUpdated?: (filters: Filter[]) => void;
className: string;
Expand Down Expand Up @@ -228,4 +227,7 @@ const FilterBarUI = React.memo(function FilterBarUI(props: Props) {
);
});

export const FilterBar = injectI18n(FilterBarUI);
const FilterBar = injectI18n(FilterBarUI);
// Needed for React.lazy
// eslint-disable-next-line import/no-default-export
export default FilterBar;
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { registerTestBed, TestBed } from '@kbn/test-jest-helpers';
import { FilterEditor, Props } from '.';
import React from 'react';

jest.mock('../../../../../kibana_react/public', () => {
const original = jest.requireActual('../../../../../kibana_react/public');
jest.mock('../../../../kibana_react/public', () => {
const original = jest.requireActual('../../../../kibana_react/public');

return {
...original,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ import { Operator } from './lib/filter_operators';
import { PhraseValueInput } from './phrase_value_input';
import { PhrasesValuesInput } from './phrases_values_input';
import { RangeValueInput } from './range_value_input';
import { getIndexPatternFromFilter } from '../../../query';
import { IIndexPattern, IFieldType } from '../../..';
import { CodeEditor } from '../../../../../kibana_react/public';
import { IIndexPattern, IFieldType } from '../../../common';
import { getIndexPatternFromFilter } from '../../query';
import { CodeEditor } from '../../../../kibana_react/public';

export interface Props {
filter: Filter;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {
rangeFilter,
stubIndexPattern,
stubFields,
} from '../../../../stubs';
import { toggleFilterNegated } from '../../../../../common';
} from '../../../stubs';
import { toggleFilterNegated } from '../../../../common';
import {
getFieldFromFilter,
getFilterableFields,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Filter, FieldFilter } from '@kbn/es-query';
import { ES_FIELD_TYPES } from '@kbn/field-types';
import isSemverValid from 'semver/functions/valid';
import { FILTER_OPERATORS, Operator } from './filter_operators';
import { isFilterable, IIndexPattern, IFieldType, IpAddress } from '../../../../../common';
import { isFilterable, IIndexPattern, IFieldType, IpAddress } from '../../../../common';

export function getFieldFromFilter(filter: FieldFilter, indexPattern: IIndexPattern) {
return indexPattern.fields.find((field) => field.name === filter.meta.key);
Expand Down
Loading