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