Add confirmation for network dropdown delete action (#9763)

feature/default_network_editable
Erik Marks 4 years ago committed by GitHub
parent ca7df8de0f
commit 1a164cd3e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      ui/app/components/app/dropdowns/network-dropdown.js

@ -42,9 +42,6 @@ function mapDispatchToProps (dispatch) {
setRpcTarget: (target, chainId, ticker, nickname) => { setRpcTarget: (target, chainId, ticker, nickname) => {
dispatch(actions.setRpcTarget(target, chainId, ticker, nickname)) dispatch(actions.setRpcTarget(target, chainId, ticker, nickname))
}, },
delRpcTarget: (target) => {
dispatch(actions.delRpcTarget(target))
},
hideNetworkDropdown: () => dispatch(actions.hideNetworkDropdown()), hideNetworkDropdown: () => dispatch(actions.hideNetworkDropdown()),
setNetworksTabAddMode: (isInAddMode) => { setNetworksTabAddMode: (isInAddMode) => {
dispatch(actions.setNetworksTabAddMode(isInAddMode)) dispatch(actions.setNetworksTabAddMode(isInAddMode))
@ -55,6 +52,13 @@ function mapDispatchToProps (dispatch) {
displayInvalidCustomNetworkAlert: (networkName) => { displayInvalidCustomNetworkAlert: (networkName) => {
dispatch(displayInvalidCustomNetworkAlert(networkName)) dispatch(displayInvalidCustomNetworkAlert(networkName))
}, },
showConfirmDeleteNetworkModal: ({ target, onConfirm }) => {
return dispatch(actions.showModal({
name: 'CONFIRM_DELETE_NETWORK',
target,
onConfirm,
}))
},
} }
} }
@ -79,8 +83,8 @@ class NetworkDropdown extends Component {
frequentRpcListDetail: PropTypes.array.isRequired, frequentRpcListDetail: PropTypes.array.isRequired,
networkDropdownOpen: PropTypes.bool.isRequired, networkDropdownOpen: PropTypes.bool.isRequired,
history: PropTypes.object.isRequired, history: PropTypes.object.isRequired,
delRpcTarget: PropTypes.func.isRequired,
displayInvalidCustomNetworkAlert: PropTypes.func.isRequired, displayInvalidCustomNetworkAlert: PropTypes.func.isRequired,
showConfirmDeleteNetworkModal: PropTypes.func.isRequired,
} }
handleClick (newProviderType) { handleClick (newProviderType) {
@ -151,7 +155,10 @@ class NetworkDropdown extends Component {
className="fa fa-times delete" className="fa fa-times delete"
onClick={(e) => { onClick={(e) => {
e.stopPropagation() e.stopPropagation()
this.props.delRpcTarget(rpcUrl) this.props.showConfirmDeleteNetworkModal({
target: rpcUrl,
onConfirm: () => undefined,
})
}} }}
/> />
) )

Loading…
Cancel
Save