Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
146dce6
Show unreachable, enabled peers
IR96334 Dec 1, 2025
4960888
Merge branch 'main' into BAI-2124-display-unreachable-peers
IR96334 Dec 1, 2025
cff728b
Fixed problem from possible type mixing
IR96334 Dec 3, 2025
d725105
Bump the mui-stack group in /lib/landing with 2 updates
dependabot[bot] Dec 1, 2025
cdce487
Fix build issues
PE39806 Dec 1, 2025
5a59926
Correct style
PE39806 Dec 1, 2025
fd33134
Bump express from 5.1.0 to 5.2.1 in /backend
dependabot[bot] Dec 1, 2025
814c39c
Bump mdast-util-to-hast from 13.2.0 to 13.2.1 in /frontend
dependabot[bot] Dec 2, 2025
82c4bd4
Bump the react-stack group across 1 directory with 3 updates
dependabot[bot] Dec 2, 2025
e267259
Update access request list by schema
GB907762 Dec 1, 2025
f3f2a26
Add minor changes
GB907762 Dec 2, 2025
bf151af
Bump mjml from 5.0.0-alpha.6 to 5.0.0-alpha.8 in /backend
dependabot[bot] Dec 1, 2025
8a8fbef
Fix backend package-lock
PE39806 Dec 1, 2025
5183256
merge conflicts
IR96334 Dec 3, 2025
77efa79
Fix colour contrast
GB907762 Dec 2, 2025
ab95139
Mock AbortController in test
PE39806 Dec 1, 2025
f4142aa
Increase test coverage
PE39806 Dec 1, 2025
2f44ab7
Increase test coverage
PE39806 Dec 1, 2025
ad58740
wip, testing using an extra cy.get to make cypress wait until it renders
JRB66955 Dec 1, 2025
5f2c5c9
update with pr feedback, use data-test role instead
JRB66955 Dec 2, 2025
5ae0fda
Optimise model deletion concurrency
PE39806 Dec 1, 2025
53f1e25
fixed build issues with mdx plugins
ARADDCC002 Dec 3, 2025
871cdb0
removed unused imports
ARADDCC002 Dec 3, 2025
614df64
updated import issue
ARADDCC002 Dec 3, 2025
5c37088
fixed styling issue with tsconfig
ARADDCC002 Dec 3, 2025
12491b0
Comments as per PR
IR96334 Dec 3, 2025
f73c5f4
Merge branch 'main' into BAI-2124-display-unreachable-peers
IR96334 Dec 3, 2025
a7c698c
eslint issues
IR96334 Dec 3, 2025
8234c2d
Removed options having two possible types
IR96334 Dec 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 0 additions & 72 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 0 additions & 18 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions frontend/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import MultipleErrorWrapper from 'src/errors/MultipleErrorWrapper'
import useDebounce from 'src/hooks/useDebounce'
import EntryList from 'src/marketplace/EntryList'
import { EntryKind, EntryKindKeys } from 'types/types'
import { isReachable } from 'utils/peerUtils'
import { isEnabled, isReachable } from 'utils/peerUtils'

interface KeyAndLabel {
key: string
Expand Down Expand Up @@ -196,10 +196,10 @@ export default function Marketplace() {
[roleOptions],
)

const reachablePeerList = useMemo(() => {
const unreachablePeerList: string[] = useMemo(() => {
if (!peers) return []
return Array.from(peers.entries())
.filter(([, value]) => isReachable(value))
.filter(([, value]) => isEnabled(value) && !isReachable(value))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor, but I think we should change it to [_key, value]. Seems more readable to me personally.

.map(([key]) => key)
}, [peers])

Expand Down Expand Up @@ -395,12 +395,13 @@ export default function Marketplace() {
/>
</Box>
)}
{federationEnabled && reachablePeerList && reachablePeerList.length > 0 && (
{federationEnabled && peers && Array.from(peers.keys()).length > 0 && (
<Box>
<ChipSelector
label='External Repositories'
chipTooltipTitle={'Include external repostories'}
options={reachablePeerList}
options={Array.from(peers.keys())}
unreachableOptions={unreachablePeerList}
expandThreshold={10}
multiple
selectedChips={selectedPeers}
Expand Down
37 changes: 24 additions & 13 deletions frontend/src/common/ChipSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ type PartialChipSelectorProps =
| {
multiple: true
options: string[]
unreachableOptions?: string[]
selectedChips: string[]
onChange: (value: string[]) => void
}
| {
multiple?: false
options: string[]
unreachableOptions?: string[]
selectedChips: string
onChange: (value: string) => void
}
Expand All @@ -34,6 +36,7 @@ type ChipSelectorProps = {
export default function ChipSelector({
label,
options,
unreachableOptions,
onChange,
selectedChips,
multiple,
Expand Down Expand Up @@ -71,11 +74,14 @@ export default function ChipSelector({
size={size}
activeChip={selectedChips.includes(option)}
handleChange={handleChange}
chipTooltipTitle={chipTooltipTitle}
chipTooltipTitle={
unreachableOptions && !unreachableOptions.includes(option) ? chipTooltipTitle : 'This is unreachable.'
}
ariaLabel={ariaLabel}
variant={variant}
icon={icon}
style={style}
disabled={unreachableOptions && unreachableOptions.includes(option)}
/>
))

Expand Down Expand Up @@ -127,6 +133,7 @@ type ChipItemProps = {
variant?: 'filled' | 'outlined'
icon?: ReactElement
style?: CSSProperties
disabled?: boolean
}

function ChipItem({
Expand All @@ -139,21 +146,25 @@ function ChipItem({
variant = 'filled',
icon = <></>,
style = {},
disabled = false,
}: ChipItemProps) {
return (
<Tooltip title={chipTooltipTitle}>
<Chip
color={activeChip ? 'secondary' : 'default'}
size={size}
key={chip}
sx={{ mx: 0.5, mb: 1, ...style }}
label={chip}
data-test={`chipOption-${chip}`}
onClick={() => handleChange(chip)}
aria-label={ariaLabel}
variant={variant}
icon={icon}
/>
<span>
<Chip
color={activeChip ? 'secondary' : 'default'}
size={size}
key={chip}
sx={{ mx: 0.5, mb: 1, ...style }}
label={chip}
data-test={`chipOption-${chip}`}
onClick={() => handleChange(chip)}
aria-label={ariaLabel}
variant={variant}
icon={icon}
disabled={disabled}
/>
</span>
</Tooltip>
)
}
13 changes: 11 additions & 2 deletions frontend/utils/peerUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,21 @@ export function getEntryUrl(peer: RemoteFederationConfig, entry: EntrySearchResu
}
}

/**
*
* @param peer to check
* @returns true if enabled/readOnly
*/
export function isEnabled(peer: PeerConfigStatus): boolean {
return peer.config.state !== 'disabled'
}

/**
* Given a peer's configuration status, is it reachable?
*
* @param peer to check
* @returns true if enabled/readOnly and successfully pinged
* @returns true if successfully pinged
*/
export function isReachable(peer: PeerConfigStatus): boolean {
return peer.config.state !== 'disabled' && !peer.status.error && peer.status.ping === 'pong'
return !peer.status.error && peer.status.ping === 'pong'
}
Loading