fix: use correct timestamp on logs download
This commit is contained in:
parent
d8ce011b28
commit
cacafb2f20
1 changed files with 2 additions and 6 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import { useLazyQuery, useQuery } from '@apollo/react-hooks'
|
||||
import { makeStyles } from '@material-ui/core/styles'
|
||||
import { subMinutes } from 'date-fns'
|
||||
import FileSaver from 'file-saver'
|
||||
import gql from 'graphql-tag'
|
||||
import React, { useState, useEffect } from 'react'
|
||||
|
|
@ -81,7 +82,6 @@ const DiagnosticsModal = ({ onClose, deviceId, sendAction }) => {
|
|||
setState(STATES.EMPTY)
|
||||
}
|
||||
if (
|
||||
timestamp &&
|
||||
data.machine.diagnostics.timestamp &&
|
||||
data.machine.diagnostics.timestamp !== timestamp
|
||||
) {
|
||||
|
|
@ -90,10 +90,6 @@ const DiagnosticsModal = ({ onClose, deviceId, sendAction }) => {
|
|||
setState(STATES.FILLED)
|
||||
stopPolling()
|
||||
}
|
||||
if (!timestamp && data.machine.diagnostics.timestamp) {
|
||||
setTimestamp(data.machine.diagnostics.timestamp)
|
||||
setState(STATES.FILLED)
|
||||
}
|
||||
}, [data, stopPolling, timeout, timestamp])
|
||||
|
||||
const path = `${URI}/operator-data/diagnostics/${deviceId}/`
|
||||
|
|
@ -177,7 +173,7 @@ const DiagnosticsModal = ({ onClose, deviceId, sendAction }) => {
|
|||
if (loading) return
|
||||
fetchSummary({
|
||||
variables: {
|
||||
from: timestamp,
|
||||
from: subMinutes(new Date(timestamp), 5),
|
||||
deviceId,
|
||||
limit: 500
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue