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

[Security Solution][Detections] fixes various timeline components issues #135907

Merged
merged 9 commits into from
Jul 13, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ interface QueryBarDefineRuleProps {
field: FieldHook;
idAria: string;
isDisabled: boolean;
placeholder?: string;
}

export const PickTimeline = ({
dataTestSubj,
field,
idAria,
isDisabled = false,
placeholder,
}: QueryBarDefineRuleProps) => {
const [timelineId, setTimelineId] = useState<string | null>(null);
const [timelineTitle, setTimelineTitle] = useState<string | null>(null);
Expand Down Expand Up @@ -70,6 +72,7 @@ export const PickTimeline = ({
timelineId={timelineId}
timelineTitle={timelineTitle}
onTimelineChange={handleOnTimelineChange}
placeholder={placeholder}
/>
</EuiFormRow>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ const TimelineTemplateFormComponent = (props: TimelineTemplateFormProps) => {
componentProps={{
idAria: 'bulkEditRulesTimelineTemplateSelector',
dataTestSubj: 'bulkEditRulesTimelineTemplateSelector',
placeholder: i18n.TEMPLATE_SELECTOR_PLACEHOLDER,
}}
/>
</BulkEditFormWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ export const bulkApplyTimelineTemplate = {
}
),

TEMPLATE_SELECTOR_PLACEHOLDER: i18n.translate(
'xpack.securitySolution.detectionEngine.rules.allRules.bulkActions.edit.applyTimelineTemplate.templateSelectorPlaceholder',
{
defaultMessage: 'Search Timeline template',
}
),

TEMPLATE_SELECTOR_DEFAULT_VALUE: i18n.translate(
'xpack.securitySolution.detectionEngine.rules.allRules.bulkActions.edit.applyTimelineTemplate.templateSelectorDefaultValue',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ const StyledEuiFieldText = styled(EuiFieldText)`

// To match EuiFieldText focus state
&:focus {
background-color: #fff;
background-color: ${({ theme }) => theme.eui.euiFormBackgroundColor};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏾

background-image: linear-gradient(
to top,
#006bb4,
#006bb4 2px,
${({ theme }) => theme.eui.euiFocusRingColor},
${({ theme }) => theme.eui.euiFocusRingColor} 2px,
transparent 2px,
transparent 100%
);
Expand All @@ -51,6 +51,7 @@ interface SearchTimelineSuperSelectProps {
timelineId: string | null;
timelineTitle: string | null;
timelineType?: TimelineTypeLiteral;
placeholder?: string;
onTimelineChange: (timelineTitle: string, timelineId: string | null) => void;
}

Expand All @@ -72,6 +73,7 @@ const SearchTimelineSuperSelectComponent: React.FC<SearchTimelineSuperSelectProp
timelineTitle,
timelineType = TimelineType.template,
onTimelineChange,
placeholder,
}) => {
const [isPopoverOpen, setIsPopoverOpen] = useState(false);

Expand All @@ -89,6 +91,7 @@ const SearchTimelineSuperSelectComponent: React.FC<SearchTimelineSuperSelectProp
readOnly
disabled={isDisabled}
onFocus={handleOpenPopover}
onClick={handleOpenPopover}
value={timelineTitle ?? i18n.DEFAULT_TIMELINE_TITLE}
icon="arrowDown"
/>
Expand Down Expand Up @@ -134,6 +137,7 @@ const SearchTimelineSuperSelectComponent: React.FC<SearchTimelineSuperSelectProp
onClosePopover={handleClosePopover}
onTimelineChange={onTimelineChange}
timelineType={timelineType}
placeholder={placeholder}
/>
</EuiInputPopover>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export interface SelectableTimelineProps {
graphEventId?: string
) => void;
timelineType: TimelineTypeLiteral;
placeholder?: string;
}

const SelectableTimelineComponent: React.FC<SelectableTimelineProps> = ({
Expand All @@ -87,6 +88,7 @@ const SelectableTimelineComponent: React.FC<SelectableTimelineProps> = ({
onClosePopover,
onTimelineChange,
timelineType,
placeholder,
}) => {
const [pageSize, setPageSize] = useState(ORIGINAL_PAGE_SIZE);
const [heightTrigger, setHeightTrigger] = useState(0);
Expand Down Expand Up @@ -152,7 +154,7 @@ const SelectableTimelineComponent: React.FC<SelectableTimelineProps> = ({
<EuiIcon type={`${option.checked === 'on' ? 'check' : 'empty'}`} color="primary" />
</EuiFlexItem>
<TimelineContentItem grow={true}>
<EuiFlexGroup gutterSize="none" direction="column">
<EuiFlexGroup gutterSize="none" direction="column" responsive={false}>
<EuiFlexItem data-test-subj="timeline">
<EuiToolTip content={title} anchorClassName="eui-textTruncate eui-alignMiddle">
<EuiHighlight search={searchValue}>{title}</EuiHighlight>
Expand Down Expand Up @@ -210,9 +212,9 @@ const SelectableTimelineComponent: React.FC<SelectableTimelineProps> = ({
const searchProps: EuiSelectableProps['searchProps'] = useMemo(
() => ({
'data-test-subj': 'timeline-super-select-search-box',
placeholder: i18n.SEARCH_BOX_TIMELINE_PLACEHOLDER(timelineType),
placeholder: placeholder ?? i18n.SEARCH_BOX_TIMELINE_PLACEHOLDER(timelineType),
onSearch: onSearchTimeline,
incremental: true,
incremental: false,
append: (
<StyledEuiFilterButton
data-test-subj="only-favorites-toggle"
Expand All @@ -223,7 +225,7 @@ const SelectableTimelineComponent: React.FC<SelectableTimelineProps> = ({
</StyledEuiFilterButton>
),
}),
[handleOnToggleOnlyFavorites, onSearchTimeline, onlyFavorites, timelineType]
[handleOnToggleOnlyFavorites, onSearchTimeline, onlyFavorites, timelineType, placeholder]
);

const listProps: EuiSelectableProps['listProps'] = useMemo(
Expand Down