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

Make all risk score decimal places consistent #198450

Merged
merged 20 commits into from
Nov 8, 2024
Merged
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
@@ -30,6 +30,7 @@ import {
SecurityCellActionType,
} from '../../../common/components/cell_actions';
import { FormattedRelativePreferenceDate } from '../../../common/components/formatted_date';
import { formatRiskScore } from '../../common';

type HostRiskScoreColumns = Array<EuiBasicTableColumn<HostRiskScore & UserRiskScore>>;

@@ -128,7 +129,7 @@ export const getRiskScoreColumns = (
if (riskScore != null) {
return (
<span data-test-subj="risk-score-truncate" title={`${riskScore}`}>
{Math.round(riskScore)}
{formatRiskScore(riskScore)}
</span>
);
}
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ import { type CriticalityLevels } from '../../../../../common/constants';
import { ENTITIES_LIST_TABLE_ID } from '../constants';
import { isUserEntity, sourceFieldToText } from '../helpers';
import { CRITICALITY_LEVEL_TITLE } from '../../asset_criticality/translations';
import { formatRiskScore } from '../../../common';

export type EntitiesListColumns = [
Columns<Entity>,
@@ -149,7 +150,7 @@ export const useEntitiesListColumns = (): EntitiesListColumns => {
if (riskScore != null) {
return (
<span data-test-subj="risk-score-truncate" title={`${riskScore}`}>
{Math.round(riskScore)}
{formatRiskScore(riskScore)}
</span>
);
}
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@ import { RiskScoreLevel } from '../severity/common';
import { ENTITY_RISK_LEVEL } from '../risk_score/translations';
import { CELL_ACTIONS_TELEMETRY } from '../risk_score/constants';
import { FormattedRelativePreferenceDate } from '../../../common/components/formatted_date';
import { formatRiskScore } from '../../common';

export const getHostRiskScoreColumns = ({
dispatchSeverityUpdate,
@@ -82,7 +83,7 @@ export const getHostRiskScoreColumns = ({
if (riskScore != null) {
return (
<span data-test-subj="risk-score-truncate" title={`${riskScore}`}>
{Math.round(riskScore)}
{formatRiskScore(riskScore)}
</span>
);
}
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ import { UsersTableType } from '../../../explore/users/store/model';
import { ENTITY_RISK_LEVEL } from '../risk_score/translations';
import { CELL_ACTIONS_TELEMETRY } from '../risk_score/constants';
import { FormattedRelativePreferenceDate } from '../../../common/components/formatted_date';
import { formatRiskScore } from '../../common';

export const getUserRiskScoreColumns = ({
dispatchSeverityUpdate,
@@ -85,7 +86,7 @@ export const getUserRiskScoreColumns = ({
if (riskScore != null) {
return (
<span data-test-subj="risk-score-truncate" title={`${riskScore}`}>
{Math.round(riskScore)}
{formatRiskScore(riskScore)}
</span>
);
}
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ describe('risk tab', { tags: ['@ess'] }, () => {
kqlSearch('host.name: "siem-kibana" {enter}');
cy.get(HOST_BY_RISK_TABLE_CELL).eq(4).should('have.text', 'siem-kibana');
cy.get(HOST_BY_RISK_TABLE_CELL).eq(5).should('have.text', 'Mar 10, 2021 @ 14:51:05.766');
cy.get(HOST_BY_RISK_TABLE_CELL).eq(6).should('have.text', '21');
cy.get(HOST_BY_RISK_TABLE_CELL).eq(6).should('have.text', '21.00');
cy.get(HOST_BY_RISK_TABLE_CELL).eq(7).should('have.text', 'Low');
});

@@ -93,7 +93,7 @@ describe('risk tab', { tags: ['@ess'] }, () => {
kqlSearch('host.name: "siem-kibana" {enter}');
cy.get(HOST_BY_RISK_TABLE_CELL).eq(4).should('have.text', 'siem-kibana');
cy.get(HOST_BY_RISK_TABLE_CELL).eq(5).should('have.text', 'Mar 10, 2021 @ 14:51:05.766');
cy.get(HOST_BY_RISK_TABLE_CELL).eq(6).should('have.text', '90');
cy.get(HOST_BY_RISK_TABLE_CELL).eq(6).should('have.text', '90.00');
cy.get(HOST_BY_RISK_TABLE_CELL).eq(7).should('have.text', 'Critical');
});