mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
[Files] Add meta
prop to <FilePicker />
(#151417)
## Summary Added the `meta` prop to the `FilePicker` component, also pass this down to the `FileUpload` component so that files created via the picker can have meta set. Close https://github.com/elastic/kibana/issues/151375 ## How to test 1. Start Kibana with examples `yarn start --run-examples` 2. Go to the "Developer examples" in the side-nav menu under analytics 3. Go to "Files example" 4. Upload a file via the "Select file" button, should present an empty file picker if you have no files, otherwise use the little upload component bottom left 5. Either select files or dismiss the modal 6. Inspect the uploaded file and see the `myCool: 'meta'` entry included with other metadata ## Screenshot A file uploaded via the `FilePicker` in the "Files example" plugin. <img width="897" alt="Screenshot 2023-02-16 at 11 41 06" src="https://user-images.githubusercontent.com/8155004/219342872-c39b5d81-7421-4187-bb1c-d6815d80a3dc.png"> ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
This commit is contained in:
parent
794a9493d5
commit
f1b0dd4720
9 changed files with 33 additions and 6 deletions
|
@ -174,6 +174,7 @@ export const FilesExampleApp = ({ files, notifications }: FilesExampleAppDeps) =
|
|||
notifications.toasts.addSuccess({
|
||||
title: 'Uploaded files',
|
||||
});
|
||||
refetch();
|
||||
}}
|
||||
onDone={(ids) => {
|
||||
notifications.toasts.addSuccess({
|
||||
|
|
|
@ -27,6 +27,7 @@ export const MyFilePicker: FunctionComponent<Props> = ({ onClose, onDone, onUplo
|
|||
onDone={(files) => onDone(files.map((f) => f.id))}
|
||||
onUpload={(n) => onUpload(n.map(({ id }) => id))}
|
||||
pageSize={50}
|
||||
uploadMeta={{ myCool: 'meta' }}
|
||||
multiple
|
||||
/>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue