diff --git a/src/plugins/data/public/ui/filter_bar/filter_options.tsx b/src/plugins/data/public/ui/filter_bar/filter_options.tsx
index 3fb7f198d546..b97e0e33f240 100644
--- a/src/plugins/data/public/ui/filter_bar/filter_options.tsx
+++ b/src/plugins/data/public/ui/filter_bar/filter_options.tsx
@@ -167,6 +167,7 @@ class FilterOptionsUI extends Component
{
anchorPosition="rightUp"
panelPaddingSize="none"
withTitle
+ repositionOnScroll
>
setIsPopoverOpen(false)}
withTitle
+ repositionOnScroll
>
{i18n.translate('data.noDataPopover.content', {
defaultMessage:
- "This time range doesn't contain any data. Increase or adjust the time range to see more fields and create charts",
+ "This time range doesn't contain any data. Increase or adjust the time range to see more fields and create charts.",
})}
@@ -66,11 +66,13 @@ export function NoDataPopover({
step={1}
stepsTotal={1}
isStepOpen={noDataPopoverVisible}
- subtitle={i18n.translate('data.noDataPopover.title', { defaultMessage: 'Tip' })}
- title=""
+ subtitle={i18n.translate('data.noDataPopover.subtitle', { defaultMessage: 'Tip' })}
+ title={i18n.translate('data.noDataPopover.title', { defaultMessage: 'Empty dataset' })}
footerAction={
{
storage.set(NO_DATA_POPOVER_STORAGE_KEY, true);
diff --git a/src/plugins/data/public/ui/saved_query_management/saved_query_management_component.tsx b/src/plugins/data/public/ui/saved_query_management/saved_query_management_component.tsx
index 6108de028018..8582f4a12fa3 100644
--- a/src/plugins/data/public/ui/saved_query_management/saved_query_management_component.tsx
+++ b/src/plugins/data/public/ui/saved_query_management/saved_query_management_component.tsx
@@ -33,7 +33,7 @@ import {
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
-import React, { useEffect, useState, Fragment, useRef } from 'react';
+import React, { useCallback, useEffect, useState, Fragment, useRef } from 'react';
import { sortBy } from 'lodash';
import { SavedQuery, SavedQueryService } from '../..';
import { SavedQueryListItem } from './saved_query_list_item';
@@ -88,9 +88,51 @@ export function SavedQueryManagementComponent({
}
}, [isOpen, activePage, savedQueryService]);
- const goToPage = (pageNumber: number) => {
- setActivePage(pageNumber);
- };
+ const handleTogglePopover = useCallback(() => setIsOpen((currentState) => !currentState), [
+ setIsOpen,
+ ]);
+
+ const handleClosePopover = useCallback(() => setIsOpen(false), []);
+
+ const handleSave = useCallback(() => {
+ handleClosePopover();
+ onSave();
+ }, [handleClosePopover, onSave]);
+
+ const handleSaveAsNew = useCallback(() => {
+ handleClosePopover();
+ onSaveAsNew();
+ }, [handleClosePopover, onSaveAsNew]);
+
+ const handleSelect = useCallback(
+ (savedQueryToSelect) => {
+ handleClosePopover();
+ onLoad(savedQueryToSelect);
+ },
+ [handleClosePopover, onLoad]
+ );
+
+ const handleDelete = useCallback(
+ (savedQueryToDelete: SavedQuery) => {
+ const onDeleteSavedQuery = async (savedQuery: SavedQuery) => {
+ cancelPendingListingRequest.current();
+ setSavedQueries(
+ savedQueries.filter((currentSavedQuery) => currentSavedQuery.id !== savedQuery.id)
+ );
+
+ if (loadedSavedQuery && loadedSavedQuery.id === savedQuery.id) {
+ onClearSavedQuery();
+ }
+
+ await savedQueryService.deleteSavedQuery(savedQuery.id);
+ setActivePage(0);
+ };
+
+ onDeleteSavedQuery(savedQueryToDelete);
+ handleClosePopover();
+ },
+ [handleClosePopover, loadedSavedQuery, onClearSavedQuery, savedQueries, savedQueryService]
+ );
const savedQueryDescriptionText = i18n.translate(
'data.search.searchBar.savedQueryDescriptionText',
@@ -113,25 +155,13 @@ export function SavedQueryManagementComponent({
}
);
- const onDeleteSavedQuery = async (savedQuery: SavedQuery) => {
- cancelPendingListingRequest.current();
- setSavedQueries(
- savedQueries.filter((currentSavedQuery) => currentSavedQuery.id !== savedQuery.id)
- );
-
- if (loadedSavedQuery && loadedSavedQuery.id === savedQuery.id) {
- onClearSavedQuery();
- }
-
- await savedQueryService.deleteSavedQuery(savedQuery.id);
- setActivePage(0);
+ const goToPage = (pageNumber: number) => {
+ setActivePage(pageNumber);
};
const savedQueryPopoverButton = (
{
- setIsOpen(!isOpen);
- }}
+ onClick={handleTogglePopover}
aria-label={i18n.translate('data.search.searchBar.savedQueryPopoverButtonText', {
defaultMessage: 'See saved queries',
})}
@@ -159,11 +189,8 @@ export function SavedQueryManagementComponent({
key={savedQuery.id}
savedQuery={savedQuery}
isSelected={!!loadedSavedQuery && loadedSavedQuery.id === savedQuery.id}
- onSelect={(savedQueryToSelect) => {
- onLoad(savedQueryToSelect);
- setIsOpen(false);
- }}
- onDelete={(savedQueryToDelete) => onDeleteSavedQuery(savedQueryToDelete)}
+ onSelect={handleSelect}
+ onDelete={handleDelete}
showWriteOperations={!!showSaveQuery}
/>
));
@@ -175,13 +202,12 @@ export function SavedQueryManagementComponent({
id="savedQueryPopover"
button={savedQueryPopoverButton}
isOpen={isOpen}
- closePopover={() => {
- setIsOpen(false);
- }}
+ closePopover={handleClosePopover}
anchorPosition="downLeft"
panelPaddingSize="none"
buffer={-8}
ownFocus
+ repositionOnScroll
>
onSave()}
+ onClick={handleSave}
aria-label={i18n.translate(
'data.search.searchBar.savedQueryPopoverSaveChangesButtonAriaLabel',
{
@@ -255,7 +281,7 @@ export function SavedQueryManagementComponent({
onSaveAsNew()}
+ onClick={handleSaveAsNew}
aria-label={i18n.translate(
'data.search.searchBar.savedQueryPopoverSaveAsNewButtonAriaLabel',
{
@@ -279,7 +305,7 @@ export function SavedQueryManagementComponent({
onSave()}
+ onClick={handleSave}
aria-label={i18n.translate(
'data.search.searchBar.savedQueryPopoverSaveButtonAriaLabel',
{ defaultMessage: 'Save a new saved query' }
@@ -298,7 +324,7 @@ export function SavedQueryManagementComponent({
onClearSavedQuery()}
+ onClick={onClearSavedQuery}
aria-label={i18n.translate(
'data.search.searchBar.savedQueryPopoverClearButtonAriaLabel',
{ defaultMessage: 'Clear current saved query' }
diff --git a/src/plugins/data/public/ui/search_bar/create_search_bar.tsx b/src/plugins/data/public/ui/search_bar/create_search_bar.tsx
index a0df7604f23a..f8b7e4f48091 100644
--- a/src/plugins/data/public/ui/search_bar/create_search_bar.tsx
+++ b/src/plugins/data/public/ui/search_bar/create_search_bar.tsx
@@ -17,6 +17,7 @@
* under the License.
*/
+import _ from 'lodash';
import React, { useState, useEffect, useRef } from 'react';
import { CoreStart } from 'src/core/public';
import { IStorageWrapper } from 'src/plugins/kibana_utils/public';
diff --git a/src/plugins/data/server/index_patterns/fetcher/lib/field_capabilities/field_capabilities.ts b/src/plugins/data/server/index_patterns/fetcher/lib/field_capabilities/field_capabilities.ts
index 502364cdcba3..b4b86b73a5f4 100644
--- a/src/plugins/data/server/index_patterns/fetcher/lib/field_capabilities/field_capabilities.ts
+++ b/src/plugins/data/server/index_patterns/fetcher/lib/field_capabilities/field_capabilities.ts
@@ -17,7 +17,7 @@
* under the License.
*/
-import { defaults, indexBy, sortBy } from 'lodash';
+import { defaults, keyBy, sortBy } from 'lodash';
import { LegacyAPICaller } from 'kibana/server';
import { callFieldCapsApi } from '../es_api';
@@ -44,7 +44,7 @@ export async function getFieldCapabilities(
metaFields: string[] = []
) {
const esFieldCaps: FieldCapsResponse = await callFieldCapsApi(callCluster, indices);
- const fieldsFromFieldCapsByName = indexBy(readFieldCapsResponse(esFieldCaps), 'name');
+ const fieldsFromFieldCapsByName = keyBy(readFieldCapsResponse(esFieldCaps), 'name');
const allFieldsUnsorted = Object.keys(fieldsFromFieldCapsByName)
.filter((name) => !name.startsWith('_'))
diff --git a/src/plugins/data/server/index_patterns/fetcher/lib/resolve_time_pattern.ts b/src/plugins/data/server/index_patterns/fetcher/lib/resolve_time_pattern.ts
index a01d34dbe9df..2e408d7569be 100644
--- a/src/plugins/data/server/index_patterns/fetcher/lib/resolve_time_pattern.ts
+++ b/src/plugins/data/server/index_patterns/fetcher/lib/resolve_time_pattern.ts
@@ -46,7 +46,7 @@ export async function resolveTimePattern(callCluster: LegacyAPICaller, timePatte
[]
)
.sortBy((indexName: string) => indexName)
- .uniq(true)
+ .sortedUniq()
.map((indexName) => {
const parsed = moment(indexName, timePattern, true);
if (!parsed.isValid()) {
@@ -65,7 +65,7 @@ export async function resolveTimePattern(callCluster: LegacyAPICaller, timePatte
isMatch: indexName === parsed.format(timePattern),
};
})
- .sortByOrder(['valid', 'order'], ['desc', 'desc'])
+ .orderBy(['valid', 'order'], ['desc', 'desc'])
.value();
return {
diff --git a/src/plugins/data/server/saved_objects/index.ts b/src/plugins/data/server/saved_objects/index.ts
index 432620014117..102183fc1c5e 100644
--- a/src/plugins/data/server/saved_objects/index.ts
+++ b/src/plugins/data/server/saved_objects/index.ts
@@ -16,8 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
-export { searchSavedObjectType } from './search';
export { querySavedObjectType } from './query';
export { indexPatternSavedObjectType } from './index_patterns';
export { kqlTelemetry } from './kql_telementry';
diff --git a/src/plugins/data/server/saved_objects/index_pattern_migrations.ts b/src/plugins/data/server/saved_objects/index_pattern_migrations.ts
index 37819a13b651..768041a376ad 100644
--- a/src/plugins/data/server/saved_objects/index_pattern_migrations.ts
+++ b/src/plugins/data/server/saved_objects/index_pattern_migrations.ts
@@ -55,6 +55,6 @@ const migrateSubTypeAndParentFieldProperties: SavedObjectMigrationFn =
};
export const indexPatternSavedObjectTypeMigrations = {
- '6.5.0': flow(migrateAttributeTypeAndAttributeTypeMeta),
- '7.6.0': flow(migrateSubTypeAndParentFieldProperties),
+ '6.5.0': flow(migrateAttributeTypeAndAttributeTypeMeta),
+ '7.6.0': flow(migrateSubTypeAndParentFieldProperties),
};
diff --git a/src/plugins/data/server/saved_objects/index_patterns.ts b/src/plugins/data/server/saved_objects/index_patterns.ts
index 902cf2988f42..44d2813f6e3e 100644
--- a/src/plugins/data/server/saved_objects/index_patterns.ts
+++ b/src/plugins/data/server/saved_objects/index_patterns.ts
@@ -54,5 +54,5 @@ export const indexPatternSavedObjectType: SavedObjectsType = {
typeMeta: { type: 'keyword' },
},
},
- migrations: indexPatternSavedObjectTypeMigrations,
+ migrations: indexPatternSavedObjectTypeMigrations as any,
};
diff --git a/src/plugins/data/server/search/search_service.ts b/src/plugins/data/server/search/search_service.ts
index df809b425eb9..34ed8c6c6f40 100644
--- a/src/plugins/data/server/search/search_service.ts
+++ b/src/plugins/data/server/search/search_service.ts
@@ -27,7 +27,6 @@ import {
} from './types';
import { registerSearchRoute } from './routes';
import { ES_SEARCH_STRATEGY, esSearchStrategyProvider } from './es_search';
-import { searchSavedObjectType } from '../saved_objects';
import { DataPluginStart } from '../plugin';
export class SearchService implements Plugin {
@@ -36,8 +35,6 @@ export class SearchService implements Plugin {
constructor(private initializerContext: PluginInitializerContext) {}
public setup(core: CoreSetup