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

Wizard V2: Custom Repositories refactor #2050

Merged
merged 1 commit into from
Jun 4, 2024

Conversation

Andrewgdewar
Copy link
Contributor

@Andrewgdewar Andrewgdewar commented May 2, 2024

  • Updated content api usage
  • Refactored repositories
  • A lot of small changes

One design change:
My pm suggested removing the confirmation modal on deletion during the edit screen, I have commented that out and will ask for feedback from all of you. We believe the warning below should be sufficient.
Screenshot 2024-05-06 at 10 46 51 PM

Also updated the empty state screen:
Screenshot 2024-05-08 at 8 34 19 PM

Screenshot 2024-05-08 at 8 39 01 PM

@app-sre-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@Andrewgdewar Andrewgdewar force-pushed the HMS-4024 branch 2 times, most recently from 3e91383 to 6eb61f0 Compare May 6, 2024 21:42
@Andrewgdewar Andrewgdewar changed the title Wizard V2: Custom Repositories refactor (WIP) Wizard V2: Custom Repositories refactor May 6, 2024
@Andrewgdewar Andrewgdewar marked this pull request as ready for review May 6, 2024 21:44
@Andrewgdewar Andrewgdewar force-pushed the HMS-4024 branch 2 times, most recently from f959ea2 to 3b6a168 Compare May 8, 2024 19:30
Copy link
Collaborator

@regexowl regexowl left a comment

Choose a reason for hiding this comment

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

Thank you for working on the refactor! The code looks much cleaner ❤️

Looking at this from the user point of view there seems to be considerably more loading as more actions trigger a new API call including search and removing repositories.

This is linked to the question of how many repositories should we initially fetch - previously we fetched all the repositories right from the start which looked a bit more seamless when going through the step. What I mean is this:

  • previously the fetching happened at the initialization of the step, but then there was no further loading / skeletons:
    repos-old

  • now the loading state gets triggered on toggling between all/selected, searching, clearing search input, changing pagination perPage limit and removing a repo
    repos-new

Which might not be necessarily bad, but it might be good to discuss which path to take from this point. What would be the advantages of handling the data via a series of API calls?

@regexowl regexowl added the ❔ question Further information is requested label May 22, 2024
@regexowl
Copy link
Collaborator

regexowl commented May 22, 2024

As for the feedback to removing the modal - I remember adding it for some reason, but can't really remember what the reason was 😅

I guess it was there to make double sure that the user knows they can break their image with the change? Not sure if that's too much safeguarding though.

Any thoughts @mmenestr @kelseamann ?

edit: it should be this modal if I'm correct
image

Also to check - when removing a repository what would be the desired behaviour? Currently when in the Selected toggle the checkbox gets unchecked, but the repository stays there until the toggle gets toggled to All and retoggled to Selected again.

After the changes the repository would disappear from the Selected list as soon as it gets unchecked. I'm aware we're not currently consistent with the behaviour between repos / packages steps, so this might be an issue for a separate PR.

@mmenestr
Copy link

I feel like we should keep the modal... this is probably a rare scenario anyway. Also, I think that when the user unselects the repo, the packages should automatically get removed from the "selected" toggle.

In general - my guidance when it comes to unselected items is this:

If the user is in the "selected" toggle, and unchecks something, then the items should remain in the "selected" list, unchecked, until the user toggles back to "All".

However, if the user is NOT on the selected toggle, and their actions impact the selected toggle, then the items should automatically go away from the selected toggle.

Does that make sense? It basically just depends on whether the user is in the selected toggle while things are unselected or not.

@regexowl
Copy link
Collaborator

Also, I think that when the user unselects the repo, the packages should automatically get removed from the "selected" toggle.

Agree, alas that's currently not possible as the packages aren't linked to their origin repository.

@Andrewgdewar
Copy link
Contributor Author

Andrewgdewar commented May 28, 2024

Thank you for working on the refactor! The code looks much cleaner ❤️

Looking at this from the user point of view there seems to be considerably more loading as more actions trigger a new API call including search and removing repositories.

This is linked to the question of how many repositories should we initially fetch - previously we fetched all the repositories right from the start which looked a bit more seamless when going through the step. What I mean is this:

  • previously the fetching happened at the initialization of the step, but then there was no further loading / skeletons:
    repos-old

        [
          
        
            ![repos-old](https://private-user-images.githubusercontent.com/49452678/332746850-ba2204ef-bd11-4a94-8176-41256fc44b16.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTU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CZYLUFtei1EYXRlPTIwMjQwNTI4VDE0NDI1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTMxZTEwZjY0MWUxMjExYWI5NmI0YTIzMjhjNTQzN2MzZTZjMWJiZDZkYzlkMWFhNWI2NDk5Mzc0NmM4YWY2NjgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.e63EtPWhTi3Jhux8d5HD5iGbfUWZnKiOVGL0R8vbz84)
        
        
          
            
              
            
            
              
              
            
          
          [
            
              
            
          ](https://private-user-images.githubusercontent.com/49452678/332746850-ba2204ef-bd11-4a94-8176-41256fc44b16.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTY5MDc2NzIsIm5iZiI6MTcxNjkwNzM3MiwicGF0aCI6Ii80OTQ1MjY3OC8zMzI3NDY4NTAtYmEyMjA0ZWYtYmQxMS00YTk0LTgxNzYtNDEyNTZmYzQ0YjE2LmdpZj9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA1MjglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNTI4VDE0NDI1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTMxZTEwZjY0MWUxMjExYWI5NmI0YTIzMjhjNTQzN2MzZTZjMWJiZDZkYzlkMWFhNWI2NDk5Mzc0NmM4YWY2NjgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.e63EtPWhTi3Jhux8d5HD5iGbfUWZnKiOVGL0R8vbz84)
    
  • now the loading state gets triggered on toggling between all/selected, searching, clearing search input, changing pagination perPage limit and removing a repo
    repos-new

        [
          
        
            ![repos-new](https://private-user-images.githubusercontent.com/49452678/332747393-f7d1785b-4bd1-4982-b8ee-cd0728780342.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTY5MDc2NzIsIm5iZiI6MTcxNjkwNzM3MiwicGF0aCI6Ii80OTQ1MjY3OC8zMzI3NDczOTMtZjdkMTc4NWItNGJkMS00OTgyLWI4ZWUtY2QwNzI4NzgwMzQyLmdpZj9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA1MjglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNTI4VDE0NDI1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdjOTRjYmRlNzg2ZjkyODIyYzUyMGI0N2I4NTQ4MzBlZjllM2U4MjQ1MTBmZTA1NTdlZDYwMDMzNTAzNTFjYzkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.W7LKIywXBmeN6-6dKiTmi7Pjde6SK11066WQ4VVCucw)
          ](https://private-user-images.githubusercontent.com/49452678/332747393-f7d1785b-4bd1-4982-b8ee-cd0728780342.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTY5MDc2NzIsIm5iZiI6MTcxNjkwNzM3MiwicGF0aCI6Ii80OTQ1MjY3OC8zMzI3NDczOTMtZjdkMTc4NWItNGJkMS00OTgyLWI4ZWUtY2QwNzI4NzgwMzQyLmdpZj9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA1MjglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNTI4VDE0NDI1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdjOTRjYmRlNzg2ZjkyODIyYzUyMGI0N2I4NTQ4MzBlZjllM2U4MjQ1MTBmZTA1NTdlZDYwMDMzNTAzNTFjYzkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.W7LKIywXBmeN6-6dKiTmi7Pjde6SK11066WQ4VVCucw)
        
        
          
            
              
            
            
              
              
            
          
          [
            
              
            
          ](https://private-user-images.githubusercontent.com/49452678/332747393-f7d1785b-4bd1-4982-b8ee-cd0728780342.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTY5MDc2NzIsIm5iZiI6MTcxNjkwNzM3MiwicGF0aCI6Ii80OTQ1MjY3OC8zMzI3NDczOTMtZjdkMTc4NWItNGJkMS00OTgyLWI4ZWUtY2QwNzI4NzgwMzQyLmdpZj9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA1MjglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNTI4VDE0NDI1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdjOTRjYmRlNzg2ZjkyODIyYzUyMGI0N2I4NTQ4MzBlZjllM2U4MjQ1MTBmZTA1NTdlZDYwMDMzNTAzNTFjYzkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.W7LKIywXBmeN6-6dKiTmi7Pjde6SK11066WQ4VVCucw)
    

Which might not be necessarily bad, but it might be good to discuss which path to take from this point. What would be the advantages of handling the data via a series of API calls?

Hello! @regexowl 👋

First thanks for the extensive review.

The primary reason I am using the API in this way is consistency across our apps.
As it was the API was built around this functionality.

I understand the idea of liking to front-load all data, but in general, it is largely frowned upon as an architectural choice unless there is an inherit slowness with the API.

The usual reasons this is sited as not a good pattern in general is you can get to a point where with enough data it becomes a problem, there are also different data limits across browsers and devices, that can lock up/slow-down the web page dramatically (likely not an issue but I digress).

On content-sources, we have a front-end cache of sorts that handles the API so the loading state is not really perceived so obviously from the users point of view when looking back at previous data.

If there is some way to implement something similar with the redux toolkit that may alleviate some of the perceived slowness, but I would suggest using the API as intended.

@Andrewgdewar
Copy link
Contributor Author

Andrewgdewar commented May 28, 2024

As for the feedback to removing the modal - I remember adding it for some reason, but can't really remember what the reason was 😅

I guess it was there to make double sure that the user knows they can break their image with the change? Not sure if that's too much safeguarding though.

Any thoughts @mmenestr @kelseamann ?

edit: it should be this modal if I'm correct image

I spoke to @jlsherrill regarding this (SME for content) and he had basically said that the warning should be enough.
But if you would like this to be re-added I can do!

Also to check - when removing a repository what would be the desired behaviour? Currently when in the Selected toggle the checkbox gets unchecked, but the repository stays there until the toggle gets toggled to All and retoggled to Selected again.

After the changes the repository would disappear from the Selected list as soon as it gets unchecked. I'm aware we're not currently consistent with the behaviour between repos / packages steps, so this might be an issue for a separate PR.

Oh hmm, I see what you mean.
That is the exact behaviour we have today in content templates when adding and removing a repository for reference.
I may be able to add a debounce on the selected items to alleviate that extra loading.

But with the addition of the remove modal, it may be less obvious as the user will be slowed down further.

@regexowl
Copy link
Collaborator

The primary reason I am using the API in this way is consistency across our apps. As it was the API was built around this functionality.

Got it, sounds great!

I understand the idea of liking to front-load all data, but in general, it is largely frowned upon as an architectural choice unless there is an inherit slowness with the API.

The usual reasons this is sited as not a good pattern in general is you can get to a point where with enough data it becomes a problem, there are also different data limits across browsers and devices, that can lock up/slow-down the web page dramatically (likely not an issue but I digress).

Fair enough! I don't know how many repositories users usually have, but I admit that relying on the idea that "there can't be that many" is not a good approach. 😅

We can try to figure out if there's a way to cache some data so the loading is less obvious, but I'd say that's out of the scope of this PR for now.

Thanks a lot for the explanation!

@regexowl
Copy link
Collaborator

But with the addition of the remove modal, it may be less obvious as the user will be slowed down further.

Hmm, when you're looking at the debounce would it be possible to make a short screencast with and without the modal?

I think there are two open questions regarding the modal:

  • how to make it obvious to the user that removing previously used repositories is a really bad idea
  • and in case the way is to display the modal, when should it be displayed?

Since we probably want the newly unchecked repos to stay in Selected for a bit, it may indeed clash with the modal popping out as soon as the repo gets unselected.

Maybe we could show the modal just once when the Next button is clicked after the changes were applied? This would probably need to be handled via wizard footer then... 🤔

Or maybe we could display the alert only when a previously used repo was unselected so it pops out more?

What do you think @mmenestr?

@regexowl
Copy link
Collaborator

Clicked around a bunch - this looks and works great, thank you! Current way of fetching/refreshing feels much better to me! The skeletons were a bit overwhelming 💀

I'd say let's double check the module_hotfixes test, decide on the modal and debounce and then it's good to get merged.

We'll need to update msw fixtures and handlers a bit if we want to keep making use of the in-browser mocking, but that's a separate problem. Opened an issue for that: #2107

@regexowl
Copy link
Collaborator

Oh, one thing - could we make the search case insensitive?

image

image

@regexowl regexowl added 🧙‍♂️ V2 Wizard and removed ❔ question Further information is requested labels May 29, 2024
@Andrewgdewar
Copy link
Contributor Author

Andrewgdewar commented May 29, 2024

Oh, one thing - could we make the search case insensitive?

image

image

Good sanity check. 🎉
Added a ticket for the API here.

@ezr-ondrej
Copy link
Contributor

/retest

@Andrewgdewar
Copy link
Contributor Author

Andrewgdewar commented May 29, 2024

Added the modal, made it so I only warn if removing an item that was present during the initial state.
I think a debounce is no longer needed here, it feels fine and with the modal pop-up it's a non-issue.
Also changed the wording a bit as with the warning in the background, it felt a bit redundant.
Screenshot 2024-05-29 at 3 00 22 PM

I also fixed some loading/state issues with the packages tab (likely my own bugs.. 🥲 ).

@regexowl
Copy link
Collaborator

/retest

1 similar comment
@regexowl
Copy link
Collaborator

/retest

Copy link
Collaborator

@regexowl regexowl left a comment

Choose a reason for hiding this comment

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

Found one bug and a tiny nitpick, but otherwise looks great to me!

@Andrewgdewar
Copy link
Contributor Author

Andrewgdewar commented May 30, 2024

Okay, so I fixed the bug above, and looked into cacheing here.
I then rewrote a few things and the cache/refetch functions now work a LOT better.
I think the snappiness you are after is largely back! 🎉

@Andrewgdewar
Copy link
Contributor Author

I have added the "search" field to the repositories mock function to get around the test failures.

@Andrewgdewar
Copy link
Contributor Author

Fixed lint and flattened merge history.

@regexowl
Copy link
Collaborator

regexowl commented Jun 4, 2024

/retest

@regexowl
Copy link
Collaborator

regexowl commented Jun 4, 2024

/retest

Copy link
Collaborator

@regexowl regexowl left a comment

Choose a reason for hiding this comment

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

Looks awesome and works like magic! 🧙 Thanks for all your work on this!!

@regexowl regexowl merged commit 5dc4ecb into osbuild:main Jun 4, 2024
5 checks passed
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.

None yet

5 participants