diff --git a/lib/new-admin/graphql/resolvers/log.resolver.js b/lib/new-admin/graphql/resolvers/log.resolver.js index 8e3bc3fd..3ed9276a 100644 --- a/lib/new-admin/graphql/resolvers/log.resolver.js +++ b/lib/new-admin/graphql/resolvers/log.resolver.js @@ -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 }]) => diff --git a/lib/new-admin/graphql/resolvers/transaction.resolver.js b/lib/new-admin/graphql/resolvers/transaction.resolver.js index e3d40ff2..274d39ff 100644 --- a/lib/new-admin/graphql/resolvers/transaction.resolver.js +++ b/lib/new-admin/graphql/resolvers/transaction.resolver.js @@ -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() } } diff --git a/lib/new-admin/graphql/types/transaction.type.js b/lib/new-admin/graphql/types/transaction.type.js index a0c8add5..7dc35a98 100644 --- a/lib/new-admin/graphql/types/transaction.type.js +++ b/lib/new-admin/graphql/types/transaction.type.js @@ -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 } ` diff --git a/new-lamassu-admin/src/components/tables/DataTable.js b/new-lamassu-admin/src/components/tables/DataTable.js index f66a7db5..331d6a76 100644 --- a/new-lamassu-admin/src/components/tables/DataTable.js +++ b/new-lamassu-admin/src/components/tables/DataTable.js @@ -37,7 +37,8 @@ const Row = ({ expWidth, expandable, onClick, - size + size, + ...props }) => { const classes = useStyles() @@ -80,7 +81,7 @@ const Row = ({
-
+
@@ -153,6 +154,7 @@ const DataTable = ({ expandRow={expandRow} expandable={expandable} onClick={onClick} + timezone={props.timezone} /> )} diff --git a/new-lamassu-admin/src/pages/Transactions/DetailsCard.js b/new-lamassu-admin/src/pages/Transactions/DetailsCard.js index 7b475c39..3ee05fa1 100644 --- a/new-lamassu-admin/src/pages/Transactions/DetailsCard.js +++ b/new-lamassu-admin/src/pages/Transactions/DetailsCard.js @@ -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 {children} } -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 diff --git a/new-lamassu-admin/src/pages/Transactions/Transactions.js b/new-lamassu-admin/src/pages/Transactions/Transactions.js index 4bde18a5..679cb65c 100644 --- a/new-lamassu-admin/src/pages/Transactions/Transactions.js +++ b/new-lamassu-admin/src/pages/Transactions/Transactions.js @@ -329,6 +329,7 @@ const Transactions = () => { Details={DetailsRow} expandable rowSize="sm" + timezone={timezone} /> )