Skip to content

Commit

Permalink
pr changes
Browse files Browse the repository at this point in the history
  • Loading branch information
stephmilovic committed Mar 30, 2020
1 parent 2defb05 commit 2b0fc0a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 17 deletions.
16 changes: 14 additions & 2 deletions x-pack/legacy/plugins/siem/public/containers/case/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,25 @@ export const DELETED_CASES = (totalCases: number, caseTitle?: string) =>
defaultMessage: 'Deleted {totalCases, plural, =1 {"{caseTitle}"} other {{totalCases} cases}}',
});

export const CLOSED_CASES = (totalCases: number, caseTitle?: string) =>
export const CLOSED_CASES = ({
totalCases,
caseTitle,
}: {
totalCases: number;
caseTitle?: string;
}) =>
i18n.translate('xpack.siem.containers.case.closedCases', {
values: { caseTitle, totalCases },
defaultMessage: 'Closed {totalCases, plural, =1 {"{caseTitle}"} other {{totalCases} cases}}',
});

export const REOPENED_CASES = (totalCases: number, caseTitle?: string) =>
export const REOPENED_CASES = ({
totalCases,
caseTitle,
}: {
totalCases: number;
caseTitle?: string;
}) =>
i18n.translate('xpack.siem.containers.case.reopenedCases', {
values: { caseTitle, totalCases },
defaultMessage: 'Reopened {totalCases, plural, =1 {"{caseTitle}"} other {{totalCases} cases}}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,16 @@ export const useUpdateCases = (): UseUpdateCase => {
const firstTitle = patchResponse[0].title;

dispatch({ type: 'FETCH_SUCCESS', payload: true });
if (resultCount && patchResponse[0].status === 'open') {
displaySuccessToast(
i18n.REOPENED_CASES(resultCount, resultCount === 1 ? firstTitle : ''),
dispatchToaster
);
} else {
displaySuccessToast(
i18n.CLOSED_CASES(resultCount, resultCount === 1 ? firstTitle : ''),
dispatchToaster
);
}
const messageArgs = {
totalCases: resultCount,
caseTitle: resultCount === 1 ? firstTitle : '',
};
const message =
resultCount && patchResponse[0].status === 'open'
? i18n.REOPENED_CASES(messageArgs)
: i18n.CLOSED_CASES(messageArgs);

displaySuccessToast(message, dispatchToaster);
}
} catch (error) {
if (!cancel) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ const MyFlexGroup = styled(EuiFlexGroup)`
const renderUsers = (
users: ElasticUser[],
handleSendEmail: (emailAddress: string | undefined | null) => void
) => {
return users.map(({ fullName, username, email }, key) => (
) =>
users.map(({ fullName, username, email }, key) => (
<MyFlexGroup key={key} justifyContent="spaceBetween">
<EuiFlexItem grow={false}>
<EuiFlexGroup gutterSize="xs">
Expand All @@ -66,12 +66,11 @@ const renderUsers = (
onClick={handleSendEmail.bind(null, email)}
iconType="email"
aria-label="email"
isDisabled={!email}
isDisabled={email == null}
/>
</EuiFlexItem>
</MyFlexGroup>
));
};

export const UserList = React.memo(({ email, headline, loading, users }: UserListProps) => {
const handleSendEmail = useCallback(
Expand Down

0 comments on commit 2b0fc0a

Please sign in to comment.