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

enhancement: frontend validation for duplicate repo entry in tui (#550) #729

Conversation

abhishek818
Copy link
Contributor

@abhishek818 abhishek818 commented Jul 4, 2024

Related to --multi-project command

Pull Request Title

enhancement: frontend validation for duplicate repo entry in tui (#550)

Description

related to --multi-project command

  • This change requires a documentation update
  • I have made corresponding changes to the documentation

Related Issue(s)

This PR addresses issue #550

closes #550
/claim #550

Screenshots

If relevant, please add screenshots.

daytona_frontend_validation_2024-07-05

@abhishek818
Copy link
Contributor Author

@Tpuljak @idagelic Up for review..

@abhishek818
Copy link
Contributor Author

if you like the work, do add a tip. It was more time taking than anticipated..

…tonaio#550)

related to --multi-project command

Signed-off-by: Abhishek Kumar Gupta <abhishekguptaatweb17@gmail.com>
@abhishek818 abhishek818 force-pushed the enhancement_duplicate_entry_validation_tui branch from 1285082 to 1ddc522 Compare July 4, 2024 23:18
Copy link
Member

@Tpuljak Tpuljak left a comment

Choose a reason for hiding this comment

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

@abhishek818 thanks for tackling this issue. Unfortunately, your solution might not be ideal for users. Your flow breaks the creation flow in the duplication scenario which is not what we want.

I suggest the following:

  1. In manual mode - use the input.Validate function to display that the repo is a duplicate (i.e. return an error that will be displayed in the input)
  2. In TUI mode - the repo that was already selected should be disabled from selection completely (ideally, if the user were to focus on the repo with arrows, the TUI would automatically skip over that repo)

I'm placing the PR in draft. No need to close it since you will be able to reuse most of the work. Thanks!

@Tpuljak Tpuljak marked this pull request as draft July 5, 2024 11:49
@abhishek818
Copy link
Contributor Author

abhishek818 commented Jul 5, 2024

Your flow breaks the creation flow in the duplication scenario which is not what we want.

@Tpuljak if i understand correctly, my current changes doesnt breaks the flow (true for both manual and TUI modes). It rather allows the users to select a different option and gives a duplicate warning in the title header WITHOUT 'breaking the command and returning a fatal error'. Please correct me if i am missing something..

@abhishek818
Copy link
Contributor Author

In TUI mode - the repo that was already selected should be disabled from selection completely

yeah, agreed much better way. Will go with this. hey, but should i keep the 'ALREADY SELECTED' tag or not for these options?

@abhishek818
Copy link
Contributor Author

In manual mode - use the input.Validate function to display that the repo is a duplicate (i.e. return an error that will be displayed in the input)

This is what i am doing currently, what is missing ? Are you talking about not returning error in the title rather throw it in footer or something etc. ?

@abhishek818
Copy link
Contributor Author

@Tpuljak

@Tpuljak
Copy link
Member

Tpuljak commented Jul 5, 2024

if i understand correctly, my current changes doesnt breaks the flow (true for both manual and TUI modes). It rather allows the users to select a different option and gives a duplicate warning in the title header WITHOUT 'breaking the command and returning a fatal error'. Please correct me if i am missing something..

@abhishek818 I didn't mean it breaks the command but it breaks the UX. The user needs to input a repo, select yes/no for more projects and then a new screen opens up.

This is what i am doing currently, what is missing ? Are you talking about not returning error in the title rather throw it in footer or something etc. ?

I'm talking about return the appropriate error from the function. The error should say that the project is a duplicate and that will then be rendered in the input and not allow the user to move forward. Try it and you'll see what I mean.

yeah, agreed much better way. Will go with this. hey, but should i keep the 'ALREADY SELECTED' tag or not for these options?

You can keep the tag but let's make it say "Already selected" instead. Caps lock is a bit too aggressive 😄

P.S. No need to tag me in a separate comment, I get an email for each reply you post 😄

@abhishek818 abhishek818 force-pushed the enhancement_duplicate_entry_validation_tui branch 2 times, most recently from c3857d4 to 8f6c096 Compare July 7, 2024 11:10
@abhishek818 abhishek818 marked this pull request as ready for review July 7, 2024 11:11
@abhishek818
Copy link
Contributor Author

abhishek818 commented Jul 7, 2024

@Tpuljak
Fixed everything! Refer the gif below.

  1. skip selection/focus view over duplicate repo & git provider options (skips git provider having all repos already selected).
  2. doesnt break the command or throws fatal error or any UX.
  3. disable 'enter' keypress for disabled options.
  4. handle duplicacy over a mix of auto and manual modes (duplicate entry in manual input invoked inside auto mode)

daytona_tui_validation_2024-07-07

@abhishek818
Copy link
Contributor Author

You can keep the tag but let's make it say "Already selected" instead. Caps lock is a bit too aggressive 😄

P.S. No need to tag me in a separate comment, I get an email for each reply you post 😄

👍 😅

@abhishek818 abhishek818 force-pushed the enhancement_duplicate_entry_validation_tui branch from 8f6c096 to 1cd4e39 Compare July 7, 2024 11:50
…io#550)

Related to workspace creation using multi-project command
1. skip selection/focus view over duplicate repo & git provider options
   (skips git provider having all repos already selected)
2. enable validation before breaking command flow and throwing fatal error and UX flows
3. disable 'enter' keypress for disabled options
4. handle duplicate entries over a mix of auto and manual modes (duplicate entry in manual input invoked inside auto mode)

Signed-off-by: abhishek kumar gupta <abhishekguptaatweb17@gmail.com>
@abhishek818 abhishek818 force-pushed the enhancement_duplicate_entry_validation_tui branch from 1cd4e39 to b3bfb45 Compare July 7, 2024 11:51
@abhishek818 abhishek818 requested a review from Tpuljak July 7, 2024 17:03
Copy link
Member

@Tpuljak Tpuljak left a comment

Choose a reason for hiding this comment

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

@abhishek818 nice work on implementing the latest changes! This now feels like a great CLI improvement.

I left 2 comments that should improve this a bit more.

P.S. We recognize the effort that went into this and, of course, a tip will be provided 🙂

pkg/views/workspace/selection/provider.go Outdated Show resolved Hide resolved
pkg/views/workspace/selection/repository.go Outdated Show resolved Hide resolved
…ytonaio#550)

Signed-off-by: abhishek818 <abhishekguptaatweb17@gmail.com>
@abhishek818 abhishek818 force-pushed the enhancement_duplicate_entry_validation_tui branch from cdacf6e to a0131f5 Compare July 8, 2024 20:23
@abhishek818 abhishek818 requested a review from Tpuljak July 8, 2024 20:24
Signed-off-by: abhishek818 <abhishekguptaatweb17@gmail.com>
Copy link
Member

@Tpuljak Tpuljak left a comment

Choose a reason for hiding this comment

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

@abhishek818 nice work! Everything seems to work great now.

pkg/cmd/workspace/util/creation_data.go Outdated Show resolved Hide resolved
@Tpuljak Tpuljak requested a review from idagelic July 9, 2024 08:38
Signed-off-by: abhishek818 <abhishekguptaatweb17@gmail.com>
@abhishek818 abhishek818 requested a review from Tpuljak July 9, 2024 08:52
Copy link
Member

@idagelic idagelic left a comment

Choose a reason for hiding this comment

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

I tested this out and it looks great! NIce work!

The code is also okay to be merged, I just added a few comments for typos

pkg/cmd/workspace/util/creation_data.go Outdated Show resolved Hide resolved
pkg/cmd/workspace/util/creation_data.go Outdated Show resolved Hide resolved
pkg/views/workspace/selection/repository.go Outdated Show resolved Hide resolved
Signed-off-by: abhishek818 <abhishekguptaatweb17@gmail.com>
@abhishek818 abhishek818 requested a review from idagelic July 9, 2024 09:21
@Tpuljak
Copy link
Member

Tpuljak commented Jul 9, 2024

/tip $10

Copy link

algora-pbc bot commented Jul 9, 2024

Copy link

algora-pbc bot commented Jul 9, 2024

🎉🎈 @abhishek818 has been awarded $10! 🎈🎊

@idagelic idagelic merged commit 2c02b17 into daytonaio:main Jul 9, 2024
12 checks passed
@abhishek818
Copy link
Contributor Author

@Tpuljak do let me know if daytona has any pending issues/features and looking to bounty it..

@Tpuljak
Copy link
Member

Tpuljak commented Jul 9, 2024

@abhishek818 thank you for your interest! We definitely plan on putting bounties on more issues so keep an eye out.

@abhishek818
Copy link
Contributor Author

abhishek818 commented Jul 9, 2024

I feel 50$ at the least would be the overall perfect bounty amount for the effort spent on this one. Would keep me motivated for contributing more..
Anyways this is open source and amount is highly opinionated topic.

@Tpuljak
Copy link
Member

Tpuljak commented Jul 9, 2024

@abhishek818 I understand what you're getting at but we feel like the already-provided tip justified the effort needed to complete this issue. You have to understand that the amount of time invested is not something that influences the bounty amount but the objective effort needed to complete it.
We hope that you will continue to contribute to Daytona because we enjoy working with you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicate repo entry frontend validation
3 participants