Skip to content
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
merged 85 commits into from
Oct 24, 2022
Merged

[Files] Filepicker #143111

merged 85 commits into from
Oct 24, 2022

Conversation

jloleysens
Copy link
Contributor

@jloleysens jloleysens commented Oct 11, 2022

Adds the new Filepicker component (modal). See the resulting files storybooks to test it out.

Notes to reviewers

  • This component does not use "true" pagination at the moment because the list endpoint does not support filtering, we should add this in a follow up PR
  • To make uploads easier we should layer on a component that makes the entire modal a droppable region that will upload files, right now it is only possible to upload a file when the component has no files loaded
  • If you want to get the best experience of the component in action (i.e., actually talking to Elastic) I would boot up Kibana with examples running yarn start --run-examples and open the filesExample plugin (at app/filesExample). Upload a few documents via the "Upload" button and then pick 'em in "Picker"!

Screenshot 2022-10-18 at 14 49 50

Screenshots

Screenshots Screenshot 2022-10-13 at 12 09 58 Screenshot 2022-10-13 at 12 12 40 Screenshot 2022-10-13 at 12 09 48 Screenshot 2022-10-13 at 12 39 39

@jloleysens
Copy link
Contributor Author

I don't see an "Upload" button or some other way to bring up the upload component, once there are some files already uploaded:

I'll address this in a follow up PR. We can probably just add the compact version of the filepicker somewhere.

@jloleysens
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@mdefazio mdefazio left a comment

Choose a reason for hiding this comment

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

A few comments:

Uploading a file

Should the text inside the file upload simply say 'Select or drop a file' to be more concise? Removes the extra conjunction.

image

When uploading the file, let's use the [loading button](https://elastic.github.io/eui/#/navigation/button#loading-state) , and then change it to a `success` button with the check icon. The label could then say 'Upload complete'. We would not need to use the pink line loading indicator in this case then. I would imagine this would be the same behavior for the `Basic` and `Allow repeated uploads` options.

The Long error scenario should also use the default button, instead of an empty button. Though in this case, we could use the danger styling. The error messages seem fine though.

If I abort the upload, should that message not appear somewhere? Also switching this to a default button rather than empty like the other scenarios can help keep this upload button the main focus. Perhaps reusing the Max size option here, but simply changing the text to 'File upload cancelled'
image

The Allow clear after upload should probably be colored as danger and say 'Remove file', since this is what we use within the file upload box as well. Perhaps also including the crossInCircleFilled icon here keeps this consistent with our clearing an input box.

The Immediate upload can use the same success message as the previous scenarios, rather than only an icon.

Same feedback for Immediate upload error.
The Immediate upload abort Retry should show a default button as mentioned in previous scenarios.

File picker

Not sure if this is part of the component, but if the button says Pick a file, the modal title should likely say 'Pick a file' rather than 'Select a file'. I would vote for 'Select a file' as the button label, but I believe these two should be consistent (as well as the save/confirmation button).

The Empty version has 'No files found' and 'Upload your first file'. These seem to contradict each other. Is this also reused as the empty state for searching? Maybe we don't need to include 'Upload your first file' if so?

The Error loading screen has the word 'stop' as the description text. Is this necessary? Or can we change it something more meaningful?


Im obviously reviewing the storybook examples, but will run this locally shortly as well. Please reach out if these comments don't make sense. This is really nice overall!

Update - File upload screen

Note sure if these are necessary for the component...but here goes:

  • I would also suggest using the left-aligned, default (stacked) description list, rather than reversing these and using columns.

  • I think the close button should be on the left side of the flyout, with 'Download' being on the right.

  • What are the possibilities for the Status column? Do we need this?

  • Wondering if we need to use the eye icon here. And just let them click on the file name?

  • And I would use our typical Confirm modal dialog when deleting a file. Unless I'm missing this pattern being adopted elsewhere? Perhaps the delete icon doesn't need to always be visible, but only show on row hover?

@jloleysens
Copy link
Contributor Author

jloleysens commented Oct 20, 2022

@mdefazio

Uploading a file

Thanks for the design feedback on the upload file component! It was very much needed. This component is not being introduced in this PR, but I'll make an issue of the comments you left and address them in a separate PR! I've opened this issue with your comments: #143724

@jloleysens jloleysens closed this Oct 20, 2022
auto-merge was automatically disabled October 20, 2022 08:22

Pull request was closed

@jloleysens jloleysens reopened this Oct 20, 2022
@jloleysens
Copy link
Contributor Author

Not sure if this is part of the component, but if the button says Pick a file, the modal title should likely say 'Pick a file'...

At the moment the modal's title is "Select a file" and the button says "Select file". When the user selects more than one file the text on the button changes to "Select x files" where x is the number of selected files.

This does still need copy review, I'll be sure to get it!

The Empty version has 'No files found' and 'Upload your first file'. These seem to contradict each other...

Good point, this also needs copy review. I was trying to use the empty to prompt the user to action. The user should only see this state if they have no files uploaded. This "no data" view will probably not be seen by most users.

The Error loading screen has the word 'stop' as the description text

😄 the text "stop" is from the error I was throwing in the story book. Normally, this would contain the error of the network request. Telling users "stop!" would be pretty funny in this context though!

@mdefazio
Copy link
Contributor

At the moment the modal's title is "Select a file" and the button says "Select file". When the user selects more than one file the text on the button changes to "Select x files" where x is the number of selected files.

This was regarding the button that launches the modal...shown in the PR description.

image

