Merge pull request #901 from SiIky/feat/Zya3XwXx/update_transaction_on_cancel

feat: update transaction details on cancel
This commit is contained in:
Rafael Taranto 2021-11-14 23:43:12 +00:00 committed by GitHub
commit 0d5da716e5
4 changed files with 11 additions and 13 deletions

View file

@ -64,7 +64,7 @@ export const ConfirmDialog = memo(
message, message,
confirmationMessage = `Write '${toBeConfirmed}' to confirm this action`, confirmationMessage = `Write '${toBeConfirmed}' to confirm this action`,
onConfirmed, onConfirmed,
onDissmised, onDismissed,
initialValue = '', initialValue = '',
disabled = false, disabled = false,
...props ...props
@ -77,7 +77,7 @@ export const ConfirmDialog = memo(
const innerOnClose = () => { const innerOnClose = () => {
setValue('') setValue('')
setError(false) setError(false)
onDissmised() onDismissed()
} }
const isOnErrorState = const isOnErrorState =

View file

@ -207,7 +207,7 @@ const MachineActions = memo(({ machine, onActionSuccess }) => {
} }
}) })
}} }}
onDissmised={() => { onDismissed={() => {
setAction({ command: null }) setAction({ command: null })
setErrorMessage(null) setErrorMessage(null)
}} }}

View file

@ -350,7 +350,7 @@ const DetailsRow = ({ it: tx, timezone }) => {
} }
}) })
}} }}
onDissmised={() => { onDismissed={() => {
setAction({ command: null }) setAction({ command: null })
setErrorMessage(null) setErrorMessage(null)
}} }}
@ -362,5 +362,5 @@ const DetailsRow = ({ it: tx, timezone }) => {
export default memo( export default memo(
DetailsRow, DetailsRow,
(prev, next) => (prev, next) =>
prev.it.id === next.it.id && prev.it.hasError === next.it.hasError prev.it.id === next.it.id && getStatus(prev.it) === getStatus(next.it)
) )

View file

@ -122,24 +122,22 @@ const Transactions = () => {
const { data: filtersResponse, loading: loadingFilters } = useQuery( const { data: filtersResponse, loading: loadingFilters } = useQuery(
GET_TRANSACTION_FILTERS GET_TRANSACTION_FILTERS
) )
const [filteredTransactions, setFilteredTransactions] = useState([])
const [variables, setVariables] = useState({ limit: NUM_LOG_RESULTS }) const [variables, setVariables] = useState({ limit: NUM_LOG_RESULTS })
const { const {
data: txResponse, data: txData,
loading: loadingTransactions, loading: loadingTransactions,
refetch, refetch,
startPolling, startPolling,
stopPolling stopPolling
} = useQuery(GET_TRANSACTIONS, { } = useQuery(GET_TRANSACTIONS, { variables })
variables,
onCompleted: data => setFilteredTransactions(R.path(['transactions'])(data))
})
useEffect(() => { useEffect(() => {
startPolling(10000) startPolling(10000)
return stopPolling return stopPolling
}) })
const txList = txData ? txData.transactions : []
const { data: configResponse, configLoading } = useQuery(GET_DATA) const { data: configResponse, configLoading } = useQuery(GET_DATA)
const timezone = R.path(['config', 'locale_timezone'], configResponse) const timezone = R.path(['config', 'locale_timezone'], configResponse)
@ -273,7 +271,7 @@ const Transactions = () => {
onChange={onFilterChange} onChange={onFilterChange}
/> />
</div> </div>
{txResponse && ( {txList && (
<div className={classes.buttonsWrapper}> <div className={classes.buttonsWrapper}>
<LogsDowloaderPopover <LogsDowloaderPopover
title="Download logs" title="Download logs"
@ -310,7 +308,7 @@ const Transactions = () => {
loading={loadingTransactions && configLoading} loading={loadingTransactions && configLoading}
emptyText="No transactions so far" emptyText="No transactions so far"
elements={elements} elements={elements}
data={filteredTransactions} data={txList}
Details={DetailsRow} Details={DetailsRow}
expandable expandable
rowSize="sm" rowSize="sm"