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 Solutions] Add tooltips #73436

Merged
merged 7 commits into from
Jul 29, 2020
Merged
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 @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { EuiButton, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { EuiButton, EuiFlexGroup, EuiFlexItem, EuiToolTip } from '@elastic/eui';
import React, { useCallback, useRef, useState } from 'react';
import { useHistory } from 'react-router-dom';

Expand Down Expand Up @@ -204,14 +204,16 @@ const RulesPageComponent: React.FC = () => {
</EuiFlexItem>
)}
<EuiFlexItem grow={false}>
<EuiButton
data-test-subj="open-value-lists-modal-button"
iconType="importAction"
isDisabled={userHasNoPermissions(canUserCRUD) || loading}
onClick={showValueListsModal}
>
{i18n.UPLOAD_VALUE_LISTS}
</EuiButton>
<EuiToolTip position="top" content={i18n.UPLOAD_VALUE_LISTS_TOOLTIP}>
<EuiButton
data-test-subj="open-value-lists-modal-button"
iconType="importAction"
isDisabled={userHasNoPermissions(canUserCRUD) || loading}
onClick={showValueListsModal}
>
{i18n.UPLOAD_VALUE_LISTS}
</EuiButton>
</EuiToolTip>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ export const UPLOAD_VALUE_LISTS = i18n.translate(
}
);

export const UPLOAD_VALUE_LISTS_TOOLTIP = i18n.translate(
'xpack.securitySolution.lists.detectionEngine.rules.uploadValueListsButtonTooltip',
{
defaultMessage:
'Use value lists to create an exception when a field value matches a value found in a list',
}
);

export const ADD_NEW_RULE = i18n.translate(
'xpack.securitySolution.detectionEngine.rules.addNewRuleTitle',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
EuiOverlayMask,
EuiToolTip,
} from '@elastic/eui';
import React, { useCallback } from 'react';
import React, { useCallback, useMemo } from 'react';
import uuid from 'uuid';
import styled from 'styled-components';
import { useDispatch, useSelector } from 'react-redux';
Expand Down Expand Up @@ -192,18 +192,28 @@ export const NewCase = React.memo<NewCaseProps>(
timelineTitle,
]);

return (
<EuiButtonEmpty
data-test-subj="attach-timeline-case"
color={compact ? undefined : 'text'}
iconSide="left"
iconType="paperClip"
disabled={timelineStatus === TimelineStatus.draft}
onClick={handleClick}
size={compact ? 'xs' : undefined}
>
{buttonText}
</EuiButtonEmpty>
const button = useMemo(
() => (
<EuiButtonEmpty
data-test-subj="attach-timeline-case"
color={compact ? undefined : 'text'}
iconSide="left"
iconType="paperClip"
disabled={timelineStatus === TimelineStatus.draft}
onClick={handleClick}
size={compact ? 'xs' : undefined}
>
{buttonText}
</EuiButtonEmpty>
),
[compact, timelineStatus, handleClick, buttonText]
);
return timelineStatus === TimelineStatus.draft ? (
<EuiToolTip position="left" content={i18n.ATTACH_TIMELINE_TO_CASE_TOOLTIP}>
{button}
</EuiToolTip>
) : (
button
);
}
);
Expand All @@ -225,8 +235,8 @@ export const ExistingCase = React.memo<ExistingCaseProps>(
? i18n.ATTACH_TO_EXISTING_CASE
: i18n.ATTACH_TIMELINE_TO_EXISTING_CASE;

return (
<>
const button = useMemo(
() => (
<EuiButtonEmpty
data-test-subj="attach-timeline-existing-case"
color={compact ? undefined : 'text'}
Expand All @@ -238,7 +248,15 @@ export const ExistingCase = React.memo<ExistingCaseProps>(
>
{buttonText}
</EuiButtonEmpty>
</>
),
[buttonText, handleClick, timelineStatus, compact]
);
return timelineStatus === TimelineStatus.draft ? (
<EuiToolTip position="left" content={i18n.ATTACH_TIMELINE_TO_CASE_TOOLTIP}>
{button}
</EuiToolTip>
) : (
button
);
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,13 @@ export const ATTACH_TO_EXISTING_CASE = i18n.translate(
}
);

export const ATTACH_TIMELINE_TO_CASE_TOOLTIP = i18n.translate(
'xpack.securitySolution.timeline.properties.attachTimelineToCaseTooltip',
{
defaultMessage: 'Please provide a title for your timeline in order to attach it to a case',
}
);

export const STREAM_LIVE = i18n.translate(
'xpack.securitySolution.timeline.properties.streamLiveButtonLabel',
{
Expand Down