Skip to content

[ML] Adds Create a data view button to index or saved search selector in ML pages and Transforms management#166668

Merged
qn895 merged 13 commits intoelastic:mainfrom
qn895:ml-add-create-data-views-in-so-finder
Oct 2, 2023
Merged

[ML] Adds Create a data view button to index or saved search selector in ML pages and Transforms management#166668
qn895 merged 13 commits intoelastic:mainfrom
qn895:ml-add-create-data-views-in-so-finder

Conversation

@qn895
Copy link
Copy Markdown
Member

@qn895 qn895 commented Sep 18, 2023

Summary

This PR add Create a data view button to index or saved search selector in ML pages including Index Data Visualizer, AIOps pages, and Data Frame Analytics.

ML pages:

Screen.Recording.2023-09-18.at.15.41.35.mov
Screen.Recording.2023-09-25.at.11.23.05.mov

Transforms

Screen.Recording.2023-09-20.at.09.04.40.mov

Checklist

Delete any items that are not applicable to this PR.

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Multiple Spaces—unexpected behavior in non-default Kibana Space. Low High Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces.
Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. High Low Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure.
Code should gracefully handle cases when feature X or plugin Y are disabled. Medium High Unit tests will verify that any feature flag or plugin combination still results in our service operational.
See more potential risk examples

For maintainers

@qn895 qn895 self-assigned this Sep 18, 2023
@qn895 qn895 changed the title [ML] Add Create a data view button to index or saved search selector in ML pages [ML] Add Create a data view button to index or saved search selector in ML pages and Transforms management Sep 20, 2023
@qn895 qn895 added the Feature:Transforms Transforms label Sep 20, 2023
@qn895 qn895 force-pushed the ml-add-create-data-views-in-so-finder branch from d9076f6 to 3a5f171 Compare September 20, 2023 14:19
@peteharverson
Copy link
Copy Markdown
Contributor

Could this be added for the 'Create job' workflow for Data frame analytics?

@qn895
Copy link
Copy Markdown
Member Author

qn895 commented Sep 25, 2023

Could this be added for the 'Create job' workflow for Data frame analytics?

Yes! Updated here 2f4ceef (#166668). I also allowed creating adhoc data view by deafult. It will successfully create the analytics, with the caveat that cloning the DFA will not work out of the box.

Screen.Recording.2023-09-25.at.11.23.05.mov

@peteharverson
Copy link
Copy Markdown
Contributor

I also allowed creating adhoc data view by default. It will successfully create the analytics, with the caveat that cloning the DFA will not work out of the box.

I think this behavior is fine. The user gets the option in the wizard to create a data view for the results index, and if that is created, the results view will be fully available even without a data view for the source index. On cloning, a clear error is displayed to create the data view if one does not already exist.

Copy link
Copy Markdown
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and LGTM

@qn895 qn895 marked this pull request as ready for review September 27, 2023 14:17
@qn895 qn895 requested a review from a team as a code owner September 27, 2023 14:17
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/ml-ui (:ml)

}) => {
const { dataViewEditor } = useMlKibana().services;
const canEditDataView = Boolean(dataViewEditor?.userPermissions.editDataView());
const closeDataViewEditor = useRef<() => void | undefined>();
Copy link
Copy Markdown
Member

@jgowdyelastic jgowdyelastic Sep 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is currently not being used.
Looking at other examples, it should be used to close the editor when unmounting the component.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated here 2262a7f (#166668)

/>
</EuiButton>
) : (
<Fragment />
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless there is a specific reason for this, normally we just return null

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated here 2262a7f (#166668)

import type { ContentManagementPublicStart } from '@kbn/content-management-plugin/public';
import type { SavedSearchPublicPluginStart } from '@kbn/saved-search-plugin/public';
import type { PluginInitializerContext } from '@kbn/core/public';
import { DataViewEditorStart } from '@kbn/data-view-editor-plugin/public';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { DataViewEditorStart } from '@kbn/data-view-editor-plugin/public';
import type { DataViewEditorStart } from '@kbn/data-view-editor-plugin/public';

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated here 2262a7f (#166668)

const dataViewEditorRef = useRef<() => void | undefined>();

const createNewDataView = useCallback(() => {
dataViewEditorRef.current = dataViewEditor?.openEditor({
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this ref isn't going to be used to close the editor when navigating away, then I don't think we need the ref at all.
However, I think it would be good to use the ref as it was initially intended to close the editor when this button component is destroyed.

Copy link
Copy Markdown
Member Author

@qn895 qn895 Oct 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching that, updated here 2a655ac (#166668) so it closes upon unmounting/ navigating away.

Copy link
Copy Markdown
Member

@jgowdyelastic jgowdyelastic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kibana-ci
Copy link
Copy Markdown

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
ml 1814 1816 +2

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
ml 3.5MB 3.5MB +819.0B
transform 401.9KB 402.5KB +685.0B
total +1.5KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @qn895

@qn895 qn895 merged commit 007c341 into elastic:main Oct 2, 2023
@qn895 qn895 deleted the ml-add-create-data-views-in-so-finder branch October 2, 2023 14:45
@kibanamachine kibanamachine added the backport:skip This PR does not require backporting label Oct 2, 2023
@szabosteve szabosteve changed the title [ML] Add Create a data view button to index or saved search selector in ML pages and Transforms management [ML] Adds Create a data view button to index or saved search selector in ML pages and Transforms management Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants