-
-
Notifications
You must be signed in to change notification settings - Fork 614
Set "All Time " range for query log datepicker based on Database ranges (luxon) #3656
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
base: luxon
Are you sure you want to change the base?
Conversation
6c1337b to
b959f44
Compare
yubiuser
left a comment
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.
scripts/js/queries.js
Outdated
| // earliest_timestamp is provided in seconds since epoch | ||
| beginningOfTime = Number(data.earliest_timestamp_disk); | ||
| // Round down to nearest 5-minute segment (300 seconds) | ||
| beginningOfTime = Math.floor(beginningOfTime / 300) * 300; |
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.
Could also work with luxon toRelative using the rounding and padding options
https://moment.github.io/luxon/api-docs/index.html#datetimetorelative
|
Two reported issues have been fixed upstream. I'll update the vendor files in my branch |
…PI and update date picker accordingly. We use the on-disk earliest timestamp to get the complete range. Signed-off-by: Adam Warner <[email protected]>
5660e60 to
e765677
Compare
… use whichever of the two timestamps is smallest (and non-zero) Signed-off-by: Adam Warner <[email protected]>
Signed-off-by: Adam Warner <[email protected]>
e765677 to
ee39167
Compare
| // We initialize them as null and populate them during page init. | ||
| let beginningOfTime = null; // seconds since epoch (set from API: info/database.earliest_timestamp) | ||
| // endOfTime should be the start of tomorrow in seconds since epoch | ||
| // We don't use 23:59:59 as the picker increments are set to 5 minutes |
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.
| // We don't use 23:59:59 as the picker increments are set to 5 minutes | |
| // We don't use 23:59:59 (endOf("day")) as the picker increments are set to 5 minutes |
| if (beginningOfTime === null) { | ||
| $("#querytime").prop("disabled", true); | ||
| $("#querytime").addClass("disabled"); | ||
| $("#querytime-note").text("No data in the database"); |
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.
| $("#querytime-note").text("No data in the database"); | |
| $("#querytime-note").text("ℹ️ No data in the database"); |
| endDate: luxon.DateTime.fromMillis(until * 1000), // convert to milliseconds since epoch | ||
| locale: { | ||
| format: dateformat, | ||
| firstDay: 7, |
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.
This might be a British thing, but my week starts on Monday
| firstDay: 7, | |
| firstDay: 1, |
| "Last Hour": [now.minus({ hours: 1 }), now], | ||
| Today: [now.startOf("day"), maxDateDt], | ||
| Yesterday: [now.minus({ days: 1 }).startOf("day"), now.minus({ days: 1 }).endOf("day")], | ||
| "Last 7 Days": [now.minus({ days: 6 }), maxDateDt], |
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.
| "Last 7 Days": [now.minus({ days: 6 }), maxDateDt], | |
| "Last 7 Days": [now.minus({ days: 6 }).startOf("day"), maxDateDt], |
| Today: [now.startOf("day"), maxDateDt], | ||
| Yesterday: [now.minus({ days: 1 }).startOf("day"), now.minus({ days: 1 }).endOf("day")], | ||
| "Last 7 Days": [now.minus({ days: 6 }), maxDateDt], | ||
| "Last 30 Days": [now.minus({ days: 29 }), maxDateDt], |
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.
| "Last 30 Days": [now.minus({ days: 29 }), maxDateDt], | |
| "Last 30 Days": [now.minus({ days: 29 }).startOf("day"), maxDateDt], |



What does this PR aim to accomplish?:
Builds upon #3655 and uses the newly published
earliest_timestamp_diskto set the earliest possible date in the daterangepicker.Due to an issue in the new daterangepicker library, there is a cosmetic issue which is fixed with a locally applied patch temporarily. This can be removed if/when the vendor integrates the upstream PR Wernfried/daterangepicker#1
By submitting this pull request, I confirm the following:
git rebase)