Commit graph

44 commits

Author SHA1 Message Date
Paul Chavard
97f0df0598 refactor(progress): move progress bar markup to haml 2023-02-28 16:36:18 +01:00
Colin Darie
d5fe29f666 chore(upload): hint about firewall blocking file upload 2023-01-31 17:09:28 +01:00
Paul Chavard
7f2a7e18d3 chore(npm): update build dependencies 2023-01-12 12:27:14 +01:00
Paul Chavard
17901d9be2 fix(fetch): always use post http method 2022-12-15 11:52:11 +01:00
Colin Darie
cb2afc74b0 style(attachments): better UX when we can try to upload without network 2022-12-05 10:47:10 +01:00
Colin Darie
b13c5e56f6 refactor(piece_justificative): UX follows mockups 2022-12-05 10:47:10 +01:00
Colin Darie
6a0379086d chore(piece_justificative): continue attachments refactor 2022-12-05 10:47:10 +01:00
Martin
4ec61e58ac feat(EditComponent): add max_file_size and content_types to upload buttons inspired by dsfr 2022-06-28 17:44:35 +02:00
Paul Chavard
525eebf600 feat(js): implement auto upload class 2022-05-10 18:10:20 +02:00
Paul Chavard
b29116817b refactor(js): improuve uploader 2022-05-10 18:10:20 +02:00
Paul Chavard
bca97268a8 fix(upload): errorFromDirectUploadMessage should take Error or string 2022-04-24 11:47:17 +02:00
Paul Chavard
2ce9c842a1 refactor(type_de_champs): use typescript in type de champs editor 2022-04-08 14:34:27 +02:00
Christophe Robillard
df3bd3a1d2 handle focus during and after upload 2021-03-17 11:31:51 +01:00
Christophe Robillard
43039d1755 add aria-value min, max and now for progressbar upload 2021-03-17 11:31:51 +01:00
Pierre de La Morinerie
e033ec3404 js: ignore missing DOM element on ProgressBar
Currently ProgressBar is used to monitor upload progress of attachments.

But there's two cases where the associated DOM element may be removed:

- In the champs editor, when the list scrolls, DOM elements are removed
and added dynamically by React;
- In the user form, the user might start an upload on a repetition, and
then remove the associated row during the download.

In both those cases, we don't want the missing DOM element to trigger
an error.
2020-09-03 15:03:13 +02:00
Pierre de La Morinerie
833d7a3b59 javascript: ignore most common upload errors also in standard uploads
In #5149, we ignored most common upload errors, but only for
auto-uploads.

This PR ignores those errors also for standard uploads.
2020-05-18 11:50:29 +02:00
Paul Chavard
43a1ead1cb fix new prettier defaults 2020-05-12 18:18:37 +02:00
Pierre de La Morinerie
6f4075f38e javascript: fix FileUploadError stacktraces
When subclassing a JS error, most browsers include the constructor
stacktrace :/

This is an issue, because:
- The stacktrace is deeper than it should be
- The stacktrace reaches into a polyfill for which there is not source
map, which causes Sentry to infer the issue grouping from the JS file
name. And the fingerprinted name changes on each release. So for each
release, the stacktrace is different ; and Sentry can't group issues
properly.
2020-04-23 12:27:26 +02:00
Pierre de La Morinerie
769e98f63e javascript: fix the progress bar removal on success
When using auto-attach, the response HTML fragment replaces the progress
bar – so it doesn't need to be removed twice.
2020-04-16 17:02:23 +02:00
Pierre de La Morinerie
647ad3ba10 javascript: consider unknown upload errors as client errors 2020-04-16 12:59:14 +02:00
Pierre de La Morinerie
b006c33ebe javascript: parse the upload status code correctly
Previously the status was "Status: 422" instead of just 422.
2020-04-16 12:54:18 +02:00
Pierre de La Morinerie
b2231e98d5 javascript: don't report connectivity issues to Sentry 2020-04-16 11:20:45 +02:00
Pierre de La Morinerie
432967bd76 javascript: make Uploader always throw the same kind of errors
A DirectUpload may fail for several reasons, and return many types of
errors (string, xhr response, Error objects, etc).

