Skip to content

Commit

Permalink
Merge pull request #88 from smartcontractkit/ggoh/OPCORE-948/required…
Browse files Browse the repository at this point in the history
…-peerid-bootstrap

[OPCORE-948]: fix(chain): peerId is available for bootstrap
  • Loading branch information
graham-chainlink authored Sep 16, 2024
2 parents f55d4fd + be9296b commit b940c8d
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 34 deletions.
5 changes: 5 additions & 0 deletions .changeset/cyan-kids-boil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@smartcontractkit/operator-ui': minor
---

Peer ID field is introduced when Node is running as bootstrap peer
4 changes: 4 additions & 0 deletions src/components/Form/ChainConfigurationForm.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,5 +180,9 @@ describe('ChainConfigurationForm', () => {
expect(await findByTestId('ocr2Multiaddr-helper-text')).toHaveTextContent(
'Required',
)

expect(
await findByTestId('ocr2P2PPeerID-helper-text'),
).not.toHaveTextContent('Required')
})
})
47 changes: 22 additions & 25 deletions src/components/Form/ChainConfigurationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,28 @@ export const ChainConfigurationForm = withStyles(styles)(
/>
</Grid>

<Grid item xs={12} md={6}>
<Field
component={TextField}
id="ocr2P2PPeerID"
name="ocr2P2PPeerID"
label="Peer ID"
select
required={!values.ocr2IsBootstrap}
fullWidth
helperText="The Peer ID used for this chain"
FormHelperTextProps={{
'data-testid': 'ocr2P2PPeerID-helper-text',
}}
>
{p2pKeys.map((key) => (
<MenuItem key={key.peerID} value={key.peerID}>
{key.peerID}
</MenuItem>
))}
</Field>
</Grid>

{values.ocr2IsBootstrap ? (
<Grid item xs={12}>
<Field
Expand All @@ -476,31 +498,6 @@ export const ChainConfigurationForm = withStyles(styles)(
</Grid>
) : (
<>
<Grid item xs={12} md={6}>
<Field
component={TextField}
id="ocr2P2PPeerID"
name="ocr2P2PPeerID"
label="Peer ID"
select
required
fullWidth
helperText="The Peer ID used for this chain"
FormHelperTextProps={{
'data-testid': 'ocr2P2PPeerID-helper-text',
}}
>
{p2pKeys.map((key) => (
<MenuItem
key={key.peerID}
value={key.peerID}
>
{key.peerID}
</MenuItem>
))}
</Field>
</Grid>

<Grid item xs={12} md={6}>
<Field
component={TextField}
Expand Down
27 changes: 18 additions & 9 deletions src/screens/FeedsManager/SupportedChainsCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,19 @@ const renderBootstrap = (
| FeedsManager_ChainConfigFields['ocr2JobConfig']
| FeedsManager_ChainConfigFields['ocr1JobConfig'],
) => (
<Grid item xs={12} sm={1} md={5}>
<DetailsCardItemTitle title="Multiaddr" />
<DetailsCardItemValue value={cfg.multiaddr} />
</Grid>
<>
<Grid item xs={12} md={5}>
<DetailsCardItemTitle title="Multiaddr" />
<DetailsCardItemValue value={cfg.multiaddr} />
</Grid>

{cfg.__typename === 'OCR2JobConfig' && (
<Grid item xs={12} md={5}>
<DetailsCardItemTitle title="P2P Peer ID" />
<DetailsCardItemValue value={cfg.p2pPeerID} />
</Grid>
)}
</>
)

const renderOracle = (
Expand All @@ -158,11 +167,11 @@ const renderOracle = (
| FeedsManager_ChainConfigFields['ocr1JobConfig'],
) => (
<>
<Grid item xs={12} sm={1} md={5}>
<Grid item xs={12} md={5}>
<DetailsCardItemTitle title="P2P Peer ID" />
<DetailsCardItemValue value={cfg.p2pPeerID} />
</Grid>
<Grid item xs={12} sm={1} md={5}>
<Grid item xs={12} md={5}>
<DetailsCardItemTitle title="OCR Key ID" />
<DetailsCardItemValue value={cfg.keyBundleID} />
</Grid>
Expand Down Expand Up @@ -196,7 +205,7 @@ const FluxMonitorJobTypeRow = withStyles(styles)(
}

return (
<Grid item xs={12} sm={1} md={12}>
<Grid item xs={12} md={12}>
<div className={classes.jobTypeContainer}>
<DetailsCardItemTitle title="Job Type" />
<DetailsCardItemValue value="Flux Monitor" />
Expand All @@ -218,7 +227,7 @@ const OCRJobTypeRow = withStyles(styles)(

return (
<>
<Grid item xs={12} sm={1} md={2}>
<Grid item xs={12} md={2}>
<div className={classes.jobTypeContainer}>
<DetailsCardItemTitle title="Job Type" />
<DetailsCardItemValue
Expand All @@ -245,7 +254,7 @@ const OCR2JobTypeRow = withStyles(styles)(

return (
<>
<Grid item xs={12} sm={1} md={2}>
<Grid item xs={12} md={2}>
<div className={classes.jobTypeContainer}>
<DetailsCardItemTitle title="Job Type" />
<DetailsCardItemValue
Expand Down

0 comments on commit b940c8d

Please sign in to comment.