Skip to content
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 @@ -8,6 +8,7 @@
import React from 'react';
import { FormattedMessage } from '@kbn/i18n-react';
import type { DataViewSpec } from '@kbn/data-views-plugin/public';
import { i18n } from '@kbn/i18n';
import { getAccountSwitchesEsqlCount } from './esql_query';
import { KeyInsightsTile } from '../common/key_insights_tile';

Expand All @@ -17,18 +18,12 @@ export const AccountSwitchesTile: React.FC<{ spaceId: string; sourcerDataView: D
}) => {
return (
<KeyInsightsTile
title={
<FormattedMessage
id="xpack.securitySolution.privmon.accountSwitches.title"
defaultMessage="Account Switches"
/>
}
label={
<FormattedMessage
id="xpack.securitySolution.privmon.accountSwitches.label"
defaultMessage="Account Switches"
/>
}
title={i18n.translate('xpack.securitySolution.privmon.accountSwitches.title', {
defaultMessage: 'Account Switches',
})}
label={i18n.translate('xpack.securitySolution.privmon.accountSwitches.label', {
defaultMessage: 'Account Switches',
})}
getEsqlQuery={(namespace) => getAccountSwitchesEsqlCount(namespace, sourcerDataView)}
id="privileged-user-monitoring-account-switches"
spaceId={spaceId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import React from 'react';
import { FormattedMessage } from '@kbn/i18n-react';
import type { DataViewSpec } from '@kbn/data-views-plugin/public';
import { i18n } from '@kbn/i18n';
import { getActivePrivilegedUsersEsqlCount } from './esql_query';
import { KeyInsightsTile } from '../common/key_insights_tile';

Expand All @@ -17,18 +18,12 @@ export const ActivePrivilegedUsersTile: React.FC<{
}> = ({ spaceId, sourcerDataView }) => {
return (
<KeyInsightsTile
title={
<FormattedMessage
id="xpack.securitySolution.privmon.activePrivilegedUsers.title"
defaultMessage="Active Privileged Users"
/>
}
label={
<FormattedMessage
id="xpack.securitySolution.privmon.activePrivilegedUsers.label"
defaultMessage="Active Privileged Users"
/>
}
title={i18n.translate('xpack.securitySolution.privmon.activePrivilegedUsers.title', {
defaultMessage: 'Active Privileged Users',
})}
label={i18n.translate('xpack.securitySolution.privmon.activePrivilegedUsers.label', {
defaultMessage: 'Active Privileged Users',
})}
getEsqlQuery={(namespace: string) =>
getActivePrivilegedUsersEsqlCount(namespace, sourcerDataView)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import React from 'react';
import { FormattedMessage } from '@kbn/i18n-react';
import { i18n } from '@kbn/i18n';
import { getAlertsTriggeredEsqlCount } from './esql_query';
import { KeyInsightsTile } from '../common/key_insights_tile';
import { useSignalIndex } from '../../../../../../detections/containers/detection_engine/alerts/use_signal_index';
Expand All @@ -15,18 +16,12 @@ export const AlertsTriggeredTile: React.FC<{ spaceId: string }> = ({ spaceId })
const { signalIndexName: alertsIndexName } = useSignalIndex();
return (
<KeyInsightsTile
title={
<FormattedMessage
id="xpack.securitySolution.privmon.alertsTriggered.title"
defaultMessage="Alerts Triggered"
/>
}
label={
<FormattedMessage
id="xpack.securitySolution.privmon.alertsTriggered.label"
defaultMessage="Alerts Triggered"
/>
}
title={i18n.translate('xpack.securitySolution.privmon.alertsTriggered.title', {
defaultMessage: 'Alerts Triggered',
})}
label={i18n.translate('xpack.securitySolution.privmon.alertsTriggered.label', {
defaultMessage: 'Alerts Triggered',
})}
getEsqlQuery={(namespace) => getAlertsTriggeredEsqlCount(namespace, alertsIndexName)}
id="privileged-user-monitoring-alerts-triggered"
spaceId={spaceId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,19 @@

import React from 'react';
import { FormattedMessage } from '@kbn/i18n-react';
import { i18n } from '@kbn/i18n';
import { getAnomaliesDetectedEsqlQuery } from './esql_query';
import { KeyInsightsTile } from '../common/key_insights_tile';

export const AnomaliesDetectedTile: React.FC<{ spaceId: string }> = ({ spaceId }) => {
return (
<KeyInsightsTile
title={
<FormattedMessage
id="xpack.securitySolution.privmon.anomaliesDetected.title"
defaultMessage="Anomalies Detected"
/>
}
label={
<FormattedMessage
id="xpack.securitySolution.privmon.anomaliesDetected.label"
defaultMessage="Anomalies Detected"
/>
}
title={i18n.translate('xpack.securitySolution.privmon.anomaliesDetected.title', {
defaultMessage: 'Anomalies Detected',
})}
label={i18n.translate('xpack.securitySolution.privmon.anomaliesDetected.label', {
defaultMessage: 'Anomalies Detected',
})}
getEsqlQuery={(namespace) => getAnomaliesDetectedEsqlQuery(namespace)}
id="privileged-user-monitoring-anomalies-detected"
spaceId={spaceId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import React from 'react';
import { FormattedMessage } from '@kbn/i18n-react';
import type { DataViewSpec } from '@kbn/data-views-plugin/public';
import { i18n } from '@kbn/i18n';
import { getAuthenticationsEsqlCount } from './esql_query';
import { KeyInsightsTile } from '../common/key_insights_tile';

Expand All @@ -17,18 +18,12 @@ export const AuthenticationsTile: React.FC<{ spaceId: string; sourcerDataView: D
}) => {
return (
<KeyInsightsTile
title={
<FormattedMessage
id="xpack.securitySolution.privmon.authentications.title"
defaultMessage="Authentications"
/>
}
label={
<FormattedMessage
id="xpack.securitySolution.privmon.authentications.label"
defaultMessage="Authentications"
/>
}
title={i18n.translate('xpack.securitySolution.privmon.authentications.title', {
defaultMessage: 'Authentications',
})}
label={i18n.translate('xpack.securitySolution.privmon.authentications.label', {
defaultMessage: 'Authentications',
})}
getEsqlQuery={(namespace) => getAuthenticationsEsqlCount(namespace, sourcerDataView)}
id="privileged-user-monitoring-authentications"
spaceId={spaceId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const LENS_VISUALIZATION_HEIGHT = 150;
const LENS_VISUALIZATION_MIN_WIDTH = 220;

interface KeyInsightsTileProps {
title: ReactElement;
label: ReactElement;
title: string;
label: string;
getEsqlQuery: (namespace: string) => string;
id: string;
inspectTitle: ReactElement;
Expand All @@ -43,13 +43,9 @@ export const KeyInsightsTile: React.FC<KeyInsightsTileProps> = ({
// Use prop spaceId if provided, otherwise use hook spaceId, fallback to 'default'
const effectiveSpaceId = propSpaceId || hookSpaceId || 'default';

// Extract the defaultMessage from FormattedMessage elements
const titleString = title.props.defaultMessage;
const labelString = label.props.defaultMessage;

const lensAttributes = createKeyInsightsPanelLensAttributes({
title: titleString,
label: labelString,
title,
label,
esqlQuery: getEsqlQuery(effectiveSpaceId),
dataViewId: 'default-dataview',
filterQuery,
Expand Down Expand Up @@ -91,7 +87,7 @@ export const KeyInsightsTile: React.FC<KeyInsightsTileProps> = ({
>
<EuiFlexItem grow={false}>
<EuiTitle size="xs">
<h4>{titleString}</h4>
<h4>{title}</h4>
</EuiTitle>
</EuiFlexItem>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import React from 'react';
import { FormattedMessage } from '@kbn/i18n-react';
import type { DataViewSpec } from '@kbn/data-views-plugin/public';
import { i18n } from '@kbn/i18n';
import { getGrantedRightsEsqlCount } from './esql_query';
import { KeyInsightsTile } from '../common/key_insights_tile';

Expand All @@ -17,18 +18,12 @@ export const GrantedRightsTile: React.FC<{ spaceId: string; sourcerDataView: Dat
}) => {
return (
<KeyInsightsTile
title={
<FormattedMessage
id="xpack.securitySolution.privmon.grantedRights.title"
defaultMessage="Granted Rights"
/>
}
label={
<FormattedMessage
id="xpack.securitySolution.privmon.grantedRights.label"
defaultMessage="Granted Rights"
/>
}
title={i18n.translate('xpack.securitySolution.privmon.grantedRights.title', {
defaultMessage: 'Granted Rights',
})}
label={i18n.translate('xpack.securitySolution.privmon.grantedRights.label', {
defaultMessage: 'Granted Rights',
})}
getEsqlQuery={(namespace) => getGrantedRightsEsqlCount(namespace, sourcerDataView)}
id="privileged-user-monitoring-granted-rights"
spaceId={spaceId}
Expand Down