Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -125,7 +125,7 @@ export const allowedExperimentalValues = Object.freeze({
/**
* Enables the redesigned execution results table on the rule details page
*/
newExecutionResultsTableEnabled: false,
newExecutionResultsTableEnabled: true,

/**
* Adds a new option to filter descendants of a process for Management / Trusted Apps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { EuiText, EuiTextBlockTruncate } from '@elastic/eui';
import * as i18n from './translations';
import { ExecutionStatusIndicator } from '../../../../rule_monitoring';
import { FormattedDate } from '../../../../../common/components/formatted_date';
import { RuleDurationFormat } from '../execution_log_table/rule_duration_format';
import { humanizeDuration } from './utils';
import { TableHeaderTooltipCell } from '../../../../rule_management_ui/components/rules_table/table_header_tooltip_cell';
import {
RULE_EXECUTION_TYPE_BACKFILL,
Expand Down Expand Up @@ -101,7 +101,7 @@ export const getColumns = ({
),
render: (value: number | null) => (
<span data-test-subj="executionResultsTableCellDuration">
{value != null ? <RuleDurationFormat duration={value} /> : '—'}
{value !== null ? humanizeDuration(value) : '—'}
</span>
),
sortable: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ import {
} from '@elastic/eui';
import * as i18n from '../translations';
import { AccordionButtonContent, FieldLabel, SectionSeparator, Tooltip } from './shared';
import { RuleDurationFormat } from '../../execution_log_table/rule_duration_format';
import { humanizeDuration } from '../utils';

interface DurationBreakdownSectionProps {
totalSearchDurationMs: number | null | undefined;
totalIndexingDurationMs: number | null | undefined;
totalSearchDurationMs: number | null;
totalIndexingDurationMs: number | null;
}

export const DurationBreakdownSection: React.FC<DurationBreakdownSectionProps> = ({
Expand Down Expand Up @@ -62,23 +62,15 @@ export const DurationBreakdownSection: React.FC<DurationBreakdownSectionProps> =
<FieldLabel label={i18n.FLYOUT_SEARCH_DURATION} />
<EuiSpacer size="xs" />
<EuiText size="s" data-test-subj="executionDetailsFlyoutSearchDuration">
{totalSearchDurationMs != null ? (
<RuleDurationFormat duration={totalSearchDurationMs} />
) : (
'—'
)}
{totalSearchDurationMs !== null ? humanizeDuration(totalSearchDurationMs) : '—'}
</EuiText>
</EuiFlexItem>
<SectionSeparator />
<EuiFlexItem>
<FieldLabel label={i18n.FLYOUT_INDEX_DURATION} />
<EuiSpacer size="xs" />
<EuiText size="s" data-test-subj="executionDetailsFlyoutIndexDuration">
{totalIndexingDurationMs != null ? (
<RuleDurationFormat duration={totalIndexingDurationMs} />
) : (
'—'
)}
{totalIndexingDurationMs !== null ? humanizeDuration(totalIndexingDurationMs) : '—'}
</EuiText>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ import {
} from '@elastic/eui';
import * as i18n from '../translations';
import { AccordionButtonContent, FieldLabel, SectionSeparator, Tooltip } from './shared';
import { RuleDurationFormat } from '../../execution_log_table/rule_duration_format';
import { humanizeDuration } from '../utils';

interface ExecutionMetricsSectionProps {
gapSeconds: number | null | undefined;
scheduleDelayMs: number | null | undefined;
executionDurationMs: number | null | undefined;
gapSeconds: number | null;
scheduleDelayMs: number | null;
executionDurationMs: number | null;
}

export const ExecutionMetricsSection: React.FC<ExecutionMetricsSectionProps> = ({
Expand Down Expand Up @@ -65,35 +65,23 @@ export const ExecutionMetricsSection: React.FC<ExecutionMetricsSectionProps> = (
<FieldLabel label={i18n.FLYOUT_GAP_DURATION} />
<EuiSpacer size="xs" />
<EuiText size="s" data-test-subj="executionDetailsFlyoutGapDuration">
{gapSeconds != null && gapSeconds > 0 ? (
<RuleDurationFormat duration={gapSeconds * 1000} />
) : (
'—'
)}
{gapSeconds !== null && gapSeconds > 0 ? humanizeDuration(gapSeconds * 1000) : '—'}
</EuiText>
</EuiFlexItem>
<SectionSeparator />
<EuiFlexItem>
<FieldLabel label={i18n.FLYOUT_SCHEDULING_DELAY} />
<EuiSpacer size="xs" />
<EuiText size="s" data-test-subj="executionDetailsFlyoutSchedulingDelay">
{scheduleDelayMs !== null ? humanizeDuration(scheduleDelayMs) : '—'}
</EuiText>
</EuiFlexItem>
{scheduleDelayMs != null && (
<>
<SectionSeparator />
<EuiFlexItem>
<FieldLabel label={i18n.FLYOUT_SCHEDULING_DELAY} />
<EuiSpacer size="xs" />
<EuiText size="s" data-test-subj="executionDetailsFlyoutSchedulingDelay">
<RuleDurationFormat duration={scheduleDelayMs} />
</EuiText>
</EuiFlexItem>
</>
)}
<SectionSeparator />
<EuiFlexItem>
<FieldLabel label={i18n.COLUMN_DURATION} />
<EuiSpacer size="xs" />
<EuiText size="s" data-test-subj="executionDetailsFlyoutExecutionDuration">
{executionDurationMs != null ? (
<RuleDurationFormat duration={executionDurationMs} />
) : (
'—'
)}
{executionDurationMs !== null ? humanizeDuration(executionDurationMs) : '—'}
</EuiText>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import {
getFormattedDurationString,
ONE_MILLISECOND_AS_NANOSECONDS,
} from '../../../../../timelines/components/formatted_duration/helpers';

export const humanizeDuration = (ms: number): string => {
if (ms === 0) {
return '0 ms';
}

return getFormattedDurationString(ms * ONE_MILLISECOND_AS_NANOSECONDS);
};

export const shortenUuid = (uuid: unknown): string | null => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it used anywhere?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good eye! Nopes, not in this branch, at least. Pulled the whole file from another branch which has all the other enhancements. Will open a separate enhancements PR soon, where this thing is going to be used.

if (typeof uuid === 'string') {
return uuid.slice(0, 8);
}

return null;
};
Loading