-
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
[Home] Adding file upload to add data page #100863
[Home] Adding file upload to add data page #100863
Conversation
@elasticmachine merge upstream |
@elasticmachine merge upstream |
Pinging @elastic/ml-ui (:ml) |
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.
home
plugin changes LGTM.
A few comments
if (tab?.content !== undefined) { | ||
return tab.content; |
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.
NIT: if (tab?.content)
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 b532118
private addDataTabs: { | ||
[key: string]: AddDataTab; | ||
} = {}; |
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.
NIT: Record<string, AddDataTab>
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 b532118
"fileUpload", | ||
"home" |
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.
I think home
should be an optional dependency here.
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 b532118
useEffect(() => { | ||
if (FileDataVisualizerComponent === null) { | ||
import('../application/file_datavisualizer').then(({ FileDataVisualizer }) => { | ||
setFileDataVisualizerComponent(FileDataVisualizer); |
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.
NIT: could use react.lazy
instead of a manual effect.
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 idea, that is much nicer.
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 b532118
@@ -40,7 +43,11 @@ export class FileDataVisualizerPlugin | |||
FileDataVisualizerSetupDependencies, | |||
FileDataVisualizerStartDependencies | |||
> { | |||
public setup() {} | |||
public setup(core: CoreSetup, plugins: FileDataVisualizerSetupDependencies) { | |||
if (plugins.home) { |
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.
Should there be a permission check here to only register the file upload tab if the user has the minimum permissions needed to analyze a file?
Would this be a good time to remove access:fileUpload:analyzeFile
and access:fileUpload:import
tags from file upload routes?
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.
I think this would be a good time to decouple file data visualizer permissions from ML so that users can upload a file and not have kibana access to ml or any ml user roles.
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.
Should there be a permission check here to only register the file upload tab if the user has the minimum permissions needed to analyze a file?
ML has run in to race condition issues before when registering links in home and the management app where, due to the time it takes to check the license and in this case maybe the capabilities, the registration happens too late for the links to actually appear.
I'll take a look to see if this is possible, but we might just have to always register and perform the capabilities check later when the user navigates to the "Upload file" tab.
Would this be a good time to remove access:fileUpload:analyzeFile and access:fileUpload:import tags from file upload routes?
I might have missed something, why would we want to remove the capabilities checks from the routes?
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 putting this PR up, its great that users can upload files without leaving the home application. Would it be possible to change the url for the "Upload a file" card on the home page to file data visualizer add data tab? That way, users will never be directed to ML from home and both locations take you to the same place.
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Public APIs missing exports
Page load bundle
Unknown metric groupsAPI count
async chunk count
References to deprecated APIs
History
To update your PR or re-run it, just comment with: |
@nreese yes, I looked into this. It isn't possible to navigate straight to a specific tab in the Add Data page. If we're happy just linking the general "Add Data" page, where the user then has to click to the correct tab, I can change this link and move the registration of the link to the file data viz plugin. Adding some URL state to the Add Data page to allow tab selection I think is outside of the scope of this PR. I'll raise an issue if we think this is needed. |
Currently, users have to have ML kibana privileges to gain access to the tags access:fileUpload:analyzeFile and access:fileUpload:import. Limiting file data visualizer access to ML kibana privileges is an artifact of were the code was historically located. Why do users have to have ML kibana privilege to upload files? It would make sense to decouple ML kibana privileges from file data visualizer so users without ML kibana privileges can upload files. Removing the capabilities tag was one implementation idea for this decoupling. |
Ok cool. I assumed we'd move these capabilities to somewhere else. But I agree that removing them entirely is probably easiest plus the actual import UI is protected behind a separate security check. |
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.
Functionally looks great. Permissions need to be sorted out but that can be tackled in another effort.
LGTM
code review, tested in chrome
* [Home] Adding file upload to add data page * updating comment * tiny refactor * attempting to reduce bundle size * reverting to original home register import * lazy load tab contents * changes based on review Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
Follow on permission work #101169 |
* master: (68 commits) Unskip advanced settings a11y test (elastic#100558) [App Search] Crawler Landing Page (elastic#100822) [DOCS] Clarify when to use kbn clean (elastic#101155) change label behavior (elastic#100991) skip flaky suite (elastic#101126) Fix cases plugin ownership (elastic#101073) [Home] Adding file upload to add data page (elastic#100863) [ML] Functional tests - reenable categorization tests (elastic#101137) [DOCS] Adds server.uuid to settings docs (elastic#101121) Fix newsfeed unread notifications always on when reloading Kibana (elastic#100357) [Lens] Time shift metrics (elastic#98781) [Deprecations service] make `correctiveActions.manualSteps` required (elastic#100997) Add "Risk Matrix" section to the PR template (elastic#100649) [Maps] spatially filter by all geo fields (elastic#100735) [Security Solution] Add Ransomware canary advanced policy option (elastic#101068) [Exploratory view] Core web vitals (elastic#100320) [Security solution][Endpoint] Add unit tests for fleet event filters/trusted apps cards (elastic#101034) [Lens] Use a setter function for the dimension panel (elastic#101123) [Index Patterns] Fix return saved index pattern object (elastic#101051) [CI] For PRs, build TS refs before public api docs check (elastic#100791) ...
* [Home] Adding file upload to add data page * updating comment * tiny refactor * attempting to reduce bundle size * reverting to original home register import * lazy load tab contents * changes based on review Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: James Gowdy <jgowdy@elastic.co>
* [ML] Add index visualizer * [ML] Readd support for global state * [ML] Add time buckets & fix dependencies * [ML] Working ver * [ML] Add back and boolean support * [ML] Remove old files inside ml * [ML] Rename files * [ML] Move field type icon * [ML] Create new folder structure * [ML] Organize index_data_visualizer * [ML] Move types into index_data_visualizer folder * [ML] Move more files into file_data_visualizer * [ML] Move more files into index_data_visualizer * [ML] Add new data visualizer model * [ML] Remove getVisualizerFieldStats which is not used by dv * [ML] Delete redundant folder * [ML] Copy old data visualizer routes to new plugin * [ML] Remove old routes * [ML] Disable for ml job cards tests for now * [ML] Remove todos * [ML] Move the toast error to the UI component * [ML] Fix map styling * [ML] Add runtime_mappings for internal/file_upload/time_field_range * [ML] Move routes into folder * [ML] Update permissions * [ML] Update texts * [ML] Update schemas import and api get_field_stats * [ML] Reorg folders into common * [ML] Update types & tests * [ML] Update internal/data_visualizer permissions and action panel tests * [ML] Update imports after #100863 * [ML] Fix CI * [ML] Rename folder from file_data_visualizer to data_visualizer * [ML] Rename i18n ids * [ML] Update fileDataVisualizer -> dataVisualizer dependency name in ml plugin * [ML] Remove ml prefix in data test subjs * [ML] Fix settings and docs * [ML] Update plugin description * [ML] Remove mlContext dependency completely * [ML] Set query to optional * Revert "[ML] Update plugin description" This reverts commit 4ab1a25c * [ML] Update plugins list docs * [ML] Fix types and i18n * [ML] Revert ml data test subj/class name changes * [ML] Split up data visualizer model, remove Logger * [ML] Remove empty file and indexPatternFieldEditor * [ML] Move imports of file_upload * [ML] Update plugin dependencies * Re-add missing data_visualizer.json * Remove capabilities in data_visualizer * Fix test subjs * Update ownership for data_visualizer and file_upload code to be ml * Update estypes after 98266 Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Adds a registry to the Home plugin to allow other plugins to add tabs to the Add Data page.
Embeds the File Data Visualizer in a new tab.
Closes #98652
cc @grabowskit
Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
Unit or functional tests were updated or added to match the most common scenarios
This was checked for breaking API changes and was labeled appropriately