-
Notifications
You must be signed in to change notification settings - Fork 22
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
Implement upload support #384
Conversation
@garrett for debugging the popover I created this patch which mimmicks an upload scenario: |
Suggestion from @mvollmer:
|
I have an error trying to build this PR:
I'd ping you on Matrix, but it seems down at the moment. |
Replace dialog. Single file: When there are multiple files: Notes:
|
Perhaps we should include the filename in the description like this, complete with monospace ("it's from a computer" |
639c615
to
458553e
Compare
6fbea5a
to
869836b
Compare
9de2891
to
150b696
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Random UI idea: since we compute the "will replace" check based on local information, and since we do it in one go before starting any uploads, I wonder if we'd better show a single dialog with the names of all files that would be replaced, instead of an endless series of "and this?" "and this?" "and this?"
src/upload-button.tsx
Outdated
if (resolution && applyToAll && resolution.skip) | ||
break; | ||
|
||
if (resolution && applyToAll && resolution.replace) | ||
toUploadFiles.push(inputFile); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like that could be restructured like
if (resolution && applyToAll) {
if (resolution.skip)
continue;
push();
} else {
... ask ...
}
or so?
src/upload-button.tsx
Outdated
for (const file of files) { | ||
if (file.name === inputFile.name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way fsinfo works is that you get a dictionary mapping file names to their attributes. We should keep that data around so that we can just do a dictionary lookup instead of this quadratic looping business...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this requires re-architecting the whole state (which I did in a separate PR, let's do it there). This at the moment has more prio.
Two things:
Otherwise, the functionality looked correct for this first-pass PR when I checked yesterday. Thanks! Please ping me again when the two things have been implemented. Looking forward to landing this soon; we're getting close! |
I'm working on the sizing of the popover. It's not as straightforward as one might think. (But you know that. 😉 Just confirming what you said in Matrix.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Great to see this unblocked 👏 I found a bunch of minor issues.
if (ref.current) { | ||
ref.current.click(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Completely optional: can be shortened to handleClick = ref.current?.click
and thus the helper function eliminated altogether.
And this is now racy... So maybe we should pass files again. |
c978ce4
to
b369e20
Compare
Rawhide builds are broken due to https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/J3HMPMH3THO34J2WK4XEAVIY6VPMMK3C/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is starting to look really great now, thanks!
Please see one comment from me. It's possible that I just don't understand this code properly and an explanation is all that's required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Some new/remaining issues, and my previous review still has a few outstanding issues. All of them except the handleClick()
elimination are a blocker for me.
Ah, I fixed those but didn't mark as resolve as you might have expected? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, thanks for your latest push -- that resolves both of my previous reviews, I closed the threads.
Good enough for me -- if you need to push again (like, for Garrett's review or so?), please strengthen the test as below, but not important.
Cheers! 🎉
const beforeUnloadHandler = (event: BeforeUnloadEvent) => { | ||
event.preventDefault(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 2 added lines are not executed by any test.
event.preventDefault(); | ||
|
||
// Included for legacy support, e.g. Chrome/Edge < 119 | ||
event.returnValue = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This added line is not executed by any test.
This implements #378
send-acks
support and refreshed images for creating testscockpit.format_bytes
typescript shenanigansConflict handling