mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
# Backport This will backport the following commits from `main` to `8.6`: - [Fixes auto suggest in security solution (#145924)](https://github.com/elastic/kibana/pull/145924) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Steph Milovic","email":"stephanie.milovic@elastic.co"},"sourceCommit":{"committedDate":"2022-11-28T16:52:03Z","message":"Fixes auto suggest in security solution (#145924)","sha":"3a6825cf47e80dab9aeae373a1a93ab740e733eb","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team: SecuritySolution","Team:Security Solution Platform","v8.6.0","v8.7.0"],"number":145924,"url":"https://github.com/elastic/kibana/pull/145924","mergeCommit":{"message":"Fixes auto suggest in security solution (#145924)","sha":"3a6825cf47e80dab9aeae373a1a93ab740e733eb"}},"sourceBranch":"main","suggestedTargetBranches":["8.6"],"targetPullRequestStates":[{"branch":"8.6","label":"v8.6.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/145924","number":145924,"mergeCommit":{"message":"Fixes auto suggest in security solution (#145924)","sha":"3a6825cf47e80dab9aeae373a1a93ab740e733eb"}}]}] BACKPORT--> Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>
This commit is contained in:
parent
d00d67ddd0
commit
3dbe45667d
4 changed files with 38 additions and 8 deletions
|
@ -31,11 +31,7 @@ import { compact, debounce, isEmpty, isEqual, isFunction, partition } from 'loda
|
|||
import { CoreStart, DocLinksStart, Toast } from '@kbn/core/public';
|
||||
import type { Query } from '@kbn/es-query';
|
||||
import { DataPublicPluginStart, getQueryLog } from '@kbn/data-plugin/public';
|
||||
import {
|
||||
type DataView,
|
||||
DataView as KibanaDataView,
|
||||
DataViewsPublicPluginStart,
|
||||
} from '@kbn/data-views-plugin/public';
|
||||
import { type DataView, DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public';
|
||||
import type { PersistedLog } from '@kbn/data-plugin/public';
|
||||
import { getFieldSubtypeNested, KIBANA_USER_QUERY_LANGUAGE_KEY } from '@kbn/data-plugin/common';
|
||||
import { toMountPoint } from '@kbn/kibana-react-plugin/public';
|
||||
|
@ -188,7 +184,7 @@ export default class QueryStringInputUI extends PureComponent<QueryStringInputPr
|
|||
QueryStringInputProps['indexPatterns'][number],
|
||||
DataView
|
||||
>(this.props.indexPatterns || [], (indexPattern): indexPattern is DataView => {
|
||||
return indexPattern instanceof KibanaDataView;
|
||||
return indexPattern.hasOwnProperty('fields') && indexPattern.hasOwnProperty('title');
|
||||
});
|
||||
const idOrTitlePatterns = stringPatterns.map((sp) =>
|
||||
typeof sp === 'string' ? { type: 'title', value: sp } : sp
|
||||
|
|
|
@ -6,8 +6,17 @@
|
|||
*/
|
||||
|
||||
import { login, visit } from '../../tasks/login';
|
||||
import { openAddFilterPopover, fillAddFilterForm } from '../../tasks/search_bar';
|
||||
import { GLOBAL_SEARCH_BAR_FILTER_ITEM } from '../../screens/search_bar';
|
||||
import {
|
||||
openAddFilterPopover,
|
||||
fillAddFilterForm,
|
||||
openKqlQueryBar,
|
||||
fillKqlQueryBar,
|
||||
} from '../../tasks/search_bar';
|
||||
import {
|
||||
AUTO_SUGGEST_AGENT_NAME,
|
||||
AUTO_SUGGEST_HOST_NAME_VALUE,
|
||||
GLOBAL_SEARCH_BAR_FILTER_ITEM,
|
||||
} from '../../screens/search_bar';
|
||||
import { getHostIpFilter } from '../../objects/filter';
|
||||
|
||||
import { HOSTS_URL } from '../../urls/navigation';
|
||||
|
@ -29,4 +38,11 @@ describe('SearchBar', () => {
|
|||
`${getHostIpFilter().key}: ${getHostIpFilter().value}`
|
||||
);
|
||||
});
|
||||
|
||||
it('auto suggests fields from the data view and auto completes available field values', () => {
|
||||
openKqlQueryBar();
|
||||
cy.get(AUTO_SUGGEST_AGENT_NAME).should('be.visible');
|
||||
fillKqlQueryBar(`host.name:`);
|
||||
cy.get(AUTO_SUGGEST_HOST_NAME_VALUE).should('be.visible');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -32,3 +32,10 @@ export const GLOBAL_SEARCH_BAR_FILTER_ITEM = '#popoverFor_filter0';
|
|||
export const GLOBAL_SEARCH_BAR_FILTER_ITEM_AT = (value: number) => `#popoverFor_filter${value}`;
|
||||
|
||||
export const GLOBAL_SEARCH_BAR_PINNED_FILTER = '.globalFilterItem-isPinned';
|
||||
|
||||
export const GLOBAL_KQL_INPUT =
|
||||
'[data-test-subj="filters-global-container"] [data-test-subj="unifiedQueryInput"] textarea';
|
||||
|
||||
export const AUTO_SUGGEST_AGENT_NAME = `[data-test-subj="autocompleteSuggestion-field-agent.name-"]`;
|
||||
|
||||
export const AUTO_SUGGEST_HOST_NAME_VALUE = `[data-test-subj='autocompleteSuggestion-value-"siem-kibana"-']`;
|
||||
|
|
|
@ -16,6 +16,7 @@ import {
|
|||
ADD_FILTER_FORM_OPERATOR_FIELD,
|
||||
ADD_FILTER_FORM_FIELD_OPTION,
|
||||
ADD_FILTER_FORM_FILTER_VALUE_INPUT,
|
||||
GLOBAL_KQL_INPUT,
|
||||
} from '../screens/search_bar';
|
||||
|
||||
export const openAddFilterPopover = () => {
|
||||
|
@ -24,6 +25,16 @@ export const openAddFilterPopover = () => {
|
|||
cy.get(GLOBAL_SEARCH_BAR_ADD_FILTER).click();
|
||||
};
|
||||
|
||||
export const openKqlQueryBar = () => {
|
||||
cy.get(GLOBAL_KQL_INPUT).should('be.visible');
|
||||
cy.get(GLOBAL_KQL_INPUT).click();
|
||||
};
|
||||
|
||||
export const fillKqlQueryBar = (query: string) => {
|
||||
cy.get(GLOBAL_KQL_INPUT).should('be.visible');
|
||||
cy.get(GLOBAL_KQL_INPUT).type(query);
|
||||
};
|
||||
|
||||
export const fillAddFilterForm = ({ key, value, operator }: SearchBarFilter) => {
|
||||
cy.get(ADD_FILTER_FORM_FIELD_INPUT).should('exist');
|
||||
cy.get(ADD_FILTER_FORM_FIELD_INPUT).should('be.visible');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue