-
Notifications
You must be signed in to change notification settings - Fork 98
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
Use text for relative timestamps and numbers for absolute #618
Conversation
ui/src/pages/Detail.tsx
Outdated
} | ||
} | ||
|
||
// const from = fromQuery != null ? parseInt(fromQuery) : to - 3600 * 1000 |
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.
Oh, this needs to be removed now.
@@ -20,6 +21,7 @@ interface ErrorsGraphProps { | |||
from: number | |||
to: number | |||
uPlotCursor: uPlot.Cursor | |||
updateTimeRange: (min: number, max: number, absolute: boolean) => void |
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.
I guess, for less duplication and more type rigidity, there can be a base type called GraphProps
with fields like from
, to
, updateTimeRange
and that type can be extended in these three components to add their own fields.
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.
That makes sense, yes. Given this is a PR to fix a bug I won't address this now. We should definitely do this later!
@@ -70,11 +71,28 @@ const Detail = () => { | |||
|
|||
const name: string = labels[MetricName] | |||
|
|||
let to: number = Date.now() |
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.
If possible, to
, from
parsing logic and updateTimeRange
callback can be extracted into a useTimeRange
hook, so that the timeRange parsing and setting logic would be in one place inside that hook without getting spilled into this component.
But I guess since this is the only page that uses timeRange, this hasn't surfaced as a problem.
Using text like `now` and `now-12h` will not spam the browser's history like reported in #590. However, selecting a specific time range with the cursor in the graphs will now still select the very specific timestamps and store them in the URL.
d7c4c3a
to
43a8013
Compare
Using text like
now
andnow-12h
will not spam the browser's history like reported in #590.However, selecting a specific time range with the cursor in the graphs will now still select the very specific timestamps and store them in the URL.