mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Security Solution][Endpoint] Add message to get-file
Download link to remind user of file cleanup/deletion (#144924)
## Summary - Adds a message, to the Download link displayed after successfully retrieving a file from the host via `get-file`, that files are periodically cleaned up.
This commit is contained in:
parent
9579a79c18
commit
0e86637015
4 changed files with 45 additions and 35 deletions
|
@ -156,7 +156,7 @@ describe('When using get-file action from response actions console', () => {
|
|||
|
||||
await waitFor(() => {
|
||||
expect(renderResult.getByTestId('getFileSuccess').textContent).toEqual(
|
||||
'File retrieved from the host.Click here to download(ZIP file passcode: elastic)'
|
||||
'File retrieved from the host.Click here to download(ZIP file passcode: elastic).Files are periodically deleted to clear storage space. Download and save file locally if needed.'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -464,7 +464,7 @@ describe('Response actions history', () => {
|
|||
const downloadLink = getByTestId(`${testPrefix}-getFileDownloadLink`);
|
||||
expect(downloadLink).toBeTruthy();
|
||||
expect(downloadLink.textContent).toEqual(
|
||||
'Click here to download(ZIP file passcode: elastic)'
|
||||
'Click here to download(ZIP file passcode: elastic).Files are periodically deleted to clear storage space. Download and save file locally if needed.'
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
@ -66,6 +66,9 @@ describe('When using the `ResponseActionFileDownloadLink` component', () => {
|
|||
expect(renderResult.getByTestId('test-passcodeMessage')).toHaveTextContent(
|
||||
'(ZIP file passcode: elastic)'
|
||||
);
|
||||
expect(renderResult.getByTestId('test-fileDeleteMessage')).toHaveTextContent(
|
||||
'Files are periodically deleted to clear storage space. Download and save file locally if needed.'
|
||||
);
|
||||
});
|
||||
|
||||
it('should display custom button label', async () => {
|
||||
|
|
|
@ -6,15 +6,10 @@
|
|||
*/
|
||||
|
||||
import React, { memo, useMemo, type CSSProperties } from 'react';
|
||||
import {
|
||||
EuiFlexGroup,
|
||||
EuiFlexItem,
|
||||
EuiButtonEmpty,
|
||||
EuiLoadingContent,
|
||||
EuiText,
|
||||
} from '@elastic/eui';
|
||||
import { EuiButtonEmpty, EuiLoadingContent, EuiText } from '@elastic/eui';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import styled from 'styled-components';
|
||||
import { resolvePathVariables } from '../../../common/utils/resolve_path_variables';
|
||||
import { FormattedError } from '../formatted_error';
|
||||
import { useGetFileInfo } from '../../hooks/response_actions/use_get_file_info';
|
||||
|
@ -38,6 +33,12 @@ export const FILE_NO_LONGER_AVAILABLE_MESSAGE = i18n.translate(
|
|||
{ defaultMessage: 'File has expired and is no longer available for download.' }
|
||||
);
|
||||
|
||||
const FileDownloadLinkContainer = styled.div`
|
||||
& > * {
|
||||
vertical-align: middle;
|
||||
}
|
||||
`;
|
||||
|
||||
export interface ResponseActionFileDownloadLinkProps {
|
||||
action: MaybeImmutable<ActionDetails>;
|
||||
/** If left undefined, the first agent that the action was sent to will be used */
|
||||
|
@ -103,32 +104,38 @@ export const ResponseActionFileDownloadLink = memo<ResponseActionFileDownloadLin
|
|||
}
|
||||
|
||||
return (
|
||||
<EuiFlexGroup alignItems="center" gutterSize="none" data-test-subj={dataTestSubj}>
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiButtonEmpty
|
||||
href={downloadUrl}
|
||||
iconType="download"
|
||||
data-test-subj={getTestId('downloadButton')}
|
||||
flush="left"
|
||||
style={STYLE_INHERIT_FONT_FAMILY}
|
||||
download
|
||||
size={textSize}
|
||||
>
|
||||
<EuiText size={textSize}>{buttonTitle}</EuiText>
|
||||
</EuiButtonEmpty>
|
||||
</EuiFlexItem>
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiText size={textSize} data-test-subj={getTestId('passcodeMessage')}>
|
||||
<FormattedMessage
|
||||
id="xpack.securitySolution.responseActionFileDownloadLink.passcodeInfo"
|
||||
defaultMessage="(ZIP file passcode: {passcode})"
|
||||
values={{
|
||||
passcode: 'elastic',
|
||||
}}
|
||||
/>
|
||||
</EuiText>
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
<FileDownloadLinkContainer data-test-subj={dataTestSubj}>
|
||||
<EuiButtonEmpty
|
||||
href={downloadUrl}
|
||||
iconType="download"
|
||||
data-test-subj={getTestId('downloadButton')}
|
||||
flush="left"
|
||||
style={STYLE_INHERIT_FONT_FAMILY}
|
||||
iconSize="s"
|
||||
download
|
||||
>
|
||||
<EuiText size={textSize}>{buttonTitle}</EuiText>
|
||||
</EuiButtonEmpty>
|
||||
<EuiText
|
||||
size={textSize}
|
||||
data-test-subj={getTestId('passcodeMessage')}
|
||||
className="eui-displayInline"
|
||||
>
|
||||
<FormattedMessage
|
||||
id="xpack.securitySolution.responseActionFileDownloadLink.passcodeInfo"
|
||||
defaultMessage="(ZIP file passcode: {passcode})."
|
||||
values={{
|
||||
passcode: 'elastic',
|
||||
}}
|
||||
/>
|
||||
</EuiText>
|
||||
<EuiText size={textSize} data-test-subj={getTestId('fileDeleteMessage')}>
|
||||
<FormattedMessage
|
||||
id="xpack.securitySolution.responseActionFileDownloadLink.deleteNotice"
|
||||
defaultMessage="Files are periodically deleted to clear storage space. Download and save file locally if needed."
|
||||
/>
|
||||
</EuiText>
|
||||
</FileDownloadLinkContainer>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue