Skip to content

Commit

Permalink
[Security Solution][Detections] Assignees shown as Unknown in Timelin…
Browse files Browse the repository at this point in the history
…es (#8028)
  • Loading branch information
e40pud committed Nov 13, 2023
1 parent 6be8d31 commit 2f0911b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ import type { TimelineNonEcsData } from '../../../../../../common/search_strateg
import type { RenderCellValueContext } from '../../../../../detections/configurations/security_solution_detections/fetch_page_context';

export interface ColumnRenderer {
isInstance: (columnName: string, data: TimelineNonEcsData[]) => boolean;
isInstance: (
columnName: string,
data: TimelineNonEcsData[],
context?: RenderCellValueContext
) => boolean;
renderColumn: ({
className,
columnName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

import type { RenderCellValueContext } from '../../../../../detections/configurations/security_solution_detections/fetch_page_context';
import type { TimelineNonEcsData } from '../../../../../../common/search_strategy/timeline';
import type { ColumnRenderer } from './column_renderer';

Expand All @@ -15,10 +16,11 @@ const unhandledColumnRenderer = (): never => {
export const getColumnRenderer = (
columnName: string,
columnRenderers: ColumnRenderer[],
data: TimelineNonEcsData[]
data: TimelineNonEcsData[],
context?: RenderCellValueContext
): ColumnRenderer => {
const renderer = columnRenderers.find((columnRenderer) =>
columnRenderer.isInstance(columnName, data)
columnRenderer.isInstance(columnName, data, context)
);
return renderer != null ? renderer : unhandledColumnRenderer();
};
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { profileUidColumns } from '../../../../../detections/configurations/secu
import type { RenderCellValueContext } from '../../../../../detections/configurations/security_solution_detections/fetch_page_context';

export const userProfileColumnRenderer: ColumnRenderer = {
isInstance: (columnName) => profileUidColumns.includes(columnName),
isInstance: (columnName, _, context) => profileUidColumns.includes(columnName) && !!context,
renderColumn: ({
columnName,
ecsData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const DefaultCellRenderer: React.FC<CellValueElementProps> = ({
: 'eui-displayInlineBlock eui-textTruncate';
return (
<StyledContent className={styledContentClassName} $isDetails={isDetails}>
{getColumnRenderer(header.id, columnRenderers, data).renderColumn({
{getColumnRenderer(header.id, columnRenderers, data, context).renderColumn({
asPlainText: asPlainText ?? asPlainTextDefault, // we want to render value with links as plain text but keep other formatters like badge. Except rule name for non preview tables
columnName: header.id,
ecsData,
Expand Down

0 comments on commit 2f0911b

Please sign in to comment.