-
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
[SLO Form] Refactor to use kibana data view component #173513
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
/ci |
Pinging @elastic/obs-ux-management-team (Team:obs-ux-management) |
It looks like there's an issue when you go to clone an SLO which was created using an AdHoc DataView, the page hangs. Here of the steps I used:
Also since we are using DataViews, do you think we could set the |
dataViewsService.get(newId).then((dataView) => { | ||
if (dataView.timeFieldName) { | ||
setValue('indicator.params.timestampField', dataView.timeFieldName); | ||
} | ||
}); |
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.
❤️
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.
Thanks for removing the "empty" temporary DataView. For the "extra" data view, I added a comment with an example that would remove that as well. So the only time we'd show an "adhoc" DataView would be if there wasn't a suitable DataView to use.
useEffect(() => { | ||
const missingAdHocDataView = adHocDataViews.find( | ||
(dataView) => dataView.getIndexPattern() === currentIndexPattern | ||
); | ||
|
||
const placeholder = i18n.translate('xpack.observability.slo.sloEdit.indexSelection.placeholder', { | ||
defaultMessage: 'Select an index pattern', | ||
}); | ||
if (!missingAdHocDataView && currentIndexPattern) { | ||
async function loadMissingDataView() { | ||
const dataView = await dataViewsService.create( | ||
{ | ||
title: currentIndexPattern, | ||
allowNoIndex: true, | ||
}, | ||
true | ||
); | ||
if (dataView.getIndexPattern() === currentIndexPattern) { | ||
setAdHocDataViews((prev) => [...prev, dataView]); | ||
} | ||
} | ||
loadMissingDataView(); | ||
} | ||
}, [adHocDataViews, currentIndexPattern, dataViewsService]); |
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 you changed this useEffect
this:
useEffect(() => {
if (!isDataViewsLoading) {
const missingAdHocDataView =
dataViews.find((dataView) => dataView.title === currentIndexPattern) ||
adHocDataViews.find((dataView) => dataView.getIndexPattern() === currentIndexPattern);
if (!missingAdHocDataView && currentIndexPattern) {
async function loadMissingDataView() {
const dataView = await dataViewsService.create(
{
title: currentIndexPattern,
allowNoIndex: true,
},
true
);
if (dataView) {
setAdHocDataViews((prev) => [...prev, dataView]);
}
}
loadMissingDataView();
}
}
}, [adHocDataViews, currentIndexPattern, dataViewsService, isDataViewsLoading, dataViews]);
Then it wouldn't list the index pattern as an adhoc index pattern when a suitable DataView exists.
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
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Module Count
Async chunks
History
To update your PR or re-run it, just comment with: |
* main: (4129 commits) [Logs Explorer] Change the default link for "Discover" in the serverless nav (#173420) [Fleet] fix unhandled error in agent details when components are missing (#174152) [Obs UX] Unskip transaction duration alerts test (#174069) [Fleet] Fix keep policies up to date after package install (#174093) [Profiling] Stack traces embeddable (#173905) [main] Sync bundled packages with Package Storage (#174115) [SLO Form] Refactor to use kibana data view component (#173513) [Obs UX] Unskip APM Service Inventory Journey (#173510) [Obs UX] Unskip preview_chart_error_count test (#173624) [api-docs] 2024-01-03 Daily api_docs build (#174142) Update babel runtime helpers (#171745) Handle content stream errors in report pre-deletion (#173792) [Cloud Posture] [Quick wins] Enable edit DataView on the Misconfigurations Findings Table (#173870) [ftr] abort retry on invalid webdriver session (#174092) Upgrade openai to 4.24.1 (#173934) chore(NA): bump node into v20 (#173461) [Security Solution][Endpoint] Fix index name pattern in SentinelOne dev. script (#174105) fix versions.json [Obs AI Assistant] Add guardrails (#174060) [ML] Transforms: Refactor validators and add unit tests. (#173736) ...
Summary
Fixes #171687
Refactor to use kibana data view component !!
user can also save a new data or use ad-hoc data view
This also avoid so many unnecessary requests being loaded, notice the difference almost avoid 15 extra requests
After
Before