Skip to content

Commit

Permalink
Clean up top nav \ search bar \ query bar directives (#41636) (#41761)
Browse files Browse the repository at this point in the history
* Move timepicker (to be deprecated) into old kbn_top_nav

* Deleted search-bar and query-bar directives!

* moved search bar to kibana_react (it's a generic react component, not a service)

* translations

* Moved superDatePicker directive to kbn_top_nav (to be deprecated)
Deleted unused react_component directives call-out and tool-bar-search-box

* TS test fix

* Delete relative options
  • Loading branch information
Liza Katz authored Jul 23, 2019
1 parent b609354 commit 44a574b
Show file tree
Hide file tree
Showing 32 changed files with 50 additions and 317 deletions.
1 change: 1 addition & 0 deletions .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"paths": {
"common.ui": "src/legacy/ui",
"data": "src/legacy/core_plugins/data",
"kibana_react": "src/legacy/core_plugins/kibana_react",
"server": "src/legacy/server",
"console": "src/legacy/core_plugins/console",
"core": "src/core",
Expand Down
2 changes: 2 additions & 0 deletions src/legacy/core_plugins/data/public/filter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@
*/

export { FilterService, FilterSetup } from './filter_service';

export { FilterBar } from './filter_bar';
10 changes: 2 additions & 8 deletions src/legacy/core_plugins/data/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
// @ts-ignore
import { renderersRegistry } from 'plugins/interpreter/registries';
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';
Expand All @@ -34,14 +33,12 @@ export class DataPlugin {
private readonly expressions: ExpressionsService;
private readonly filter: FilterService;
private readonly indexPatterns: IndexPatternsService;
private readonly search: SearchService;
private readonly query: QueryService;

constructor() {
this.indexPatterns = new IndexPatternsService();
this.filter = new FilterService();
this.query = new QueryService();
this.search = new SearchService();
this.expressions = new ExpressionsService();
}

Expand All @@ -61,7 +58,6 @@ export class DataPlugin {
filter: this.filter.setup({
indexPatterns: indexPatternsService.indexPatterns,
}),
search: this.search.setup(),
query: this.query.setup(),
};
}
Expand All @@ -70,7 +66,6 @@ export class DataPlugin {
this.expressions.stop();
this.indexPatterns.stop();
this.filter.stop();
this.search.stop();
this.query.stop();
}
}
Expand All @@ -80,7 +75,6 @@ export interface DataSetup {
expressions: ExpressionsSetup;
indexPatterns: IndexPatternsSetup;
filter: FilterSetup;
search: SearchSetup;
query: QuerySetup;
}

Expand All @@ -89,8 +83,8 @@ export { ExpressionRenderer, ExpressionRendererProps, ExpressionRunner } from '.

/** @public types */
export { IndexPattern, StaticIndexPattern, StaticIndexPatternField, Field } from './index_patterns';
export { Query } from './query';
export { SearchBar, SearchBarProps } from './search';
export { Query, QueryBar } from './query';
export { FilterBar } from './filter';
export { FilterManager, FilterStateManager, uniqFilters } from './filter/filter_manager';

/** @public static code */
Expand Down
2 changes: 1 addition & 1 deletion src/legacy/core_plugins/data/public/query/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
* under the License.
*/

export { QueryService, QuerySetup, Query } from './query_service';
export * from './query_service';

This file was deleted.

3 changes: 0 additions & 3 deletions src/legacy/core_plugins/data/public/query/query_bar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,4 @@ export { fromUser } from './lib/from_user';
export { toUser } from './lib/to_user';
export { getQueryLog } from './lib/get_query_log';

// @ts-ignore
export { setupDirective } from './directive';

export { Query } from '../../../../../../plugins/data/common/query/types';
13 changes: 2 additions & 11 deletions src/legacy/core_plugins/data/public/query/query_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,7 @@
* under the License.
*/

import { once } from 'lodash';
import {
QueryBar,
QueryBarInput,
fromUser,
toUser,
getQueryLog,
setupDirective as setupQueryBarDirective,
} from './query_bar';
import { QueryBar, QueryBarInput, fromUser, toUser, getQueryLog } from './query_bar';

/**
* Query Service
Expand All @@ -35,7 +27,6 @@ import {
export class QueryService {
public setup() {
return {
loadLegacyDirectives: once(setupQueryBarDirective),
helpers: {
fromUser,
toUser,
Expand All @@ -56,4 +47,4 @@ export class QueryService {
/** @public */
export type QuerySetup = ReturnType<QueryService['setup']>;

export { Query } from './query_bar';
export { Query, QueryBar } from './query_bar';
22 changes: 0 additions & 22 deletions src/legacy/core_plugins/data/public/search/index.tsx

This file was deleted.

This file was deleted.

43 changes: 0 additions & 43 deletions src/legacy/core_plugins/data/public/search/search_service.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/legacy/core_plugins/kibana/public/dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import { uiModules } from 'ui/modules';
import 'ui/capabilities/route_setup';

import { data } from 'plugins/data/setup';
data.search.loadLegacyDirectives();
data.filter.loadLegacyDirectives();

const app = uiModules.get('app/dashboard', [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ import { getRootBreadcrumbs, getSavedSearchBreadcrumbs } from '../breadcrumbs';
import { buildVislibDimensions } from 'ui/visualize/loader/pipeline_helpers/build_pipeline';
import 'ui/capabilities/route_setup';

import { data } from 'plugins/data/setup';
data.search.loadLegacyDirectives();

const fetchStatuses = {
UNINITIALIZED: 'uninitialized',
LOADING: 'loading',
Expand Down
1 change: 0 additions & 1 deletion src/legacy/core_plugins/kibana/public/kibana.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ import './context';
import 'ui/vislib';
import 'ui/agg_response';
import 'ui/agg_types';
import 'ui/timepicker';
import { showAppRedirectNotification } from 'ui/notify';
import 'leaflet';

Expand Down
1 change: 0 additions & 1 deletion src/legacy/core_plugins/kibana/public/visualize/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import { FeatureCatalogueRegistryProvider, FeatureCatalogueCategory } from 'ui/r
import { getLandingBreadcrumbs, getWizardStep1Breadcrumbs } from './breadcrumbs';

import { data } from 'plugins/data/setup';
data.search.loadLegacyDirectives();
data.filter.loadLegacyDirectives();

uiRoutes
Expand Down
1 change: 1 addition & 0 deletions src/legacy/core_plugins/kibana_react/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@

/** @public types */
export { TopNavMenu, TopNavMenuData } from './top_nav_menu';
export { SearchBar, SearchBarProps } from './search_bar';
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,9 @@ import React from 'react';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
import { SearchBar } from './search_bar';

jest.mock('../../../filter/filter_bar', () => {
jest.mock('../../../../data/public', () => {
return {
FilterBar: () => <div className="filterBar"></div>,
};
});

jest.mock('../../../query/query_bar', () => {
return {
QueryBar: () => <div className="queryBar"></div>,
};
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ import React, { Component } from 'react';
import ResizeObserver from 'resize-observer-polyfill';
import { Storage } from 'ui/storage';

import { IndexPattern } from '../../../index_patterns';
import { Query, QueryBar } from '../../../query/query_bar';
import { FilterBar } from '../../../filter/filter_bar';
import { IndexPattern, Query, QueryBar, FilterBar } from '../../../../data/public';

interface DateRange {
from: string;
Expand Down Expand Up @@ -110,16 +108,16 @@ class SearchBarUI extends Component<SearchBarProps, State> {

private getFilterTriggerButton() {
const filtersAppliedText = this.props.intl.formatMessage({
id: 'data.search.searchBar.filtersButtonFiltersAppliedTitle',
id: 'kibana_react.search.searchBar.filtersButtonFiltersAppliedTitle',
defaultMessage: 'filters applied.',
});
const clickToShowOrHideText = this.state.isFiltersVisible
? this.props.intl.formatMessage({
id: 'data.search.searchBar.filtersButtonClickToShowTitle',
id: 'kibana_react.search.searchBar.filtersButtonClickToShowTitle',
defaultMessage: 'Select to hide',
})
: this.props.intl.formatMessage({
id: 'data.search.searchBar.filtersButtonClickToHideTitle',
id: 'kibana_react.search.searchBar.filtersButtonClickToHideTitle',
defaultMessage: 'Select to show',
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,3 @@
*/

export * from './components';

// @ts-ignore
export { setupDirective } from './directive';
Original file line number Diff line number Diff line change
Expand Up @@ -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('../../../../core_plugins/data/public', () => {
jest.mock('../search_bar', () => {
return {
SearchBar: () => <div className="searchBar"></div>,
SearchBarProps: {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 '../../../../core_plugins/data/public';
import { SearchBar, SearchBarProps } from '../search_bar';

type Props = Partial<SearchBarProps> & {
name: string;
Expand Down
Loading

0 comments on commit 44a574b

Please sign in to comment.