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

feat: [M3-8023] - Refactor Image Upload and Add Tags #10484

Conversation

bnussman-akamai
Copy link
Member

@bnussman-akamai bnussman-akamai commented May 17, 2024

Description 📝

  • Refactors the Image Upload page and related components 🧹
    • Use react-hook-form to provide realtime validation ☑️
  • Implements new UI based on Image Service gen2 mockups 🎨
  • Adds tags to the Image Upload page 🏷️
  • Improves drag-drop styles 🎨
  • Adds a Create Image button 🔘 (previously, the upload would begin when the upload was selected)

Preview 📷

Before After
Screenshot 2024-05-17 at 3 10 09 PM Screenshot 2024-05-17 at 3 09 00 PM

How to test 🧪

  • Test all functionality related to the Image Upload page 👀
    • Verify you can upload an image
    • Verify validation works
    • Verify you can't navigate to a different page when an upload is in progress
    • Compare this new flow to the existing flow and look for oversights/regressions

Note

Don't have an Image to upload? This is how I generate a gziped image:

  1. Download an image from https://alpinelinux.org/downloads/
  2. In your terminal run gzip alpine-standard-3.19.1-x86_64.iso.gz
  3. Upload that Image

As an Author I have considered 🤔

  • 👀 Doing a self review
  • ❔ Our contribution guidelines
  • 🤏 Splitting feature into small PRs
  • ➕ Adding a changeset
  • 🧪 Providing/Improving test coverage
  • 🔐 Removing all sensitive information from the code and PR description
  • 🚩 Using a feature flag to protect the release
  • 👣 Providing comprehensive reproduction steps
  • 📑 Providing or updating our documentation
  • 🕛 Scheduling a pair reviewing session
  • 📱 Providing mobile support
  • ♿ Providing accessibility support

@bnussman-akamai bnussman-akamai self-assigned this May 17, 2024
@bnussman-akamai bnussman-akamai marked this pull request as ready for review May 17, 2024 19:20
@bnussman-akamai bnussman-akamai requested review from a team as code owners May 17, 2024 19:20
@bnussman-akamai bnussman-akamai requested review from AzureLatte, mjac0bs and abailly-akamai and removed request for a team May 17, 2024 19:20
Copy link

github-actions bot commented May 17, 2024

Coverage Report:
Base Coverage: 81.73%
Current Coverage: 82.28%

Copy link
Member Author

Choose a reason for hiding this comment

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

I moved logic out of ImageUpload and into here to clean up ImageUpload as much as possible

Copy link
Member Author

@bnussman-akamai bnussman-akamai May 17, 2024

Choose a reason for hiding this comment

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

Lots of changes here. All of these changes were at my discretion. I will check with UX and make sure they are cool with everything.

  • Batching logic isn't needed because you can only upload one image at a time
  • I made the styles more obvious for when you drag and drop
  • I moved the logic that makes the API request and upload request into ImageUpload
  • Errors now show as a notice instead of a toast
  • Added upload rate and estimated time
Screen.Recording.2024-05-17.at.3.58.58.PM.mov

Copy link
Member Author

Choose a reason for hiding this comment

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

This is the primary component 🚨

  • We now use react-hook-form
  • There is now a submit button (it no longer submits when you drop the image)
  • Removed one-off styles
  • Added tags
  • Removed unnessearcy logic that sends the user to login (this is handeled automatically elsewhere and shouldn't be needed)
  • New UI based on Image Service Gen2 mockups

Copy link
Member Author

Choose a reason for hiding this comment

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

This just contains utils for ImageUpload. I created this to try to keep ImageUpload clean

Comment on lines -19 to -35
const [label, setLabel] = React.useState<string>(
location?.state ? location.state.imageLabel : ''
);
const [description, setDescription] = React.useState<string>(
location?.state ? location.state.imageDescription : ''
);
const [isCloudInit, setIsCloudInit] = React.useState<boolean>(false);

const handleSetLabel = (e: React.ChangeEvent<HTMLInputElement>) => {
const value = e.target.value;
setLabel(value);
};

const handleSetDescription = (e: React.ChangeEvent<HTMLInputElement>) => {
const value = e.target.value;
setDescription(value);
};
Copy link
Member Author

Choose a reason for hiding this comment

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

All state is now handled by react-hook-form

@abailly-akamai
Copy link
Contributor

@bnussman-akamai looks great! can you confirm all changes with UX before doing a deep dive review?

Copy link
Contributor

@hkhalil-akamai hkhalil-akamai left a comment

Choose a reason for hiding this comment

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

Changes look good in manual and code review. One suggestion related to inputRef.

Copy link
Contributor

Choose a reason for hiding this comment

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

Love to see this simplification! 🧹

@AzureLatte AzureLatte removed their request for review May 21, 2024 15:27
Copy link
Contributor

@mjac0bs mjac0bs left a comment

Choose a reason for hiding this comment

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

Lots of great clean up and improvements here, thanks @bnussman-akamai. 🧼 ✨ The uploader styling with estimated time and upload rate all looks so much better!

Confirmed:

  • The ability to upload images in Chrome, Firefox, Safari via both file explorer and drag and drop
  • That styles looked good in both light and dark mode
  • I encounter a confirmation modal if I navigate away from the upload page while upload is in progress
  • Validation works by triggering various errors
  • Tests pass
  • Storybook story looks good - thanks for updating

⚠️ Noticed:

  • That the CLI command doesn't include tags

Left some other minor recommendations that are either typos or suggestions to improve UX. I can circle back to this if there are any further UX changes, but I'll approve in the meantime since overall functionality looks good so this doesn't get held up.

packages/manager/src/features/Images/ImageUpload.utils.ts Outdated Show resolved Hide resolved
packages/manager/src/features/Images/ImageUpload.utils.ts Outdated Show resolved Hide resolved
packages/api-v4/src/images/images.ts Outdated Show resolved Hide resolved
packages/manager/src/features/Images/ImageUpload.tsx Outdated Show resolved Hide resolved
packages/manager/src/features/Images/ImageUpload.tsx Outdated Show resolved Hide resolved
packages/manager/src/features/Images/ImageUpload.tsx Outdated Show resolved Hide resolved
packages/manager/src/features/Images/ImageUpload.tsx Outdated Show resolved Hide resolved
@bnussman-akamai
Copy link
Member Author

Great feedback @mjac0bs. I'm checking with UX on the Upload Using Command Line change

Copy link
Contributor

@abailly-akamai abailly-akamai left a comment

Choose a reason for hiding this comment

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

The code changes are a little too dense and touching so many areas it's pretty hard to review effectively. This is the kind of refactor that could've used a phased approach along with UX partnership before being put in a large PR.

All that being said it's a nice cleanup, featuring good improvements (upload CTA) and things are working well and "feel" good so I'll assume code quality and focus and a couple UI aspects:

Panels: (new change)
Screenshot 2024-05-23 at 09 08 22

Region Select (opportunity to improve on existing)
Screenshot 2024-05-23 at 09 25 05

Confirmation Toast:
Screenshot 2024-05-23 at 09 23 36
👉 shows an closing icon but toast can't be dismissed, meanwhile when toast showing up when the image is available is dismissible

@bnussman-akamai bnussman-akamai added the Approved Multiple approvals and ready to merge! label May 23, 2024
@bnussman-akamai
Copy link
Member Author

AlI changes have been reviewed and approved by UX 🎉

The "Upload Using Command Line" change was made @mjac0bs

Going to check with UX on the region helper text and the two papers @abailly-akamai The broken Toast issue is out of scope of this work.

@abailly-akamai
Copy link
Contributor

Lol everything was kinda out of scope

@mjac0bs
Copy link
Contributor

mjac0bs commented May 23, 2024

@abailly-akamai Noting that we do have a ticket for the broken toast close already (M3-8052).

Thanks for checking with UX and confirming those improvements, @bnussman-akamai!

@abailly-akamai
Copy link
Contributor

Awesome rework - thanks for spending the time on this 👍

something funky with the pipeline again 🤔

@bnussman-akamai
Copy link
Member Author

@abailly-akamai UX confirmed they want to keep the separate papers. They provided some updated helper text for the region select. They requested it goes above the input instead of below

@bnussman-akamai bnussman-akamai merged commit 60a108d into linode:develop May 28, 2024
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Multiple approvals and ready to merge! Images Relating to Images
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants