Skip to content

Commit

Permalink
CR feedback - Tim
Browse files Browse the repository at this point in the history
  • Loading branch information
jamie-rasmussen committed Oct 2, 2024
1 parent c47e99e commit bcf95d7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,13 @@ export const CallSchemaLink = ({call}: {call: CallSchema}) => {
);
};

const SHOWN_COLS = ['op_name', 'status', 'inputs.*', 'output', 'output.*'];
const ALLOWED_COLUMN_PATTERNS = [
'op_name',
'status',
'inputs.*',
'output',
'output.*',
];

export const CallDetails: FC<{
call: CallSchema;
Expand Down Expand Up @@ -178,7 +184,7 @@ export const CallDetails: FC<{
}}
entity={call.entity}
project={call.project}
shownCols={SHOWN_COLS}
allowedColumnPatterns={ALLOWED_COLUMN_PATTERNS}
/>
);
if (isPeeking) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export const CallsTable: FC<{
setPaginationModel?: (newModel: GridPaginationModel) => void;

// Can include glob for prefix match, e.g. "inputs.*"
shownCols?: string[];
allowedColumnPatterns?: string[];
}> = ({
entity,
project,
Expand All @@ -161,7 +161,7 @@ export const CallsTable: FC<{
setSortModel,
paginationModel,
setPaginationModel,
shownCols,
allowedColumnPatterns,
}) => {
const {loading: loadingUserInfo, userInfo} = useViewerInfo();

Expand Down Expand Up @@ -307,7 +307,7 @@ export const CallsTable: FC<{
onCollapse,
onExpand,
columnIsRefExpanded,
shownCols,
allowedColumnPatterns,
onAddFilter
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const useCallsTableColumns = (
onCollapse: (col: string) => void,
onExpand: (col: string) => void,
columnIsRefExpanded: (col: string) => boolean,
shownCols?: string[],
allowedColumnPatterns?: string[],
onAddFilter?: (field: string, operator: string | null, value: any) => void
) => {
const [userDefinedColumnWidths, setUserDefinedColumnWidths] = useState<
Expand Down Expand Up @@ -130,7 +130,7 @@ export const useCallsTableColumns = (
onExpand,
columnIsRefExpanded,
userDefinedColumnWidths,
shownCols,
allowedColumnPatterns,
onAddFilter
),
[
Expand All @@ -146,7 +146,7 @@ export const useCallsTableColumns = (
onExpand,
columnIsRefExpanded,
userDefinedColumnWidths,
shownCols,
allowedColumnPatterns,
onAddFilter,
]
);
Expand All @@ -171,7 +171,7 @@ function buildCallsTableColumns(
onExpand: (col: string) => void,
columnIsRefExpanded: (col: string) => boolean,
userDefinedColumnWidths: Record<string, number>,
shownCols?: string[],
allowedColumnPatterns?: string[],
onAddFilter?: (field: string, operator: string | null, value: any) => void
): {
cols: Array<GridColDef<TraceCallSchema>>;
Expand Down Expand Up @@ -455,8 +455,8 @@ function buildCallsTableColumns(
// TODO: It would be better to build up the cols rather than throwing away
// some at the end, but making simpler change for now.
let orderedCols = cols;
if (shownCols !== undefined) {
orderedCols = shownCols.flatMap(shownCol => {
if (allowedColumnPatterns !== undefined) {
orderedCols = allowedColumnPatterns.flatMap(shownCol => {
if (shownCol.includes('*')) {
const regex = new RegExp('^' + shownCol.replace('*', '.*') + '$');
return cols.filter(col => regex.test(col.field));
Expand Down

0 comments on commit bcf95d7

Please sign in to comment.