Again, didn't know if this was part of the component or up to the developer using it. But would be good to add a note that these should match, or a recommended label.

The user should only see this state if they have no files uploaded. This "no data" view will probably not be seen by most users.

What if they search and return no results? I agree pushing an action on the empty state. Perhaps just removing the word 'first' would avoid any potential confusion?

Normally, this would contain the error of the network request.

So not something this component controls? Do we have a set of common network errors that we provide stock copy for?

Thanks for bearing with me on the follow up questions. Just wanted to clarify and then I'll ✅

@jloleysens
Copy link
Contributor Author

jloleysens commented Oct 20, 2022

Again, didn't know if this was part of the component or up to the developer using it. But would be good to add a note that these should match, or a recommended label.

I see, apologies for the misunderstanding. This is the developer examples app, shouldn't ever be seen by non-devs, but happy to go with your recommendation!

What if they search and return no results? I agree pushing an action on the empty state. Perhaps just removing the word 'first' would avoid any potential confusion?

Ah I see, in that case the user will see "No files matched filter".

Screenshot 2022-10-20 at 16 50 00

So not something this component controls? Do we have a set of common network errors that we provide stock copy for?

Right, not something this component controls. This is intended as a catch-all message where the summary is "We couldn't load the files". The action will always be to just retry. If that doesn't work, they have an error message that might help or that they can report to us if it comes to it.

@@ -0,0 +1,5 @@
.filesFilePicker {
.euiCard__content, .euiCard__description {
margin :0; // make the cards a little bit more compact
Copy link
Contributor

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)

Copy link
Contributor

@mdefazio mdefazio left a comment

Choose a reason for hiding this comment

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

Just a comment on the margin override. Not a huge deal, thanks for setting up the other issue with my comments 🙇

@jloleysens
Copy link
Contributor Author

@elasticmachine merge upstream

@jloleysens
Copy link
Contributor Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
files 41 68 +27

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
files 14 18 +4

Async chunks

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

id before after diff
files 9.0KB 25.3KB +16.4KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
files 18.9KB 19.5KB +573.0B
Unknown metric groups

API count

id before after diff
files 260 271 +11

async chunk count

id before after diff
files 1 2 +1

ESLint disabled in files

id before after diff
files 3 4 +1

Total ESLint disabled count

id before after diff
files 6 7 +1

History

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

@jloleysens jloleysens merged commit a42f182 into elastic:main Oct 24, 2022
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Oct 24, 2022
@jloleysens jloleysens deleted the files-filepicker-KBNA2079 branch October 24, 2022 09:00
jloleysens added a commit to jloleysens/kibana that referenced this pull request Oct 24, 2022
* main: (57 commits)
  [Files] Filepicker (elastic#143111)
  [Infrastructure UI] Replace Lens table with EUI table and own api (elastic#142871)
  [api-docs] Daily api_docs build (elastic#143829)
  [api-docs] Daily api_docs build (elastic#143825)
  [api-docs] Daily api_docs build (elastic#143823)
  [Security Solution] Restructuring folders of Detection Engine + refactoring Rule Management (elastic#142950)
  [Dev tools] Fix performance issue with autocomplete suggestions (elastic#143428)
  [Security Solution] Disable ML rule's edit button link under basic license (elastic#143260)
  [Lens]  Use the language-documentation package for formula (elastic#143649)
  [api-docs] Daily api_docs build (elastic#143811)
  [Security Solution] Fix missing title on inspect pop-up (elastic#143601)
  fix incorrect filters being passed to events table causing duplicate entries in our inpsect tool request tab (elastic#143239)
  [Security Solution][Endpoint] `get-file` response action kibana download file API (elastic#143708)
  Rely on refresh context to update stats independently of overview cards. (elastic#143308)
  [RAM] Rule event log - Fix incorrect results when filtering by message and outcome simultaneously (elastic#143119)
  [ML] Display link to create data view from error cases in data frame analytics results pages (elastic#143596)
  Update links in README :) (elastic#143675)
  Add more tests for ml_inference_logic (elastic#143764)
  skip failing test suite (elastic#143717)
  [DOCS] Add assignees to case APIs (elastic#143610)
  ...
defaultMessage: 'my-file-*',
}),
emptyFileGridPrompt: i18n.translate('xpack.files.filePicker.emptyGridPrompt', {
defaultMessage: 'No files matched filter',
Copy link
Contributor

Choose a reason for hiding this comment

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

No files match your filter


export const i18nTexts = {
title: i18n.translate('xpack.files.filePicker.title', {
defaultMessage: 'Select a file',
Copy link
Contributor

Choose a reason for hiding this comment

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

The title is good if you can select 1 file. If you can select multiple files, then the title should be "Select files",

defaultMessage: 'Select a file',
}),
loadingFilesErrorTitle: i18n.translate('xpack.files.filePicker.error.loadingTitle', {
defaultMessage: 'Could not load files',
Copy link
Contributor

Choose a reason for hiding this comment

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

The title is "Select a file" (singular) but the message is "Could not load files" (plural). This should match.

Also, suggest this wording "Cannot load files"

The body of the message says "stop". Can you give a reason as to why the files cannot be loaded?

retryButtonLabel: i18n.translate('xpack.files.filePicker.error.retryButtonLabel', {
defaultMessage: 'Retry',
}),
emptyStatePrompt: i18n.translate('xpack.files.filePicker.emptyStatePrompt', {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this an empty state? If so, can "Upload your first file" be the heading?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed backport:skip This commit does not require backporting feature:Files release_note:skip Skip the PR/issue when compiling release notes v8.6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants