mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 10:23:14 -04:00
# Backport This will backport the following commits from `main` to `8.9`: - [[Event annotations] fix table list tag filtering (#161048)](https://github.com/elastic/kibana/pull/161048) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Drew Tate","email":"drew.tate@elastic.co"},"sourceCommit":{"committedDate":"2023-07-06T05:55:53Z","message":"[Event annotations] fix table list tag filtering (#161048)","sha":"569e873ffb1456e5c9c814c3d66023061365fd2d","branchLabelMapping":{"^v8.10.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Visualizations","release_note:skip","backport:prev-minor","v8.10.0"],"number":161048,"url":"https://github.com/elastic/kibana/pull/161048","mergeCommit":{"message":"[Event annotations] fix table list tag filtering (#161048)","sha":"569e873ffb1456e5c9c814c3d66023061365fd2d"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.10.0","labelRegex":"^v8.10.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/161048","number":161048,"mergeCommit":{"message":"[Event annotations] fix table list tag filtering (#161048)","sha":"569e873ffb1456e5c9c814c3d66023061365fd2d"}}]}] BACKPORT--> Co-authored-by: Drew Tate <drew.tate@elastic.co>
This commit is contained in:
parent
fc463b9627
commit
7f00cc9e31
5 changed files with 24 additions and 33 deletions
|
@ -108,8 +108,8 @@ describe('annotation list view', () => {
|
||||||
expect(mockEventAnnotationService.findAnnotationGroupContent).toHaveBeenCalledWith(
|
expect(mockEventAnnotationService.findAnnotationGroupContent).toHaveBeenCalledWith(
|
||||||
'My Search Query',
|
'My Search Query',
|
||||||
30,
|
30,
|
||||||
[{ id: 'first_id', type: 'sometype' }],
|
['first_id'],
|
||||||
[{ id: 'second_id', type: 'sometype' }]
|
['second_id']
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -95,8 +95,8 @@ export const EventAnnotationGroupTableList = ({
|
||||||
return eventAnnotationService.findAnnotationGroupContent(
|
return eventAnnotationService.findAnnotationGroupContent(
|
||||||
searchTerm,
|
searchTerm,
|
||||||
listingLimit, // TODO is this right?
|
listingLimit, // TODO is this right?
|
||||||
references,
|
references?.map(({ id }) => id),
|
||||||
referencesToExclude
|
referencesToExclude?.map(({ id }) => id)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
[eventAnnotationService, listingLimit]
|
[eventAnnotationService, listingLimit]
|
||||||
|
|
|
@ -514,7 +514,7 @@ describe('Event Annotation Service', () => {
|
||||||
const searchTerm = 'my search';
|
const searchTerm = 'my search';
|
||||||
|
|
||||||
const content = await eventAnnotationService.findAnnotationGroupContent(searchTerm, 20, [
|
const content = await eventAnnotationService.findAnnotationGroupContent(searchTerm, 20, [
|
||||||
{ type: 'mytype', id: '1234' },
|
'1234',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
expect(content).toMatchSnapshot();
|
expect(content).toMatchSnapshot();
|
||||||
|
@ -525,6 +525,13 @@ describe('Event Annotation Service', () => {
|
||||||
Object {
|
Object {
|
||||||
"contentTypeId": "event-annotation-group",
|
"contentTypeId": "event-annotation-group",
|
||||||
"query": Object {
|
"query": Object {
|
||||||
|
"limit": 20,
|
||||||
|
"tags": Object {
|
||||||
|
"excluded": undefined,
|
||||||
|
"included": Array [
|
||||||
|
"1234",
|
||||||
|
],
|
||||||
|
},
|
||||||
"text": "my search*",
|
"text": "my search*",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -10,22 +10,13 @@ import React from 'react';
|
||||||
import { partition } from 'lodash';
|
import { partition } from 'lodash';
|
||||||
import { queryToAst } from '@kbn/data-plugin/common';
|
import { queryToAst } from '@kbn/data-plugin/common';
|
||||||
import { ExpressionAstExpression } from '@kbn/expressions-plugin/common';
|
import { ExpressionAstExpression } from '@kbn/expressions-plugin/common';
|
||||||
import {
|
import type { CoreStart, SavedObjectReference } from '@kbn/core/public';
|
||||||
CoreStart,
|
|
||||||
SavedObjectReference,
|
|
||||||
SavedObjectsFindOptions,
|
|
||||||
SavedObjectsFindOptionsReference,
|
|
||||||
} from '@kbn/core/public';
|
|
||||||
import { SavedObjectsManagementPluginStart } from '@kbn/saved-objects-management-plugin/public';
|
import { SavedObjectsManagementPluginStart } from '@kbn/saved-objects-management-plugin/public';
|
||||||
import { DataViewPersistableStateService } from '@kbn/data-views-plugin/common';
|
import { DataViewPersistableStateService } from '@kbn/data-views-plugin/common';
|
||||||
import { ContentManagementPublicStart } from '@kbn/content-management-plugin/public';
|
import { ContentManagementPublicStart } from '@kbn/content-management-plugin/public';
|
||||||
import { defaultAnnotationLabel } from '../../common/manual_event_annotation';
|
import { defaultAnnotationLabel } from '../../common/manual_event_annotation';
|
||||||
import { EventAnnotationGroupContent } from '../../common/types';
|
import { EventAnnotationGroupContent } from '../../common/types';
|
||||||
import {
|
import { EventAnnotationConfig, EventAnnotationGroupConfig } from '../../common';
|
||||||
EventAnnotationConfig,
|
|
||||||
EventAnnotationGroupConfig,
|
|
||||||
EVENT_ANNOTATION_GROUP_TYPE,
|
|
||||||
} from '../../common';
|
|
||||||
import { EventAnnotationServiceType } from './types';
|
import { EventAnnotationServiceType } from './types';
|
||||||
import {
|
import {
|
||||||
defaultAnnotationColor,
|
defaultAnnotationColor,
|
||||||
|
@ -144,27 +135,21 @@ export function getEventAnnotationService(
|
||||||
const findAnnotationGroupContent = async (
|
const findAnnotationGroupContent = async (
|
||||||
searchTerm: string,
|
searchTerm: string,
|
||||||
pageSize: number,
|
pageSize: number,
|
||||||
references?: SavedObjectsFindOptionsReference[],
|
tagsToInclude?: string[],
|
||||||
referencesToExclude?: SavedObjectsFindOptionsReference[]
|
tagsToExclude?: string[]
|
||||||
): Promise<{ total: number; hits: EventAnnotationGroupContent[] }> => {
|
): Promise<{ total: number; hits: EventAnnotationGroupContent[] }> => {
|
||||||
const searchOptions: SavedObjectsFindOptions = {
|
|
||||||
type: [EVENT_ANNOTATION_GROUP_TYPE],
|
|
||||||
searchFields: ['title^3', 'description'],
|
|
||||||
search: searchTerm ? `${searchTerm}*` : undefined,
|
|
||||||
perPage: pageSize,
|
|
||||||
page: 1,
|
|
||||||
defaultSearchOperator: 'AND' as const,
|
|
||||||
hasReference: references,
|
|
||||||
hasNoReference: referencesToExclude,
|
|
||||||
};
|
|
||||||
|
|
||||||
const { pagination, hits } = await client.search<
|
const { pagination, hits } = await client.search<
|
||||||
EventAnnotationGroupSearchIn,
|
EventAnnotationGroupSearchIn,
|
||||||
EventAnnotationGroupSearchOut
|
EventAnnotationGroupSearchOut
|
||||||
>({
|
>({
|
||||||
contentTypeId: CONTENT_ID,
|
contentTypeId: CONTENT_ID,
|
||||||
query: {
|
query: {
|
||||||
text: searchOptions.search,
|
text: searchTerm ? `${searchTerm}*` : undefined,
|
||||||
|
limit: pageSize,
|
||||||
|
tags: {
|
||||||
|
included: tagsToInclude,
|
||||||
|
excluded: tagsToExclude,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ExpressionAstExpression } from '@kbn/expressions-plugin/common/ast';
|
import { ExpressionAstExpression } from '@kbn/expressions-plugin/common/ast';
|
||||||
import { SavedObjectsFindOptionsReference } from '@kbn/core-saved-objects-api-browser';
|
|
||||||
import type { SavedObjectCommon } from '@kbn/saved-objects-finder-plugin/common';
|
import type { SavedObjectCommon } from '@kbn/saved-objects-finder-plugin/common';
|
||||||
import { EventAnnotationGroupContent } from '../../common/types';
|
import { EventAnnotationGroupContent } from '../../common/types';
|
||||||
import { EventAnnotationConfig, EventAnnotationGroupConfig } from '../../common';
|
import { EventAnnotationConfig, EventAnnotationGroupConfig } from '../../common';
|
||||||
|
@ -18,8 +17,8 @@ export interface EventAnnotationServiceType {
|
||||||
findAnnotationGroupContent: (
|
findAnnotationGroupContent: (
|
||||||
searchTerm: string,
|
searchTerm: string,
|
||||||
pageSize: number,
|
pageSize: number,
|
||||||
references?: SavedObjectsFindOptionsReference[],
|
tagsToInclude?: string[],
|
||||||
referencesToExclude?: SavedObjectsFindOptionsReference[]
|
tagsToExclude?: string[]
|
||||||
) => Promise<{ total: number; hits: EventAnnotationGroupContent[] }>;
|
) => Promise<{ total: number; hits: EventAnnotationGroupContent[] }>;
|
||||||
deleteAnnotationGroups: (ids: string[]) => Promise<void>;
|
deleteAnnotationGroups: (ids: string[]) => Promise<void>;
|
||||||
createAnnotationGroup: (group: EventAnnotationGroupConfig) => Promise<{ id: string }>;
|
createAnnotationGroup: (group: EventAnnotationGroupConfig) => Promise<{ id: string }>;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue