-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
fix(ui): adding times in script editor will default start and endtime for timerange queries #16201
Conversation
… for timerange queries
…nge scripts are based on those timeranges
5c73c06
to
04fa483
Compare
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.
in case you find the need to extract all of the variables in a query to test existence, it looks like this: query.match(/v.\S*/g).map(m => m.slice(2))
@@ -15,7 +15,7 @@ import {ErrorHandling} from 'src/shared/decorators/errors' | |||
interface OwnProps { | |||
view: View | |||
check: Partial<Check> | |||
timeRange: TimeRange | |||
timeRange: TimeRange | null |
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.
it doesn't look like you are using this prop
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.
ah you are... but I think you should not be
|
||
export const getActiveTimeRange = (timeRange: TimeRange, queries: array) => { | ||
if (!queries) { | ||
return timeRange |
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.
ooh interesting. I wonder if we should check for when queries.text is empty as well... ?
Would like to take a look at what happens to an empty graph with these changes.
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.
Hmmm, I wonder if that would ever be possible since there's a minimum criteria to submit a query that gets compiled into the script text
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 you test it visually with no query before merging please?
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.
definitely
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.
No query = cannot submit without some DOM manipulation (removing the disabled
flag from the console)
const timeZone = state.app.persisted.timeZone | ||
|
||
return { | ||
endTime: getEndTime(timeRange), | ||
startTime: getStartTime(timeRange), | ||
ranges: timeRange, |
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.
let's keep calling this timeRange to signal to the next programmer that this is the same old timeRange that they know from the rest of the app.
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.
but we have timeRange
in the OwnProps
:(
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.
why are we passing the same prop to the same component twice? What is the difference between them? Which one is redundant?
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 difference between them is that the timeRange
refers to the dropdown selection while the ranges
refer to the specific ranges in the query script editor
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 is not correct.
) => { | ||
const range = extent((data as number[]) || []) | ||
if (!timeRange) { |
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 might happen for a variety of reasons. we don't know what to do if timeRange is undefined.
|
||
export const getActiveTimeRange = (timeRange: TimeRange, queries: array) => { | ||
if (!queries) { | ||
return timeRange |
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 you test it visually with no query before merging please?
… for timerange queries (#16201) fix(ui): adding times in script editor will default start and endtime for timerange queries, compute timeranges based on script and based on widest date range & fix dashboard so that cells that have been saved with timerange scripts are based on those timeranges
Closes #16123
Problem
Currently, graph start and end times were being set based on selections from the dropdown regardless of whether the script editor input manual time ranges.
Solution
Before determining the start and end time, check to see whether a custom time has been input in the script editor