Skip to content

Commit

Permalink
filter issues based on key and summary
Browse files Browse the repository at this point in the history
  • Loading branch information
kurukimi committed Jun 12, 2024
1 parent cba8a67 commit 26d8179
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions web/src/components/entry-dialog/DimensionComboBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ const DimensionComboBox = <T extends FieldValues>({
const issuesEnabled = name === "issue" && !loading;
const { data: issueData } = useGetIssues(options, issuesEnabled);
const keyToSummary = issueData ? issueKeyToSummary(issueData) : {};
const getOptionText = (option: string) =>
keyToSummary[option] ? `${option}: ${keyToSummary[option]}` : option;

return (
<Grid item xs={12} md={6}>
Expand All @@ -39,12 +41,16 @@ const DimensionComboBox = <T extends FieldValues>({
onChange={(_, value) => onChange(value)}
options={options}
renderOption={(props, option) => {
return (
<li {...props}>
{keyToSummary[option] ? `${option}: ${keyToSummary[option]}` : option}
</li>
);
return <li {...props}>{getOptionText(option)}</li>;
}}
filterOptions={(options, state) =>
options.filter((option) =>
getOptionText(option)
.toLowerCase()
.trim()
.includes(state.inputValue.toLowerCase().trim()),
)
}
autoHighlight
renderInput={(params) => (
<TextField
Expand Down

0 comments on commit 26d8179

Please sign in to comment.