Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Commit

Permalink
Use simplified power search config
Browse files Browse the repository at this point in the history
Summary: this gets the latest contains any of operators and is less code

Reviewed By: lblasa

Differential Revision: D52079498

fbshipit-source-id: 1e8bc68019736a376898e15fbb148b9c6ba1dc98
  • Loading branch information
Luke De Feo authored and facebook-github-bot committed Dec 14, 2023
1 parent 90fb76c commit 8d4623b
Showing 1 changed file with 6 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export function FrameworkEventsTable({
({
key: `payload.${customKey}` as any,
title: startCase(customKey),
powerSearchConfig: stringConfig,
powerSearchConfig: {type: 'string'},
} as DataTableColumn<AugmentedFrameworkEvent>),
);

Expand Down Expand Up @@ -159,18 +159,8 @@ const MonoSpace = (t: any) => (
<span style={{fontFamily: 'monospace'}}>{t}</span>
);

const stringConfig = [
dataTablePowerSearchOperators.string_contains(),
dataTablePowerSearchOperators.string_not_contains(),
dataTablePowerSearchOperators.string_matches_exactly(),
];
const idConfig = [dataTablePowerSearchOperators.int_equals()];

const inferredEnum = [
dataTablePowerSearchOperators.enum_set_is_any_of({}),
dataTablePowerSearchOperators.enum_set_is_none_of({}),
];

const staticColumns: DataTableColumn<AugmentedFrameworkEvent>[] = [
{
key: 'timestamp',
Expand All @@ -188,25 +178,15 @@ const staticColumns: DataTableColumn<AugmentedFrameworkEvent>[] = [
key: 'type',
title: 'Event type',
onRender: (row: FrameworkEvent) => eventTypeToName(row.type),
powerSearchConfig: {
inferEnumOptionsFromData: true,
operators: inferredEnum,
},
powerSearchConfig: {type: 'enum', inferEnumOptionsFromData: true},
},
{
key: 'duration',
title: 'Duration (Nanos)',
onRender: (row: FrameworkEvent) =>
row.duration != null ? formatDuration(row.duration) : null,
formatters: MonoSpace,

powerSearchConfig: [
dataTablePowerSearchOperators.int_greater_or_equal(),
dataTablePowerSearchOperators.int_greater_than(),
dataTablePowerSearchOperators.int_equals(),
dataTablePowerSearchOperators.int_less_or_equal(),
dataTablePowerSearchOperators.int_less_than(),
],
powerSearchConfig: {type: 'int'},
},
{
key: 'treeId',
Expand All @@ -218,7 +198,7 @@ const staticColumns: DataTableColumn<AugmentedFrameworkEvent>[] = [
{
key: 'rootComponentName',
title: 'Root component name',
powerSearchConfig: stringConfig,
powerSearchConfig: {type: 'string'},
formatters: MonoSpace,
},
{
Expand All @@ -230,14 +210,14 @@ const staticColumns: DataTableColumn<AugmentedFrameworkEvent>[] = [
{
key: 'nodeName',
title: 'Component name',
powerSearchConfig: stringConfig,
powerSearchConfig: {type: 'string'},
formatters: MonoSpace,
},
{
key: 'thread',
title: 'Thread',
onRender: (row: FrameworkEvent) => startCase(row.thread),
powerSearchConfig: stringConfig,
powerSearchConfig: {type: 'enum', inferEnumOptionsFromData: true},
formatters: MonoSpace,
},
];

0 comments on commit 8d4623b

Please sign in to comment.