Skip to content
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

Merged
merged 1 commit into from
Feb 20, 2023

Conversation

metalmatze
Copy link
Member

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.

@metalmatze metalmatze added the bug Something isn't working label Feb 19, 2023
}
}

// const from = fromQuery != null ? parseInt(fromQuery) : to - 3600 * 1000
Copy link
Member Author

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
Copy link
Contributor

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.

Copy link
Member Author

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()
Copy link
Contributor

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.
@metalmatze metalmatze merged commit 5d9bb84 into release-0.5 Feb 20, 2023
@metalmatze metalmatze deleted the ui-refresh-absolute-timestamps branch February 20, 2023 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants