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

initial download-folder-selector interface #890

Merged
merged 24 commits into from
Sep 24, 2024

Conversation

mcmonkey4eva
Copy link
Contributor

@mcmonkey4eva mcmonkey4eva commented Sep 19, 2024

Depends on comfyanonymous/ComfyUI#4981 and comfyanonymous/ComfyUI#4980

This is a followup from earlier PR #569


Adds a model download folder selector

If I use vanilla HTML Select it's naturally quite ugly
image

PrimeVue looks nicer:
image

But it's weirdly slow about updating when you select things and idk what's up with that. I think it's something to do with v-model and the indirection towards the actual folder path, but I'm not entirely sure. fixed

It's also chonky and ugly regardless so I added a visibility checkbox
image
(Most users won't want to change from default in theory)

TODO

  • user setting for default folder path, or just generally persist selections
  • fix the select interface being all wonky fixed
  • make the tests pass lol the merge fixed it? lol

@mcmonkey4eva mcmonkey4eva added New Browser Test Expectations New browser test screenshot should be set by github action and removed New Browser Test Expectations New browser test screenshot should be set by github action labels Sep 22, 2024
@mcmonkey4eva mcmonkey4eva marked this pull request as ready for review September 22, 2024 11:57
Copy link
Member

@huchenlei huchenlei left a comment

Choose a reason for hiding this comment

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

Can you add at least a playwright test to verify the UI is shown correctly? You can add code to https://github.com/Comfy-Org/ComfyUI_devtools to perform test setup.

@mcmonkey4eva mcmonkey4eva changed the base branch from main to dev1.3 September 23, 2024 09:46
@mcmonkey4eva mcmonkey4eva added New Browser Test Expectations New browser test screenshot should be set by github action and removed New Browser Test Expectations New browser test screenshot should be set by github action labels Sep 23, 2024
@mcmonkey4eva mcmonkey4eva added New Browser Test Expectations New browser test screenshot should be set by github action and removed New Browser Test Expectations New browser test screenshot should be set by github action labels Sep 23, 2024
@mcmonkey4eva mcmonkey4eva added New Browser Test Expectations New browser test screenshot should be set by github action and removed New Browser Test Expectations New browser test screenshot should be set by github action labels Sep 23, 2024
@mcmonkey4eva mcmonkey4eva added the New Browser Test Expectations New browser test screenshot should be set by github action label Sep 23, 2024
since the checkbox covers that better anyway
@mcmonkey4eva mcmonkey4eva added New Browser Test Expectations New browser test screenshot should be set by github action and removed New Browser Test Expectations New browser test screenshot should be set by github action labels Sep 23, 2024
@mcmonkey4eva mcmonkey4eva added New Browser Test Expectations New browser test screenshot should be set by github action and removed New Browser Test Expectations New browser test screenshot should be set by github action labels Sep 23, 2024
@mcmonkey4eva
Copy link
Contributor Author

alright, now it has playwright testing on it, screenshots all look correctly. (Note the folder selector shows 'models' and 'output' in the screenshot, visually similar but not wrong)

@huchenlei
Copy link
Member

huchenlei commented Sep 24, 2024

alright, now it has playwright testing on it, screenshots all look correctly. (Note the folder selector shows 'models' and 'output' in the screenshot, visually similar but not wrong)

The general rule of thumb for screenshot test is that we only do that do check litegraph canvas. For things that can be checked via inspecting DOM / evaluating JS, we do that instead to make test less fragile to subtle style changes and running locally.

Copy link
Member

@huchenlei huchenlei left a comment

Choose a reason for hiding this comment

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

Please rewrite the test to avoid using screenshot expectations.

@mcmonkey4eva
Copy link
Contributor Author

Kinda hurts not being able to do the thorough validation of screenshots but I get it, too much changeweight any time minor stylistic stuff is altered.

I rewrote the tests to exclude screenshots and instead check visibility and classnames to ensure they are reacting appropriately.

There's probably room to be more thorough than that? But that covers the key predictable functional parts, short of writing a full unit test that mocks the folder list and download apis to test end-to-end.

Copy link
Member

@huchenlei huchenlei left a comment

Choose a reason for hiding this comment

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

Please revert the hard coded sources and suffixes.

'Comfy.Workflow.ModelDownload.AllowedSuffixes'
)
const showFolderSelect = ref(false)

Copy link
Member

Choose a reason for hiding this comment

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

