Paul Chavard
1890c05974
fix(js): more polyfills for IE
2022-04-29 14:11:00 +02:00
Paul Chavard
20a78f08c9
fix(js): add turbo and stimulus polyfills
2022-04-28 11:14:26 +02:00
Paul Chavard
02f977fd8d
refactor(champs): refactor champs components to use typescript
2022-04-26 13:56:26 +02:00
Paul Chavard
bca97268a8
fix(upload): errorFromDirectUploadMessage should take Error or string
2022-04-24 11:47:17 +02:00
Paul Chavard
62dca1c7b0
refactor(js): remove ds:page:update event
2022-04-22 10:24:39 +02:00
Paul Chavard
0dac59bffc
refactor(js): use DOMContentLoaded instead of ds:page:update
2022-04-22 09:40:17 +02:00
Paul Chavard
64c599e208
refactor(stimulus): initiate react components via stimulus
2022-04-20 14:08:47 +02:00
Paul Chavard
2ce9c842a1
refactor(type_de_champs): use typescript in type de champs editor
2022-04-08 14:34:27 +02:00
Paul Chavard
44c64669e9
Revert "Merge pull request #6787 from tchak/use-vite"
...
This reverts commit 5d572727b5
, reversing
changes made to 43be4482ee
.
2022-03-31 12:07:52 +02:00
Paul Chavard
187e84a010
feat(assets): use vitejs to build javascript
2022-03-29 16:27:08 +02:00
Paul Chavard
a914950982
chore(eslint): fix getJSON reponse type
2022-02-23 15:28:51 +01:00
Paul Chavard
beafa21796
chore(eslint): fix isNumeric types
2022-02-23 15:28:51 +01:00
François Vantomme
cc6cb2ea30
feat(matomo): use env variables to set the domain
2022-02-15 09:25:23 +01:00
Paul Chavard
ea6aec8b1a
chore(webpack): enable typescript
2022-02-09 10:29:00 +01:00
Pierre de La Morinerie
d4fada9f6c
config: add MATOMO_HOST environment variable
2022-01-19 15:43:44 +01:00
Paul Chavard
6776a5e05a
fix(react): remove register component cache
2022-01-03 19:41:23 +01:00
Pierre de La Morinerie
07230870d3
js: don't track external links
...
This fixes an issue where, by default, links to private attachments are
reported to Matomo.
This is benign: attachments URLs can be filtered out server-side, and
expire after one hour anyway. But we don't want to ship an insecure
configuration by default.
2021-12-23 09:50:21 +01:00
Paul Chavard
f8d245d2f8
refactor(js): use dynamic import
2021-12-21 17:09:49 +00:00
Pierre de La Morinerie
8dce7d59ed
js: redirect to sign-in when a ujs link_to receives a 401
...
Before, when a 401 was received by a ujs-enabled link (like `link_to …,
method: :delete, data: { remote: true }`, rails-ujs tried to insert the
response text as a Javascript script.
As the script was something like `Please sign-in`, which is not valid
Javascript, the browser would throw an "Unexpected token" error.
The typical use-case is:
1. The user open a form in a tab,
2. The user disconnects in another tab,
3. In the first tab, the user clicks on a remote "Delete" link_to
In that case the browser raised an error in the console (and in Sentry),
but the user would see nothing.
With this commit, all 401 ujs errors are turned into redirects to the
sign-in page.
Fix https://sentry.io/organizations/demarches-simplifiees/issues/2522512693/activity/
2021-09-07 16:45:52 -05:00
Pierre de La Morinerie
255c00c174
js: ignore a new variant of the same warning
2021-09-07 16:45:52 -05:00
Pierre de La Morinerie
7808f6dd4f
js: document utils.ajax()
2021-07-22 11:58:02 +02:00
Pierre de La Morinerie
071d9145ca
js: don't attempt to log unexistent statusText
2021-07-22 11:58:01 +02:00
Pierre de La Morinerie
63cde95fc9
js: ignore errors generated by a Microsoft crawler
...
Sentry has a lot of Javacript errors stating:
> UnhandledRejection: Non-Error promise rejection captured with value: Object Not Found Matching Id:2
This is apparently caused by a Microsoft crawler (maybe for scanning
targets of email links), and can be safely ignored.
See https://forum.sentry.io/t/unhandledrejection-non-error-promise-rejection-captured-with-value/14062/12
2021-07-20 09:21:59 +02:00
Christophe Robillard
6026793c1d
focus to target after toggle
2021-03-17 11:31:51 +01: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
Paul Chavard
752ee78c49
Use fetch instead of jQuery
2020-10-13 10:55:10 +02:00
Paul Chavard
95eb907090
remove unused javascript
2020-10-07 11:39:57 +02: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
5949266e89
javascript: silence Crisp warning in Javascript console
2020-06-26 15:57:14 +02:00
Paul Chavard
901b6e23a8
Remove legacy carto
2020-06-04 16:03:23 +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
Pierre de La Morinerie
b5f1d97629
app: disable Turbolinks
...
Fix #5039
2020-05-13 11:04:16 +02:00
Paul Chavard
43a1ead1cb
fix new prettier defaults
2020-05-12 18:18:37 +02:00
Paul Chavard
05e408225b
Implement atomic operations on MapEditor
2020-05-06 16:46:14 +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
Paul Chavard
bc8217e030
Carte Editor sends FeatureCollection to the server
2020-04-16 18:29:19 +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
Paul Chavard
442a6a3cdd
Remove deprecated map reader
2020-04-15 18:07:09 +02:00
Pierre de La Morinerie
61660b1b3b
javascript: remove unused jQuery.active bookkeeping
2020-04-09 17:52:47 +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
38c0cdc360
javascript: ignore errors of attachments pooler
...
Pooling for attachment status is a background operation. Errors should
not be reported to the user, who didn't even ask for this operation to
take place.
This is why we ignore all errors, whether Javascript exceptions or
network errors.
2020-04-07 12:35:54 +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
Pierre de La Morinerie
7a27e78452
specs: remove unused wait-for-ajax helper
...
This helper is:
- no longer used;
- buggy (not all requests increment it);
- discouraged (we should instead match an UI change that signals the end
of an ajax request).
Good riddance.
2020-03-31 12:54:49 +02:00
Pierre de La Morinerie
ec2199f7b1
javascript: make utils.ajax() return a promise
...
This allow to use `await ajax(…)`, and still have Rails manage the
request, insert the proper headers and tokens, etc.
2020-03-19 18:28:24 +01:00
Paul Chavard
0b06864f7a
Upgrade core-js
2020-02-24 19:43:07 +01:00
Paul Chavard
5afe158c89
Tweak a bit timeout values for export polling
2020-02-03 15:56:10 +01:00
Paul Chavard
a86129c3a1
Revert "Revert "Update javascript dependencies and add webpack-bundle-analyzer""
...
This reverts commit eddd59e554
.
2020-02-03 14:54:25 +01:00
Paul Chavard
08400cdd4c
Poll for export readiness updates
2020-01-29 22:52:03 +01:00
Keirua
eddd59e554
Revert "Update javascript dependencies and add webpack-bundle-analyzer"
2020-01-29 14:51:55 +01:00
Paul Chavard
7ebebf2e80
Refactor leaflet code for better loading
2020-01-28 16:37:44 +01:00
Paul Chavard
f03cca4386
Search departements by code
2020-01-23 14:12:19 +00:00
Paul Chavard
14295db9ad
Revert "Revert "Merge pull request #4552 from tchak/champ-communes""
...
This reverts commit 4373cb22cb
.
2020-01-14 18:46:07 +01:00
clemkeirua
4373cb22cb
Revert "Merge pull request #4552 from tchak/champ-communes"
...
This reverts commit 4cec26f73a
, reversing
changes made to 0ef25ef36c
.
2020-01-13 16:26:27 +01:00
Paul Chavard
e61e39d345
Remove unused code and tests
2020-01-07 11:52:51 +01:00
Paul Chavard
22aa2d4ee0
Make all location champs autocomplete
2020-01-07 11:52:51 +01:00
Paul Chavard
03326169c5
Always load IntersectionObserver to fix old browsers
...
fix #4614
2019-12-04 16:26:59 +01:00
Paul Chavard
2cf415dc41
Simplify React components loader
2019-11-28 14:45:40 +01:00
Pierre de La Morinerie
6de5c0c9d1
autosave: make requests time out
...
This avoids recent requests being stuck because an older request never
finished.
2019-11-21 14:00:06 +01:00
Pierre de La Morinerie
bff7892ba8
dossiers: autosave drafts
2019-11-21 14:00:06 +01:00
Pierre de La Morinerie
74a9db6580
javascript: make utils resilient to missing elements
2019-11-20 17:36:09 +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
Nicolas Bouilleaud
c26a701a17
Refactor and redesign publish modal
...
* remove the autocomplete menu
* use ujs to pre-validate the procedure
* tweak the UI
2019-09-17 16:30:48 +02:00
Paul Chavard
86b9ed2079
Run load scripts after ujs responces
2019-08-13 17:03:55 +01:00
Chaïb Martinez
d968e7e6bd
Add some admin usage info for contextual help with crisp
...
Fix #4052
Signed-off-by: Chaïb Martinez <chaibax@gmail.com>
2019-07-15 12:10:56 +02:00
Chaïb Martinez
535d032b73
Send URL page view to Crisp to trigger contextual help
...
Fix #4052
Signed-off-by: Chaïb Martinez <chaibax@gmail.com>
2019-07-15 12:10: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
Chaïb Martinez
eccd456325
Add crisp
...
Signed-off-by: Chaïb Martinez <chaibax@gmail.com>
2019-06-05 17:41:47 +02:00
Paul Chavard
6d312e1716
spec: refactor wait_for_ajax
to work with out new ajax utils
...
`wait_for_ajax` is not used anymore, but it may be in the future.
2019-06-04 16:30:36 +02:00
Pierre de La Morinerie
f2f16e2580
carte: disable tiles layer during tests
...
During integration tests, we don't want to load the tiles from OSM:
- It hits OSM servers during every test run;
- It it slow (Capybara waits for the tiles to be loaded to proceed);
- It makes test time out when tiles cannot be loaded for some reason.
Fix #3913
2019-06-03 17:24:15 +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
Paul Chavard
c93b1bb276
Add intersection-observer polyfill
2019-05-14 10:55:16 +02:00
clemkeirua
ec2e17032e
suppression de la double confirmation
2019-05-07 08:54:29 +02:00
Paul Chavard
2f633b5d23
Load leaflet from a separate chunk
2019-05-02 14:10:48 +02:00
Paul Chavard
a60943a173
Polyfill insertAdjacentElement and dataset on old browsers
2019-04-09 15:26:42 +02:00
Paul Chavard
4fb889f10a
Send browser support information and format user id
2019-04-04 14:21:32 +02:00
Paul Chavard
8e6e730c80
Send user information to sentry without email
2019-04-04 14:21:32 +02:00
Paul Chavard
b9be186d2c
Sentry should send environment information
2019-04-03 18:19:16 +02:00
Paul Chavard
47694d286e
Revrite types de champ editor using React
2019-04-03 14:38:57 +02:00
Paul Chavard
5a032d344d
Activate React components loader
2019-04-03 14:38:57 +02:00
Paul Chavard
51c79ba6a6
Update webpacker and replace vue with react
2019-04-03 14:38:07 +02:00
Paul Chavard
e71cdcd12c
Move all the trackers to a separate js pack
2019-04-02 17:33:53 +02:00
Pierre de La Morinerie
1f636e4d59
piece_justificative: toggle file upload control
2019-02-19 18:02:27 +01: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
Pierre de La Morinerie
82fc017430
autocomplete: fix initialization happening several times
2019-02-07 15:29:46 +01:00
Paul Chavard
bb5c90c579
Fix champ address on repetitions
2019-02-07 12:29:27 +01:00
Paul Chavard
2f2aa580f8
Update activestorage.js
2018-12-04 11:37:00 +01:00