{dataProviderGroups.map((group, groupIndex) => (
-
-
-
-
-
-
-
- {'('}
-
-
-
- {(droppableProvided) => (
-
- {group.map((dataProvider, index) => (
-
- {(provided, snapshot) => (
-
-
-
- 0 ? dataProvider.id : undefined}
- browserFields={browserFields}
- deleteProvider={() =>
- index > 0
- ? onDataProviderRemoved(group[0].id, dataProvider.id)
- : onDataProviderRemoved(dataProvider.id)
- }
- field={
- index > 0
- ? dataProvider.queryMatch.displayField ??
- dataProvider.queryMatch.field
- : group[0].queryMatch.displayField ??
- group[0].queryMatch.field
- }
- kqlQuery={index > 0 ? dataProvider.kqlQuery : group[0].kqlQuery}
- isEnabled={index > 0 ? dataProvider.enabled : group[0].enabled}
- isExcluded={index > 0 ? dataProvider.excluded : group[0].excluded}
- onDataProviderEdited={onDataProviderEdited}
- operator={
- index > 0
- ? dataProvider.queryMatch.operator ?? IS_OPERATOR
- : group[0].queryMatch.operator ?? IS_OPERATOR
- }
- register={dataProvider}
- providerId={index > 0 ? group[0].id : dataProvider.id}
- timelineId={id}
- toggleEnabledProvider={() =>
- index > 0
- ? onToggleDataProviderEnabled({
- providerId: group[0].id,
- enabled: !dataProvider.enabled,
- andProviderId: dataProvider.id,
- })
- : onToggleDataProviderEnabled({
- providerId: dataProvider.id,
- enabled: !dataProvider.enabled,
- })
- }
- toggleExcludedProvider={() =>
- index > 0
- ? onToggleDataProviderExcluded({
- providerId: group[0].id,
- excluded: !dataProvider.excluded,
- andProviderId: dataProvider.id,
- })
- : onToggleDataProviderExcluded({
- providerId: dataProvider.id,
- excluded: !dataProvider.excluded,
- })
- }
- val={
- dataProvider.queryMatch.displayValue ??
- dataProvider.queryMatch.value
- }
- />
-
-
- {!snapshot.isDragging &&
- (index < group.length - 1 ? (
-
- ) : (
-
-
-
- ))}
-
-
-
- )}
-
- ))}
- {droppableProvided.placeholder}
-
+
+ {groupIndex !== 0 && }
+
+
+
+ {groupIndex === 0 ? (
+
+
+
+ ) : (
+
+
+
)}
-
-
-
- {')'}
-
-
+
+
+ {'('}
+
+
+
+ {(droppableProvided) => (
+
+ {group.map((dataProvider, index) => (
+
+ {(provided, snapshot) => (
+
+
+
+ 0 ? dataProvider.id : undefined}
+ browserFields={browserFields}
+ deleteProvider={() =>
+ index > 0
+ ? onDataProviderRemoved(group[0].id, dataProvider.id)
+ : onDataProviderRemoved(dataProvider.id)
+ }
+ field={
+ index > 0
+ ? dataProvider.queryMatch.displayField ??
+ dataProvider.queryMatch.field
+ : group[0].queryMatch.displayField ??
+ group[0].queryMatch.field
+ }
+ kqlQuery={index > 0 ? dataProvider.kqlQuery : group[0].kqlQuery}
+ isEnabled={index > 0 ? dataProvider.enabled : group[0].enabled}
+ isExcluded={
+ index > 0 ? dataProvider.excluded : group[0].excluded
+ }
+ onDataProviderEdited={onDataProviderEdited}
+ operator={
+ index > 0
+ ? dataProvider.queryMatch.operator ?? IS_OPERATOR
+ : group[0].queryMatch.operator ?? IS_OPERATOR
+ }
+ register={dataProvider}
+ providerId={index > 0 ? group[0].id : dataProvider.id}
+ timelineId={timelineId}
+ toggleEnabledProvider={() =>
+ index > 0
+ ? onToggleDataProviderEnabled({
+ providerId: group[0].id,
+ enabled: !dataProvider.enabled,
+ andProviderId: dataProvider.id,
+ })
+ : onToggleDataProviderEnabled({
+ providerId: dataProvider.id,
+ enabled: !dataProvider.enabled,
+ })
+ }
+ toggleExcludedProvider={() =>
+ index > 0
+ ? onToggleDataProviderExcluded({
+ providerId: group[0].id,
+ excluded: !dataProvider.excluded,
+ andProviderId: dataProvider.id,
+ })
+ : onToggleDataProviderExcluded({
+ providerId: dataProvider.id,
+ excluded: !dataProvider.excluded,
+ })
+ }
+ toggleTypeProvider={() =>
+ index > 0
+ ? onToggleDataProviderType({
+ providerId: group[0].id,
+ type:
+ dataProvider.type === DataProviderType.template
+ ? DataProviderType.default
+ : DataProviderType.template,
+ andProviderId: dataProvider.id,
+ })
+ : onToggleDataProviderType({
+ providerId: dataProvider.id,
+ type:
+ dataProvider.type === DataProviderType.template
+ ? DataProviderType.default
+ : DataProviderType.template,
+ })
+ }
+ val={getDataProviderValue(dataProvider)}
+ type={dataProvider.type}
+ />
+
+
+ {!snapshot.isDragging &&
+ (index < group.length - 1 ? (
+
+ ) : (
+
+
+
+ ))}
+
+
+
+ )}
+
+ ))}
+ {droppableProvided.placeholder}
+
+ )}
+
+
+
+ {')'}
+
+
+
))}
);
diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/translations.ts b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/translations.ts
index 104ff44cb9b7c..48f1f4e2218d2 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/translations.ts
+++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/data_providers/translations.ts
@@ -72,6 +72,20 @@ export const FILTER_FOR_FIELD_PRESENT = i18n.translate(
}
);
+export const CONVERT_TO_FIELD = i18n.translate(
+ 'xpack.securitySolution.dataProviders.convertToFieldLabel',
+ {
+ defaultMessage: 'Convert to field',
+ }
+);
+
+export const CONVERT_TO_TEMPLATE_FIELD = i18n.translate(
+ 'xpack.securitySolution.dataProviders.convertToTemplateFieldLabel',
+ {
+ defaultMessage: 'Convert to template field',
+ }
+);
+
export const HIGHLIGHTED = i18n.translate('xpack.securitySolution.dataProviders.highlighted', {
defaultMessage: 'highlighted',
});
@@ -148,3 +162,24 @@ export const VALUE_ARIA_LABEL = i18n.translate(
defaultMessage: 'value',
}
);
+
+export const ADD_FIELD_LABEL = i18n.translate(
+ 'xpack.securitySolution.dataProviders.addFieldPopoverButtonLabel',
+ {
+ defaultMessage: 'Add field',
+ }
+);
+
+export const ADD_TEMPLATE_FIELD_LABEL = i18n.translate(
+ 'xpack.securitySolution.dataProviders.addTemplateFieldPopoverButtonLabel',
+ {
+ defaultMessage: 'Add template field',
+ }
+);
+
+export const TEMPLATE_FIELD_LABEL = i18n.translate(
+ 'xpack.securitySolution.dataProviders.templateFieldLabel',
+ {
+ defaultMessage: 'Template field',
+ }
+);
diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/events.ts b/x-pack/plugins/security_solution/public/timelines/components/timeline/events.ts
index 6c9a9b8b89679..4653880739c6d 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/timeline/events.ts
+++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/events.ts
@@ -7,7 +7,7 @@
import { ColumnHeaderOptions } from '../../../timelines/store/timeline/model';
import { ColumnId } from './body/column_id';
import { SortDirection } from './body/sort';
-import { QueryOperator } from './data_providers/data_provider';
+import { DataProvider, DataProviderType, QueryOperator } from './data_providers/data_provider';
/** Invoked when a user clicks the close button to remove a data provider */
export type OnDataProviderRemoved = (providerId: string, andProviderId?: string) => void;
@@ -26,6 +26,13 @@ export type OnToggleDataProviderExcluded = (excluded: {
andProviderId?: string;
}) => void;
+/** Invoked when a user toggles type (can "default" or "template") of a data provider */
+export type OnToggleDataProviderType = (type: {
+ providerId: string;
+ type: DataProviderType;
+ andProviderId?: string;
+}) => void;
+
/** Invoked when a user edits the properties of a data provider */
export type OnDataProviderEdited = ({
andProviderId,
@@ -35,6 +42,7 @@ export type OnDataProviderEdited = ({
operator,
providerId,
value,
+ type,
}: {
andProviderId?: string;
excluded: boolean;
@@ -43,6 +51,7 @@ export type OnDataProviderEdited = ({
operator: QueryOperator;
providerId: string;
value: string | number;
+ type: DataProvider['type'];
}) => void;
/** Invoked when a user change the kql query of our data provider */
diff --git a/x-pack/plugins/security_solution/public/timelines/components/timeline/header/__snapshots__/index.test.tsx.snap b/x-pack/plugins/security_solution/public/timelines/components/timeline/header/__snapshots__/index.test.tsx.snap
index b3b39236150ec..f94c30c5a102d 100644
--- a/x-pack/plugins/security_solution/public/timelines/components/timeline/header/__snapshots__/index.test.tsx.snap
+++ b/x-pack/plugins/security_solution/public/timelines/components/timeline/header/__snapshots__/index.test.tsx.snap
@@ -138,11 +138,12 @@ exports[`Header rendering renders correctly against snapshot 1`] = `
},
]
}
- id="foo"
onDataProviderEdited={[MockFunction]}
onDataProviderRemoved={[MockFunction]}
onToggleDataProviderEnabled={[MockFunction]}
onToggleDataProviderExcluded={[MockFunction]}
+ onToggleDataProviderType={[MockFunction]}
+ timelineId="foo"
/>