From 0ac5b98470394d76a8b76590d43e9c22342c7a2c Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Wed, 19 Aug 2020 11:26:44 +0200 Subject: [PATCH 01/30] Convert ES body of discover doc request to use fields API --- .../public/application/components/doc/use_es_doc_search.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/discover/public/application/components/doc/use_es_doc_search.ts b/src/plugins/discover/public/application/components/doc/use_es_doc_search.ts index 522ebad1691a9..8a20237b65708 100644 --- a/src/plugins/discover/public/application/components/doc/use_es_doc_search.ts +++ b/src/plugins/discover/public/application/components/doc/use_es_doc_search.ts @@ -45,7 +45,7 @@ export function buildSearchBody(id: string, indexPattern: IndexPattern): Record< stored_fields: computedFields.storedFields, _source: true, script_fields: computedFields.scriptFields, - docvalue_fields: computedFields.docvalueFields, + fields: computedFields.docvalueFields, }; } From fb91a0ea2fd36ffb0752f5b952e058ea39730d50 Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Mon, 24 Aug 2020 18:25:50 +0200 Subject: [PATCH 02/30] Migrate angular discover.html template to react --- .../public/application/angular/discover.html | 160 ------------ .../public/application/angular/discover.js | 6 +- .../application/angular/discover_legacy.html | 48 ++++ .../doc_table/create_doc_table_react.tsx | 115 +++++++++ .../create_discover_legacy_directive.ts | 63 +++++ .../components/discover.legacy.tsx | 242 ++++++++++++++++++ .../components/fetch_error/fetch_error.tsx | 10 +- .../fetch_error/{index.js => index.ts} | 0 .../hits_counter/hits_counter_directive.ts | 27 -- .../components/hits_counter/index.ts | 1 - .../sidebar/discover_sidebar_directive.ts | 34 --- .../application/components/sidebar/index.ts | 1 - .../components/skip_bottom_button/index.ts | 1 - .../skip_bottom_button_directive.ts | 23 -- .../components/timechart_header/index.ts | 1 - .../timechart_header_directive.ts | 32 --- src/plugins/discover/public/build_services.ts | 8 +- .../discover/public/get_inner_angular.ts | 18 +- src/plugins/discover/public/plugin.ts | 14 +- 19 files changed, 491 insertions(+), 313 deletions(-) delete mode 100644 src/plugins/discover/public/application/angular/discover.html create mode 100644 src/plugins/discover/public/application/angular/discover_legacy.html create mode 100644 src/plugins/discover/public/application/angular/doc_table/create_doc_table_react.tsx create mode 100644 src/plugins/discover/public/application/components/create_discover_legacy_directive.ts create mode 100644 src/plugins/discover/public/application/components/discover.legacy.tsx rename src/plugins/discover/public/application/components/fetch_error/{index.js => index.ts} (100%) delete mode 100644 src/plugins/discover/public/application/components/hits_counter/hits_counter_directive.ts delete mode 100644 src/plugins/discover/public/application/components/sidebar/discover_sidebar_directive.ts delete mode 100644 src/plugins/discover/public/application/components/skip_bottom_button/skip_bottom_button_directive.ts delete mode 100644 src/plugins/discover/public/application/components/timechart_header/timechart_header_directive.ts diff --git a/src/plugins/discover/public/application/angular/discover.html b/src/plugins/discover/public/application/angular/discover.html deleted file mode 100644 index d3d4f524873d8..0000000000000 --- a/src/plugins/discover/public/application/angular/discover.html +++ /dev/null @@ -1,160 +0,0 @@ - -

{{screenTitle}}

- - - - - -
-
-
-
- - -
-
- -
- - - - - -
- - - -
- -
- -
- - - - - -
- - - - -
- -
-

