diff --git a/x-pack/plugins/triggers_actions_ui/.storybook/decorator.tsx b/x-pack/plugins/triggers_actions_ui/.storybook/decorator.tsx index cde89f97e53da..381223e0ba355 100644 --- a/x-pack/plugins/triggers_actions_ui/.storybook/decorator.tsx +++ b/x-pack/plugins/triggers_actions_ui/.storybook/decorator.tsx @@ -88,7 +88,7 @@ export const StorybookContextDecorator: React.FC ruleTagFilter: true, ruleStatusFilter: true, rulesDetailLogs: true, - ruleLastRunOutcome: true, + ruleUseExecutionStatus: false, }, }); return ( diff --git a/x-pack/plugins/triggers_actions_ui/common/experimental_features.ts b/x-pack/plugins/triggers_actions_ui/common/experimental_features.ts index 6a0f9b1c8f140..0890e86c15ab7 100644 --- a/x-pack/plugins/triggers_actions_ui/common/experimental_features.ts +++ b/x-pack/plugins/triggers_actions_ui/common/experimental_features.ts @@ -17,7 +17,7 @@ export const allowedExperimentalValues = Object.freeze({ ruleTagFilter: true, ruleStatusFilter: true, rulesDetailLogs: true, - ruleLastRunOutcome: true, + ruleUseExecutionStatus: false, }); type ExperimentalConfigKeys = Array; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule.test.tsx index f41b325277ba3..83924e7307d6c 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule.test.tsx @@ -320,6 +320,8 @@ describe('alertToListItem', () => { describe('execution duration overview', () => { it('render last execution status', async () => { + (getIsExperimentalFeatureEnabled as jest.Mock).mockImplementation(() => true); + const rule = mockRule({ executionStatus: { status: 'ok', lastExecutionDate: new Date('2020-08-20T19:23:38Z') }, }); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_data_grid.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_data_grid.tsx index c7b4c84f64c30..24a3c3fe3b8bd 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_data_grid.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_data_grid.tsx @@ -175,7 +175,7 @@ export const RuleEventLogDataGrid = (props: RuleEventLogDataGrid) => { const { euiTheme } = useEuiTheme(); - const isRuleLastRunOutcomeEnabled = getIsExperimentalFeatureEnabled('ruleLastRunOutcome'); + const isRuleUsingExecutionStatus = getIsExperimentalFeatureEnabled('ruleUseExecutionStatus'); const getPaginatedRowIndex = useCallback( (rowIndex: number) => { @@ -624,7 +624,7 @@ export const RuleEventLogDataGrid = (props: RuleEventLogDataGrid) => { dateFormat={dateFormat} ruleId={ruleId} spaceIds={spaceIds} - lastRunOutcomeEnabled={isRuleLastRunOutcomeEnabled} + useExecutionStatus={isRuleUsingExecutionStatus} /> diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_cell_renderer.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_cell_renderer.tsx index 956021ddc6754..63a62d2bc4503 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_cell_renderer.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_cell_renderer.tsx @@ -32,7 +32,7 @@ interface RuleEventLogListCellRendererProps { dateFormat?: string; ruleId?: string; spaceIds?: string[]; - lastRunOutcomeEnabled?: boolean; + useExecutionStatus?: boolean; } export const RuleEventLogListCellRenderer = (props: RuleEventLogListCellRendererProps) => { @@ -43,7 +43,7 @@ export const RuleEventLogListCellRenderer = (props: RuleEventLogListCellRenderer dateFormat = DEFAULT_DATE_FORMAT, ruleId, spaceIds, - lastRunOutcomeEnabled = false, + useExecutionStatus = true, } = props; const spacesData = useSpacesData(); const { http } = useKibana().services; @@ -99,7 +99,7 @@ export const RuleEventLogListCellRenderer = (props: RuleEventLogListCellRenderer return ( ); } diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_kpi.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_kpi.tsx index 783b985c97346..3f668df208df2 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_kpi.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_kpi.tsx @@ -105,7 +105,7 @@ export const RuleEventLogListKPI = (props: RuleEventLogListKPIProps) => { } = useKibana().services; const isInitialized = useRef(false); - const isRuleLastRunOutcomeEnabled = getIsExperimentalFeatureEnabled('ruleLastRunOutcome'); + const isRuleUsingExecutionStatus = getIsExperimentalFeatureEnabled('ruleUseExecutionStatus'); const [isLoading, setIsLoading] = useState(false); const [kpi, setKpi] = useState(); @@ -173,7 +173,7 @@ export const RuleEventLogListKPI = (props: RuleEventLogListKPIProps) => { description={getStatDescription( )} titleSize="s" @@ -187,7 +187,7 @@ export const RuleEventLogListKPI = (props: RuleEventLogListKPIProps) => { description={getStatDescription( )} titleSize="s" @@ -201,7 +201,7 @@ export const RuleEventLogListKPI = (props: RuleEventLogListKPIProps) => { description={getStatDescription( )} titleSize="s" diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_status.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_status.tsx index 9640b6704ef80..2e4098c573832 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_status.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_status.tsx @@ -17,7 +17,7 @@ import { interface RuleEventLogListStatusProps { status: RuleAlertingOutcome; - lastRunOutcomeEnabled?: boolean; + useExecutionStatus?: boolean; } const statusContainerStyles = { @@ -45,15 +45,15 @@ const STATUS_TO_OUTCOME: Record = { }; export const RuleEventLogListStatus = (props: RuleEventLogListStatusProps) => { - const { status, lastRunOutcomeEnabled = false } = props; + const { status, useExecutionStatus = true } = props; const color = STATUS_TO_COLOR[status] || 'gray'; const statusString = useMemo(() => { - if (lastRunOutcomeEnabled) { - return STATUS_TO_OUTCOME[status].toLocaleLowerCase(); + if (useExecutionStatus) { + return status; } - return status; - }, [lastRunOutcomeEnabled, status]); + return STATUS_TO_OUTCOME[status].toLocaleLowerCase(); + }, [useExecutionStatus, status]); return (
diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_status_filter.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_status_filter.tsx index af4325c906456..26bc5fc78b161 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_status_filter.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_status_filter.tsx @@ -22,7 +22,7 @@ interface RuleEventLogListStatusFilterProps { export const RuleEventLogListStatusFilter = (props: RuleEventLogListStatusFilterProps) => { const { selectedOptions = [], onChange = () => {} } = props; - const isRuleLastRunOutcomeEnabled = getIsExperimentalFeatureEnabled('ruleLastRunOutcome'); + const isRuleUsingExecutionStatus = getIsExperimentalFeatureEnabled('ruleUseExecutionStatus'); const [isPopoverOpen, setIsPopoverOpen] = useState(false); @@ -73,7 +73,7 @@ export const RuleEventLogListStatusFilter = (props: RuleEventLogListStatusFilter > ); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.test.tsx index 6b8aaeac80566..59876bd48b459 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.test.tsx @@ -359,7 +359,7 @@ describe('rules_list component with props', () => { describe('Last response filter', () => { beforeEach(() => { - (getIsExperimentalFeatureEnabled as jest.Mock).mockImplementation(() => true); + // (getIsExperimentalFeatureEnabled as jest.Mock).mockImplementation(() => true); }); afterEach(() => { @@ -1029,7 +1029,7 @@ describe('rules_list component with items', () => { expect(wrapper.find('[data-test-subj="rulesListAutoRefresh"]').exists()).toBeTruthy(); expect(wrapper.find('EuiHealth[data-test-subj="ruleStatus-failed"]').first().text()).toEqual( - 'Error' + 'Failed' ); expect(wrapper.find('EuiHealth[data-test-subj="ruleStatus-failed"]').last().text()).toEqual( 'License Error' @@ -1280,7 +1280,7 @@ describe('rules_list component with items', () => { }); it('renders brief', async () => { - (getIsExperimentalFeatureEnabled as jest.Mock).mockImplementation(() => true); + (getIsExperimentalFeatureEnabled as jest.Mock).mockImplementation(() => false); await setup(); // ruleLastRunOutcome: { diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.tsx index a180610784b04..ae7b2dc8b437e 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list.tsx @@ -198,7 +198,7 @@ export const RulesList = ({ const isRuleTagFilterEnabled = getIsExperimentalFeatureEnabled('ruleTagFilter'); const isRuleStatusFilterEnabled = getIsExperimentalFeatureEnabled('ruleStatusFilter'); - const isRuleLastRunOutcomeEnabled = getIsExperimentalFeatureEnabled('ruleLastRunOutcome'); + const isRuleUsingExecutionStatus = getIsExperimentalFeatureEnabled('ruleUseExecutionStatus'); const cloneRuleId = useRef(null); @@ -586,20 +586,20 @@ export const RulesList = ({ }; const getRuleOutcomeOrStatusFilter = () => { - if (isRuleLastRunOutcomeEnabled) { + if (isRuleUsingExecutionStatus) { return [ - , ]; } return [ - , ]; }; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list_column_selector.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list_column_selector.tsx index 39089c2168cb3..c88070cceafee 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list_column_selector.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list_column_selector.tsx @@ -36,8 +36,7 @@ export type RulesListVisibleColumns = | 'ruleExecutionPercentile' | 'ruleExecutionSuccessRatio' | 'ruleExecutionStatus' - | 'ruleExecutionState' - | 'ruleLastRunOutcome'; + | 'ruleExecutionState'; const OriginalRulesListVisibleColumns: RulesListVisibleColumns[] = [ 'ruleName', diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list_error_banner.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list_error_banner.tsx index dd8a99b4d3a60..afdd55dc19080 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list_error_banner.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list_error_banner.tsx @@ -21,11 +21,11 @@ export const RulesListErrorBanner = (props: RulesListErrorBannerProps) => { props; const onClick = () => { - const isRuleLastRunOutcomeEnabled = getIsExperimentalFeatureEnabled('ruleLastRunOutcome'); - if (isRuleLastRunOutcomeEnabled) { - setRuleLastRunOutcomesFilter(['failed']); - } else { + const isRuleUsingExecutionStatus = getIsExperimentalFeatureEnabled('ruleUseExecutionStatus'); + if (isRuleUsingExecutionStatus) { setRuleExecutionStatusesFilter(['error']); + } else { + setRuleLastRunOutcomesFilter(['failed']); } }; diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list_statuses.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list_statuses.tsx index 7e01311b71c1d..12d044462ad3a 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list_statuses.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list_statuses.tsx @@ -29,24 +29,39 @@ interface RulesListStatusesProps { export const RulesListStatuses = (props: RulesListStatusesProps) => { const { rulesStatuses, rulesLastRunOutcomes } = props; - const isRuleLastRunOutcomeEnabled = getIsExperimentalFeatureEnabled('ruleLastRunOutcome'); + const isRuleUsingExecutionStatus = getIsExperimentalFeatureEnabled('ruleUseExecutionStatus'); - if (isRuleLastRunOutcomeEnabled) { + if (isRuleUsingExecutionStatus) { return ( - - {RULE_LAST_RUN_OUTCOME_SUCCEEDED_DESCRIPTION(rulesLastRunOutcomes.succeeded)} + + {RULE_STATUS_ACTIVE(rulesStatuses.active)} - - {RULE_LAST_RUN_OUTCOME_FAILED_DESCRIPTION(rulesLastRunOutcomes.failed)} + + {RULE_STATUS_ERROR(rulesStatuses.error)} - {RULE_LAST_RUN_OUTCOME_WARNING_DESCRIPTION(rulesLastRunOutcomes.warning)} + {RULE_STATUS_WARNING(rulesStatuses.warning)} + + + + + {RULE_STATUS_OK(rulesStatuses.ok)} + + + + + {RULE_STATUS_PENDING(rulesStatuses.pending)} + + + + + {RULE_STATUS_UNKNOWN(rulesStatuses.unknown)} @@ -56,33 +71,18 @@ export const RulesListStatuses = (props: RulesListStatusesProps) => { return ( - - {RULE_STATUS_ACTIVE(rulesStatuses.active)} + + {RULE_LAST_RUN_OUTCOME_SUCCEEDED_DESCRIPTION(rulesLastRunOutcomes.succeeded)} - - {RULE_STATUS_ERROR(rulesStatuses.error)} + + {RULE_LAST_RUN_OUTCOME_FAILED_DESCRIPTION(rulesLastRunOutcomes.failed)} - {RULE_STATUS_WARNING(rulesStatuses.warning)} - - - - - {RULE_STATUS_OK(rulesStatuses.ok)} - - - - - {RULE_STATUS_PENDING(rulesStatuses.pending)} - - - - - {RULE_STATUS_UNKNOWN(rulesStatuses.unknown)} + {RULE_LAST_RUN_OUTCOME_WARNING_DESCRIPTION(rulesLastRunOutcomes.warning)} diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list_table.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list_table.tsx index e888875e77115..2542c87abec53 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list_table.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list_table.tsx @@ -215,7 +215,7 @@ export const RulesListTable = (props: RulesListTableProps) => { const [currentlyOpenNotify, setCurrentlyOpenNotify] = useState(); const [isLoadingMap, setIsLoadingMap] = useState>({}); - const isRuleLastRunOutcomeEnabled = getIsExperimentalFeatureEnabled('ruleLastRunOutcome'); + const isRuleUsingExecutionStatus = getIsExperimentalFeatureEnabled('ruleUseExecutionStatus'); const [defaultNumberFormat] = useUiSetting$(DEFAULT_NUMBER_FORMAT); const { euiTheme } = useEuiTheme(); @@ -329,11 +329,11 @@ export const RulesListTable = (props: RulesListTableProps) => { }, [isPageSelected, onSelectPage, onSelectRow, isRowSelected]); const ruleOutcomeColumnField = useMemo(() => { - if (isRuleLastRunOutcomeEnabled) { - return 'lastRun.outcome'; + if (isRuleUsingExecutionStatus) { + return 'executionStatus.status'; } - return 'executionStatus.status'; - }, [isRuleLastRunOutcomeEnabled]); + return 'lastRun.outcome'; + }, [isRuleUsingExecutionStatus]); const getRulesTableColumns = useCallback((): RulesListColumns[] => { return [ diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list_table_status_cell.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list_table_status_cell.test.tsx index 33ee761b828dc..c4cd31cd4b07a 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list_table_status_cell.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rules_list/components/rules_list_table_status_cell.test.tsx @@ -44,7 +44,7 @@ const ComponentWithLocale = (props: RulesListTableStatusCellProps) => { describe('RulesListTableStatusCell', () => { beforeEach(() => { - (getIsExperimentalFeatureEnabled as jest.Mock).mockImplementation(() => true); + (getIsExperimentalFeatureEnabled as jest.Mock).mockImplementation(() => false); }); afterEach(() => { diff --git a/x-pack/plugins/triggers_actions_ui/public/common/get_experimental_features.test.tsx b/x-pack/plugins/triggers_actions_ui/public/common/get_experimental_features.test.tsx index a35599e992786..318a681eba7f6 100644 --- a/x-pack/plugins/triggers_actions_ui/public/common/get_experimental_features.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/common/get_experimental_features.test.tsx @@ -20,7 +20,7 @@ describe('getIsExperimentalFeatureEnabled', () => { rulesDetailLogs: true, ruleTagFilter: true, ruleStatusFilter: true, - ruleLastRunOutcome: true, + ruleUseExecutionStatus: false, }, }); @@ -44,9 +44,9 @@ describe('getIsExperimentalFeatureEnabled', () => { expect(result).toEqual(true); - result = getIsExperimentalFeatureEnabled('ruleLastRunOutcome'); + result = getIsExperimentalFeatureEnabled('ruleUseExecutionStatus'); - expect(result).toEqual(true); + expect(result).toEqual(false); expect(() => getIsExperimentalFeatureEnabled('doesNotExist' as any)).toThrowError( `Invalid enable value doesNotExist. Allowed values are: ${allowedExperimentalValueKeys.join( diff --git a/x-pack/plugins/triggers_actions_ui/public/common/lib/rule_status_helper.test.ts b/x-pack/plugins/triggers_actions_ui/public/common/lib/rule_status_helper.test.ts index 91af1e05ece20..b2c4bc79ea78d 100644 --- a/x-pack/plugins/triggers_actions_ui/public/common/lib/rule_status_helper.test.ts +++ b/x-pack/plugins/triggers_actions_ui/public/common/lib/rule_status_helper.test.ts @@ -65,7 +65,7 @@ const licenseErrorRule = { } as RuleTableItem; beforeEach(() => { - (getIsExperimentalFeatureEnabled as jest.Mock).mockImplementation(() => true); + (getIsExperimentalFeatureEnabled as jest.Mock).mockImplementation(() => false); }); describe('getRuleHealthColor', () => { @@ -73,7 +73,7 @@ describe('getRuleHealthColor', () => { let color = getRuleHealthColor(mockRule); expect(color).toEqual('success'); - (getIsExperimentalFeatureEnabled as jest.Mock).mockImplementation(() => false); + (getIsExperimentalFeatureEnabled as jest.Mock).mockImplementation(() => true); color = getRuleHealthColor(mockRule); expect(color).toEqual('success'); @@ -83,7 +83,7 @@ describe('getRuleHealthColor', () => { let color = getRuleHealthColor(warningRule); expect(color).toEqual('warning'); - (getIsExperimentalFeatureEnabled as jest.Mock).mockImplementation(() => false); + (getIsExperimentalFeatureEnabled as jest.Mock).mockImplementation(() => true); color = getRuleHealthColor(warningRule); expect(color).toEqual('warning'); @@ -93,7 +93,7 @@ describe('getRuleHealthColor', () => { let color = getRuleHealthColor(failedRule); expect(color).toEqual('danger'); - (getIsExperimentalFeatureEnabled as jest.Mock).mockImplementation(() => false); + (getIsExperimentalFeatureEnabled as jest.Mock).mockImplementation(() => true); color = getRuleHealthColor(failedRule); expect(color).toEqual('danger'); @@ -110,7 +110,7 @@ describe('getRuleStatusMessage', () => { }); expect(statusMessage).toEqual('Succeeded'); - (getIsExperimentalFeatureEnabled as jest.Mock).mockImplementation(() => false); + (getIsExperimentalFeatureEnabled as jest.Mock).mockImplementation(() => true); statusMessage = getRuleStatusMessage({ rule: mockRule, licenseErrorText: ALERT_STATUS_LICENSE_ERROR, @@ -129,7 +129,7 @@ describe('getRuleStatusMessage', () => { }); expect(statusMessage).toEqual('Warning'); - (getIsExperimentalFeatureEnabled as jest.Mock).mockImplementation(() => false); + (getIsExperimentalFeatureEnabled as jest.Mock).mockImplementation(() => true); statusMessage = getRuleStatusMessage({ rule: warningRule, licenseErrorText: ALERT_STATUS_LICENSE_ERROR, @@ -148,7 +148,7 @@ describe('getRuleStatusMessage', () => { }); expect(statusMessage).toEqual('Failed'); - (getIsExperimentalFeatureEnabled as jest.Mock).mockImplementation(() => false); + (getIsExperimentalFeatureEnabled as jest.Mock).mockImplementation(() => true); statusMessage = getRuleStatusMessage({ rule: failedRule, licenseErrorText: ALERT_STATUS_LICENSE_ERROR, @@ -167,7 +167,7 @@ describe('getRuleStatusMessage', () => { }); expect(statusMessage).toEqual('License Error'); - (getIsExperimentalFeatureEnabled as jest.Mock).mockImplementation(() => false); + (getIsExperimentalFeatureEnabled as jest.Mock).mockImplementation(() => true); statusMessage = getRuleStatusMessage({ rule: licenseErrorRule, licenseErrorText: ALERT_STATUS_LICENSE_ERROR, diff --git a/x-pack/plugins/triggers_actions_ui/public/common/lib/rule_status_helpers.ts b/x-pack/plugins/triggers_actions_ui/public/common/lib/rule_status_helpers.ts index f3e6419e4e2fa..ceb83870ca724 100644 --- a/x-pack/plugins/triggers_actions_ui/public/common/lib/rule_status_helpers.ts +++ b/x-pack/plugins/triggers_actions_ui/public/common/lib/rule_status_helpers.ts @@ -43,11 +43,11 @@ export const getExecutionStatusHealthColor = (status: RuleExecutionStatuses) => }; export const getRuleHealthColor = (rule: Rule) => { - const isRuleLastRunOutcomeEnabled = getIsExperimentalFeatureEnabled('ruleLastRunOutcome'); - if (isRuleLastRunOutcomeEnabled) { - return (rule.lastRun && getOutcomeHealthColor(rule.lastRun.outcome)) || 'subdued'; + const isRuleUsingExecutionStatus = getIsExperimentalFeatureEnabled('ruleUseExecutionStatus'); + if (isRuleUsingExecutionStatus) { + return getExecutionStatusHealthColor(rule.executionStatus.status); } - return getExecutionStatusHealthColor(rule.executionStatus.status); + return (rule.lastRun && getOutcomeHealthColor(rule.lastRun.outcome)) || 'subdued'; }; export const getIsLicenseError = (rule: Rule) => { @@ -69,13 +69,13 @@ export const getRuleStatusMessage = ({ executionStatusTranslations: Record; }) => { const isLicenseError = getIsLicenseError(rule); - const isRuleLastRunOutcomeEnabled = getIsExperimentalFeatureEnabled('ruleLastRunOutcome'); + const isRuleUsingExecutionStatus = getIsExperimentalFeatureEnabled('ruleUseExecutionStatus'); if (isLicenseError) { return licenseErrorText; } - if (isRuleLastRunOutcomeEnabled) { - return rule.lastRun && lastOutcomeTranslations[rule.lastRun.outcome]; + if (isRuleUsingExecutionStatus) { + return executionStatusTranslations[rule.executionStatus.status]; } - return executionStatusTranslations[rule.executionStatus.status]; + return rule.lastRun && lastOutcomeTranslations[rule.lastRun.outcome]; }; diff --git a/x-pack/test/functional_with_es_ssl/config.ts b/x-pack/test/functional_with_es_ssl/config.ts index 55cbf68ead3e0..6ca556876d0e7 100644 --- a/x-pack/test/functional_with_es_ssl/config.ts +++ b/x-pack/test/functional_with_es_ssl/config.ts @@ -93,7 +93,6 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { 'internalAlertsTable', 'ruleTagFilter', 'ruleStatusFilter', - 'ruleLastRunOutcome', ])}`, `--xpack.alerting.rules.minimumScheduleInterval.value="2s"`, `--xpack.actions.enabledActionTypes=${JSON.stringify(enabledActionTypes)}`,