diff --git a/.changeset/pretty-gifts-complain.md b/.changeset/pretty-gifts-complain.md new file mode 100644 index 00000000..5a9d4dc4 --- /dev/null +++ b/.changeset/pretty-gifts-complain.md @@ -0,0 +1,5 @@ +--- +'@smartcontractkit/operator-ui': minor +--- + +add button to drop 'unstarted' txs diff --git a/@types/core/store/models.d.ts b/@types/core/store/models.d.ts index 5840b584..35da4268 100644 --- a/@types/core/store/models.d.ts +++ b/@types/core/store/models.d.ts @@ -62,6 +62,8 @@ declare module 'core/store/models' { nextNonce: ?integer abandon: ?boolean enabled: ?boolean + abandonUnstarted: ?boolean + subject: ?string } export interface BuildInfo { diff --git a/src/api/v2/evmKeys.ts b/src/api/v2/evmKeys.ts index a5ea62c7..0843a2ec 100644 --- a/src/api/v2/evmKeys.ts +++ b/src/api/v2/evmKeys.ts @@ -22,6 +22,13 @@ export class EVMKeys { if (request.enabled !== null) { query.append('enabled', String(request.enabled)) } + if (request.abandonUnstarted !== null) { + query.append('abandonUnstarted', String(request.abandonUnstarted)) + + if (request.subject !== null) { + query.append('subject', request.subject) + } + } const endpoint = ENDPOINT + '?' + query.toString() diff --git a/src/screens/KeyManagement/EVMAccountRow.tsx b/src/screens/KeyManagement/EVMAccountRow.tsx index 1bab0e41..982ccef9 100644 --- a/src/screens/KeyManagement/EVMAccountRow.tsx +++ b/src/screens/KeyManagement/EVMAccountRow.tsx @@ -50,8 +50,8 @@ const styles = (theme: Theme) => lineHeight: '1rem', }, dialogPaper: { - minHeight: '360px', - maxHeight: '360px', + minHeight: '450px', + maxHeight: '450px', minWidth: '670px', maxWidth: '670px', overflow: 'hidden', @@ -84,6 +84,12 @@ const styles = (theme: Theme) => runJobModalContent: { overflow: 'hidden', }, + // Adjusts the text field to fit within the modal padding + textField: { + marginLeft: theme.spacing.unit * 6, + marginRight: theme.spacing.unit * 6, + width: 'calc(100% - 96px)', + }, }) interface Props { @@ -98,12 +104,16 @@ function apiCall({ nextNonce, abandon, enabled, + abandonUnstarted, + subject }: { evmChainID: string address: string nextNonce: bigint | null abandon: boolean enabled: boolean + abandonUnstarted: boolean + subject: string }): Promise> { const definition: EVMKeysChainRequest = { evmChainID, @@ -111,6 +121,8 @@ function apiCall({ nextNonce, abandon, enabled, + abandonUnstarted, + subject, } return api.v2.evmKeys.chain(definition) } @@ -128,10 +140,12 @@ const UnstyledEVMAccountRow: React.FC = ({ const [enabled, setEnabled] = useState(!ethKey.isDisabled) const [nextNonce, setNextNonce] = useState(null) const [abandon, setAbandon] = useState(false) + const [abandonUnstarted, setAbandonUnstarted] = useState(false) + const [subject, setSubject] = useState('') const onSubmit = (event: React.SyntheticEvent) => { event.preventDefault() - handleUpdate(nextNonce, abandon, enabled) + handleUpdate(nextNonce, abandon, enabled, abandonUnstarted, subject) } const handleEnabledCheckboxChange = () => { @@ -146,18 +160,30 @@ const UnstyledEVMAccountRow: React.FC = ({ setAbandon(!abandon) } + const handleAbandonUnstartedCheckboxChange = () => { + setAbandonUnstarted(!abandonUnstarted) + } + + const handleSubjectFieldChange = (event: any) => { + setSubject(event.target.value) + } + const closeModal = () => { setModalOpen(false) // reset state setAbandon(false) setNextNonce(null) setEnabled(!ethKey.isDisabled) + setAbandonUnstarted(false) + setSubject('') } async function handleUpdate( nextNonce: bigint | null, abandon: boolean, enabled: boolean, + abandonUnstarted: boolean, + subject: string, ) { apiCall({ evmChainID: ethKey.chain.id, @@ -165,6 +191,8 @@ const UnstyledEVMAccountRow: React.FC = ({ nextNonce, abandon, enabled, + abandonUnstarted, + subject, }) .then(({ data }) => { refetch && refetch() @@ -254,6 +282,32 @@ const UnstyledEVMAccountRow: React.FC = ({ label="Abandon all current transactions (use with caution!)" /> + + + } + label="Abandon unstarted transactions" + /> + + {abandonUnstarted && ( + + + + )}