-
Notifications
You must be signed in to change notification settings - Fork 6
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
[#1795] Add backend support for multiple file upload #855
Conversation
2bc6822
to
6da0043
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #855 +/- ##
===========================================
- Coverage 92.93% 92.79% -0.15%
===========================================
Files 775 776 +1
Lines 26636 26713 +77
===========================================
+ Hits 24754 24787 +33
- Misses 1882 1926 +44 ☔ View full report in Codecov by Sentry. |
6da0043
to
733a65b
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.
Would recommend using get_by_label, other than that, based on a quick look this seems fine to me (didn’t do ann actual test yet though).
@@ -432,7 +432,7 @@ def test_cases(self, m): | |||
upload_form = page.locator("#document-upload") | |||
expect(upload_form).to_be_visible() | |||
|
|||
file_input = upload_form.get_by_text(_("Sleep of selecteer bestand")) | |||
file_input = page.locator("[name='file']") |
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 think we should prefer the get_by_label where possible (or any other selector that testes a11y).
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 changed the id
and for
attributes for the input
and label
elements to make the test work with get_by_label
. Let me know if this is not desirable.
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 did do a small change, instead of using a hardcoded id I used the "auto_id" for both the input and the label.
@@ -3,7 +3,7 @@ | |||
<div class="form__control file-input"> | |||
{% render_card direction="vertical" %} | |||
{% icon icon="upload" icon_position="before" outlined=True %} | |||
<input class="file-input__input" id="{{ field.auto_id }}" name="file" type="file"{% if field.field.required %} required{% endif %}> | |||
<input class="file-input__input" id="{{ field.auto_id }}" name="file" type="file"{% if field.field.required %} required{% endif %} multiple> |
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.
Should this be dynamic based on the field type, and shouldn't we (dynamically) change the labels into plurals accordingly?
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.
multiple
should be set dynamically and has been fixed. I'm not sure about the labels. There's no change in the backend if the client drops a file or two into the widget, so I'm not sure what could decide if the label should be singular or plural. Passing that info front to back seems overkill. I tend towards leaving it as is, or perhaps use an "optional plural" form like "Selecteer bestand(en)"
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 changed the label simply based on multiple. I don't think we need to have plural forms based on the length of the selection.
02d41ae
to
4678342
Compare
4678342
to
998b97e
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.
Nice work - the Success notification does have the annoying habit of becoming sticky and it should get into Focus after a successful upload, but that's not part of this task.
d0bf625
to
d11eb91
Compare
created_relationship = connect_case_with_document( | ||
self.case.url, created_document.get("url") | ||
) | ||
except AttributeError: |
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.
@pi-sigma I've added the AttributeError handling here because created_document could be None
, however I think we might want to separate the error handling for the both objects and only create the relationship if the document is actually created.
This might require some small refactoring here.
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.
@svenvandescheur I don't think we need to expose this to the user; they only care about whether the upload worked or not.
Relatedly, I tested the code again and it now fails with getattr
for me too, as it should. So I think we're good to go.
d11eb91
to
e35db34
Compare
Taiga: #1795
Front-end: PR #833