Skip to content

Commit

Permalink
Merge branch 'master' into sendToGitHub/rename-within-lookoutui
Browse files Browse the repository at this point in the history
  • Loading branch information
eleanorpratt authored Feb 13, 2025
2 parents dff1ec2 + d609c3c commit c0ee47d
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions internal/lookoutui/src/utils/jobsTableUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ExpandedStateList, Updater } from "@tanstack/react-table"
import _ from "lodash"

import {
ANNOTATION_COLUMN_PREFIX,
AnnotationColumnId,
DEFAULT_COLUMN_MATCHES,
fromAnnotationColId,
Expand Down Expand Up @@ -48,16 +49,25 @@ export const pendingDataForAllVisibleData = (
}

export const matchForColumn = (columnId: string, columnMatches: Record<string, Match>) => {
let match: Match = Match.StartsWith // base case if undefined (annotations)
let match: Match = Match.Exact // base case
if (columnId in DEFAULT_COLUMN_MATCHES) {
match = DEFAULT_COLUMN_MATCHES[columnId]
}
if (columnId in columnMatches) {
match = VALID_COLUMN_MATCHES[columnId].includes(columnMatches[columnId])
? columnMatches[columnId]
: VALID_COLUMN_MATCHES[columnId][0]

if (!(columnId in columnMatches)) {
return match
}
return match

const validMatches = isStandardColId(columnId)
? VALID_COLUMN_MATCHES[columnId]
: VALID_COLUMN_MATCHES[ANNOTATION_COLUMN_PREFIX]

if (!validMatches) {
console.error(`There are no valid column matches for column with ID '${columnId}'`)
return match
}

return validMatches.includes(columnMatches[columnId]) ? columnMatches[columnId] : validMatches[0]
}

export function getFiltersForRows(
Expand Down

0 comments on commit c0ee47d

Please sign in to comment.