- - - - - -
-
-
-
-
-
-
diff --git a/src/plugins/discover/public/application/angular/discover.js b/src/plugins/discover/public/application/angular/discover.js index 22da3e877054a..078df186cb0f0 100644 --- a/src/plugins/discover/public/application/angular/discover.js +++ b/src/plugins/discover/public/application/angular/discover.js @@ -30,8 +30,7 @@ import { RequestAdapter } from '../../../../inspector/public'; import { SavedObjectSaveModal, showSaveModal } from '../../../../saved_objects/public'; import { getSortArray, getSortForSearchSource } from './doc_table'; import * as columnActions from './doc_table/actions/columns'; - -import indexTemplate from './discover.html'; +import indexTemplateLegacy from './discover_legacy.html'; import { showOpenSearchPanel } from '../components/top_nav/show_open_search_panel'; import { addHelpMenuToAppChrome } from '../components/help_menu/help_menu_util'; import '../components/fetch_error'; @@ -114,7 +113,7 @@ app.config(($routeProvider) => { }; const discoverRoute = { ...defaults, - template: indexTemplate, + template: indexTemplateLegacy, reloadOnSearch: false, resolve: { savedObjects: function ($route, Promise) { @@ -610,6 +609,7 @@ function discoverController($element, $route, $scope, $timeout, $window, Promise timefield: getTimeField(), savedSearch: savedSearch, indexPatternList: $route.current.locals.savedObjects.ip.list, + config: config, }; const shouldSearchOnPageLoad = () => { diff --git a/src/plugins/discover/public/application/angular/discover_legacy.html b/src/plugins/discover/public/application/angular/discover_legacy.html new file mode 100644 index 0000000000000..4595d42bd9ead --- /dev/null +++ b/src/plugins/discover/public/application/angular/discover_legacy.html @@ -0,0 +1,48 @@ + + + + diff --git a/src/plugins/discover/public/application/angular/doc_table/create_doc_table_react.tsx b/src/plugins/discover/public/application/angular/doc_table/create_doc_table_react.tsx new file mode 100644 index 0000000000000..e5104b8783af9 --- /dev/null +++ b/src/plugins/discover/public/application/angular/doc_table/create_doc_table_react.tsx @@ -0,0 +1,115 @@ +/* + * 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. + */ +import angular, { auto, ICompileService, IScope } from 'angular'; +import { render } from 'react-dom'; +import React, { useRef, useEffect } from 'react'; +import { getServices } from '../../../kibana_services'; +export type AngularScope = IScope; + +export interface AngularDirective { + template: string; +} + +/** + * Compiles and injects the give angular template into the given dom node + * returns a function to cleanup the injected angular element + */ +export async function injectAngularElement( + domNode: Element, + template: string, + scopeProps: any, + getInjector: () => Promise +): Promise<() => void> { + const $injector = await getInjector(); + const rootScope: AngularScope = $injector.get('$rootScope'); + const $compile: ICompileService = $injector.get('$compile'); + const newScope = Object.assign(rootScope.$new(), scopeProps); + + const $target = angular.element(domNode); + const $element = angular.element(template); + + newScope.$apply(() => { + const linkFn = $compile($element); + $target.empty().append($element); + linkFn(newScope); + }); + + return () => { + newScope.$destroy(); + }; +} + +/** + * Converts a given legacy angular directive to a render function + * for usage in a react component. Note that the rendering is async + */ +export function convertDirectiveToRenderFn( + directive: AngularDirective, + getInjector: () => Promise +) { + return (domNode: Element, props: any) => { + let rejected = false; + + const cleanupFnPromise = injectAngularElement(domNode, directive.template, props, getInjector); + cleanupFnPromise.catch((e) => { + rejected = true; + render(
error
, domNode); + }); + + return () => { + if (!rejected) { + // for cleanup + // http://roubenmeschian.com/rubo/?p=51 + cleanupFnPromise.then((cleanup) => cleanup()); + } + }; + }; +} + +export function DocTableLegacy(renderProps: any) { + const renderFn = convertDirectiveToRenderFn( + { + template: ``, + }, + () => getServices().getEmbeddableInjector() + ); + const ref = useRef(null); + useEffect(() => { + if (ref && ref.current) { + return renderFn(ref.current, renderProps); + } + }, [renderFn, renderProps]); + return
; +} diff --git a/src/plugins/discover/public/application/components/create_discover_legacy_directive.ts b/src/plugins/discover/public/application/components/create_discover_legacy_directive.ts new file mode 100644 index 0000000000000..91b63c9fc9973 --- /dev/null +++ b/src/plugins/discover/public/application/components/create_discover_legacy_directive.ts @@ -0,0 +1,63 @@ +/* + * 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. + */ + +import { DiscoverLegacy } from './discover.legacy'; + +export function createDiscoverLegacyDirective(reactDirective: any) { + return reactDirective(DiscoverLegacy, [ + ['addColumn', { watchDepth: 'reference' }], + ['bucketInterval', { watchDepth: 'reference' }], + ['config', { watchDepth: 'reference' }], + ['fetch', { watchDepth: 'reference' }], + ['fetchCounter', { watchDepth: 'reference' }], + ['fetchError', { watchDepth: 'reference' }], + ['fieldCounts', { watchDepth: 'reference' }], + ['getContextAppHref', { watchDepth: 'reference' }], + ['histogramData', { watchDepth: 'reference' }], + ['hits', { watchDepth: 'reference' }], + ['indexPattern', { watchDepth: 'reference' }], + ['indexPatternList', { watchDepth: 'reference' }], + ['intervalOptions', { watchDepth: 'reference' }], + ['onAddFilter', { watchDepth: 'reference' }], + ['onChangeInterval', { watchDepth: 'reference' }], + ['onRemoveColumn', { watchDepth: 'reference' }], + ['onSetColumns', { watchDepth: 'reference' }], + ['onSort', { watchDepth: 'reference' }], + ['opts', { watchDepth: 'reference' }], + ['onSkipBottomButtonClick', { watchDepth: 'reference' }], + ['resetQuery', { watchDepth: 'reference' }], + ['resultState', { watchDepth: 'reference' }], + ['rows', { watchDepth: 'reference' }], + ['savedSearch', { watchDepth: 'reference' }], + ['screenTitle', { watchDepth: 'reference' }], + ['searchSource', { watchDepth: 'reference' }], + ['setColumns', { watchDepth: 'reference' }], + ['setIndexPattern', { watchDepth: 'reference' }], + ['setSortOrder', { watchDepth: 'reference' }], + ['showSaveQuery', { watchDepth: 'reference' }], + ['showTimeCol', { watchDepth: 'reference' }], + ['state', { watchDepth: 'reference' }], + ['timefilterUpdateHandler', { watchDepth: 'reference' }], + ['timeRange', { watchDepth: 'reference' }], + ['topNavMenu', { watchDepth: 'reference' }], + ['updateQuery', { watchDepth: 'reference' }], + ['updateSavedQueryId', { watchDepth: 'reference' }], + ['vis', { watchDepth: 'reference' }], + ]); +} diff --git a/src/plugins/discover/public/application/components/discover.legacy.tsx b/src/plugins/discover/public/application/components/discover.legacy.tsx new file mode 100644 index 0000000000000..09972944fbffe --- /dev/null +++ b/src/plugins/discover/public/application/components/discover.legacy.tsx @@ -0,0 +1,242 @@ +/* + * 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. + */ +import React from 'react'; +import moment from 'moment'; +import { EuiButtonEmpty } from '@elastic/eui'; +import { FormattedMessage, I18nProvider } from '@kbn/i18n/react'; +import { HitsCounter } from './hits_counter'; +import { TimechartHeader } from './timechart_header'; +import { DiscoverSidebar } from './sidebar'; +import { getServices } from '../../kibana_services'; +// @ts-ignore +import { DiscoverNoResults } from '../angular/directives/no_results'; +import { DiscoverUninitialized } from '../angular/directives/uninitialized'; +import { DiscoverHistogram } from '../angular/directives/histogram'; +import { LoadingSpinner } from './loading_spinner/loading_spinner'; +import { DiscoverFetchError } from './fetch_error/fetch_error'; +import { DocTableLegacy } from '../angular/doc_table/create_doc_table_react'; +import { SkipBottomButton } from './skip_bottom_button'; + +export function DiscoverLegacy({ + addColumn, + bucketInterval, + config, + fetch, + fetchError, + fetchCounter, + fieldCounts, + getContextAppHref, + histogramData, + hits, + indexPattern, + indexPatternList, + intervalOptions, + onAddFilter, + onChangeInterval, + onRemoveColumn, + onSetColumns, + onSort, + onSkipBottomButtonClick, + opts, + resetQuery, + resultState, + rows, + screenTitle, + searchSource, + setIndexPattern, + showTimeCol, + showSaveQuery, + state, + timefilterUpdateHandler, + timeRange, + topNavMenu, + vis, + updateQuery, + updateSavedQueryId, +}: any) { + const toMoment = function (datetime: string) { + if (!datetime) { + return ''; + } + return moment(datetime).format(config.get('dateFormat')); + }; + if (!timeRange) { + return
Loading
; + } + const { TopNavMenu } = getServices().navigation.ui; + const { savedSearch } = opts; + + return ( + +
+

{screenTitle}

+ +
+
+
+
+ +
+
+
+ {resultState === 'none' && ( + + )} + {resultState === 'uninitialized' && } + + {resultState === 'loading' && ( + <> + {fetchError && } + {!fetchError && ( +
+ +
+ )} + + )} + + {resultState === 'ready' && ( +
+ + 0 ? hits : 0} + showResetButton={!!(savedSearch && savedSearch.id)} + onResetQuery={resetQuery} + /> + + + {opts.timefield && ( +
+ {vis && rows.length !== 0 && ( +
+ +
+ )} +
+ )} + +
+
+

+ +

+ {rows && rows.length && ( +
+ + + ​ + + {rows.length === opts.sampleSize && ( +
+ + + window.scrollTo(0, 0)}> + + +
+ )} +
+ )} +
+
+
+ )} +
+
+
+
+
+ ); +} diff --git a/src/plugins/discover/public/application/components/fetch_error/fetch_error.tsx b/src/plugins/discover/public/application/components/fetch_error/fetch_error.tsx index 880a493983adf..324aed809f0e8 100644 --- a/src/plugins/discover/public/application/components/fetch_error/fetch_error.tsx +++ b/src/plugins/discover/public/application/components/fetch_error/fetch_error.tsx @@ -20,7 +20,7 @@ import './fetch_error.scss'; import React, { Fragment } from 'react'; import { FormattedMessage, I18nProvider } from '@kbn/i18n/react'; import { EuiFlexGroup, EuiFlexItem, EuiCallOut, EuiCodeBlock, EuiSpacer } from '@elastic/eui'; -import { getAngularModule, getServices } from '../../../kibana_services'; +import { getServices } from '../../../kibana_services'; interface Props { fetchError: { @@ -31,7 +31,7 @@ interface Props { }; } -const DiscoverFetchError = ({ fetchError }: Props) => { +export const DiscoverFetchError = ({ fetchError }: Props) => { if (!fetchError) { return null; } @@ -92,9 +92,3 @@ const DiscoverFetchError = ({ fetchError }: Props) => { ); }; - -export function createFetchErrorDirective(reactDirective: any) { - return reactDirective(DiscoverFetchError); -} - -getAngularModule().directive('discoverFetchError', createFetchErrorDirective); diff --git a/src/plugins/discover/public/application/components/fetch_error/index.js b/src/plugins/discover/public/application/components/fetch_error/index.ts similarity index 100% rename from src/plugins/discover/public/application/components/fetch_error/index.js rename to src/plugins/discover/public/application/components/fetch_error/index.ts diff --git a/src/plugins/discover/public/application/components/hits_counter/hits_counter_directive.ts b/src/plugins/discover/public/application/components/hits_counter/hits_counter_directive.ts deleted file mode 100644 index 8d45e28370cad..0000000000000 --- a/src/plugins/discover/public/application/components/hits_counter/hits_counter_directive.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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. - */ -import { HitsCounter } from './hits_counter'; - -export function createHitsCounterDirective(reactDirective: any) { - return reactDirective(HitsCounter, [ - ['hits', { watchDepth: 'reference' }], - ['showResetButton', { watchDepth: 'reference' }], - ['onResetQuery', { watchDepth: 'reference' }], - ]); -} diff --git a/src/plugins/discover/public/application/components/hits_counter/index.ts b/src/plugins/discover/public/application/components/hits_counter/index.ts index 58e7a9eda7f51..0ce95f061df17 100644 --- a/src/plugins/discover/public/application/components/hits_counter/index.ts +++ b/src/plugins/discover/public/application/components/hits_counter/index.ts @@ -18,4 +18,3 @@ */ export { HitsCounter } from './hits_counter'; -export { createHitsCounterDirective } from './hits_counter_directive'; diff --git a/src/plugins/discover/public/application/components/sidebar/discover_sidebar_directive.ts b/src/plugins/discover/public/application/components/sidebar/discover_sidebar_directive.ts deleted file mode 100644 index 624ec0f757894..0000000000000 --- a/src/plugins/discover/public/application/components/sidebar/discover_sidebar_directive.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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. - */ -import { DiscoverSidebar } from './discover_sidebar'; - -export function createDiscoverSidebarDirective(reactDirective: any) { - return reactDirective(DiscoverSidebar, [ - ['columns', { watchDepth: 'reference' }], - ['fieldCounts', { watchDepth: 'reference' }], - ['hits', { watchDepth: 'reference' }], - ['indexPatternList', { watchDepth: 'reference' }], - ['onAddField', { watchDepth: 'reference' }], - ['onAddFilter', { watchDepth: 'reference' }], - ['onRemoveField', { watchDepth: 'reference' }], - ['selectedIndexPattern', { watchDepth: 'reference' }], - ['setIndexPattern', { watchDepth: 'reference' }], - ['state', { watchDepth: 'reference' }], - ]); -} diff --git a/src/plugins/discover/public/application/components/sidebar/index.ts b/src/plugins/discover/public/application/components/sidebar/index.ts index 1b837840b52f6..aec8dfc86e817 100644 --- a/src/plugins/discover/public/application/components/sidebar/index.ts +++ b/src/plugins/discover/public/application/components/sidebar/index.ts @@ -18,4 +18,3 @@ */ export { DiscoverSidebar } from './discover_sidebar'; -export { createDiscoverSidebarDirective } from './discover_sidebar_directive'; diff --git a/src/plugins/discover/public/application/components/skip_bottom_button/index.ts b/src/plugins/discover/public/application/components/skip_bottom_button/index.ts index 2feaa35e0d61f..b3d93e40be0bd 100644 --- a/src/plugins/discover/public/application/components/skip_bottom_button/index.ts +++ b/src/plugins/discover/public/application/components/skip_bottom_button/index.ts @@ -18,4 +18,3 @@ */ export { SkipBottomButton } from './skip_bottom_button'; -export { createSkipBottomButtonDirective } from './skip_bottom_button_directive'; diff --git a/src/plugins/discover/public/application/components/skip_bottom_button/skip_bottom_button_directive.ts b/src/plugins/discover/public/application/components/skip_bottom_button/skip_bottom_button_directive.ts deleted file mode 100644 index 27f17b25fd447..0000000000000 --- a/src/plugins/discover/public/application/components/skip_bottom_button/skip_bottom_button_directive.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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. - */ -import { SkipBottomButton } from './skip_bottom_button'; - -export function createSkipBottomButtonDirective(reactDirective: any) { - return reactDirective(SkipBottomButton, [['onClick', { watchDepth: 'reference' }]]); -} diff --git a/src/plugins/discover/public/application/components/timechart_header/index.ts b/src/plugins/discover/public/application/components/timechart_header/index.ts index 43473319c318c..34bed2cd72a74 100644 --- a/src/plugins/discover/public/application/components/timechart_header/index.ts +++ b/src/plugins/discover/public/application/components/timechart_header/index.ts @@ -18,4 +18,3 @@ */ export { TimechartHeader } from './timechart_header'; -export { createTimechartHeaderDirective } from './timechart_header_directive'; diff --git a/src/plugins/discover/public/application/components/timechart_header/timechart_header_directive.ts b/src/plugins/discover/public/application/components/timechart_header/timechart_header_directive.ts deleted file mode 100644 index 027236cd46521..0000000000000 --- a/src/plugins/discover/public/application/components/timechart_header/timechart_header_directive.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ -import { TimechartHeader } from './timechart_header'; - -export function createTimechartHeaderDirective(reactDirective: any) { - return reactDirective(TimechartHeader, [ - ['from', { watchDepth: 'reference' }], - ['to', { watchDepth: 'reference' }], - ['options', { watchDepth: 'reference' }], - ['onChangeInterval', { watchDepth: 'reference' }], - ['stateInterval', { watchDepth: 'reference' }], - ['showScaledInfo', { watchDepth: 'reference' }], - ['bucketIntervalDescription', { watchDepth: 'reference' }], - ['bucketIntervalScale', { watchDepth: 'reference' }], - ]); -} diff --git a/src/plugins/discover/public/build_services.ts b/src/plugins/discover/public/build_services.ts index 75c83e30d80ad..f7feafad4b32d 100644 --- a/src/plugins/discover/public/build_services.ts +++ b/src/plugins/discover/public/build_services.ts @@ -43,6 +43,7 @@ import { DiscoverStartPlugins } from './plugin'; import { createSavedSearchesLoader, SavedSearch } from './saved_searches'; import { getHistory } from './kibana_services'; import { KibanaLegacyStart } from '../../kibana_legacy/public'; +import { NavigationPublicPluginStart } from '../../navigation/public'; export interface DiscoverServices { addBasePath: (path: string) => string; @@ -57,12 +58,14 @@ export interface DiscoverServices { indexPatterns: IndexPatternsContract; inspector: InspectorPublicPluginStart; metadata: { branch: string }; + navigation: NavigationPublicPluginStart; share?: SharePluginStart; kibanaLegacy: KibanaLegacyStart; timefilter: TimefilterContract; toastNotifications: ToastsStart; getSavedSearchById: (id: string) => Promise; getSavedSearchUrlById: (id: string) => Promise; + getEmbeddableInjector: any; uiSettings: IUiSettingsClient; visualizations: VisualizationsStart; } @@ -70,7 +73,8 @@ export interface DiscoverServices { export async function buildServices( core: CoreStart, plugins: DiscoverStartPlugins, - context: PluginInitializerContext + context: PluginInitializerContext, + getEmbeddableInjector: any ): Promise { const services: SavedObjectKibanaServices = { savedObjectsClient: core.savedObjects.client, @@ -90,6 +94,7 @@ export async function buildServices( docLinks: core.docLinks, theme: plugins.charts.theme, filterManager: plugins.data.query.filterManager, + getEmbeddableInjector, getSavedSearchById: async (id: string) => savedObjectService.get(id), getSavedSearchUrlById: async (id: string) => savedObjectService.urlFor(id), history: getHistory, @@ -98,6 +103,7 @@ export async function buildServices( metadata: { branch: context.env.packageInfo.branch, }, + navigation: plugins.navigation, share: plugins.share, kibanaLegacy: plugins.kibanaLegacy, timefilter: plugins.data.query.timefilter.timefilter, diff --git a/src/plugins/discover/public/get_inner_angular.ts b/src/plugins/discover/public/get_inner_angular.ts index 85b0752f13463..10f3bf1e29781 100644 --- a/src/plugins/discover/public/get_inner_angular.ts +++ b/src/plugins/discover/public/get_inner_angular.ts @@ -57,14 +57,10 @@ import { createTopNavDirective, createTopNavHelper, } from '../../kibana_legacy/public'; -import { createDiscoverSidebarDirective } from './application/components/sidebar'; -import { createHitsCounterDirective } from '././application/components/hits_counter'; -import { createLoadingSpinnerDirective } from '././application/components/loading_spinner/loading_spinner'; -import { createTimechartHeaderDirective } from './application/components/timechart_header'; import { createContextErrorMessageDirective } from './application/components/context_error_message'; import { DiscoverStartPlugins } from './plugin'; import { getScopedHistory } from './kibana_services'; -import { createSkipBottomButtonDirective } from './application/components/skip_bottom_button'; +import { createDiscoverLegacyDirective } from './application/components/create_discover_legacy_directive'; /** * returns the main inner angular module, it contains all the parts of Angular Discover @@ -88,11 +84,9 @@ export function getInnerAngularModule( export function getInnerAngularModuleEmbeddable( name: string, core: CoreStart, - deps: DiscoverStartPlugins, - context: PluginInitializerContext + deps: DiscoverStartPlugins ) { - const module = initializeInnerAngularModule(name, core, deps.navigation, deps.data, true); - return module; + return initializeInnerAngularModule(name, core, deps.navigation, deps.data, true); } let initialized = false; @@ -154,11 +148,7 @@ export function initializeInnerAngularModule( .directive('collapsibleSidebar', CollapsibleSidebarProvider) .directive('fixedScroll', FixedScrollProvider) .directive('renderComplete', createRenderCompleteDirective) - .directive('discoverSidebar', createDiscoverSidebarDirective) - .directive('skipBottomButton', createSkipBottomButtonDirective) - .directive('hitsCounter', createHitsCounterDirective) - .directive('loadingSpinner', createLoadingSpinnerDirective) - .directive('timechartHeader', createTimechartHeaderDirective) + .directive('discoverLegacy', createDiscoverLegacyDirective) .directive('contextErrorMessage', createContextErrorMessageDirective) .service('debounce', ['$timeout', DebounceProviderTimeout]); } diff --git a/src/plugins/discover/public/plugin.ts b/src/plugins/discover/public/plugin.ts index 015f4267646c1..0d5b2909b52e1 100644 --- a/src/plugins/discover/public/plugin.ts +++ b/src/plugins/discover/public/plugin.ts @@ -321,7 +321,12 @@ export class DiscoverPlugin if (this.servicesInitialized) { return { core, plugins }; } - const services = await buildServices(core, plugins, this.initializerContext); + const services = await buildServices( + core, + plugins, + this.initializerContext, + this.getEmbeddableInjector + ); setServices(services); this.servicesInitialized = true; @@ -374,12 +379,7 @@ export class DiscoverPlugin const { core, plugins } = await this.initializeServices(); getServices().kibanaLegacy.loadFontAwesome(); const { getInnerAngularModuleEmbeddable } = await import('./get_inner_angular'); - getInnerAngularModuleEmbeddable( - embeddableAngularName, - core, - plugins, - this.initializerContext - ); + getInnerAngularModuleEmbeddable(embeddableAngularName, core, plugins); const mountpoint = document.createElement('div'); this.embeddableInjector = angular.bootstrap(mountpoint, [embeddableAngularName]); } From 13a1756fc35fe1c34225f3df963a77fa24c7022e Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Tue, 25 Aug 2020 06:23:02 +0200 Subject: [PATCH 03/30] Undo es doc fetch change --- .../public/application/components/doc/use_es_doc_search.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/discover/public/application/components/doc/use_es_doc_search.ts b/src/plugins/discover/public/application/components/doc/use_es_doc_search.ts index 8a20237b65708..522ebad1691a9 100644 --- a/src/plugins/discover/public/application/components/doc/use_es_doc_search.ts +++ b/src/plugins/discover/public/application/components/doc/use_es_doc_search.ts @@ -45,7 +45,7 @@ export function buildSearchBody(id: string, indexPattern: IndexPattern): Record< stored_fields: computedFields.storedFields, _source: true, script_fields: computedFields.scriptFields, - fields: computedFields.docvalueFields, + docvalue_fields: computedFields.docvalueFields, }; } From d513821d757777d626f96ce017d4ee4a8d1f1bb1 Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Tue, 25 Aug 2020 07:00:03 +0200 Subject: [PATCH 04/30] Enable collapsing of sidebar --- .../components/discover.legacy.tsx | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/plugins/discover/public/application/components/discover.legacy.tsx b/src/plugins/discover/public/application/components/discover.legacy.tsx index 09972944fbffe..724b22a6b38fb 100644 --- a/src/plugins/discover/public/application/components/discover.legacy.tsx +++ b/src/plugins/discover/public/application/components/discover.legacy.tsx @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import React from 'react'; +import React, { useState } from 'react'; import moment from 'moment'; import { EuiButtonEmpty } from '@elastic/eui'; import { FormattedMessage, I18nProvider } from '@kbn/i18n/react'; @@ -70,6 +70,7 @@ export function DiscoverLegacy({ updateQuery, updateSavedQueryId, }: any) { + const [isSidebarClosed, setIsSidebarClosed] = useState(false); const toMoment = function (datetime: string) { if (!datetime) { return ''; @@ -103,7 +104,9 @@ export function DiscoverLegacy({
@@ -121,8 +124,22 @@ export function DiscoverLegacy({ state={state} />
+
-
+
{resultState === 'none' && ( Date: Tue, 25 Aug 2020 07:21:50 +0200 Subject: [PATCH 05/30] Enable filtering of doc table --- .../collapsible_sidebar.ts | 88 ------------------- .../doc_table/create_doc_table_react.tsx | 6 +- .../discover/public/get_inner_angular.ts | 3 - 3 files changed, 3 insertions(+), 94 deletions(-) delete mode 100644 src/plugins/discover/public/application/angular/directives/collapsible_sidebar/collapsible_sidebar.ts diff --git a/src/plugins/discover/public/application/angular/directives/collapsible_sidebar/collapsible_sidebar.ts b/src/plugins/discover/public/application/angular/directives/collapsible_sidebar/collapsible_sidebar.ts deleted file mode 100644 index 16fbb0af9f3fd..0000000000000 --- a/src/plugins/discover/public/application/angular/directives/collapsible_sidebar/collapsible_sidebar.ts +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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. - */ - -import _ from 'lodash'; -import $ from 'jquery'; -import { IScope } from 'angular'; - -interface LazyScope extends IScope { - [key: string]: any; -} - -export function CollapsibleSidebarProvider() { - // simply a list of all of all of angulars .col-md-* classes except 12 - const listOfWidthClasses = _.times(11, function (i) { - return 'col-md-' + i; - }); - - return { - restrict: 'C', - link: ($scope: LazyScope, $elem: any) => { - let isCollapsed = false; - const $collapser = $( - `` - ); - // If the collapsable element has an id, also set aria-controls - if ($elem.attr('id')) { - $collapser.attr('aria-controls', $elem.attr('id')); - } - const $icon = $(''); - $collapser.append($icon); - const $siblings = $elem.siblings(); - - const siblingsClass = listOfWidthClasses.reduce((prev: string, className: string) => { - if (prev) return prev; - return $siblings.hasClass(className) && className; - }, ''); - - // If there is are only two elements we can assume the other one will take 100% of the width. - const hasSingleSibling = $siblings.length === 1 && siblingsClass; - - $collapser.on('click', function () { - if (isCollapsed) { - isCollapsed = false; - $elem.removeClass('closed'); - $icon.addClass('fa-chevron-circle-left'); - $icon.removeClass('fa-chevron-circle-right'); - $collapser.attr('aria-expanded', 'true'); - } else { - isCollapsed = true; - $elem.addClass('closed'); - $icon.removeClass('fa-chevron-circle-left'); - $icon.addClass('fa-chevron-circle-right'); - $collapser.attr('aria-expanded', 'false'); - } - - if (hasSingleSibling) { - $siblings.toggleClass(siblingsClass + ' col-md-12'); - } - - if ($scope.toggleSidebar) $scope.toggleSidebar(); - }); - - $collapser.appendTo($elem); - }, - }; -} diff --git a/src/plugins/discover/public/application/angular/doc_table/create_doc_table_react.tsx b/src/plugins/discover/public/application/angular/doc_table/create_doc_table_react.tsx index e5104b8783af9..32006027bdc56 100644 --- a/src/plugins/discover/public/application/angular/doc_table/create_doc_table_react.tsx +++ b/src/plugins/discover/public/application/angular/doc_table/create_doc_table_react.tsx @@ -91,17 +91,17 @@ export function DocTableLegacy(renderProps: any) { sorting="sort" columns="columns" infinite-scroll="true" - filter="filterQuery" + filter="onFilter" data-shared-item data-title="{{opts.savedSearch.lastSavedTitle}}" data-description="{{opts.savedSearch.description}}" data-test-subj="discoverDocTable" minimum-visible-rows="minimumVisibleRows" render-complete - on-add-column="addColumn" + on-add-column="onAddColumn" on-change-sort-order="setSortOrder" on-move-column="moveColumn" - on-remove-column="removeColumn">`, + on-remove-column="onRemoveColumn">`, }, () => getServices().getEmbeddableInjector() ); diff --git a/src/plugins/discover/public/get_inner_angular.ts b/src/plugins/discover/public/get_inner_angular.ts index 10f3bf1e29781..493a89e6f2944 100644 --- a/src/plugins/discover/public/get_inner_angular.ts +++ b/src/plugins/discover/public/get_inner_angular.ts @@ -40,7 +40,6 @@ import { createTableRowDirective } from './application/angular/doc_table/compone import { createPagerFactory } from './application/angular/doc_table/lib/pager/pager_factory'; import { createInfiniteScrollDirective } from './application/angular/doc_table/infinite_scroll'; import { createDocViewerDirective } from './application/angular/doc_viewer'; -import { CollapsibleSidebarProvider } from './application/angular/directives/collapsible_sidebar/collapsible_sidebar'; // @ts-ignore import { FixedScrollProvider } from './application/angular/directives/fixed_scroll'; // @ts-ignore @@ -143,9 +142,7 @@ export function initializeInnerAngularModule( ]) .config(watchMultiDecorator) .run(registerListenEventListener) - .directive('icon', (reactDirective) => reactDirective(EuiIcon)) .directive('kbnAccessibleClick', KbnAccessibleClickProvider) - .directive('collapsibleSidebar', CollapsibleSidebarProvider) .directive('fixedScroll', FixedScrollProvider) .directive('renderComplete', createRenderCompleteDirective) .directive('discoverLegacy', createDiscoverLegacyDirective) From 007f84bf8bcc541db7221d5774353cb6d85af731 Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Tue, 25 Aug 2020 11:12:16 +0200 Subject: [PATCH 06/30] Fix tests --- .../components/discover.legacy.tsx | 18 ++++++------- .../loading_spinner/loading_spinner.tsx | 26 +++++++------------ 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/src/plugins/discover/public/application/components/discover.legacy.tsx b/src/plugins/discover/public/application/components/discover.legacy.tsx index 724b22a6b38fb..8d4341852d2a9 100644 --- a/src/plugins/discover/public/application/components/discover.legacy.tsx +++ b/src/plugins/discover/public/application/components/discover.legacy.tsx @@ -148,16 +148,14 @@ export function DiscoverLegacy({ )} {resultState === 'uninitialized' && } - {resultState === 'loading' && ( - <> - {fetchError && } - {!fetchError && ( -
- -
- )} - - )} + + {fetchError && } + {!fetchError && ( +
+ +
+ )} +
{resultState === 'ready' && (
diff --git a/src/plugins/discover/public/application/components/loading_spinner/loading_spinner.tsx b/src/plugins/discover/public/application/components/loading_spinner/loading_spinner.tsx index 44b922bf0f708..4e1754638d479 100644 --- a/src/plugins/discover/public/application/components/loading_spinner/loading_spinner.tsx +++ b/src/plugins/discover/public/application/components/loading_spinner/loading_spinner.tsx @@ -18,24 +18,18 @@ */ import React from 'react'; import { EuiLoadingSpinner, EuiTitle, EuiSpacer } from '@elastic/eui'; -import { FormattedMessage, I18nProvider } from '@kbn/i18n/react'; +import { FormattedMessage } from '@kbn/i18n/react'; export function LoadingSpinner() { return ( - - <> - -

- -

-
- - - -
+ <> + +

+ +

+
+ + + ); } - -export function createLoadingSpinnerDirective(reactDirective: any) { - return reactDirective(LoadingSpinner); -} From 244d2cbe2f08569cfc4b7c7df414c7cb99ed0a5d Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Thu, 27 Aug 2020 10:15:04 +0200 Subject: [PATCH 07/30] Fix missing data-title and data-description --- .../application/angular/doc_table/create_doc_table_react.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/discover/public/application/angular/doc_table/create_doc_table_react.tsx b/src/plugins/discover/public/application/angular/doc_table/create_doc_table_react.tsx index 32006027bdc56..a939ecd916c9d 100644 --- a/src/plugins/discover/public/application/angular/doc_table/create_doc_table_react.tsx +++ b/src/plugins/discover/public/application/angular/doc_table/create_doc_table_react.tsx @@ -93,8 +93,8 @@ export function DocTableLegacy(renderProps: any) { infinite-scroll="true" filter="onFilter" data-shared-item - data-title="{{opts.savedSearch.lastSavedTitle}}" - data-description="{{opts.savedSearch.description}}" + data-title="searchTitle" + data-description="searchDescription" data-test-subj="discoverDocTable" minimum-visible-rows="minimumVisibleRows" render-complete From 2855008768da4a23a4fb8ad72fbb92d103818b52 Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Thu, 27 Aug 2020 10:37:38 +0200 Subject: [PATCH 08/30] Fix missing timeRange leading to an functional test fail --- .../components/discover.legacy.tsx | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/plugins/discover/public/application/components/discover.legacy.tsx b/src/plugins/discover/public/application/components/discover.legacy.tsx index 8d4341852d2a9..91c03bbb8a01f 100644 --- a/src/plugins/discover/public/application/components/discover.legacy.tsx +++ b/src/plugins/discover/public/application/components/discover.legacy.tsx @@ -77,9 +77,6 @@ export function DiscoverLegacy({ } return moment(datetime).format(config.get('dateFormat')); }; - if (!timeRange) { - return
Loading
; - } const { TopNavMenu } = getServices().navigation.ui; const { savedSearch } = opts; @@ -165,17 +162,19 @@ export function DiscoverLegacy({ showResetButton={!!(savedSearch && savedSearch.id)} onResetQuery={resetQuery} /> + {timeRange && ( + + )} - {opts.timefield && (
Date: Thu, 27 Aug 2020 13:25:42 +0200 Subject: [PATCH 09/30] Fix another test --- .../public/application/angular/discover_legacy.html | 2 -- .../public/application/components/discover.legacy.tsx | 6 +++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/discover/public/application/angular/discover_legacy.html b/src/plugins/discover/public/application/angular/discover_legacy.html index 4595d42bd9ead..22c9d5c04e1b2 100644 --- a/src/plugins/discover/public/application/angular/discover_legacy.html +++ b/src/plugins/discover/public/application/angular/discover_legacy.html @@ -29,8 +29,6 @@ saved-search="savedSearch" search-source="searchSource" screen-title="screenTitle" - search-description="opts.savedSearch.description" - search-title="opts.savedSearch.lastSavedTitle" selected-index-pattern="searchSource.getField('index')" set-index-pattern="setIndexPattern" show-time-col="showTimeCol" diff --git a/src/plugins/discover/public/application/components/discover.legacy.tsx b/src/plugins/discover/public/application/components/discover.legacy.tsx index 91c03bbb8a01f..a1277d6648ba7 100644 --- a/src/plugins/discover/public/application/components/discover.legacy.tsx +++ b/src/plugins/discover/public/application/components/discover.legacy.tsx @@ -200,7 +200,11 @@ export function DiscoverLegacy({ /> {rows && rows.length && ( -
+
Date: Thu, 27 Aug 2020 15:18:04 +0200 Subject: [PATCH 10/30] Fix sorting of table --- .../angular/doc_table/create_doc_table_react.tsx | 6 +++--- .../public/application/components/discover.legacy.tsx | 11 +++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/plugins/discover/public/application/angular/doc_table/create_doc_table_react.tsx b/src/plugins/discover/public/application/angular/doc_table/create_doc_table_react.tsx index a939ecd916c9d..89cf2d0a37ce7 100644 --- a/src/plugins/discover/public/application/angular/doc_table/create_doc_table_react.tsx +++ b/src/plugins/discover/public/application/angular/doc_table/create_doc_table_react.tsx @@ -93,13 +93,13 @@ export function DocTableLegacy(renderProps: any) { infinite-scroll="true" filter="onFilter" data-shared-item - data-title="searchTitle" - data-description="searchDescription" + data-title="{{searchTitle}}" + data-description="{{searchDescription}}" data-test-subj="discoverDocTable" minimum-visible-rows="minimumVisibleRows" render-complete on-add-column="onAddColumn" - on-change-sort-order="setSortOrder" + on-change-sort-order="onSort" on-move-column="moveColumn" on-remove-column="onRemoveColumn">`, }, diff --git a/src/plugins/discover/public/application/components/discover.legacy.tsx b/src/plugins/discover/public/application/components/discover.legacy.tsx index a1277d6648ba7..b15dd24851b49 100644 --- a/src/plugins/discover/public/application/components/discover.legacy.tsx +++ b/src/plugins/discover/public/application/components/discover.legacy.tsx @@ -19,6 +19,7 @@ import React, { useState } from 'react'; import moment from 'moment'; import { EuiButtonEmpty } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; import { FormattedMessage, I18nProvider } from '@kbn/i18n/react'; import { HitsCounter } from './hits_counter'; import { TimechartHeader } from './timechart_header'; @@ -177,7 +178,9 @@ export function DiscoverLegacy({ {opts.timefield && (
{vis && rows.length !== 0 && ( @@ -200,11 +203,7 @@ export function DiscoverLegacy({ /> {rows && rows.length && ( -
+
Date: Thu, 27 Aug 2020 23:18:06 +0200 Subject: [PATCH 11/30] Handle refresh --- .../discover/public/application/angular/discover_legacy.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/discover/public/application/angular/discover_legacy.html b/src/plugins/discover/public/application/angular/discover_legacy.html index 22c9d5c04e1b2..5f4fc01bcc03d 100644 --- a/src/plugins/discover/public/application/angular/discover_legacy.html +++ b/src/plugins/discover/public/application/angular/discover_legacy.html @@ -39,7 +39,7 @@ time-filter-update-handler="timefilterUpdateHandler" top-nav-menu="topNavMenu" vis="vis" - update-query="updateQuery" + update-query="handleRefresh" update-saved-query-id="updateSavedQueryId" > From 3be737479fc6406d35523fab7a82a0156ee55d04 Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Tue, 1 Sep 2020 08:02:16 +0200 Subject: [PATCH 12/30] Fix scroll to bottom --- src/plugins/discover/public/application/angular/discover.js | 1 + .../public/application/angular/discover_legacy.html | 1 + .../public/application/angular/doc_table/doc_table.ts | 6 +----- .../components/create_discover_legacy_directive.ts | 1 + .../public/application/components/discover.legacy.tsx | 2 ++ 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/plugins/discover/public/application/angular/discover.js b/src/plugins/discover/public/application/angular/discover.js index 078df186cb0f0..a60e9922ff463 100644 --- a/src/plugins/discover/public/application/angular/discover.js +++ b/src/plugins/discover/public/application/angular/discover.js @@ -769,6 +769,7 @@ function discoverController($element, $route, $scope, $timeout, $window, Promise if (!init.complete) return; $scope.fetchCounter++; $scope.fetchError = undefined; + $scope.minimumVisibleRows = 50; if (!validateTimeRange(timefilter.getTime(), toastNotifications)) { $scope.resultState = 'none'; return; diff --git a/src/plugins/discover/public/application/angular/discover_legacy.html b/src/plugins/discover/public/application/angular/discover_legacy.html index 5f4fc01bcc03d..e7e71276a458d 100644 --- a/src/plugins/discover/public/application/angular/discover_legacy.html +++ b/src/plugins/discover/public/application/angular/discover_legacy.html @@ -14,6 +14,7 @@ index-pattern-list="opts.indexPatternList" index-pattern="indexPattern" interval-options="intervalOptions" + minimum-visible-rows="minimumVisibleRows" on-add-column="addColumn" on-add-filter="filterQuery" on-change-interval="changeInterval" diff --git a/src/plugins/discover/public/application/angular/doc_table/doc_table.ts b/src/plugins/discover/public/application/angular/doc_table/doc_table.ts index f972c158ff3dd..735ee9f555740 100644 --- a/src/plugins/discover/public/application/angular/doc_table/doc_table.ts +++ b/src/plugins/discover/public/application/angular/doc_table/doc_table.ts @@ -50,10 +50,6 @@ export function createDocTableDirective(pagerFactory: any, $filter: any) { inspectorAdapters: '=?', }, link: ($scope: LazyScope, $el: JQuery) => { - $scope.$watch('minimumVisibleRows', (minimumVisibleRows: number) => { - $scope.limit = Math.max(minimumVisibleRows || 50, $scope.limit || 50); - }); - $scope.persist = { sorting: $scope.sorting, columns: $scope.columns, @@ -77,7 +73,7 @@ export function createDocTableDirective(pagerFactory: any, $filter: any) { if (!hits) return; // Reset infinite scroll limit - $scope.limit = 50; + $scope.limit = $scope.minimumVisibleRows || 50; if (hits.length === 0) { dispatchRenderComplete($el[0]); diff --git a/src/plugins/discover/public/application/components/create_discover_legacy_directive.ts b/src/plugins/discover/public/application/components/create_discover_legacy_directive.ts index 91b63c9fc9973..65aba8a253eff 100644 --- a/src/plugins/discover/public/application/components/create_discover_legacy_directive.ts +++ b/src/plugins/discover/public/application/components/create_discover_legacy_directive.ts @@ -34,6 +34,7 @@ export function createDiscoverLegacyDirective(reactDirective: any) { ['indexPattern', { watchDepth: 'reference' }], ['indexPatternList', { watchDepth: 'reference' }], ['intervalOptions', { watchDepth: 'reference' }], + ['minimumVisibleRows', { watchDepth: 'reference' }], ['onAddFilter', { watchDepth: 'reference' }], ['onChangeInterval', { watchDepth: 'reference' }], ['onRemoveColumn', { watchDepth: 'reference' }], diff --git a/src/plugins/discover/public/application/components/discover.legacy.tsx b/src/plugins/discover/public/application/components/discover.legacy.tsx index b15dd24851b49..6cb28228b7697 100644 --- a/src/plugins/discover/public/application/components/discover.legacy.tsx +++ b/src/plugins/discover/public/application/components/discover.legacy.tsx @@ -48,6 +48,7 @@ export function DiscoverLegacy({ indexPattern, indexPatternList, intervalOptions, + minimumVisibleRows, onAddFilter, onChangeInterval, onRemoveColumn, @@ -208,6 +209,7 @@ export function DiscoverLegacy({ ariaLabelledBy="documentsAriaLabel" columns={state.columns} indexPattern={indexPattern} + minimumVisibleRows={minimumVisibleRows} rows={rows} sort={state.sort} sampleSize={opts.sampleSize} From ccdfc75bba2ab5e70e3882e85be1115cb4df37f7 Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Tue, 1 Sep 2020 08:12:37 +0200 Subject: [PATCH 13/30] Fix invalid painless scripted field functional test --- .../discover/public/application/angular/discover.js | 1 - .../public/application/angular/discover_legacy.html | 4 ++-- .../public/application/components/discover.legacy.tsx | 8 +++----- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/plugins/discover/public/application/angular/discover.js b/src/plugins/discover/public/application/angular/discover.js index a60e9922ff463..1e1a26fbf2cf6 100644 --- a/src/plugins/discover/public/application/angular/discover.js +++ b/src/plugins/discover/public/application/angular/discover.js @@ -33,7 +33,6 @@ import * as columnActions from './doc_table/actions/columns'; import indexTemplateLegacy from './discover_legacy.html'; import { showOpenSearchPanel } from '../components/top_nav/show_open_search_panel'; import { addHelpMenuToAppChrome } from '../components/help_menu/help_menu_util'; -import '../components/fetch_error'; import { getPainlessError } from './get_painless_error'; import { discoverResponseHandler } from './response_handler'; import { diff --git a/src/plugins/discover/public/application/angular/discover_legacy.html b/src/plugins/discover/public/application/angular/discover_legacy.html index e7e71276a458d..971476c01d2ca 100644 --- a/src/plugins/discover/public/application/angular/discover_legacy.html +++ b/src/plugins/discover/public/application/angular/discover_legacy.html @@ -5,8 +5,8 @@ columns="state.columns" config="opts.config" fetch="fetch" - fetchCounter="fetchCounter" - fetchError="fetchError" + fetch-counter="fetchCounter" + fetch-error="fetchError" field-counts="fieldCounts" get-context-app-href="getContextAppHref" hits="hits" diff --git a/src/plugins/discover/public/application/components/discover.legacy.tsx b/src/plugins/discover/public/application/components/discover.legacy.tsx index 6cb28228b7697..4df9478be1948 100644 --- a/src/plugins/discover/public/application/components/discover.legacy.tsx +++ b/src/plugins/discover/public/application/components/discover.legacy.tsx @@ -149,11 +149,9 @@ export function DiscoverLegacy({ {fetchError && } - {!fetchError && ( -
- -
- )} +
+ +
{resultState === 'ready' && ( From 129d7c92382fe25fe32f91e99d36adb5383543e2 Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Thu, 3 Sep 2020 15:13:33 +0200 Subject: [PATCH 14/30] Simplify code --- .../public/application/angular/discover.js | 15 ----------- .../application/angular/discover_legacy.html | 10 ------- .../create_discover_legacy_directive.ts | 7 ----- .../components/discover.legacy.tsx | 26 +++++++++---------- 4 files changed, 13 insertions(+), 45 deletions(-) diff --git a/src/plugins/discover/public/application/angular/discover.js b/src/plugins/discover/public/application/angular/discover.js index 1e1a26fbf2cf6..747ae5472d26c 100644 --- a/src/plugins/discover/public/application/angular/discover.js +++ b/src/plugins/discover/public/application/angular/discover.js @@ -68,7 +68,6 @@ import { indexPatterns as indexPatternsUtils, connectToQueryState, syncQueryStateWithUrl, - search, } from '../../../../data/public'; import { getIndexPatternId } from '../helpers/get_index_pattern_id'; import { addFatalError } from '../../../../kibana_legacy/public'; @@ -305,17 +304,8 @@ function discoverController($element, $route, $scope, $timeout, $window, Promise mode: 'absolute', }); }; - $scope.intervalOptions = search.aggs.intervalOptions; $scope.minimumVisibleRows = 50; $scope.fetchStatus = fetchStatuses.UNINITIALIZED; - $scope.showSaveQuery = uiCapabilities.discover.saveQuery; - - $scope.$watch( - () => uiCapabilities.discover.saveQuery, - (newCapability) => { - $scope.showSaveQuery = newCapability; - } - ); let abortController; $scope.$on('$destroy', () => { @@ -511,8 +501,6 @@ function discoverController($element, $route, $scope, $timeout, $window, Promise ]); } - $scope.screenTitle = savedSearch.title; - const getFieldCounts = async () => { // the field counts aren't set until we have the data back, // so we wait for the fetch to be done before proceeding @@ -866,9 +854,6 @@ function discoverController($element, $route, $scope, $timeout, $window, Promise tabifiedData, getDimensions($scope.vis.data.aggs.aggs, $scope.timeRange) ); - if ($scope.vis.data.aggs.aggs[1]) { - $scope.bucketInterval = $scope.vis.data.aggs.aggs[1].buckets.getInterval(); - } $scope.updateTime(); } diff --git a/src/plugins/discover/public/application/angular/discover_legacy.html b/src/plugins/discover/public/application/angular/discover_legacy.html index 971476c01d2ca..73b458833ca2e 100644 --- a/src/plugins/discover/public/application/angular/discover_legacy.html +++ b/src/plugins/discover/public/application/angular/discover_legacy.html @@ -1,9 +1,6 @@
-

{screenTitle}

+

{savedSearch.title}

@@ -166,7 +166,7 @@ export function DiscoverLegacy({ Date: Thu, 3 Sep 2020 15:39:55 +0200 Subject: [PATCH 15/30] Fix types --- .../public/application/components/discover.legacy.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/discover/public/application/components/discover.legacy.tsx b/src/plugins/discover/public/application/components/discover.legacy.tsx index 0ab24a8d26911..8d8019d5d1f97 100644 --- a/src/plugins/discover/public/application/components/discover.legacy.tsx +++ b/src/plugins/discover/public/application/components/discover.legacy.tsx @@ -80,7 +80,7 @@ export function DiscoverLegacy({ const { savedSearch, indexPatternList } = opts; const bucketInterval = - vis && vis.data.aggs.aggs[1] ? $scope.vis.data.aggs.aggs[1].buckets.getInterval() : null; + vis && vis.data.aggs.aggs[1] ? vis.data.aggs.aggs[1].buckets.getInterval() : null; return ( @@ -94,9 +94,9 @@ export function DiscoverLegacy({ onSavedQueryIdChange={updateSavedQueryId} query={state.query} savedQueryId={state.savedQuery} - screenTitle={screenTitle} + screenTitle={savedSearch.title} showDatePicker={indexPattern.isTimeBased()} - showSaveQuery={uiCapabilities?.saveQuery} + showSaveQuery={!!uiCapabilities?.saveQuery} showSearchBar={true} useDefaultBehaviors={true} /> From 5caba4adf907c6531e303cf1441424b70285646f Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Fri, 4 Sep 2020 08:53:53 +0200 Subject: [PATCH 16/30] Fix savedSearches test --- src/plugins/discover/public/application/angular/discover.js | 2 ++ .../public/application/components/discover.legacy.tsx | 6 ++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/discover/public/application/angular/discover.js b/src/plugins/discover/public/application/angular/discover.js index 747ae5472d26c..48cdbb0b5946d 100644 --- a/src/plugins/discover/public/application/angular/discover.js +++ b/src/plugins/discover/public/application/angular/discover.js @@ -306,6 +306,8 @@ function discoverController($element, $route, $scope, $timeout, $window, Promise }; $scope.minimumVisibleRows = 50; $scope.fetchStatus = fetchStatuses.UNINITIALIZED; + $scope.showSaveQuery = uiCapabilities.discover.saveQuery; + console.log($scope.showSaveQuery); let abortController; $scope.$on('$destroy', () => { diff --git a/src/plugins/discover/public/application/components/discover.legacy.tsx b/src/plugins/discover/public/application/components/discover.legacy.tsx index 8d8019d5d1f97..177dce568f09a 100644 --- a/src/plugins/discover/public/application/components/discover.legacy.tsx +++ b/src/plugins/discover/public/application/components/discover.legacy.tsx @@ -34,7 +34,6 @@ import { DiscoverFetchError } from './fetch_error/fetch_error'; import { DocTableLegacy } from '../angular/doc_table/create_doc_table_react'; import { SkipBottomButton } from './skip_bottom_button'; import { search } from '../../../../data/public'; -import { useKibana } from '../../../../kibana_react/public'; export function DiscoverLegacy({ addColumn, @@ -59,6 +58,7 @@ export function DiscoverLegacy({ rows, searchSource, setIndexPattern, + showSaveQuery, state, timefilterUpdateHandler, timeRange, @@ -67,8 +67,6 @@ export function DiscoverLegacy({ updateQuery, updateSavedQueryId, }: any) { - const uiCapabilities = useKibana().services.application?.capabilities?.discover; - const [isSidebarClosed, setIsSidebarClosed] = useState(false); const toMoment = function (datetime: string) { if (!datetime) { @@ -96,7 +94,7 @@ export function DiscoverLegacy({ savedQueryId={state.savedQuery} screenTitle={savedSearch.title} showDatePicker={indexPattern.isTimeBased()} - showSaveQuery={!!uiCapabilities?.saveQuery} + showSaveQuery={showSaveQuery} showSearchBar={true} useDefaultBehaviors={true} /> From 0442073de19bbee81b425da991d2e78079c979f0 Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Fri, 4 Sep 2020 11:18:17 +0200 Subject: [PATCH 17/30] Fix showSaveQuery --- src/plugins/discover/public/application/angular/discover.js | 1 - .../application/components/create_discover_legacy_directive.ts | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/discover/public/application/angular/discover.js b/src/plugins/discover/public/application/angular/discover.js index 48cdbb0b5946d..ec4a0edd3e5b9 100644 --- a/src/plugins/discover/public/application/angular/discover.js +++ b/src/plugins/discover/public/application/angular/discover.js @@ -307,7 +307,6 @@ function discoverController($element, $route, $scope, $timeout, $window, Promise $scope.minimumVisibleRows = 50; $scope.fetchStatus = fetchStatuses.UNINITIALIZED; $scope.showSaveQuery = uiCapabilities.discover.saveQuery; - console.log($scope.showSaveQuery); let abortController; $scope.$on('$destroy', () => { diff --git a/src/plugins/discover/public/application/components/create_discover_legacy_directive.ts b/src/plugins/discover/public/application/components/create_discover_legacy_directive.ts index 5de5e17dc7815..de3b35074c80d 100644 --- a/src/plugins/discover/public/application/components/create_discover_legacy_directive.ts +++ b/src/plugins/discover/public/application/components/create_discover_legacy_directive.ts @@ -46,6 +46,7 @@ export function createDiscoverLegacyDirective(reactDirective: any) { ['setColumns', { watchDepth: 'reference' }], ['setIndexPattern', { watchDepth: 'reference' }], ['setSortOrder', { watchDepth: 'reference' }], + ['showSaveQuery', { watchDepth: 'reference' }], ['state', { watchDepth: 'reference' }], ['timefilterUpdateHandler', { watchDepth: 'reference' }], ['timeRange', { watchDepth: 'reference' }], From f10997fec64642df4294468b52c529f3d4be9441 Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Fri, 4 Sep 2020 14:12:11 +0200 Subject: [PATCH 18/30] Fix type and cleanup --- .../application/angular/discover_legacy.html | 11 +-- .../application/angular/discover_state.ts | 4 + .../doc_table/create_doc_table_react.tsx | 42 ++++++--- .../create_discover_legacy_directive.ts | 8 +- ...iscover.legacy.tsx => discover_legacy.tsx} | 94 ++++++++++++++----- .../components/fetch_error/fetch_error.tsx | 14 +-- .../components/sidebar/discover_sidebar.tsx | 8 +- .../components/sidebar/lib/get_details.ts | 5 +- .../lib/get_index_pattern_field_list.ts | 4 +- .../discover/public/saved_searches/types.ts | 1 + 10 files changed, 128 insertions(+), 63 deletions(-) rename src/plugins/discover/public/application/components/{discover.legacy.tsx => discover_legacy.tsx} (78%) diff --git a/src/plugins/discover/public/application/angular/discover_legacy.html b/src/plugins/discover/public/application/angular/discover_legacy.html index 73b458833ca2e..8582f71c0cb88 100644 --- a/src/plugins/discover/public/application/angular/discover_legacy.html +++ b/src/plugins/discover/public/application/angular/discover_legacy.html @@ -5,18 +5,17 @@ fetch-counter="fetchCounter" fetch-error="fetchError" field-counts="fieldCounts" - get-context-app-href="getContextAppHref" - hits="hits" histogram-data="histogramData" + hits="hits" index-pattern="indexPattern" minimum-visible-rows="minimumVisibleRows" - on-add-column="addColumn" on-add-filter="filterQuery" + on-move-column="moveColumn" on-change-interval="changeInterval" on-remove-column="removeColumn" on-set-columns="setColumns" - on-sort="setSortOrder" on-skip-bottom-button-click="onSkipBottomButtonClick" + on-sort="setSortOrder" opts="opts" reset-query="resetQuery" result-state="resultState" @@ -26,12 +25,12 @@ set-index-pattern="setIndexPattern" show-save-query="showSaveQuery" state="state" - time-range="timeRange" time-filter-update-handler="timefilterUpdateHandler" + time-range="timeRange" top-nav-menu="topNavMenu" - vis="vis" update-query="handleRefresh" update-saved-query-id="updateSavedQueryId" + vis="vis" > diff --git a/src/plugins/discover/public/application/angular/discover_state.ts b/src/plugins/discover/public/application/angular/discover_state.ts index ff8fb9f80a723..f14822df57933 100644 --- a/src/plugins/discover/public/application/angular/discover_state.ts +++ b/src/plugins/discover/public/application/angular/discover_state.ts @@ -55,6 +55,10 @@ export interface AppState { * Array of the used sorting [[field,direction],...] */ sort?: string[][]; + /** + * id of the used saved query + */ + savedQuery?: string; } interface GetStateParams { diff --git a/src/plugins/discover/public/application/angular/doc_table/create_doc_table_react.tsx b/src/plugins/discover/public/application/angular/doc_table/create_doc_table_react.tsx index 89cf2d0a37ce7..ad2b674af014c 100644 --- a/src/plugins/discover/public/application/angular/doc_table/create_doc_table_react.tsx +++ b/src/plugins/discover/public/application/angular/doc_table/create_doc_table_react.tsx @@ -19,7 +19,8 @@ import angular, { auto, ICompileService, IScope } from 'angular'; import { render } from 'react-dom'; import React, { useRef, useEffect } from 'react'; -import { getServices } from '../../../kibana_services'; +import { getServices, IIndexPattern } from '../../../kibana_services'; +import { IndexPatternField } from '../../../../../data/common/index_patterns'; export type AngularScope = IScope; export interface AngularDirective { @@ -67,7 +68,7 @@ export function convertDirectiveToRenderFn( let rejected = false; const cleanupFnPromise = injectAngularElement(domNode, directive.template, props, getInjector); - cleanupFnPromise.catch((e) => { + cleanupFnPromise.catch(() => { rejected = true; render(
error
, domNode); }); @@ -82,26 +83,41 @@ export function convertDirectiveToRenderFn( }; } -export function DocTableLegacy(renderProps: any) { +export interface DocTableLegacyProps { + columns: string[]; + searchDescription?: string; + searchTitle?: string; + onFilter: (field: IndexPatternField | string, value: string, type: '+' | '-') => void; + rows: Array>; + indexPattern: IIndexPattern; + minimumVisibleRows: number; + onAddColumn: (column: string) => void; + onSort: (sort: string[][]) => void; + onMoveColumn: (columns: string, newIdx: number) => void; + onRemoveColumn: (column: string) => void; + sort?: string[][]; +} + +export function DocTableLegacy(renderProps: DocTableLegacyProps) { const renderFn = convertDirectiveToRenderFn( { template: ``, + on-move-column="onMoveColumn" + on-remove-column="onRemoveColumn" + render-complete + sorting="sort">`, }, () => getServices().getEmbeddableInjector() ); diff --git a/src/plugins/discover/public/application/components/create_discover_legacy_directive.ts b/src/plugins/discover/public/application/components/create_discover_legacy_directive.ts index de3b35074c80d..a3502cbb211fa 100644 --- a/src/plugins/discover/public/application/components/create_discover_legacy_directive.ts +++ b/src/plugins/discover/public/application/components/create_discover_legacy_directive.ts @@ -17,7 +17,7 @@ * under the License. */ -import { DiscoverLegacy } from './discover.legacy'; +import { DiscoverLegacy } from './discover_legacy'; export function createDiscoverLegacyDirective(reactDirective: any) { return reactDirective(DiscoverLegacy, [ @@ -26,26 +26,24 @@ export function createDiscoverLegacyDirective(reactDirective: any) { ['fetchCounter', { watchDepth: 'reference' }], ['fetchError', { watchDepth: 'reference' }], ['fieldCounts', { watchDepth: 'reference' }], - ['getContextAppHref', { watchDepth: 'reference' }], ['histogramData', { watchDepth: 'reference' }], ['hits', { watchDepth: 'reference' }], ['indexPattern', { watchDepth: 'reference' }], ['minimumVisibleRows', { watchDepth: 'reference' }], ['onAddFilter', { watchDepth: 'reference' }], ['onChangeInterval', { watchDepth: 'reference' }], + ['onMoveColumn', { watchDepth: 'reference' }], ['onRemoveColumn', { watchDepth: 'reference' }], ['onSetColumns', { watchDepth: 'reference' }], + ['onSkipBottomButtonClick', { watchDepth: 'reference' }], ['onSort', { watchDepth: 'reference' }], ['opts', { watchDepth: 'reference' }], - ['onSkipBottomButtonClick', { watchDepth: 'reference' }], ['resetQuery', { watchDepth: 'reference' }], ['resultState', { watchDepth: 'reference' }], ['rows', { watchDepth: 'reference' }], ['savedSearch', { watchDepth: 'reference' }], ['searchSource', { watchDepth: 'reference' }], - ['setColumns', { watchDepth: 'reference' }], ['setIndexPattern', { watchDepth: 'reference' }], - ['setSortOrder', { watchDepth: 'reference' }], ['showSaveQuery', { watchDepth: 'reference' }], ['state', { watchDepth: 'reference' }], ['timefilterUpdateHandler', { watchDepth: 'reference' }], diff --git a/src/plugins/discover/public/application/components/discover.legacy.tsx b/src/plugins/discover/public/application/components/discover_legacy.tsx similarity index 78% rename from src/plugins/discover/public/application/components/discover.legacy.tsx rename to src/plugins/discover/public/application/components/discover_legacy.tsx index 177dce568f09a..dc2bcb380a2e9 100644 --- a/src/plugins/discover/public/application/components/discover.legacy.tsx +++ b/src/plugins/discover/public/application/components/discover_legacy.tsx @@ -21,37 +21,91 @@ import moment from 'moment'; import { EuiButtonEmpty } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage, I18nProvider } from '@kbn/i18n/react'; +import { IUiSettingsClient } from 'kibana/public'; import { HitsCounter } from './hits_counter'; import { TimechartHeader } from './timechart_header'; import { DiscoverSidebar } from './sidebar'; -import { getServices } from '../../kibana_services'; +import { getServices, IIndexPattern } from '../../kibana_services'; // @ts-ignore import { DiscoverNoResults } from '../angular/directives/no_results'; import { DiscoverUninitialized } from '../angular/directives/uninitialized'; import { DiscoverHistogram } from '../angular/directives/histogram'; import { LoadingSpinner } from './loading_spinner/loading_spinner'; -import { DiscoverFetchError } from './fetch_error/fetch_error'; +import { DiscoverFetchError, FetchError } from './fetch_error/fetch_error'; import { DocTableLegacy } from '../angular/doc_table/create_doc_table_react'; import { SkipBottomButton } from './skip_bottom_button'; -import { search } from '../../../../data/public'; +import { + IndexPatternField, + search, + ISearchSource, + TimeRange, + Query, + IndexPatternAttributes, +} from '../../../../data/public'; +import { Chart } from '../angular/helpers/point_series'; +import { AppState } from '../angular/discover_state'; +import { SavedSearch } from '../../saved_searches'; + +import { SavedObject } from '../../../../../core/types'; +import { Vis } from '../../../../visualizations/public'; +import { TopNavMenuData } from '../../../../navigation/public'; + +export interface DiscoverLegacyProps { + addColumn: (column: string) => void; + fetch: () => void; + fetchCounter: number; + fetchError: FetchError; + fieldCounts: Record; + histogramData: Chart; + hits: number; + indexPattern: IIndexPattern; + minimumVisibleRows: number; + onAddFilter: (field: IndexPatternField | string, value: string, type: '+' | '-') => void; + onChangeInterval: (interval: string) => void; + onMoveColumn: (columns: string, newIdx: number) => void; + onRemoveColumn: (column: string) => void; + onSetColumns: (columns: string[]) => void; + onSkipBottomButtonClick: () => void; + onSort: (sort: string[][]) => void; + opts: { + savedSearch: SavedSearch; + config: IUiSettingsClient; + indexPatternList: Array>; + timefield: string; + sampleSize: number; + }; + resetQuery: () => void; + resultState: string; + rows: Array>; + searchSource: ISearchSource; + setIndexPattern: (id: string) => void; + showSaveQuery: boolean; + state: AppState; + timefilterUpdateHandler: (ranges: { from: number; to: number }) => void; + timeRange?: { from: string; to: string }; + topNavMenu: TopNavMenuData[]; + updateQuery: (payload: { dateRange: TimeRange; query?: Query }, isUpdate?: boolean) => void; + updateSavedQueryId: (savedQueryId?: string) => void; + vis?: Vis; +} export function DiscoverLegacy({ addColumn, fetch, - fetchError, fetchCounter, + fetchError, fieldCounts, - getContextAppHref, histogramData, hits, indexPattern, minimumVisibleRows, onAddFilter, onChangeInterval, + onMoveColumn, onRemoveColumn, onSetColumns, - onSort, onSkipBottomButtonClick, + onSort, opts, resetQuery, resultState, @@ -63,10 +117,10 @@ export function DiscoverLegacy({ timefilterUpdateHandler, timeRange, topNavMenu, - vis, updateQuery, updateSavedQueryId, -}: any) { + vis, +}: DiscoverLegacyProps) { const [isSidebarClosed, setIsSidebarClosed] = useState(false); const toMoment = function (datetime: string) { if (!datetime) { @@ -76,9 +130,8 @@ export function DiscoverLegacy({ }; const { TopNavMenu } = getServices().navigation.ui; const { savedSearch, indexPatternList } = opts; - - const bucketInterval = - vis && vis.data.aggs.aggs[1] ? vis.data.aggs.aggs[1].buckets.getInterval() : null; + // @ts-ignore + const bucketInterval = vis?.data?.aggs?.aggs[5]?.buckets?.getInterval(); return ( @@ -109,7 +162,7 @@ export function DiscoverLegacy({ >
-
+
{resultState === 'none' && ( )} {resultState === 'uninitialized' && } - + {/* @TODO: Solved in the Angular way to satisfy functional test - should be improved*/} {fetchError && }
- {resultState === 'ready' && (
diff --git a/test/functional/page_objects/discover_page.ts b/test/functional/page_objects/discover_page.ts index 5a224d930ee42..7a99509257bf7 100644 --- a/test/functional/page_objects/discover_page.ts +++ b/test/functional/page_objects/discover_page.ts @@ -254,7 +254,7 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider } public async getSidebarWidth() { - const sidebar = await find.byCssSelector('.sidebar-list'); + const sidebar = await testSubjects.find('discover-sidebar'); return await sidebar.getAttribute('clientWidth'); } From ee43b9e4897dc128967a9f73fedeed182026eb80 Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Mon, 14 Sep 2020 14:42:06 +0200 Subject: [PATCH 26/30] Fix i18n --- x-pack/plugins/translations/translations/ja-JP.json | 4 ---- x-pack/plugins/translations/translations/zh-CN.json | 4 ---- 2 files changed, 8 deletions(-) diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 603723111c051..7c1f3d607b982 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -1432,10 +1432,7 @@ "discover.localMenu.saveTitle": "保存", "discover.localMenu.shareSearchDescription": "検索を共有します", "discover.localMenu.shareTitle": "共有", - "discover.noResults.addressShardFailuresTitle": "シャードエラーの解決", "discover.noResults.expandYourTimeRangeTitle": "時間範囲を拡大", - "discover.noResults.indexFailureIndexText": "インデックス {failureIndex}", - "discover.noResults.indexFailureShardText": "{index}、シャード {failureShard}", "discover.noResults.queryMayNotMatchTitle": "1つ以上の表示されているインデックスに日付フィールドが含まれています。クエリが現在の時間範囲のデータと一致しないか、現在選択された時間範囲にデータが全く存在しない可能性があります。データが存在する時間範囲に変えることができます。", "discover.noResults.searchExamples.400to499StatusCodeExampleTitle": "400-499のすべてのステータスコードを検索", "discover.noResults.searchExamples.400to499StatusCodeWithPhpExtensionExampleTitle": "400-499のphp拡張子のステータスコードを検索", @@ -1446,7 +1443,6 @@ "discover.noResults.searchExamples.queryStringSyntaxLinkText": "クエリ文字列の構文", "discover.noResults.searchExamples.refineYourQueryTitle": "クエリの調整", "discover.noResults.searchExamples.statusField200StatusCodeExampleTitle": "ステータスフィールドの200を検索", - "discover.noResults.shardFailuresDescription": "次のシャードエラーが発生しました。", "discover.notifications.invalidTimeRangeText": "指定された時間範囲が無効です。(開始:'{from}'、終了:'{to}')", "discover.notifications.invalidTimeRangeTitle": "無効な時間範囲", "discover.notifications.notSavedSearchTitle": "検索「{savedSearchTitle}」は保存されませんでした。", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index d7d3e63ffd8bc..91a8d29c60fbf 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -1433,10 +1433,7 @@ "discover.localMenu.saveTitle": "保存", "discover.localMenu.shareSearchDescription": "共享搜索", "discover.localMenu.shareTitle": "共享", - "discover.noResults.addressShardFailuresTitle": "解决分片错误", "discover.noResults.expandYourTimeRangeTitle": "展开时间范围", - "discover.noResults.indexFailureIndexText": "索引 {failureIndex}", - "discover.noResults.indexFailureShardText": "{index},分片 {failureShard}", "discover.noResults.queryMayNotMatchTitle": "您正在查看的一个或多个索引包含日期字段。您的查询在当前时间范围内可能不匹配任何数据,也可能在当前选定的时间范围内没有任何数据。您可以尝试将时间范围更改为包含数据的时间范围。", "discover.noResults.searchExamples.400to499StatusCodeExampleTitle": "查找所有介于 400-499 之间的状态代码", "discover.noResults.searchExamples.400to499StatusCodeWithPhpExtensionExampleTitle": "查找状态代码 400-499 以及扩展名 php", @@ -1447,7 +1444,6 @@ "discover.noResults.searchExamples.queryStringSyntaxLinkText": "查询字符串语法", "discover.noResults.searchExamples.refineYourQueryTitle": "优化您的查询", "discover.noResults.searchExamples.statusField200StatusCodeExampleTitle": "在状态字段中查找 200", - "discover.noResults.shardFailuresDescription": "发生了以下分片错误:", "discover.notifications.invalidTimeRangeText": "提供的时间范围无效。(起始:“{from}”,结束:“{to}”)", "discover.notifications.invalidTimeRangeTitle": "时间范围无效", "discover.notifications.notSavedSearchTitle": "搜索“{savedSearchTitle}”未保存。", From f7d6b4b32f04f343cda749480b91bb2a7373d007 Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Tue, 15 Sep 2020 13:40:54 +0200 Subject: [PATCH 27/30] Set aria-expanded of sidebar --- .../discover/public/application/components/discover_legacy.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/discover/public/application/components/discover_legacy.tsx b/src/plugins/discover/public/application/components/discover_legacy.tsx index b45bcbe23fe95..627fdb6b72c59 100644 --- a/src/plugins/discover/public/application/components/discover_legacy.tsx +++ b/src/plugins/discover/public/application/components/discover_legacy.tsx @@ -201,7 +201,7 @@ export function DiscoverLegacy({ onClick={() => setIsSidebarClosed(!isSidebarClosed)} data-test-subj="collapseSideBarButton" aria-controls="discover-sidebar" - aria-expanded="true" + aria-expanded={isSidebarClosed ? 'false' : 'true'} aria-label="Toggle sidebar" className="kuiCollapseButton kbnCollapsibleSidebar__collapseButton" > From b6a46bd37e1eefd6b5ddf904701d981e8673feb4 Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Wed, 16 Sep 2020 08:45:49 +0200 Subject: [PATCH 28/30] Address review comments --- .../public/application/_discover.scss | 11 +++++++--- .../_collapsible_sidebar.scss | 5 ++++- .../angular/directives/fixed_scroll.js | 2 +- .../angular/directives/fixed_scroll.test.js | 2 +- .../components/discover_legacy.tsx | 22 ++++++++----------- 5 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/plugins/discover/public/application/_discover.scss b/src/plugins/discover/public/application/_discover.scss index f814e6e9f4fe0..b52c38620a3fe 100644 --- a/src/plugins/discover/public/application/_discover.scss +++ b/src/plugins/discover/public/application/_discover.scss @@ -5,6 +5,11 @@ overflow: hidden; } +.dscAppContainer { + > * { + position: relative; + } +} discover-app { flex-grow: 1; } @@ -18,7 +23,7 @@ discover-app { // SASSTODO: replace the z-index value with a variable .dscWrapper { padding-right: $euiSizeS; - padding-left: 21px; + padding-left: 22px; z-index: 1; } @@ -104,11 +109,11 @@ discover-app { top: $euiSizeXS; } -.fixed-scroll { +.dscFixedScroll { overflow-x: auto; padding-bottom: 0; - + .fixed-scroll-scroller { + + .dscFixedScroll__scroller { position: fixed; bottom: 0; overflow-x: auto; diff --git a/src/plugins/discover/public/application/angular/directives/collapsible_sidebar/_collapsible_sidebar.scss b/src/plugins/discover/public/application/angular/directives/collapsible_sidebar/_collapsible_sidebar.scss index 68594cbe538cf..2dfaf0cdea88f 100644 --- a/src/plugins/discover/public/application/angular/directives/collapsible_sidebar/_collapsible_sidebar.scss +++ b/src/plugins/discover/public/application/angular/directives/collapsible_sidebar/_collapsible_sidebar.scss @@ -7,9 +7,12 @@ .kbnCollapsibleSidebar__collapseButton { position: absolute; top: 0; - right: -21px; + right: -20px; cursor: pointer; z-index: -1; + min-height: $euiSizeM; + min-width: $euiSizeM; + padding: $euiSizeXS * .5; } &.closed { diff --git a/src/plugins/discover/public/application/angular/directives/fixed_scroll.js b/src/plugins/discover/public/application/angular/directives/fixed_scroll.js index 1cb0271c5e27c..262710c7bf9e3 100644 --- a/src/plugins/discover/public/application/angular/directives/fixed_scroll.js +++ b/src/plugins/discover/public/application/angular/directives/fixed_scroll.js @@ -42,7 +42,7 @@ export function createFixedScroll($scope, $timeout) { return function (el) { const $el = typeof el.css === 'function' ? el : $(el); let $window = $(window); - let $scroller = $('
').height(SCROLLER_HEIGHT); + let $scroller = $('
').height(SCROLLER_HEIGHT); /** * Remove the listeners bound in listen() diff --git a/src/plugins/discover/public/application/angular/directives/fixed_scroll.test.js b/src/plugins/discover/public/application/angular/directives/fixed_scroll.test.js index 114f22d03ff0b..808eeaaeb5f7b 100644 --- a/src/plugins/discover/public/application/angular/directives/fixed_scroll.test.js +++ b/src/plugins/discover/public/application/angular/directives/fixed_scroll.test.js @@ -122,7 +122,7 @@ describe('FixedScroll directive', function () { return { $container: $el, $content: $content, - $scroller: $parent.find('.fixed-scroll-scroller'), + $scroller: $parent.find('.dscFixedScroll__scroller'), }; }; }); diff --git a/src/plugins/discover/public/application/components/discover_legacy.tsx b/src/plugins/discover/public/application/components/discover_legacy.tsx index 352183e8f1d29..dc120e66a0692 100644 --- a/src/plugins/discover/public/application/components/discover_legacy.tsx +++ b/src/plugins/discover/public/application/components/discover_legacy.tsx @@ -18,7 +18,7 @@ */ import React, { useState, useCallback, useEffect } from 'react'; import classNames from 'classnames'; -import { EuiButtonEmpty } from '@elastic/eui'; +import { EuiButtonEmpty, EuiButtonIcon } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage, I18nProvider } from '@kbn/i18n/react'; import { IUiSettingsClient, MountPoint } from 'kibana/public'; @@ -153,14 +153,9 @@ export function DiscoverLegacy({ 'col-md-12': isSidebarClosed, }); - const sidebarCloseIcon = classNames({ - 'fa-chevron-circle-right': isSidebarClosed, - 'fa-chevron-circle-left': !isSidebarClosed, - }); - return ( -
+

{savedSearch.title}

)} - + className="kbnCollapsibleSidebar__collapseButton" + />
{resultState === 'none' && ( @@ -264,7 +260,7 @@ export function DiscoverLegacy({
From e79be9538e32d6b9f886a22ce51c847afbbfb672 Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Wed, 16 Sep 2020 09:22:52 +0200 Subject: [PATCH 29/30] Further cleanup of SCSS --- .../public/application/_discover.scss | 39 ++++++++++++++- .../angular/directives/_index.scss | 1 - .../_collapsible_sidebar.scss | 47 ------------------- .../collapsible_sidebar/_depth.scss | 13 ----- .../collapsible_sidebar/_index.scss | 2 - .../angular/directives/fixed_scroll.js | 2 +- .../angular/directives/fixed_scroll.test.js | 2 +- .../components/discover_legacy.tsx | 6 +-- .../server/lib/layouts/preserve_layout.css | 2 +- .../reporting/server/lib/layouts/print.css | 2 +- 10 files changed, 44 insertions(+), 72 deletions(-) delete mode 100644 src/plugins/discover/public/application/angular/directives/collapsible_sidebar/_collapsible_sidebar.scss delete mode 100644 src/plugins/discover/public/application/angular/directives/collapsible_sidebar/_depth.scss delete mode 100644 src/plugins/discover/public/application/angular/directives/collapsible_sidebar/_index.scss diff --git a/src/plugins/discover/public/application/_discover.scss b/src/plugins/discover/public/application/_discover.scss index b52c38620a3fe..b1a62c5014b79 100644 --- a/src/plugins/discover/public/application/_discover.scss +++ b/src/plugins/discover/public/application/_discover.scss @@ -109,14 +109,49 @@ discover-app { top: $euiSizeXS; } -.dscFixedScroll { +.dscTableFixedScroll { overflow-x: auto; padding-bottom: 0; - + .dscFixedScroll__scroller { + + .dscTableFixedScroll__scroller { position: fixed; bottom: 0; overflow-x: auto; overflow-y: hidden; } } + +.dscCollapsibleSidebar { + position: relative; + z-index: $euiZLevel1; + + .dscCollapsibleSidebar__collapseButton { + position: absolute; + top: 0; + right: -20px; + cursor: pointer; + z-index: -1; + min-height: $euiSizeM; + min-width: $euiSizeM; + padding: $euiSizeXS * .5; + } + + &.closed { + width: 0 !important; + border-right-width: 0; + border-left-width: 0; + } +} + +@include euiBreakpoint('xs', 's', 'm') { + .dscCollapsibleSidebar { + &.closed { + display: none; + } + + .dscCollapsibleSidebar__collapseButton { + display: none; + } + } +} + diff --git a/src/plugins/discover/public/application/angular/directives/_index.scss b/src/plugins/discover/public/application/angular/directives/_index.scss index 2bfc74ffa0279..d4b365547b40c 100644 --- a/src/plugins/discover/public/application/angular/directives/_index.scss +++ b/src/plugins/discover/public/application/angular/directives/_index.scss @@ -1,3 +1,2 @@ @import 'no_results'; @import 'histogram'; -@import './collapsible_sidebar/index'; diff --git a/src/plugins/discover/public/application/angular/directives/collapsible_sidebar/_collapsible_sidebar.scss b/src/plugins/discover/public/application/angular/directives/collapsible_sidebar/_collapsible_sidebar.scss deleted file mode 100644 index 2dfaf0cdea88f..0000000000000 --- a/src/plugins/discover/public/application/angular/directives/collapsible_sidebar/_collapsible_sidebar.scss +++ /dev/null @@ -1,47 +0,0 @@ -// SASSTODO: Can't rename main class -// because it's also the name of the angular directive -.collapsible-sidebar { - position: relative; - z-index: $kbnDiscoverSidebarDepth; - - .kbnCollapsibleSidebar__collapseButton { - position: absolute; - top: 0; - right: -20px; - cursor: pointer; - z-index: -1; - min-height: $euiSizeM; - min-width: $euiSizeM; - padding: $euiSizeXS * .5; - } - - &.closed { - width: 0 !important; - border-right-width: 0; - border-left-width: 0; - - > * { - visibility: hidden; - } - - .kbnCollapsibleSidebar__collapseButton { - visibility: visible; - - .chevron-cont:before { - content: "\F138"; - } - } - } -} - -@include euiBreakpoint('xs', 's', 'm') { - .collapsible-sidebar { - &.closed { - display: none; - } - - .kbnCollapsibleSidebar__collapseButton { - display: none; - } - } -} diff --git a/src/plugins/discover/public/application/angular/directives/collapsible_sidebar/_depth.scss b/src/plugins/discover/public/application/angular/directives/collapsible_sidebar/_depth.scss deleted file mode 100644 index 4bc59001f9931..0000000000000 --- a/src/plugins/discover/public/application/angular/directives/collapsible_sidebar/_depth.scss +++ /dev/null @@ -1,13 +0,0 @@ -/** - * 1. The local nav contains tooltips which should pop over the filter bar. - * 2. The filter and local nav components should always appear above the dashboard grid items. - * 3. The filter and local nav components should always appear above the discover content. - * 4. The sidebar collapser button should appear above the main Discover content but below the top elements. - * 5. Dragged panels in dashboard should always appear above other panels. - */ -$kbnFilterBarDepth: 4; /* 1 */ -$kbnLocalNavDepth: 5; /* 1 */ -$kbnDashboardGridDepth: 1; /* 2 */ -$kbnDashboardDraggingGridDepth: 2; /* 5 */ -$kbnDiscoverWrapperDepth: 1; /* 3 */ -$kbnDiscoverSidebarDepth: 2; /* 4 */ diff --git a/src/plugins/discover/public/application/angular/directives/collapsible_sidebar/_index.scss b/src/plugins/discover/public/application/angular/directives/collapsible_sidebar/_index.scss deleted file mode 100644 index 1409920d11aa7..0000000000000 --- a/src/plugins/discover/public/application/angular/directives/collapsible_sidebar/_index.scss +++ /dev/null @@ -1,2 +0,0 @@ -@import 'depth'; -@import 'collapsible_sidebar'; diff --git a/src/plugins/discover/public/application/angular/directives/fixed_scroll.js b/src/plugins/discover/public/application/angular/directives/fixed_scroll.js index 262710c7bf9e3..e2d5f10a0faf7 100644 --- a/src/plugins/discover/public/application/angular/directives/fixed_scroll.js +++ b/src/plugins/discover/public/application/angular/directives/fixed_scroll.js @@ -42,7 +42,7 @@ export function createFixedScroll($scope, $timeout) { return function (el) { const $el = typeof el.css === 'function' ? el : $(el); let $window = $(window); - let $scroller = $('
').height(SCROLLER_HEIGHT); + let $scroller = $('
').height(SCROLLER_HEIGHT); /** * Remove the listeners bound in listen() diff --git a/src/plugins/discover/public/application/angular/directives/fixed_scroll.test.js b/src/plugins/discover/public/application/angular/directives/fixed_scroll.test.js index 808eeaaeb5f7b..e44bb45cf2431 100644 --- a/src/plugins/discover/public/application/angular/directives/fixed_scroll.test.js +++ b/src/plugins/discover/public/application/angular/directives/fixed_scroll.test.js @@ -122,7 +122,7 @@ describe('FixedScroll directive', function () { return { $container: $el, $content: $content, - $scroller: $parent.find('.dscFixedScroll__scroller'), + $scroller: $parent.find('.dscTableFixedScroll__scroller'), }; }; }); diff --git a/src/plugins/discover/public/application/components/discover_legacy.tsx b/src/plugins/discover/public/application/components/discover_legacy.tsx index dc120e66a0692..0e1f517ca331e 100644 --- a/src/plugins/discover/public/application/components/discover_legacy.tsx +++ b/src/plugins/discover/public/application/components/discover_legacy.tsx @@ -175,7 +175,7 @@ export function DiscoverLegacy({
@@ -203,7 +203,7 @@ export function DiscoverLegacy({ aria-controls="discover-sidebar" aria-expanded={isSidebarClosed ? 'false' : 'true'} aria-label="Toggle sidebar" - className="kbnCollapsibleSidebar__collapseButton" + className="dscCollapsibleSidebar__collapseButton" />
@@ -260,7 +260,7 @@ export function DiscoverLegacy({
diff --git a/x-pack/plugins/reporting/server/lib/layouts/preserve_layout.css b/x-pack/plugins/reporting/server/lib/layouts/preserve_layout.css index 12ac5b27c7a4a..35590df90fbb9 100644 --- a/x-pack/plugins/reporting/server/lib/layouts/preserve_layout.css +++ b/x-pack/plugins/reporting/server/lib/layouts/preserve_layout.css @@ -36,7 +36,7 @@ filter-bar, /* hide unusable controls */ discover-app .dscTimechart, discover-app .dscSidebar__container, -discover-app .kbnCollapsibleSidebar__collapseButton, +discover-app .dscCollapsibleSidebar__collapseButton, discover-app .discover-table-footer { display: none; } diff --git a/x-pack/plugins/reporting/server/lib/layouts/print.css b/x-pack/plugins/reporting/server/lib/layouts/print.css index 9b07e3c923138..3ff39974536d2 100644 --- a/x-pack/plugins/reporting/server/lib/layouts/print.css +++ b/x-pack/plugins/reporting/server/lib/layouts/print.css @@ -35,7 +35,7 @@ filter-bar, /* hide unusable controls */ discover-app .dscTimechart, discover-app .dscSidebar__container, -discover-app .kbnCollapsibleSidebar__collapseButton, +discover-app .dscCollapsibleSidebar__collapseButton, discover-app .discover-table-footer { display: none; } From 31cf12f804cf7f7d147919582f0973b325fb33f6 Mon Sep 17 00:00:00 2001 From: Andrea Del Rio Date: Wed, 16 Sep 2020 14:28:10 -0700 Subject: [PATCH 30/30] improve sidebar toggle --- .../discover/public/application/_discover.scss | 11 ++++++++--- .../public/application/components/discover_legacy.tsx | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/plugins/discover/public/application/_discover.scss b/src/plugins/discover/public/application/_discover.scss index b1a62c5014b79..bc704439d161b 100644 --- a/src/plugins/discover/public/application/_discover.scss +++ b/src/plugins/discover/public/application/_discover.scss @@ -22,9 +22,12 @@ discover-app { // SASSTODO: replace the z-index value with a variable .dscWrapper { + padding-left: $euiSizeXL; padding-right: $euiSizeS; - padding-left: 22px; z-index: 1; + @include euiBreakpoint('xs', 's', 'm') { + padding-left: $euiSizeS; + } } @include euiPanel('.dscWrapper__content'); @@ -128,7 +131,7 @@ discover-app { .dscCollapsibleSidebar__collapseButton { position: absolute; top: 0; - right: -20px; + right: -$euiSizeXL + 4; cursor: pointer; z-index: -1; min-height: $euiSizeM; @@ -140,6 +143,9 @@ discover-app { width: 0 !important; border-right-width: 0; border-left-width: 0; + .dscCollapsibleSidebar__collapseButton { + right: -$euiSizeL + 4; + } } } @@ -154,4 +160,3 @@ discover-app { } } } - diff --git a/src/plugins/discover/public/application/components/discover_legacy.tsx b/src/plugins/discover/public/application/components/discover_legacy.tsx index 0e1f517ca331e..1a98843649259 100644 --- a/src/plugins/discover/public/application/components/discover_legacy.tsx +++ b/src/plugins/discover/public/application/components/discover_legacy.tsx @@ -195,8 +195,8 @@ export function DiscoverLegacy({
)} setIsSidebarClosed(!isSidebarClosed)} data-test-subj="collapseSideBarButton"