Move SearchBar back to data plugin. (#42449) (#42492)

Restored an empty service for Saved Queries to use
This commit is contained in:
Liza Katz 2019-08-02 09:13:06 +03:00 committed by GitHub
parent 2c8efa49ac
commit 27a04dcb46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 75 additions and 13 deletions

View file

@ -39,6 +39,7 @@ export {
} from './index_patterns';
export { Query, QueryBar, QueryBarInput } from './query';
export { FilterBar, ApplyFiltersPopover } from './filter';
export { SearchBar, SearchBarProps } from './search';
export {
FilterManager,
FilterStateManager,

View file

@ -19,6 +19,7 @@
import { CoreSetup, CoreStart, Plugin } from '../../../../core/public';
import { ExpressionsService, ExpressionsSetup } from './expressions';
import { SearchService, SearchSetup } from './search';
import { QueryService, QuerySetup } from './query';
import { FilterService, FilterSetup } from './filter';
import { IndexPatternsService, IndexPatternsSetup } from './index_patterns';
@ -44,6 +45,7 @@ export interface DataSetup {
indexPatterns: IndexPatternsSetup;
filter: FilterSetup;
query: QuerySetup;
search: SearchSetup;
}
/**
@ -63,6 +65,7 @@ export class DataPlugin implements Plugin<DataSetup, void, DataPluginSetupDepend
private readonly filter: FilterService = new FilterService();
private readonly indexPatterns: IndexPatternsService = new IndexPatternsService();
private readonly query: QueryService = new QueryService();
private readonly search: SearchService = new SearchService();
public setup(core: CoreSetup, { __LEGACY, interpreter }: DataPluginSetupDependencies): DataSetup {
const indexPatternsService = this.indexPatterns.setup();
@ -75,6 +78,7 @@ export class DataPlugin implements Plugin<DataSetup, void, DataPluginSetupDepend
indexPatterns: indexPatternsService.indexPatterns,
}),
query: this.query.setup(),
search: this.search.setup(),
};
}
@ -85,5 +89,6 @@ export class DataPlugin implements Plugin<DataSetup, void, DataPluginSetupDepend
this.indexPatterns.stop();
this.filter.stop();
this.query.stop();
this.search.stop();
}
}

View file

@ -0,0 +1,22 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
export { SearchService, SearchSetup } from './search_service';
export * from './search_bar';

View file

@ -21,7 +21,7 @@ import React from 'react';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
import { SearchBar } from './search_bar';
jest.mock('../../../../data/public', () => {
jest.mock('../../../../../data/public', () => {
return {
FilterBar: () => <div className="filterBar"></div>,
QueryBar: () => <div className="queryBar"></div>,

View file

@ -27,7 +27,7 @@ import React, { Component } from 'react';
import ResizeObserver from 'resize-observer-polyfill';
import { Storage } from 'ui/storage';
import { IndexPattern, Query, QueryBar, FilterBar } from '../../../../data/public';
import { IndexPattern, Query, QueryBar, FilterBar } from '../../../../../data/public';
interface DateRange {
from: string;
@ -111,7 +111,7 @@ class SearchBarUI extends Component<SearchBarProps, State> {
const filterCount = this.getFilterLength();
const filtersAppliedText = this.props.intl.formatMessage(
{
id: 'kibana_react.search.searchBar.filtersButtonFiltersAppliedTitle',
id: 'data.search.searchBar.searchBar.filtersButtonFiltersAppliedTitle',
defaultMessage:
'{filterCount} {filterCount, plural, one {filter} other {filters}} applied.',
},
@ -121,11 +121,11 @@ class SearchBarUI extends Component<SearchBarProps, State> {
);
const clickToShowOrHideText = this.state.isFiltersVisible
? this.props.intl.formatMessage({
id: 'kibana_react.search.searchBar.filtersButtonClickToShowTitle',
id: 'data.search.searchBar.searchBar.filtersButtonClickToShowTitle',
defaultMessage: 'Select to hide',
})
: this.props.intl.formatMessage({
id: 'kibana_react.search.searchBar.filtersButtonClickToHideTitle',
id: 'data.search.searchBar.searchBar.filtersButtonClickToHideTitle',
defaultMessage: 'Select to show',
});
@ -139,7 +139,7 @@ class SearchBarUI extends Component<SearchBarProps, State> {
aria-expanded={!!this.state.isFiltersVisible}
title={`${filterCount ? filtersAppliedText : ''} ${clickToShowOrHideText}`}
>
{i18n.translate('kibana_react.search.searchBar.filtersButtonLabel', {
{i18n.translate('data.search.searchBar.searchBar.filtersButtonLabel', {
defaultMessage: 'Filters',
description: 'The noun "filter" in plural.',
})}

View file

@ -0,0 +1,35 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* Search Service
* @internal
*/
export class SearchService {
public setup() {
return {};
}
public stop() {}
}
/** @public */
export type SearchSetup = ReturnType<SearchService['setup']>;

View file

@ -24,4 +24,3 @@
/** @public types */
export { TopNavMenu, TopNavMenuData } from './top_nav_menu';
export { SearchBar, SearchBarProps } from './search_bar';

View file

@ -22,7 +22,7 @@ import { TopNavMenu } from './top_nav_menu';
import { TopNavMenuData } from './top_nav_menu_data';
import { shallowWithIntl } from 'test_utils/enzyme_helpers';
jest.mock('../search_bar', () => {
jest.mock('../../../../core_plugins/data/public', () => {
return {
SearchBar: () => <div className="searchBar"></div>,
SearchBarProps: {},

View file

@ -23,7 +23,7 @@ import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { I18nProvider } from '@kbn/i18n/react';
import { TopNavMenuData } from './top_nav_menu_data';
import { TopNavMenuItem } from './top_nav_menu_item';
import { SearchBar, SearchBarProps } from '../search_bar';
import { SearchBar, SearchBarProps } from '../../../../core_plugins/data/public';
type Props = Partial<SearchBarProps> & {
name: string;

View file

@ -813,8 +813,8 @@
"data.query.queryBar.syntaxOptionsDescription": "{docsLink} (KQL) は、シンプルなクエリ構文とスクリプトフィールドのサポートを提供します。また、KQL はベーシックライセンス以上をご利用の場合、自動入力も提供します。KQL をオフにすると、Kibana は Lucene を使用します。",
"data.query.queryBar.syntaxOptionsDescription.docsLinkText": "こちら",
"data.query.queryBar.syntaxOptionsTitle": "構文オプション",
"kibana_react.search.searchBar.filtersButtonClickToHideTitle": "選択して表示",
"kibana_react.search.searchBar.filtersButtonClickToShowTitle": "選択して非表示",
"data.search.searchBar.searchBar.filtersButtonClickToHideTitle": "選択して表示",
"data.search.searchBar.searchBar.filtersButtonClickToShowTitle": "選択して非表示",
"embeddableApi.actionPanel.title": "オプション",
"embeddableApi.actions.applyFilterActionTitle": "現在のビューにフィルターを適用",
"embeddableApi.addPanel.createNew": "新規 {factoryName} を作成",

View file

@ -814,8 +814,8 @@
"data.query.queryBar.syntaxOptionsDescription": "{docsLink} (KQL) 提供简化查询语法并支持脚本字段。如果您具有基本许可或更高级别的许可KQL 还提供自动填充功能。如果关闭 KQLKibana 将使用 Lucene。",
"data.query.queryBar.syntaxOptionsDescription.docsLinkText": "此处",
"data.query.queryBar.syntaxOptionsTitle": "语法选项",
"kibana_react.search.searchBar.filtersButtonClickToHideTitle": "选择以显示",
"kibana_react.search.searchBar.filtersButtonClickToShowTitle": "选择以隐藏",
"data.search.searchBar.searchBar.filtersButtonClickToHideTitle": "选择以显示",
"data.search.searchBar.searchBar.filtersButtonClickToShowTitle": "选择以隐藏",
"embeddableApi.actionPanel.title": "选项",
"embeddableApi.actions.applyFilterActionTitle": "将筛选应用于当前视图",
"embeddableApi.addPanel.createNew": "创建新的{factoryName}",