fix: added timestamp parameters for a date range on the gql queries for

machineLogs, serverLogs and transactions

feat: added optional limit and offset variables for the logs queries,
for filtering and pagination

feat: adapted the LogsDownloaderPopper to download the logs by whats set
on the filters

fix: improved code readability

fix: avoid errors when the range option is selected and no range is
actually selected
This commit is contained in:
Liordino Neto 2020-07-16 21:50:38 -03:00 committed by Josh Harvey
parent 37ea3a04c3
commit f641e605a4
7 changed files with 109 additions and 68 deletions

View file

@ -18,9 +18,11 @@ import { mainStyles } from './Transactions.styles'
const useStyles = makeStyles(mainStyles)
const NUM_LOG_RESULTS = 1000
const GET_TRANSACTIONS = gql`
{
transactions {
query transactions($limit: Int, $from: Date, $until: Date) {
transactions(limit: $limit, from: $from, until: $until) {
id
txClass
txHash
@ -52,7 +54,11 @@ const GET_TRANSACTIONS = gql`
const Transactions = () => {
const classes = useStyles()
const { data: txResponse } = useQuery(GET_TRANSACTIONS)
const { data: txResponse } = useQuery(GET_TRANSACTIONS, {
variables: {
limit: NUM_LOG_RESULTS
}
})
const formatCustomerName = customer => {
const { firstName, lastName } = customer
@ -136,8 +142,8 @@ const Transactions = () => {
<LogsDowloaderPopover
title="Download logs"
name="transactions"
logs={txResponse.transactions}
getTimestamp={tx => tx.created}
query={GET_TRANSACTIONS}
getLogs={logs => R.path(['transactions'])(logs)}
/>
</div>
)}