-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ML] Fixing issue with incorrect timezones in jobs list #22714
[ML] Fixing issue with incorrect timezones in jobs list #22714
Conversation
Pinging @elastic/ml-ui |
} | ||
|
||
// if either of the dates are empty, set them to undefined | ||
// if either of the dates are zero, set them to undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this comment still apply, so that now
is passed to the target page if the job has no results?
// moment will convert undefined to now. | ||
from = (from === '') ? undefined : from; | ||
to = (to === '') ? undefined : to; | ||
const fromString = moment(from).format(TIME_FORMAT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The from
and to
variables refer to the time in seconds, but this usage of moment expects the value in ms. Are the variables holding ms
values rather than s
as their name would imply?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good spot. earliestTimeStampSeconds
should be earliestTimeStampMs
|
||
import { mlJobService } from 'plugins/ml/services/job_service'; | ||
|
||
function getLink(location, jobs) { | ||
let from = 0; | ||
let to = 0; | ||
if (jobs.length === 1) { | ||
from = jobs[0].earliestTimeStamp.string; | ||
to = jobs[0].latestTimeStamp.string; | ||
from = jobs[0].earliestTimeStampMs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, but 'timestamp' is generally one word, so I think these should be earliestTimestampMs
and latestTimestampMs
!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
💔 Build Failed |
retest |
💚 Build Succeeded |
* [ML] Fixing issue with incorrect timezones in jobs list * refactoring min and max calculation * changes based on review * changing TimeStamp to Timestamp
* [ML] Fixing issue with incorrect timezones in jobs list * refactoring min and max calculation * changes based on review * changing TimeStamp to Timestamp
Fixes issue where some of the job times in the jobs list are local to the server rather than the browser.
This was caused by
moment
being used on the server to create the time string in the jobs summary endpoint (the data used to create the table).This PR removes this server side use of moment and just passes across the epoch seconds.
The browser then runs it through moment at display time.