Why this becomes hard coded again? We do want to expose this configurability to cloud deployment platforms to download from custom endpoints.

@mcmonkey4eva
Copy link
Contributor Author

mcmonkey4eva commented Sep 24, 2024

They need to not be in user settings, and they should ideally not be something that gets corrupted by an accidental run of the playwright test.

If we want to expose server configurability, it should not be through user settings.

As noted earlier, the most ideal place imo would be an internal API on the Comfy core side that returns its actual accepted value list, and then the UI simply reads and works with that. (The UI is simply trying to preview what the server will determine, and atm serverside it's hardcoded)
If you agree with that, I can go PR that on the core side.

@huchenlei
Copy link
Member

They need to not be in user settings, and they should ideally not be something that gets corrupted by an accidental run of the playwright test.

If we want to expose server configurability, it should not be through user settings.

As noted earlier, the most ideal place imo would be an internal API on the Comfy core side that returns its actual accepted value list, and then the UI simply reads and works with that. (The UI is simply trying to preview what the server will determine, and atm serverside it's hardcoded) If you agree with that, I can go PR that on the core side.

I think the playwright test side issue can be fixed by having extra logic backup server side user files and restore them after running all tests. Just for testability, they should not be hard-coded.

@mcmonkey4eva
Copy link
Contributor Author

Just for testability, they should not be hard-coded. the tests work cleanly currently

@huchenlei
Copy link
Member

Just for testability, they should not be hard-coded. the tests work cleanly currently

Do you really want to expose localhost to default model download whitelist origin?

@mcmonkey4eva
Copy link
Contributor Author

Do you really want to expose localhost to default model download whitelist origin?
Yes imo this is fine to allow localhost to render as if valid (though the server will not actually download from localhost)
(And note again we'll want to replace the list with server-read source either now or in the future)
(if you want it to be strictly correct before merging, I'm happy to make the core PR to provide the relevant internal API to do the list properly)

@huchenlei huchenlei merged commit 556be8c into dev1.3 Sep 24, 2024
9 checks passed
@huchenlei huchenlei deleted the downloader-folder-selection branch September 24, 2024 07:51
huchenlei pushed a commit that referenced this pull request Sep 24, 2024
* initial download-folder-selector interface

* use primevue select

* add a folder select visibility checkbox

* slightly reduce indirection

* fix up select box updating

* revert bad upstream changes

* cleanup

* allow localhost sourced models in ui side

(for testing purposes only basically, but does no harm in deployed envs)

* add screenshot expectations to test

* Update test expectations [skip ci]

* add testing of folder select

* fix test

* don't exclude folder selector when there's only 1

since the checkbox covers that better anyway

* oo - fix checkbox

* Update test expectations [skip ci]

* testing - don't expect screenshots :(

* experimental new test code

* toHaveClass is silly

* add // comments documenting intent of allowedSources

---------

Co-authored-by: github-actions <[email protected]>
huchenlei pushed a commit that referenced this pull request Sep 25, 2024
* initial download-folder-selector interface

* use primevue select

* add a folder select visibility checkbox

* slightly reduce indirection

* fix up select box updating

* revert bad upstream changes

* cleanup

* allow localhost sourced models in ui side

(for testing purposes only basically, but does no harm in deployed envs)

* add screenshot expectations to test

* Update test expectations [skip ci]

* add testing of folder select

* fix test

* don't exclude folder selector when there's only 1

since the checkbox covers that better anyway

* oo - fix checkbox

* Update test expectations [skip ci]

* testing - don't expect screenshots :(

* experimental new test code

* toHaveClass is silly

* add // comments documenting intent of allowedSources

---------

Co-authored-by: github-actions <[email protected]>
huchenlei pushed a commit that referenced this pull request Sep 25, 2024
* initial download-folder-selector interface

* use primevue select

* add a folder select visibility checkbox

* slightly reduce indirection

* fix up select box updating

* revert bad upstream changes

* cleanup

* allow localhost sourced models in ui side

(for testing purposes only basically, but does no harm in deployed envs)

* add screenshot expectations to test

* Update test expectations [skip ci]

* add testing of folder select

* fix test

* don't exclude folder selector when there's only 1

since the checkbox covers that better anyway

* oo - fix checkbox

* Update test expectations [skip ci]

* testing - don't expect screenshots :(

* experimental new test code

* toHaveClass is silly

* add // comments documenting intent of allowedSources

---------

Co-authored-by: github-actions <[email protected]>
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