Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix types #4

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,6 @@ export const allowedExperimentalValues = Object.freeze({
* Enables experimental Entity Analytics HTTP endpoints
*/
riskScoringRoutesEnabled: true,
/*
*
* Enables Discover embedded within timeline
*
* */
discoverInTimeline: true,

/**
* disables ES|QL rules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { createFilterAction } from '@kbn/unified-search-plugin/public';
import type { History } from 'history';
import type { SecurityAppStore } from '../../common/store';
import type { StartServices } from '../../types';
import { DiscoverInTimelineTrigger, DiscoverInTimelineAction } from '../constants';
import { EsqlInTimelineTrigger, EsqlInTimelineAction } from '../constants';

const createDiscoverHistogramCustomFilterAction = (
store: SecurityAppStore,
Expand All @@ -20,8 +20,8 @@ const createDiscoverHistogramCustomFilterAction = (
services.customDataService.query.filterManager,
services.customDataService.query.timefilter.timefilter,
services.theme,
DiscoverInTimelineAction.VIS_FILTER_ACTION,
DiscoverInTimelineAction.VIS_FILTER_ACTION
EsqlInTimelineAction.VIS_FILTER_ACTION,
EsqlInTimelineAction.VIS_FILTER_ACTION
);
services.uiActions.registerAction(histogramApplyFilter);

Expand All @@ -34,7 +34,7 @@ const createDiscoverHistogramCustomTrigger = (
services: StartServices
) => {
services.uiActions.registerTrigger({
id: DiscoverInTimelineTrigger.HISTOGRAM_TRIGGER,
id: EsqlInTimelineTrigger.HISTOGRAM_TRIGGER,
});
};

Expand All @@ -47,8 +47,5 @@ export const registerDiscoverHistogramActions = (

const histogramApplyFilter = createDiscoverHistogramCustomFilterAction(store, history, services);

services.uiActions.attachAction(
DiscoverInTimelineTrigger.HISTOGRAM_TRIGGER,
histogramApplyFilter.id
);
services.uiActions.attachAction(EsqlInTimelineTrigger.HISTOGRAM_TRIGGER, histogramApplyFilter.id);
};
2 changes: 1 addition & 1 deletion x-pack/plugins/security_solution/public/actions/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import type { CellAction, CellActionExecutionContext, CellActionFactory } from '@kbn/cell-actions';
import type { QueryOperator } from '../../common/types';
export { DiscoverInTimelineAction, DiscoverInTimelineTrigger } from './constants';
export { EsqlInTimelineTrigger, EsqlInTimelineAction } from './constants';
export interface AndFilter {
field: string;
value: string | string[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type { CustomizationCallback } from '@kbn/discover-plugin/public';
import type { UnifiedHistogramContainerProps } from '@kbn/unified-histogram-plugin/public';
import { ACTION_GLOBAL_APPLY_FILTER } from '@kbn/unified-search-plugin/public';
import { useCallback } from 'react';
import { DiscoverInTimelineTrigger } from '../../../../../actions/constants';
import { EsqlInTimelineTrigger } from '../../../../../actions/constants';
import { useKibana } from '../../../../../common/lib/kibana';

export type WithPreventableEvent<T> = T & {
Expand Down Expand Up @@ -67,9 +67,7 @@ export const useHistogramCustomization = () => {
}

if (filters && filters.length > 0) {
const applyFilterTrigger = uiActions.getTrigger(
DiscoverInTimelineTrigger.HISTOGRAM_TRIGGER
);
const applyFilterTrigger = uiActions.getTrigger(EsqlInTimelineTrigger.HISTOGRAM_TRIGGER);

await applyFilterTrigger.exec({
filters,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,16 @@
*/

import type { CustomizationCallback } from '@kbn/discover-plugin/public';
import { useIsExperimentalFeatureEnabled } from '../../../../../common/hooks/use_experimental_features';
import { useGetStatefulQueryBar } from '../use_get_stateful_query_bar';

export const useSearchBarCustomizations = () => {
const { CustomStatefulTopNavKqlQueryBar } = useGetStatefulQueryBar();
const isDiscoverInTimelineEnabled = useIsExperimentalFeatureEnabled('discoverInTimeline');

const setSearchBarCustomizations: CustomizationCallback = ({ customizations }) => {
customizations.set({
id: 'search_bar',
CustomSearchBar: CustomStatefulTopNavKqlQueryBar,
hideDataViewPicker: isDiscoverInTimelineEnabled,
hideDataViewPicker: true,
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { useDispatch } from 'react-redux';
import styled from 'styled-components';

import { FormattedMessage } from '@kbn/i18n-react';
import { useKibana } from '../../../../common/lib/kibana';
import { useAssistantTelemetry } from '../../../../assistant/use_assistant_telemetry';
import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features';
import { useConversationStore } from '../../../../assistant/use_conversation_store';
Expand Down Expand Up @@ -133,7 +134,7 @@ const ActiveTimelineTab = memo<ActiveTimelineTabProps>(
setConversationId,
showTimeline,
}) => {
const isEsqlInTimelineEnabled = useIsExperimentalFeatureEnabled('discoverInTimeline');
const isEsqlSettingEnabled = useKibana().services.configSettings.ESQLEnabled;
const { hasAssistantPrivilege } = useAssistantAvailability();
const getTab = useCallback(
(tab: TimelineTabs) => {
Expand Down Expand Up @@ -181,7 +182,7 @@ const ActiveTimelineTab = memo<ActiveTimelineTabProps>(
timelineId={timelineId}
/>
</HideShowContainer>
{isEsqlInTimelineEnabled && (
{isEsqlSettingEnabled && (
<HideShowContainer
$isVisible={TimelineTabs.esql === activeTimelineTab}
data-test-subj={`timeline-tab-content-${TimelineTabs.esql}`}
Expand Down Expand Up @@ -285,7 +286,7 @@ const TabsContentComponent: React.FC<BasicTimelineTab> = ({
sessionViewConfig,
timelineDescription,
}) => {
const isEsqlInTimelineEnabled = useIsExperimentalFeatureEnabled('discoverInTimeline');
const isEsqlSettingEnabled = useKibana().services.configSettings.ESQLEnabled;
const { hasAssistantPrivilege } = useAssistantAvailability();
const dispatch = useDispatch();
const getActiveTab = useMemo(() => getActiveTabSelector(), []);
Expand Down Expand Up @@ -399,7 +400,7 @@ const TabsContentComponent: React.FC<BasicTimelineTab> = ({
<span>{i18n.QUERY_TAB}</span>
{showTimeline && <TimelineEventsCountBadge />}
</StyledEuiTab>
{isEsqlInTimelineEnabled && (
{isEsqlSettingEnabled && (
<StyledEuiTab
data-test-subj={`timelineTabs-${TimelineTabs.esql}`}
onClick={setEsqlAsActiveTab}
Expand Down
1 change: 0 additions & 1 deletion x-pack/test/security_solution_cypress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) {
`--xpack.securitySolution.enableExperimental=${JSON.stringify([
'alertDetailsPageEnabled',
'chartEmbeddablesEnabled',
'discoverInTimeline',
])}`,
// mock cloud to enable the guided onboarding tour in e2e tests
'--xpack.cloud.id=test',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const TIMESTAMP_COLUMN_NAME = '@timestamp';
describe.skip(
`Discover Datagrid Cell Actions`,
{
env: { ftrConfig: { enableExperimental: ['discoverInTimeline'] } },
tags: ['@ess'],
},
() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ const DEFAULT_ESQL_QUERY =
describe(
'Discover State',
{
env: { ftrConfig: { enableExperimental: ['discoverInTimeline'] } },
tags: ['@ess'],
},
() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ const esqlQuery = 'from auditbeat-* | where ecs.version == "8.0.0"';
describe(
'Discover Timeline State Integration',
{
env: { ftrConfig: { enableExperimental: ['discoverInTimeline'] } },
tags: ['@ess', '@brokenInServerless'],
// ESQL and test involving STACK_MANAGEMENT_PAGE are broken in serverless
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ const esqlQuery = 'from auditbeat-* | where ecs.version == "8.0.0"';
describe(
'Basic discover search and filter operations',
{
env: { ftrConfig: { enableExperimental: ['discoverInTimeline'] } },
tags: ['@ess'],
},
() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ export const GET_TIMELINE_HEADER = (fieldName: string) => {
return `[data-test-subj="timeline"] [data-test-subj="header-text-${fieldName}"]`;
};

export const ESQL_TAB = getDataTestSubjectSelector('timelineTabs-discover');
export const ESQL_TAB = getDataTestSubjectSelector('timelineTabs-esql');

export const TIMELINE_DATE_PICKER_CONTAINER = getDataTestSubjectSelector(
'timeline-date-picker-container'
Expand Down