fix: add timezone to specific tx logs
feat: pass timezone to details row
This commit is contained in:
parent
b5e35b82c2
commit
4e88c995d3
6 changed files with 34 additions and 18 deletions
|
|
@ -10,7 +10,7 @@ const resolvers = {
|
|||
logs.simpleGetMachineLogs(deviceId, from, until, limit, offset),
|
||||
machineLogsCsv: (...[, { deviceId, from, until, limit, offset, timezone }]) =>
|
||||
logs.simpleGetMachineLogs(deviceId, from, until, limit, offset)
|
||||
.then(res => parseAsync(dateFormat(timezone, res))),
|
||||
.then(res => parseAsync(logs.logDateFormat(timezone, res, ['timestamp']))),
|
||||
serverLogs: (...[, { from, until, limit, offset }]) =>
|
||||
serverLogs.getServerLogs(from, until, limit, offset),
|
||||
serverLogsCsv: (...[, { from, until, limit, offset, timezone }]) =>
|
||||
|
|
|
|||
|
|
@ -32,11 +32,15 @@ const resolvers = {
|
|||
transactions.batch(from, until, limit, offset, deviceId, txClass, machineName, customerName, fiatCode, cryptoCode, toAddress, status),
|
||||
transactionsCsv: (...[, { from, until, limit, offset, txClass, machineName, customerName, fiatCode, cryptoCode, toAddress, status, timezone }]) =>
|
||||
transactions.batch(from, until, limit, offset, txClass, machineName, customerName, fiatCode, cryptoCode, toAddress, status)
|
||||
.then(data => parseAsync(data, { fields: tx_logFields, transforms: logDateFormat(timezone, data, ['created', 'sendTime']) })),
|
||||
transactionCsv: (...[, { id, txClass }]) =>
|
||||
transactions.getTx(id, txClass).then(data => parseAsync(data)),
|
||||
txAssociatedDataCsv: (...[, { id, txClass }]) =>
|
||||
transactions.getTxAssociatedData(id, txClass).then(data => parseAsync(data)),
|
||||
.then(data => parseAsync(logDateFormat(timezone, data, ['created', 'sendTime']), { fields: txLogFields })),
|
||||
transactionCsv: (...[, { id, txClass, timezone }]) =>
|
||||
transactions.getTx(id, txClass).then(data =>
|
||||
parseAsync(logDateFormat(timezone, [data], ['created', 'sendTime']))
|
||||
),
|
||||
txAssociatedDataCsv: (...[, { id, txClass, timezone }]) =>
|
||||
transactions.getTxAssociatedData(id, txClass).then(data =>
|
||||
parseAsync(logDateFormat(timezone, data, ['created']))
|
||||
),
|
||||
transactionFilters: () => filters.transaction()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,9 +52,9 @@ const typeDef = gql`
|
|||
|
||||
type Query {
|
||||
transactions(from: Date, until: Date, limit: Int, offset: Int, deviceId: ID, txClass: String, machineName: String, customerName: String, fiatCode: String, cryptoCode: String, toAddress: String, status: String): [Transaction] @auth
|
||||
transactionsCsv(from: Date, until: Date, limit: Int, offset: Int, txClass: String, machineName: String, customerName: String, fiatCode: String, cryptoCode: String, toAddress: String, status: String): String @auth
|
||||
transactionCsv(id: ID, txClass: String): String @auth
|
||||
txAssociatedDataCsv(id: ID, txClass: String): String @auth
|
||||
transactionsCsv(from: Date, until: Date, limit: Int, offset: Int, txClass: String, machineName: String, customerName: String, fiatCode: String, cryptoCode: String, toAddress: String, status: String, timezone: String): String @auth
|
||||
transactionCsv(id: ID, txClass: String, timezone: String): String @auth
|
||||
txAssociatedDataCsv(id: ID, txClass: String, timezone: String): String @auth
|
||||
transactionFilters: [Filter] @auth
|
||||
}
|
||||
`
|
||||
|
|
|
|||
|
|
@ -37,7 +37,8 @@ const Row = ({
|
|||
expWidth,
|
||||
expandable,
|
||||
onClick,
|
||||
size
|
||||
size,
|
||||
...props
|
||||
}) => {
|
||||
const classes = useStyles()
|
||||
|
||||
|
|
@ -80,7 +81,7 @@ const Row = ({
|
|||
<div className={classes.after}>
|
||||
<Tr className={classnames({ [classes.expanded]: expanded })}>
|
||||
<Td width={width}>
|
||||
<Details it={data} />
|
||||
<Details it={data} timezone={props.timezone} />
|
||||
</Td>
|
||||
</Tr>
|
||||
</div>
|
||||
|
|
@ -153,6 +154,7 @@ const DataTable = ({
|
|||
expandRow={expandRow}
|
||||
expandable={expandable}
|
||||
onClick={onClick}
|
||||
timezone={props.timezone}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -39,16 +39,23 @@ const TX_SUMMARY = gql`
|
|||
$from: DateTime
|
||||
$until: DateTime
|
||||
$txClass: String
|
||||
$timezone: String
|
||||
) {
|
||||
serverLogsCsv(limit: $limit, from: $from, until: $until)
|
||||
serverLogsCsv(
|
||||
limit: $limit
|
||||
from: $from
|
||||
until: $until
|
||||
timezone: $timezone
|
||||
)
|
||||
machineLogsCsv(
|
||||
deviceId: $deviceId
|
||||
limit: $limit
|
||||
from: $from
|
||||
until: $until
|
||||
timezone: $timezone
|
||||
)
|
||||
transactionCsv(id: $txId, txClass: $txClass)
|
||||
txAssociatedDataCsv(id: $txId, txClass: $txClass)
|
||||
transactionCsv(id: $txId, txClass: $txClass, timezone: $timezone)
|
||||
txAssociatedDataCsv(id: $txId, txClass: $txClass, timezone: $timezone)
|
||||
}
|
||||
`
|
||||
|
||||
|
|
@ -60,7 +67,7 @@ const Label = ({ children }) => {
|
|||
return <Label1 className={classes.label}>{children}</Label1>
|
||||
}
|
||||
|
||||
const DetailsRow = ({ it: tx }) => {
|
||||
const DetailsRow = ({ it: tx, timezone }) => {
|
||||
const classes = useStyles()
|
||||
|
||||
const zip = new JSZip()
|
||||
|
|
@ -96,8 +103,10 @@ const DetailsRow = ({ it: tx }) => {
|
|||
.add(MINUTES_OFFSET, 'm')
|
||||
.format()
|
||||
|
||||
const downloadRawLogs = ({ id: txId, deviceId, txClass }) => {
|
||||
fetchSummary({ variables: { txId, from, until, deviceId, txClass } })
|
||||
const downloadRawLogs = ({ id: txId, deviceId, txClass }, timezone) => {
|
||||
fetchSummary({
|
||||
variables: { txId, from, until, deviceId, txClass, timezone }
|
||||
})
|
||||
}
|
||||
|
||||
const createCsv = async logs => {
|
||||
|
|
@ -266,7 +275,7 @@ const DetailsRow = ({ it: tx }) => {
|
|||
Icon={Download}
|
||||
InverseIcon={DownloadInverseIcon}
|
||||
className={classes.downloadRawLogs}
|
||||
onClick={() => downloadRawLogs(tx)}>
|
||||
onClick={() => downloadRawLogs(tx, timezone)}>
|
||||
Download raw logs
|
||||
</ActionButton>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -329,6 +329,7 @@ const Transactions = () => {
|
|||
Details={DetailsRow}
|
||||
expandable
|
||||
rowSize="sm"
|
||||
timezone={timezone}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue