Skip to content

Commit

Permalink
MAT-7989 display library versions in descending order
Browse files Browse the repository at this point in the history
  • Loading branch information
sb-prateekkeerthi committed Dec 4, 2024
1 parent 8d99200 commit 970c76a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/CqlBuilderPanel/Includes/CqlLibraryDetailsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,17 +143,18 @@ const CqlLibraryDetailsDialog = ({
}}
size="small"
onChange={(evt) => handleVersionChange(evt.target.value)}
options={library?.otherVersions?.map((version) => {
return (
options={library?.otherVersions
?.filter((version) => /^\d+(\.\d+)*$/.test(version)) // filtering valid version strings
.sort((a, b) => b.localeCompare(a, undefined, { numeric: true })) // sort in descending numeric order
.map((version) => (
<MenuItem
key={version}
value={version}
data-testid={`option-${version}`}
>
{version}
</MenuItem>
);
})}
))}
/>
);
} else {
Expand Down

0 comments on commit 970c76a

Please sign in to comment.