Skip to content

Commit

Permalink
Set default view by default
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Lamparelli <[email protected]>
  • Loading branch information
lampajr committed Oct 21, 2024
1 parent d2fbf0f commit 96d0c44
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion horreum-web/src/components/LabelFilter/FilterDropDown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default function FilterDropDown(props: FilterDropDownProps) {
>
<MenuContent>
<MenuList>
{props.options.map((option) => <MenuItem itemId={option}>{option}</MenuItem>)}
{props.options.map((option, idx) => <MenuItem itemId={option} key={option + idx}>{option}</MenuItem>)}
</MenuList>
</MenuContent>
</Menu>
Expand Down
1 change: 1 addition & 0 deletions horreum-web/src/components/LabelFilter/LabelFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export default function LabelFilter({selection, onSelect, source, emptyPlacehold
return (

<ToolbarLabelFilter
key={key}
name={key}
options={opts}
filter={selection}
Expand Down
6 changes: 3 additions & 3 deletions horreum-web/src/components/LabelFilter/LabelFilterOption.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ export default function LabelFilterOption(props: FilterOptionProps) {
const menu = (
<Menu ref={menuRef} id="attribute-search-{props.name}-menu" onSelect={onSelect} selected={props.selection}>
<MenuContent>
<MenuList>
<MenuList key={props.name}>
{
props.options.map((option) => (
<MenuItem isSelected={props.selection === option} itemId={option} key={option}>
props.options.map((option, idx) =>(
<MenuItem isSelected={props.selection === option} itemId={option} key={option + idx}>
{option}
</MenuItem>
))
Expand Down
9 changes: 5 additions & 4 deletions horreum-web/src/domain/runs/TestDatasets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ import { teamsSelector, teamToName, tokenSelector } from "../../auth"

import {
CellProps,
UseTableOptions,
UseRowSelectInstanceProps,
UseRowSelectRowProps,
Column,
UseSortByColumnOptions,
SortingRule,
Expand Down Expand Up @@ -130,7 +127,11 @@ export default function TestDatasets() {
useEffect(() => {
fetchTest(testIdInt, alerting)
.then(setTest)
.then(() => fetchViews(testIdInt, alerting).then(setViews))
.then(() => fetchViews(testIdInt, alerting).then(res => {
setViewId(res?.find(v => v.name.toLowerCase() === "default")?.id || -1)
return res
}).then(setViews)
)
}, [testIdInt, teams, token])

useEffect(() => {
Expand Down

0 comments on commit 96d0c44

Please sign in to comment.