Skip to content

Commit

Permalink
Merge pull request #37 from smartcontractkit/add-supported-plugins-to…
Browse files Browse the repository at this point in the history
…-fms-ocr2-chain-configs

Add more options to the OCR2 plugin selection for FMS
  • Loading branch information
jkongie authored Mar 30, 2023
2 parents 1c7d170 + 21b9c41 commit 7aebc6f
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/early-chefs-stare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@smartcontractkit/operator-ui': patch
---

Add more options to the OCR2 plugin selection for FMS
9 changes: 9 additions & 0 deletions src/components/Form/ChainConfigurationForm.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ describe('ChainConfigurationForm', () => {
ocr2Multiaddr: '',
ocr2P2PPeerID: '',
ocr2KeyBundleID: '',
ocr2CommitPluginEnabled: false,
ocr2ExecutePluginEnabled: false,
ocr2MedianPluginEnabled: false,
ocr2MercuryPluginEnabled: false,
}

render(
Expand Down Expand Up @@ -73,7 +76,10 @@ describe('ChainConfigurationForm', () => {
ocr2Multiaddr: '',
ocr2P2PPeerID: '',
ocr2KeyBundleID: '',
ocr2CommitPluginEnabled: false,
ocr2ExecutePluginEnabled: false,
ocr2MedianPluginEnabled: false,
ocr2MercuryPluginEnabled: false,
}

render(
Expand Down Expand Up @@ -128,7 +134,10 @@ describe('ChainConfigurationForm', () => {
ocr2Multiaddr: '',
ocr2P2PPeerID: '',
ocr2KeyBundleID: '',
ocr2CommitPluginEnabled: false,
ocr2ExecutePluginEnabled: false,
ocr2MedianPluginEnabled: false,
ocr2MercuryPluginEnabled: false,
}

render(
Expand Down
38 changes: 37 additions & 1 deletion src/components/Form/ChainConfigurationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ export type FormValues = {
ocr2Multiaddr?: string | null
ocr2P2PPeerID?: string | null
ocr2KeyBundleID?: string | null
ocr2CommitPluginEnabled: boolean
ocr2ExecutePluginEnabled: boolean
ocr2MedianPluginEnabled: boolean
ocr2MercuryPluginEnabled: boolean
}

const ValidationSchema = Yup.object().shape({
Expand Down Expand Up @@ -82,7 +85,10 @@ const ValidationSchema = Yup.object().shape({
then: Yup.string().required('Required').nullable(),
})
.nullable(),
ocr2CommitPluginEnabled: Yup.boolean().required('Required'),
ocr2ExecutePluginEnabled: Yup.boolean().required('Required'),
ocr2MedianPluginEnabled: Yup.boolean().required('Required'),
ocr2MercuryPluginEnabled: Yup.boolean().required('Required'),
})

const styles = (theme: Theme) => {
Expand Down Expand Up @@ -436,7 +442,27 @@ export const ChainConfigurationForm = withStyles(styles)(
<Typography>Supported Plugins</Typography>
</Grid>

<Grid item xs={12}>
<Grid item xs={6}>
<Field
component={CheckboxWithLabel}
name="ocr2CommitPluginEnabled"
type="checkbox"
Label={{
label: 'Commit',
}}
/>
</Grid>
<Grid item xs={6}>
<Field
component={CheckboxWithLabel}
name="ocr2ExecutePluginEnabled"
type="checkbox"
Label={{
label: 'Execute',
}}
/>
</Grid>
<Grid item xs={6}>
<Field
component={CheckboxWithLabel}
name="ocr2MedianPluginEnabled"
Expand All @@ -446,6 +472,16 @@ export const ChainConfigurationForm = withStyles(styles)(
}}
/>
</Grid>
<Grid item xs={6}>
<Field
component={CheckboxWithLabel}
name="ocr2MercuryPluginEnabled"
type="checkbox"
Label={{
label: 'Mercury',
}}
/>
</Grid>
</>

)}
Expand Down
3 changes: 3 additions & 0 deletions src/hooks/queries/useFeedsManagersWithProposalsQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ const FEEDS_MANAGER__CHAIN_CONFIG_FIELDS = gql`
p2pPeerID
keyBundleID
plugins {
commit
execute
median
mercury
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/screens/FeedsManager/EditSupportedChainDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ export const EditSupportedChainDialog = ({
ocr2Multiaddr: cfg.ocr2JobConfig.multiaddr,
ocr2P2PPeerID: cfg.ocr2JobConfig.p2pPeerID,
ocr2KeyBundleID: cfg.ocr2JobConfig.keyBundleID,
ocr2CommitPluginEnabled: cfg.ocr2JobConfig.plugins.commit,
ocr2ExecutePluginEnabled: cfg.ocr2JobConfig.plugins.execute,
ocr2MedianPluginEnabled: cfg.ocr2JobConfig.plugins.median,
ocr2MercuryPluginEnabled: cfg.ocr2JobConfig.plugins.mercury,
}

const chainIDs: string[] = chainData
Expand Down
3 changes: 3 additions & 0 deletions src/screens/FeedsManager/NewSupportedChainDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ export const NewSupportedChainDialog = ({ onClose, open, onSubmit }: Props) => {
ocr2Multiaddr: '',
ocr2P2PPeerID: '',
ocr2KeyBundleID: '',
ocr2CommitPluginEnabled: false,
ocr2ExecutePluginEnabled: false,
ocr2MedianPluginEnabled: false,
ocr2MercuryPluginEnabled: false,
}

const chainIDs: string[] = chainData
Expand Down
4 changes: 2 additions & 2 deletions src/screens/FeedsManager/SupportedChainsCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export const SupportedChainsCard = withStyles(styles)(
values.ocr2P2PPeerID !== '' ? values.ocr2P2PPeerID : null,
ocr2KeyBundleID:
values.ocr2KeyBundleID != '' ? values.ocr2KeyBundleID : null,
ocr2Plugins: `{"median":${values.ocr2MedianPluginEnabled}}`
ocr2Plugins: `{"commit":${values.ocr2CommitPluginEnabled},"execute":${values.ocr2ExecutePluginEnabled},"median":${values.ocr2MedianPluginEnabled},"mercury":${values.ocr2MercuryPluginEnabled}}`
},
},
})
Expand Down Expand Up @@ -293,7 +293,7 @@ export const SupportedChainsCard = withStyles(styles)(
values.ocr2P2PPeerID !== '' ? values.ocr2P2PPeerID : null,
ocr2KeyBundleID:
values.ocr2KeyBundleID != '' ? values.ocr2KeyBundleID : null,
ocr2Plugins: `{"median":${values.ocr2MedianPluginEnabled}}`
ocr2Plugins: `{"commit":${values.ocr2CommitPluginEnabled},"execute":${values.ocr2ExecutePluginEnabled},"median":${values.ocr2MedianPluginEnabled},"mercury":${values.ocr2MercuryPluginEnabled}}`
},
},
})
Expand Down

0 comments on commit 7aebc6f

Please sign in to comment.