For convenience, wrap all these errors in a FileUploadError object.

- It makes easier for clients of the Uploader class to handle errors;
- It allows to propagate the error code and failure responsability.
2020-04-16 11:20:45 +02:00
Pierre de La Morinerie
d8f3b86b0e javascript: move auto-upload attachment to the Uploader class
Rationale:

- It makes more sense to handle the progress bar updates in a single class;
- This will allow us to unify the error handling.
2020-04-16 11:20:45 +02:00
Pierre de La Morinerie
c633cd0888 javascript: improve Sentry grouping of direct upload errors
DirectUpload returns errors as strings, including an HTTP status and a
file name (and without a stack trace).

But Sentry groups issues according to the stack trace, and maybe the
error message in last resort.

So we have an issue: as all DirectUpload errors logged by Sentry are
generated on the same line, with random-looking messages, Sentry groups
them either too or too little aggressively.

Instead of creating all the errors on the same line:

- add some `if`s statements to create them on different lines (and so
  with different stack traces),
- strip the file name from the error message.

This allows Sentry to group the errors properly, with meaningful error
messages.
2020-04-09 17:38:44 +02:00
Pierre de La Morinerie
bc1c15b81d javascript: make DirectUpload errors return true error objects
DirectUpload errors are string (instead of error objects). But Sentry
works better if we have true errors, which include the stacktrace.
2020-04-09 12:50:47 +02:00
Pierre de La Morinerie
6417c0d2c0 dossiers: allow auto upload of attachments 2020-03-31 13:09:44 +02:00
Pierre de La Morinerie
a1083ca253 javascript: add some comments to the upload systems 2020-03-31 13:09:17 +02:00
Paul Chavard
08400cdd4c Poll for export readiness updates 2020-01-29 22:52:03 +01:00
Pierre de La Morinerie
bb024d1850 javascript: display a localized message on upload errors 2019-10-24 16:12:56 +02:00
Pierre de La Morinerie
a3057afc22 javascript: report upload errors to Sentry 2019-10-24 16:12:56 +02:00
Paul Chavard
860588b216 Upgrade javascript dependencies and add actiontext 2019-07-03 11:42:25 +02:00
Pierre de La Morinerie
78f75744e3 javascript: fix payload of ActiveStorage events missing on IE 11
Under some circumstances (like dispatching events just before a page
navigation), IE 11 events will be dispatched twice by the browser: once
with the payload, and a second time without.

To prevent these errors, ignore the events if the payload is missing.
2019-06-06 15:00:57 +02:00
Paul Chavard
6797c01b69 Properly handle justificatif_motivation case 2019-05-22 14:11:08 +02:00
Paul Chavard
6a3413018a Refresh attachments with virus scan result 2019-05-21 14:21:55 +02:00
Paul Chavard
0265c10474 Safari throw if deleting inexistent property 2019-05-14 17:12:27 +02:00
clemkeirua
ec2e17032e suppression de la double confirmation 2019-05-07 08:54:29 +02:00
Paul Chavard
5e806aa39e Add progress bar to model uploads 2019-02-14 17:13:41 +01:00
Paul Chavard
1e8bc3e14c Refactor upload progress bar 2019-02-14 17:13:41 +01:00
Paul Chavard
235310bcf6 Fix upload progress bar 2019-02-14 17:13:41 +01:00
Paul Chavard
2f2aa580f8 Update activestorage.js 2018-12-04 11:37:00 +01:00
Pierre de La Morinerie
40d0986a82 javascript: transpile activestorage files (instead of copying them) 2018-08-14 11:40:33 +02:00
Paul Chavard
e7e616ae5b Fix transpiling issues in IE 2018-08-09 21:05:07 +02:00
Paul Chavard
8b79c32a55 Do not rely on javascript for form submits without direct upload 2018-08-07 16:58:49 +02:00