Skip to content

Commit

Permalink
Merge branch 'main' into route_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bhapas authored Jun 28, 2024
2 parents e4c39ae + 8ba400c commit b1b1ad2
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 28 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@
"@dnd-kit/core": "^6.1.0",
"@dnd-kit/sortable": "^8.0.0",
"@dnd-kit/utilities": "^3.2.2",
"@elastic/apm-rum": "^5.16.0",
"@elastic/apm-rum": "^5.16.1",
"@elastic/apm-rum-core": "^5.21.0",
"@elastic/apm-rum-react": "^2.0.2",
"@elastic/apm-rum-react": "^2.0.3",
"@elastic/charts": "66.0.4",
"@elastic/datemath": "5.0.3",
"@elastic/ecs": "^8.11.1",
Expand Down
7 changes: 6 additions & 1 deletion src/plugins/visualizations/public/embeddable/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@
* Side Public License, v 1.
*/

import { i18n } from '@kbn/i18n';

export { VISUALIZE_EMBEDDABLE_TYPE } from '../../common/constants';

export const COMMON_VISUALIZATION_GROUPING = [
{
id: 'visualizations',
getDisplayName: () => 'Visualizations',
getDisplayName: () =>
i18n.translate('visualizations.common.constants.grouping.legacy', {
defaultMessage: 'Visualizations',
}),
getIconType: () => {
return 'visGauge';
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { i18n } from '@kbn/i18n';

export const COMMON_SLO_GROUPING = [
{
id: 'slos',
getDisplayName: () => 'Observability',
getDisplayName: () =>
i18n.translate('xpack.slo.common.constants.grouping.legacy', {
defaultMessage: 'Observability',
}),
getIconType: () => {
return 'visGauge';
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { i18n } from '@kbn/i18n';
import type { CommonProps } from '@elastic/eui';
import { EuiPanel, EuiSpacer } from '@elastic/eui';
import classNames from 'classnames';
import type { ResponseActionAgentType } from '../../../../../common/endpoint/service/response_actions/constants';
import { useDataTestSubj } from '../hooks/state_selectors/use_data_test_subj';
import { useTestIdGenerator } from '../../../hooks/use_test_id_generator';
import { ConsoleText } from './console_text';
Expand All @@ -19,6 +20,10 @@ const COMMAND_EXECUTION_RESULT_SUCCESS_TITLE = i18n.translate(
'xpack.securitySolution.commandExecutionResult.successTitle',
{ defaultMessage: 'Action completed.' }
);
const COMMAND_EXECUTION_SUBMIT_RESULT_SUCCESS_TITLE = i18n.translate(
'xpack.securitySolution.commandExecutionSubmitResult.successTitle',
{ defaultMessage: 'Action successfully submitted.' }
);
const COMMAND_EXECUTION_RESULT_FAILURE_TITLE = i18n.translate(
'xpack.securitySolution.commandExecutionResult.failureTitle',
{ defaultMessage: 'Action failed.' }
Expand Down Expand Up @@ -47,6 +52,8 @@ export type CommandExecutionResultProps = PropsWithChildren<{

className?: CommonProps['className'];

agentType?: ResponseActionAgentType;

'data-test-subj'?: string;
}>;

Expand All @@ -63,6 +70,7 @@ export const CommandExecutionResult = memo<CommandExecutionResultProps>(
'data-test-subj': dataTestSubj,
className,
children,
agentType,
}) => {
const consoleDataTestSubj = useDataTestSubj();
const getTestId = useTestIdGenerator(dataTestSubj ?? consoleDataTestSubj);
Expand All @@ -76,6 +84,19 @@ export const CommandExecutionResult = memo<CommandExecutionResultProps>(
});
}, [className, showAs]);

const titleMessage = useMemo(() => {
if (title) {
return title;
}
if (showAs === 'success') {
return agentType === 'crowdstrike'
? COMMAND_EXECUTION_SUBMIT_RESULT_SUCCESS_TITLE
: COMMAND_EXECUTION_RESULT_SUCCESS_TITLE;
} else {
return COMMAND_EXECUTION_RESULT_FAILURE_TITLE;
}
}, [agentType, showAs, title]);

return (
<EuiPanel
hasShadow={false}
Expand All @@ -92,11 +113,7 @@ export const CommandExecutionResult = memo<CommandExecutionResultProps>(
{showTitle && (
<>
<ConsoleText color={showAs === 'success' ? 'success' : 'danger'}>
{title
? title
: showAs === 'success'
? COMMAND_EXECUTION_RESULT_SUCCESS_TITLE
: COMMAND_EXECUTION_RESULT_FAILURE_TITLE}
{titleMessage}
</ConsoleText>

<EuiSpacer size="s" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const ActionSuccess = memo<ActionSuccessProps>(
return actionOutputCode ? endpointActionResponseCodes[actionOutputCode] : undefined;
}, [_title, action.agents, action.outputs]);

return <ResultComponent {...props} title={title} />;
return <ResultComponent {...props} title={title} agentType={action.agentType} />;
}
);
ActionSuccess.displayName = 'ActionSuccess';
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ const OutputContent = memo<{ action: MaybeImmutable<ActionDetails>; 'data-test-s
);
}

if (action.agentType === 'crowdstrike') {
return <>{OUTPUT_MESSAGES.submittedSuccessfully(command)}</>;
}
return <>{OUTPUT_MESSAGES.wasSuccessful(command)}</>;
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ export const OUTPUT_MESSAGES = Object.freeze({
defaultMessage: `{command} completed successfully`,
values: { command },
}),
submittedSuccessfully: (command: string) =>
i18n.translate('xpack.securitySolution.responseActionsList.list.item.submittedSuccessfully', {
defaultMessage: `{command} submitted successfully`,
values: { command },
}),
isPending: (command: string) =>
i18n.translate('xpack.securitySolution.responseActionsList.list.item.isPending', {
defaultMessage: `{command} is pending`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ describe('Entity Analytics Dashboard', { tags: ['@ess', '@serverless'] }, () =>
});
});

// https://github.com/elastic/kibana/issues/179687
describe('When risk engine is enabled', { tags: ['@skipInServerlessMKI'] }, () => {
describe('When risk engine is enabled', () => {
beforeEach(() => {
login();
mockRiskEngineEnabled();
Expand Down Expand Up @@ -151,7 +150,6 @@ describe('Entity Analytics Dashboard', { tags: ['@ess', '@serverless'] }, () =>
});

beforeEach(() => {
login();
visitWithTimeRange(ALERTS_URL);
waitForAlertsToPopulate();
visitWithTimeRange(ENTITY_ANALYTICS_URL);
Expand Down Expand Up @@ -244,7 +242,6 @@ describe('Entity Analytics Dashboard', { tags: ['@ess', '@serverless'] }, () =>
});

beforeEach(() => {
login();
visitWithTimeRange(ALERTS_URL);
waitForAlertsToPopulate();
visitWithTimeRange(ENTITY_ANALYTICS_URL);
Expand Down
28 changes: 14 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1627,29 +1627,29 @@
dependencies:
tslib "^2.0.0"

"@elastic/apm-rum-core@^5.21.0":
version "5.21.0"
resolved "https://registry.yarnpkg.com/@elastic/apm-rum-core/-/apm-rum-core-5.21.0.tgz#0dc214b2c829c80a2cd07d37a250c89761fe8386"
integrity sha512-O2Sq1CPq2baG3z2RGtgyG+Hybli3rwq4oMOCMvUSiTiMKBPY1dRCfuebs6KpZsk3euoqykN+oTp0DPKeOI+XIg==
"@elastic/apm-rum-core@^5.21.0", "@elastic/apm-rum-core@^5.21.1":
version "5.21.1"
resolved "https://registry.yarnpkg.com/@elastic/apm-rum-core/-/apm-rum-core-5.21.1.tgz#ea6f2268629193962c194ae1d29971e2c5b2e531"
integrity sha512-/LyLhVdJ+zcsKogwq2AEYARc//RDXOoTHWPERLay4sCsvvxc4/GkkhhOC40CqI0oMu4kUAoJInQWZuCM7zCZRQ==
dependencies:
error-stack-parser "^1.3.5"
opentracing "^0.14.3"
promise-polyfill "^8.1.3"

"@elastic/apm-rum-react@^2.0.2":
version "2.0.2"
resolved "https://registry.yarnpkg.com/@elastic/apm-rum-react/-/apm-rum-react-2.0.2.tgz#5f73d41d462941f4d073ffaa118723987379548b"
integrity sha512-m0l982fLiImSxtuy8kKVXTnNl5wSMG3/TD3QokFQiYnVap+wjEULVm1HbS+dE4hjh9eVqCkuBiPu450a8lUs8g==
"@elastic/apm-rum-react@^2.0.3":
version "2.0.3"
resolved "https://registry.yarnpkg.com/@elastic/apm-rum-react/-/apm-rum-react-2.0.3.tgz#6193464943ea80a74682373de2242490623111f6"
integrity sha512-oDdNz1GEZvy7R1CPOJWkXFRRHY5yNO3vRhUttDXqvXvRBEd1m7HosskHs/R/LjtoYghpAVrG+yzJGvDI9TSuxQ==
dependencies:
"@elastic/apm-rum" "^5.16.0"
"@elastic/apm-rum" "^5.16.1"
hoist-non-react-statics "^3.3.0"

"@elastic/apm-rum@^5.16.0":
version "5.16.0"
resolved "https://registry.yarnpkg.com/@elastic/apm-rum/-/apm-rum-5.16.0.tgz#bb9b00a866a48ec40c07ea742d241f835e8b5f9d"
integrity sha512-vNwRWDIccdu6iPDpCyrC3myRnpBzRH6wlAoOZjgSFJilQJMsymb8NzR1rkQmNEBca+frRuDCZabd+ylEZ47YBA==
"@elastic/apm-rum@^5.16.1":
version "5.16.1"
resolved "https://registry.yarnpkg.com/@elastic/apm-rum/-/apm-rum-5.16.1.tgz#59767f587a31293c17497ff86e05754627182be4"
integrity sha512-hxmhjLqF4EqEl2wVwxKU5p88jiwHPF//zqk97bm09vj5CQQ6HBtWkwIxQ5dvEEOnRwJinFEf9V2JibpamgzUWA==
dependencies:
"@elastic/apm-rum-core" "^5.21.0"
"@elastic/apm-rum-core" "^5.21.1"

"@elastic/app-search-javascript@^8.1.2":
version "8.1.2"
Expand Down

0 comments on commit b1b1ad2

Please sign in to comment.