Skip to content

Conversation

@mendaomn
Copy link
Contributor

@mendaomn mendaomn commented Mar 7, 2023

Description

This PR improves the hidden file uploader so that it can be controlled via props. This is part of a bigger effort to change way the cluster creation can be started by the user.

Follow up PRs will be linked to this

Changes

  • deprecate existing HiddenUploader so not to break the Source page with this PR
  • refactor HiddenFileUpload to be controlled via props

How Has This Been Tested?

  • manually
  • unit test
  • a proper test checking that the onChange handler is being called after upload file is missing, this is due to the difficulty to simulate a file upload while also controlling the behaviour of the onload event of the FileReader

PR Quality Checklist

  • I added tests to new or existing code
  • I removed hardcoded strings and used react-i18next library (useTranslation hook and/or Trans component), see an example here
  • I made sure no sensitive info gets logged at any time in the codebase (see here) (e.g. no user info or details, no stacktraces, etc.)
  • I checked that infrastructure/update_infrastructure.sh runs without any error
  • I checked that npm run build builds without any error
  • I checked that clusters are listed correctly
  • I checked that a new cluster can be created (config is produced and dry run passes)
  • I checked that login and logout work as expected

In order to increase the likelihood of your contribution being accepted, please make sure you have read both the Contributing Guidelines and the Project Guidelines

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@mendaomn mendaomn requested a review from mtfranchetto March 7, 2023 10:19
@mendaomn mendaomn marked this pull request as draft March 7, 2023 10:19
@mendaomn mendaomn marked this pull request as ready for review March 7, 2023 10:20
Copy link
Contributor

@mtfranchetto mtfranchetto left a comment

Choose a reason for hiding this comment

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

The changes LGTM, even though the hidden file upload is quite tricky. Have you consider using a fileinput not hidden? By switching to a ButtonDropdown in the Clusters table for selecting the type of wizard you can place a fileinput that will get triggered as soon as the option is selected, without the open/useEffect trick to trigger it

@mendaomn
Copy link
Contributor Author

mendaomn commented Mar 7, 2023

The changes LGTM, even though the hidden file upload is quite tricky. Have you consider using a fileinput not hidden? By switching to a ButtonDropdown in the Clusters table for selecting the type of wizard you can place a fileinput that will get triggered as soon as the option is selected, without the open/useEffect trick to trigger it

As discussed offline, since the ButtonDropdown does not support custom ReactElements, we are keeping the current solution

@mendaomn mendaomn merged commit 3b80ffe into main Mar 7, 2023
@mendaomn mendaomn deleted the refactor-hidden-file-upload branch March 7, 2023 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants