-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[SIEM] Add react/display-name eslint rule #53107
Changes from 5 commits
2f04edc
4af9fd6
bc1f53d
1385da5
6321638
a295ce0
c2d48f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,33 +51,35 @@ const defaultAlertsFilters: esFilters.Filter[] = [ | |
}, | ||
]; | ||
|
||
export const AlertsTable = React.memo( | ||
({ | ||
endDate, | ||
startDate, | ||
pageFilters = [], | ||
}: { | ||
endDate: number; | ||
startDate: number; | ||
pageFilters?: esFilters.Filter[]; | ||
}) => { | ||
const alertsFilter = useMemo(() => [...defaultAlertsFilters, ...pageFilters], [pageFilters]); | ||
return ( | ||
<StatefulEventsViewer | ||
pageFilters={alertsFilter} | ||
defaultModel={alertsDefaultModel} | ||
end={endDate} | ||
id={ALERTS_TABLE_ID} | ||
start={startDate} | ||
timelineTypeContext={useMemo( | ||
() => ({ | ||
documentType: i18n.ALERTS_DOCUMENT_TYPE, | ||
footerText: i18n.TOTAL_COUNT_OF_ALERTS, | ||
title: i18n.ALERTS_TABLE_TITLE, | ||
}), | ||
[] | ||
)} | ||
/> | ||
); | ||
} | ||
); | ||
interface Props { | ||
endDate: number; | ||
startDate: number; | ||
pageFilters?: esFilters.Filter[]; | ||
} | ||
|
||
const AlertsTableComponent: React.FC<Props> = ({ endDate, startDate, pageFilters = [] }) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the intent of creating this intermediary There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahhh, perfect, that's what I was wondering! 🙂 For anyone passing through, @patrykkopycinski outlines this behavior in https://github.com/elastic/siem-team/issues/485. |
||
const alertsFilter = useMemo(() => [...defaultAlertsFilters, ...pageFilters], [pageFilters]); | ||
return ( | ||
<StatefulEventsViewer | ||
pageFilters={alertsFilter} | ||
defaultModel={alertsDefaultModel} | ||
end={endDate} | ||
id={ALERTS_TABLE_ID} | ||
start={startDate} | ||
timelineTypeContext={useMemo( | ||
() => ({ | ||
documentType: i18n.ALERTS_DOCUMENT_TYPE, | ||
footerText: i18n.TOTAL_COUNT_OF_ALERTS, | ||
title: i18n.ALERTS_TABLE_TITLE, | ||
}), | ||
[] | ||
)} | ||
/> | ||
); | ||
}; | ||
|
||
AlertsTableComponent.displayName = 'AlertsTableComponent'; | ||
|
||
export const AlertsTable = React.memo(AlertsTableComponent); | ||
|
||
AlertsTable.displayName = 'AlertsTable'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -237,3 +237,5 @@ export const FieldsBrowser = React.memo<Props>( | |
); | ||
} | ||
); | ||
|
||
FieldsBrowser.displayName = 'FieldsBrowser'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ | |
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
/* eslint-disable react/display-name */ | ||
|
||
Comment on lines
+7
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just noting the consistency of naming our connected components. Seems it's hit or miss on if we set the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. with react-redux@7 we will be able to migrate from |
||
import { has } from 'lodash/fp'; | ||
import React, { useCallback } from 'react'; | ||
import { connect } from 'react-redux'; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May want to add a comment here as to why this is being disabled -- when I added
displayName
's for the below three components (AppPluginRoot
,StartApp
, andSiemApp
) they were not being shown in the react dev tools Component tree, so I assume this is the reason?