-
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
[Files] Filepicker #143111
Merged
jloleysens
merged 85 commits into
elastic:main
from
jloleysens:files-filepicker-KBNA2079
Oct 24, 2022
Merged
[Files] Filepicker #143111
Changes from 81 commits
Commits
Show all changes
85 commits
Select commit
Hold shift + click to select a range
f184096
added unscoped file client to the files components context
jloleysens ddf2173
wip: created some basic files and stories for new filepicker component
jloleysens 41ed423
fix some types after require filesclient to be passed in
jloleysens a85a1dc
added file picker state and some basic tests
jloleysens 2661683
added file picker context
jloleysens a2221d9
added missing file client value
jloleysens a129c4b
updated file picker stories
jloleysens 42459a2
expanded files context;
jloleysens dfbaae5
remove the size observable and also added a test for file removal and…
jloleysens 1538c92
added error content component
jloleysens 70d7495
refactor upload component to not take files client as prop
jloleysens 5f61346
updated shared file compoennts context value
jloleysens 0dd866d
added test for adding multiple files at once
jloleysens 1a3b5f7
allow passing in string or array of strings
jloleysens c87a239
added some i18n texts
jloleysens 4c9f438
move the creation of a file kinds registry to a common location
jloleysens f080aec
set file kinds only once
jloleysens 98fa226
a bunch of stuff: added title component, using grid, removed responsi…
jloleysens 8391853
refactor layour components to own component using grid, added new i18…
jloleysens 569de31
minor copy tweak
jloleysens 3a49db2
added basic story with some files
jloleysens 6844647
added file grid and refactored picker to only exist in modal for now
jloleysens f2e71a5
get the css grid algo that we want: auto-fill not auto-fit!
jloleysens 69ba34b
override styling for content area of file
jloleysens abaf1f2
split stories of files
jloleysens 51ba099
delete commented out code
jloleysens 9bd9f75
give the modal a fixed width
jloleysens e56b10a
fix upload file state, where we do not want a fixed width modal
jloleysens 92ca412
moved styles down to card, and combined margin removal rules
jloleysens 1b8c4d6
optimize for filtering files, first pass just filter on names
jloleysens ed2c6da
include xxl
jloleysens a43cd1b
moved debounceTime to rxjs land, added test for filtering behaviour
jloleysens 19b9c58
added story with more images
jloleysens c0cb93f
big ol wip
jloleysens 1f551df
empty prompt when uploading a file
jloleysens 2b93c44
added pagination
jloleysens 24994ae
fixed tests and added some comments
jloleysens 690a387
address lint
jloleysens 70efb7e
moved copy to i18n and updated size and color of empty error prompt
jloleysens 9469648
remove use of css`
jloleysens 8b33acc
remove non existant prop
jloleysens ecf6c90
Merge branch 'main' into files-filepicker-KBNA2079
jloleysens 2bb31ea
also reload files
jloleysens ec346b1
fileUpload -> files
jloleysens 424879c
update logic for watching if selected
jloleysens 126bfb6
disambiguate i18n ids
jloleysens 51f1a28
Merge branch 'main' into files-filepicker-KBNA2079
jloleysens b576308
use abort signal and call sendRequest from file$, filtering done serv…
jloleysens 954a5a4
fix a few off by one errors and hook up the new system to the ui
jloleysens 6aac935
added test for in flight requests behaviour
jloleysens 65c5a75
update the files example app
jloleysens 2689c9b
fix minor card layout styling to make all cards the same size regardl…
jloleysens beb0360
added new file picker component
jloleysens 57a0b65
make file cards a bit wider and text a bit smaller so that it wraps...
jloleysens 2233c93
fix issue of throwing abort error and prematurely setting request to …
jloleysens e07decc
remove unused import
jloleysens 3b4b4e2
replace filter i18n
jloleysens 1373c52
a bunch of cool changes
jloleysens 54eecae
added export for the file picker component
jloleysens 9eef858
updated example app to use multiple file upload
jloleysens bb02c64
added some comments and made images load eagerly in file picker for n…
jloleysens 217a4f5
complete ux for examples
jloleysens 0a7d8a3
only files that are "READY" should be in the file picker
jloleysens e3eddcb
Merge branch 'main' into files-filepicker-KBNA2079
jloleysens 60b5fbb
Merge branch 'main' into files-filepicker-KBNA2079
jloleysens 0d1d530
set loading to false if error
jloleysens e742e2b
install data-test-subj everywhere!
jloleysens 25b04ac
added some react component tests
jloleysens 3276146
remove unused import
jloleysens d7b86c1
fix storybook case
jloleysens 52db453
Merge branch 'main' into files-filepicker-KBNA2079
jloleysens eca2bd3
fix up where the files example plugin is listed, moved it to the deve…
jloleysens b3b52d5
fix potential flashing of loader by debouncing
jloleysens 28dbef0
do not create new observable on every render
jloleysens 786485e
i18n
jloleysens fe23fde
have only filepicker ctx used in filepicker components
jloleysens 94e8caa
refactor loadImageEagerly -> lazy
jloleysens b05f2d9
useObservable instead of useEffect
jloleysens ba7f6bd
factor modal footer to own component and remove css util
jloleysens 7b83fe1
use the middle dot luke
jloleysens 8946c03
Merge branch 'main' into files-filepicker-KBNA2079
kibanamachine 784cf1c
copy update in files example app
jloleysens 151ead5
added filter story
jloleysens 75adddf
Merge branch 'main' into files-filepicker-KBNA2079
kibanamachine c560b17
Merge branch 'main' into files-filepicker-KBNA2079
kibanamachine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
x-pack/examples/files_example/public/components/file_picker.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import type { FunctionComponent } from 'react'; | ||
|
||
import { exampleFileKind } from '../../common'; | ||
|
||
import { FilePicker } from '../imports'; | ||
|
||
interface Props { | ||
onClose: () => void; | ||
onDone: (ids: string[]) => void; | ||
} | ||
|
||
export const MyFilePicker: FunctionComponent<Props> = ({ onClose, onDone }) => { | ||
return <FilePicker kind={exampleFileKind.id} onClose={onClose} onDone={onDone} />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
x-pack/plugins/files/public/components/file_picker/components/clear_filter_button.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import React from 'react'; | ||
import type { FunctionComponent } from 'react'; | ||
import useObservable from 'react-use/lib/useObservable'; | ||
import { EuiLink } from '@elastic/eui'; | ||
import { css } from '@emotion/react'; | ||
import { useFilePickerContext } from '../context'; | ||
|
||
import { i18nTexts } from '../i18n_texts'; | ||
|
||
interface Props { | ||
onClick: () => void; | ||
} | ||
|
||
export const ClearFilterButton: FunctionComponent<Props> = ({ onClick }) => { | ||
const { state } = useFilePickerContext(); | ||
const query = useObservable(state.queryDebounced$); | ||
if (!query) { | ||
return null; | ||
} | ||
return ( | ||
<div | ||
css={css` | ||
display: grid; | ||
place-items: center; | ||
`} | ||
> | ||
<EuiLink onClick={onClick}>{i18nTexts.clearFilterButton}</EuiLink> | ||
</div> | ||
); | ||
}; |
37 changes: 37 additions & 0 deletions
37
x-pack/plugins/files/public/components/file_picker/components/error_content.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import type { FunctionComponent } from 'react'; | ||
import { EuiButton, EuiEmptyPrompt } from '@elastic/eui'; | ||
import { i18nTexts } from '../i18n_texts'; | ||
import { useFilePickerContext } from '../context'; | ||
import { useBehaviorSubject } from '../../use_behavior_subject'; | ||
|
||
interface Props { | ||
error: Error; | ||
} | ||
|
||
export const ErrorContent: FunctionComponent<Props> = ({ error }) => { | ||
const { state } = useFilePickerContext(); | ||
const isLoading = useBehaviorSubject(state.isLoading$); | ||
return ( | ||
<EuiEmptyPrompt | ||
data-test-subj="errorPrompt" | ||
iconType="alert" | ||
iconColor="danger" | ||
titleSize="xs" | ||
title={<h3>{i18nTexts.loadingFilesErrorTitle}</h3>} | ||
body={error.message} | ||
actions={ | ||
<EuiButton disabled={isLoading} onClick={state.retry}> | ||
{i18nTexts.retryButtonLabel} | ||
</EuiButton> | ||
} | ||
/> | ||
); | ||
}; |
5 changes: 5 additions & 0 deletions
5
x-pack/plugins/files/public/components/file_picker/components/file_card.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.filesFilePicker { | ||
.euiCard__content, .euiCard__description { | ||
margin :0; // make the cards a little bit more compact | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Not that I don't agree with you. But I'm not sure there's a significant reason to overwrite our EUI styles here. Ideally we wouldn't need to do this to save future maintenance (and work for you)