-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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] Data Frame Analytics custom URLs: adds ability to set custom time range in urls #155337
[ML] Data Frame Analytics custom URLs: adds ability to set custom time range in urls #155337
Conversation
Pinging @elastic/ml-ui (:ml) |
x-pack/plugins/ml/public/application/components/custom_urls/custom_url_editor/editor.tsx
Outdated
Show resolved
Hide resolved
.../ml/public/application/components/custom_urls/custom_url_editor/custom_time_range_picker.tsx
Outdated
Show resolved
Hide resolved
{showCustomTimeRangeSelector ? ( | ||
<> | ||
<EuiSpacer size="s" /> | ||
<EuiFormRow |
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 the destination data view of the job has a timestamp field, and the target page is either Dashboard or Discover with a data view that has a timestamp field, it would be good to include an extra option here as well as the custom time range option, where the user can specify an interval. The action here would be to open the target page showing interval
either side of the time of the row the action is being run on, similar to the option we have for anomaly detection job custom URLs:
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 item is part of the overall meta issue #150375 and can be done in a separate PR 👍
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.
Tested latest changes and LGTM
}, | ||
} = useMlKibana(); | ||
|
||
const onCustomTimeRangeSwitchChange = (e: { |
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 type of e can be e: React.ChangeEvent<HTMLInputElement>
But a neater way might be to just pass in a boolean and call onCustomTimeRangeSwitchChange
with onChange={(e) => onCustomTimeRangeSwitchChange(e.target.checked)}
This is the style we've used the most in our code.
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 call - updated to use the consistent style in eca357a
@@ -29,10 +30,11 @@ import { DataView } from '@kbn/data-views-plugin/public'; | |||
import { CustomUrlSettings, isValidCustomUrlSettingsTimeRange } from './utils'; | |||
import { isValidLabel } from '../../../util/custom_url_utils'; | |||
import { type DataFrameAnalyticsConfig } from '../../../../../common/types/data_frame_analytics'; | |||
import { Job, isAnomalyDetectionJob } from '../../../../../common/types/anomaly_detection_jobs'; | |||
import { Job } from '../../../../../common/types/anomaly_detection_jobs'; |
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.
import { Job } from '../../../../../common/types/anomaly_detection_jobs'; | |
import { type Job } from '../../../../../common/types/anomaly_detection_jobs'; |
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.
Updated in eca357a
@@ -252,12 +254,19 @@ async function buildDashboardUrlFromSettings(settings: CustomUrlSettings): Promi | |||
} | |||
|
|||
const dashboard = getDashboard(); | |||
let customStart; |
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.
these two new blocks of code are identical, could they be moved to a small function that takes in settings
?
it could even incorporate the customStart ?? '$earliest$'
check later and just return from
and to
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.
Moved to a separate function in eca357a
@elasticmachine merge upstream |
This has been updated with final suggestions 🙏 cc @jgowdyelastic, @peteharverson |
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
@elasticmachine merge upstream |
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Async chunks
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
Summary
Related meta issue: #150375
This PR adds a custom time range picker to the custom urls UI for Data Frame Analytics jobs.
When not selected, the timerange will default to the global timerange - this is the same behavior as before.
Checklist
Delete any items that are not applicable to this PR.