diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/event_log/event_log_data_grid.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/event_log/event_log_data_grid.tsx index 3926e723f9d18..43199b924ba2d 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/event_log/event_log_data_grid.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/event_log/event_log_data_grid.tsx @@ -64,7 +64,6 @@ export interface EventLogDataGrid { onChangeItemsPerPage: (pageSize: number) => void; onChangePage: (pageIndex: number) => void; onFlyoutOpen?: (runLog: IExecutionLog) => void; - onRuleNameClick?: (ruleId: string) => void; setVisibleColumns: (visibleColumns: string[]) => void; setSortingColumns: (sortingColumns: EuiDataGridSorting['columns']) => void; } @@ -168,7 +167,6 @@ export const EventLogDataGrid = (props: EventLogDataGrid) => { onChangeItemsPerPage, onChangePage, onFlyoutOpen, - onRuleNameClick, } = props; const { euiTheme } = useEuiTheme(); @@ -345,7 +343,6 @@ export const EventLogDataGrid = (props: EventLogDataGrid) => { ruleId={ruleId} spaceIds={spaceIds} useExecutionStatus={isRuleUsingExecutionStatus} - onRuleNameClick={onRuleNameClick} /> diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/event_log/event_log_list_cell_renderer.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/event_log/event_log_list_cell_renderer.test.tsx index 9618ebdb6b581..32e5c0e83d297 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/event_log/event_log_list_cell_renderer.test.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/event_log/event_log_list_cell_renderer.test.tsx @@ -147,22 +147,4 @@ describe('rule_event_log_list_cell_renderer', () => { window.location = savedLocation; }); - - it('calls onRuleNameClick if the function is provided', () => { - const onRuleNameClick = jest.fn(); - - const wrapper1 = shallow( - - ); - - wrapper1.find(EuiLink).simulate('click'); - - expect(onRuleNameClick).toHaveBeenCalledWith('1'); - }); }); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/event_log/event_log_list_cell_renderer.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/event_log/event_log_list_cell_renderer.tsx index cf1446fc1b5e7..f11c38a9dfe11 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/event_log/event_log_list_cell_renderer.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/common/components/event_log/event_log_list_cell_renderer.tsx @@ -36,7 +36,6 @@ interface EventLogListCellRendererProps { ruleId?: string; spaceIds?: string[]; useExecutionStatus?: boolean; - onRuleNameClick?: (ruleId: string) => void; } export const EventLogListCellRenderer = (props: EventLogListCellRendererProps) => { @@ -48,7 +47,6 @@ export const EventLogListCellRenderer = (props: EventLogListCellRendererProps) = ruleId, spaceIds, useExecutionStatus = true, - onRuleNameClick, } = props; const spacesData = useSpacesData(); const { http } = useKibana().services; @@ -86,21 +84,15 @@ export const EventLogListCellRenderer = (props: EventLogListCellRendererProps) = return ruleRoute; }, [ruleId, ruleOnDifferentSpace, history, activeSpace, http, spaceIds]); - const onRuleNameClickInternal = useCallback(() => { - if (!ruleId) { - return; - } - if (onRuleNameClick) { - onRuleNameClick(ruleId); - return; - } + const onClickRuleName = useCallback(() => { + if (!ruleId) return; if (ruleOnDifferentSpace) { const newUrl = window.location.href.replace(window.location.pathname, ruleNamePathname); window.open(newUrl, '_blank'); return; } history.push(ruleNamePathname); - }, [ruleNamePathname, history, ruleOnDifferentSpace, ruleId, onRuleNameClick]); + }, [ruleNamePathname, history, ruleOnDifferentSpace, ruleId]); if (typeof value === 'undefined') { return null; @@ -121,7 +113,7 @@ export const EventLogListCellRenderer = (props: EventLogListCellRendererProps) = if (columnId === 'rule_name' && ruleId) { return ( - + {value} ); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/global_rule_event_log_list.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/global_rule_event_log_list.tsx index 4e3e49c15df66..bb939e3e26180 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/global_rule_event_log_list.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/global_rule_event_log_list.tsx @@ -16,7 +16,6 @@ export interface GlobalRuleEventLogListProps { setHeaderActions?: RuleEventLogListCommonProps['setHeaderActions']; localStorageKey?: RuleEventLogListCommonProps['localStorageKey']; filteredRuleTypes?: RuleEventLogListCommonProps['filteredRuleTypes']; - onRuleNameClick?: RuleEventLogListCommonProps['onRuleNameClick']; } const GLOBAL_EVENT_LOG_LIST_STORAGE_KEY = @@ -32,7 +31,7 @@ const REFRESH_TOKEN = { }; export const GlobalRuleEventLogList = (props: GlobalRuleEventLogListProps) => { - const { setHeaderActions, localStorageKey, filteredRuleTypes, onRuleNameClick } = props; + const { setHeaderActions, localStorageKey, filteredRuleTypes } = props; const { spaces } = useKibana().services; // eslint-disable-next-line react-hooks/exhaustive-deps @@ -52,7 +51,6 @@ export const GlobalRuleEventLogList = (props: GlobalRuleEventLogListProps) => { localStorageKey={localStorageKey || GLOBAL_EVENT_LOG_LIST_STORAGE_KEY} filteredRuleTypes={filteredRuleTypes} setHeaderActions={setHeaderActions} - onRuleNameClick={onRuleNameClick} /> ); diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_table.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_table.tsx index cf5fc82b42624..32db0a686bff5 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_table.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/rule_details/components/rule_event_log_list_table.tsx @@ -95,7 +95,6 @@ export interface RuleEventLogListCommonProps { hasAllSpaceSwitch?: boolean; filteredRuleTypes?: string[]; setHeaderActions?: (components?: React.ReactNode[]) => void; - onRuleNameClick?: (ruleId: string) => void; } export type RuleEventLogListTableProps = @@ -117,7 +116,6 @@ export const RuleEventLogListTable = ( hasAllSpaceSwitch = false, setHeaderActions, filteredRuleTypes, - onRuleNameClick, } = props; const { uiSettings, notifications } = useKibana().services; @@ -629,7 +627,6 @@ export const RuleEventLogListTable = ( onChangeItemsPerPage={onChangeItemsPerPage} onChangePage={onChangePage} onFlyoutOpen={onFlyoutOpen} - onRuleNameClick={onRuleNameClick} setVisibleColumns={setVisibleColumns} setSortingColumns={setSortingColumns} />