Commit graph

2218 commits

Author SHA1 Message Date
Yohan Boniface
4fc66da80c fix: use layer labelKey if any when filtering features
fix #1908
2024-06-21 13:35:06 +02:00
Yohan Boniface
5609092cc0 chore: do not set overlay=null as default
FormBuilder will break when reimporting an exported map with this
default value (at the casting to object was only made on the init,
so reimporting will override this to null again).
2024-06-21 11:39:39 +02:00
David Larlet
ed2386eaae
2.4.0b2 2024-06-20 10:56:26 -04:00
David Larlet
0edf7cc5d9
i18n 2024-06-20 10:56:04 -04:00
David Larlet
8b2610947a
Merge pull request #1917 from umap-project/1911-better-importers-styles
fix: CSS adjustments for importers
2024-06-20 09:59:40 -04:00
David Larlet
f78320d153
Merge pull request #1916 from umap-project/1913-alert-on-import
fix: display an alert if the import is successful
2024-06-20 09:59:26 -04:00
David Larlet
41abbc90d0
Merge pull request #1914 from umap-project/1912-native-radio-inputs
fix: remove custom styles for radio inputs
2024-06-20 09:59:00 -04:00
David Larlet
0a9f57d2d8
fix: CSS adjustments for importers
Fix #1911
2024-06-18 15:11:58 -04:00
David Larlet
7e6d264796
fix: display an alert if the import is successful
Fix #1913
2024-06-18 14:53:27 -04:00
David Larlet
f1b1abb38f
Merge pull request #1903 from umap-project/set-layername-from-dataset
feat: set layer name when importing from dataset
2024-06-18 14:41:02 -04:00
David Larlet
08f5debd62
fix: remove custom styles for radio inputs
Fix #1912
2024-06-18 14:38:00 -04:00
Yohan Boniface
b977d26eae feat: set layer name when importing from dataset 2024-06-17 11:54:06 +02:00
Yohan Boniface
afcaf2a07a fix: correct way to open files dialgo with ctrl+O 2024-06-17 10:46:46 +02:00
David Larlet
1a3377723b
2.4.0b1 2024-06-14 21:44:44 -04:00
David Larlet
411452ac70
fix: allow first radio input click when second selected 2024-06-14 17:43:00 -04:00
David Larlet
a3afadb677
fix: hide importers section if none is defined 2024-06-14 17:21:09 -04:00
David Larlet
ceab5090a7
fix: explicit import paths for collectstatic hashes 2024-06-14 17:20:16 -04:00
David Larlet
6de3e1f881
2.4.0b0 2024-06-14 16:42:13 -04:00
Yohan Boniface
c144c9d958 fix: django cannot run collectstatic with circular imports in modules
alert.js was importing request.js which then imports alert.js

In the process, we moved the post to send the email out of the
alert.js file, and thus tried another pattern to communicate data
between an alert and its caller.
2024-06-14 22:05:56 +02:00
Yohan Boniface
99595e3e2f chore: fix translated test 2024-06-14 20:51:29 +02:00
Yohan Boniface
b747b347f4 fix: dialog class should have "window" class to get propert buttons 2024-06-14 20:45:39 +02:00
Yohan Boniface
74e0b43311 fix: correct syntax for translating string when sending emails 2024-06-14 20:41:53 +02:00
Yohan Boniface
ca18c5b7df chore: move alert.html inside templates and update translations
When alert.html was in static, Django was creating a new translation
file, while we want it to just add those strings in the backend
po file.
2024-06-14 20:41:53 +02:00
Yohan Boniface
34f00dfec1 tests: try to fix randomly failing test test_should_honour_fromZoom 2024-06-14 18:51:58 +02:00
Yohan Boniface
710b0cf1d9
Merge pull request #1857 from umap-project/geodatamine-plugin
Importers for custom external sources
2024-06-14 18:47:45 +02:00
Yohan Boniface
88b7e401c0
Merge pull request #1776 from umap-project/conditional-rules
feat: very minimal experimental conditional style rules
2024-06-14 18:40:37 +02:00
Yohan Boniface
e16d3a629c wip: fix tests 2024-06-14 18:40:05 +02:00
Yohan Boniface
ca16e5b2c9 wip: use new alert API after rebase 2024-06-14 18:40:05 +02:00
Yohan Boniface
e9f9c30639 wip: shorter labels in importer panel 2024-06-14 18:40:05 +02:00
Yohan Boniface
6f0d42d817 wip: re-center radio and checkbox inputs 2024-06-14 18:40:05 +02:00
Yohan Boniface
4ed7c45086 wip: use same label in buttons and title for "Import data"
The control says "Import data", let's keep this for now.
2024-06-14 18:40:05 +02:00
Yohan Boniface
e90ad4b9cd wip: sort themes in GeoDataMine importer 2024-06-14 18:40:05 +02:00
Yohan Boniface
d928195a5b wip: rename and document UMAP_IMPORTERS 2024-06-14 18:40:05 +02:00
Yohan Boniface
4127ffb891 wip: simplify a bit input CSS height 2024-06-14 18:40:05 +02:00
Yohan Boniface
4f1eb20be9 wip: move importers css to a dedicated file and refactor 2024-06-14 18:40:05 +02:00
Yohan Boniface
017e407758 wip: refactor margin bottom management in caption title 2024-06-14 18:40:05 +02:00
Yohan Boniface
3f6940cd5b wip: make sure importers are always in the same order
Given they are loaded from an import() call, the order they are
added in IMPORTERS in asynchronous, so we cannot rely on this order
2024-06-14 18:40:05 +02:00
Yohan Boniface
c51f8ae5ce wip: close importer dialog on escape in any 2024-06-14 18:40:05 +02:00
Yohan Boniface
460843b900 wip: add icons for importers 2024-06-14 18:40:05 +02:00
Yohan Boniface
115130083d wip: make sure we do not add an invalid overpass URL 2024-06-14 18:40:05 +02:00
Yohan Boniface
a70307ea29 wip: rename presets to datasets 2024-06-14 18:40:05 +02:00
Yohan Boniface
2c9623aff6 wip: refine geodatamine importer 2024-06-14 18:40:05 +02:00
Yohan Boniface
f1901ea84c wip: add margin-bottom on select element 2024-06-14 18:40:04 +02:00
Yohan Boniface
c1ab57d952 wip: add quick help for overpass importer expressions syntax 2024-06-14 18:38:44 +02:00
Yohan Boniface
c599082eca wip: deal with multiple dialog z-index 2024-06-14 18:38:44 +02:00
Yohan Boniface
b7dd771a7f wip: prettier 2024-06-14 18:38:44 +02:00
Yohan Boniface
c3ae3b5770 wip: minimal overpass importer
cf #112
2024-06-14 18:38:44 +02:00
Yohan Boniface
43f7e6a467 feat: allow to set the new layer name at import 2024-06-14 18:38:44 +02:00
Yohan Boniface
3998a88d43 wip: use dt/dd for import formats help box 2024-06-14 18:38:43 +02:00
Yohan Boniface
b0e9bbd86c wip: smaller dialog width 2024-06-14 18:38:30 +02:00
Yohan Boniface
35189cc9fb wip(importer): use only one submit button and be smarter to guess action 2024-06-14 18:38:30 +02:00
Yohan Boniface
8dd1c4bc7f wip: remove AutoComplete.URL (can't set class properties yet) 2024-06-14 18:38:30 +02:00
Yohan Boniface
1cefd4c9a7 wip: allow to control geodatamine baseUrl from settings 2024-06-14 18:38:30 +02:00
Yohan Boniface
d35e72dab9 wip: add aspoint attribute to geodatamine URL 2024-06-14 18:38:30 +02:00
Yohan Boniface
4e3228d114 feat: allow to create remote data layer from import panel
And make the form conditional.
2024-06-14 18:38:30 +02:00
Yohan Boniface
dbafe19b7f chore: declare ttl property in schema 2024-06-14 18:38:30 +02:00
Yohan Boniface
16fd5d8ca3 wip: typo 2024-06-14 18:38:30 +02:00
Yohan Boniface
342dcbabbe wip: no need for AVAILABLE_IMPORTERS 2024-06-14 18:38:30 +02:00
Yohan Boniface
f5eea1fe3f wip(naming): replace "plugin" by "importer"
We are not ready yet to talk about plugins
2024-06-14 18:38:30 +02:00
Yohan Boniface
93a189497b wip: control plugins from settings 2024-06-14 18:38:29 +02:00
Yohan Boniface
a7a214d7fe wip: deal with boundary types in geodatamine importer 2024-06-14 18:38:29 +02:00
Yohan Boniface
03ce8e90d6 wip: refactor importer 2024-06-14 18:38:29 +02:00
Yohan Boniface
c7cd87ec8a wip: move presets to importer plugins 2024-06-14 18:38:29 +02:00
Yohan Boniface
b657a5e9b3 wip: simpler importer API 2024-06-14 18:38:29 +02:00
Yohan Boniface
1e4de02694 wip: add a basic importer for commune shapes
Mainly wanted to have two improters to play with, in order to
better understand the common part, and thus the API we may define
between them and the importer panel.
2024-06-14 18:38:29 +02:00
Yohan Boniface
5b914c1bd2 wip: make it simpler to create an autocomplete class 2024-06-14 18:38:29 +02:00
Yohan Boniface
e51347e239 wip: very naive geodatamine and communes importers 2024-06-14 18:38:29 +02:00
Yohan Boniface
22ccd61d87 chore: remove empty help entry inclusion 2024-06-14 18:30:32 +02:00
Yohan Boniface
191fb6d853 chore: reviewing labels with Aurélie 2024-06-14 18:24:56 +02:00
Yohan Boniface
59dbde4f32 chore: make browser labels consistent 2024-06-14 18:24:54 +02:00
Yohan Boniface
d407949138 chore: be more explicit on browser modes 2024-06-14 18:24:10 +02:00
Yohan Boniface
e023321ee5
Merge pull request #1895 from umap-project/request-error-alert
fix: display an alert on any request error
2024-06-14 18:22:54 +02:00
Yohan Boniface
713be1538c chore: change alert CSS sizing 2024-06-14 18:21:44 +02:00
David Larlet
eda3823b3a
Merge pull request #1896 from umap-project/better-alerts
chore: overall alerts improvements
2024-06-14 11:51:46 -04:00
Yohan Boniface
7e86bc6db8 wip: do not display alerts from the maps in a content list page 2024-06-14 17:51:42 +02:00
Yohan Boniface
a2ba35cb93
Merge pull request #1894 from umap-project/fix-feature-edit-icon
fix: use correct icon class in edit feature panel
2024-06-14 17:31:42 +02:00
David Larlet
fb1407cdbf
chore: overall alerts improvements 2024-06-14 11:08:59 -04:00
Yohan Boniface
9dc11ec9f9 wip: fix tests after rebase on master 2024-06-14 16:55:36 +02:00
Yohan Boniface
6bdba1d0ed wip: do not use public class fields yet
Browser support is not enough.
2024-06-14 16:55:36 +02:00
Yohan Boniface
f10d345113 wip: use this.rules.getOption directly 2024-06-14 16:55:36 +02:00
Yohan Boniface
907ba09c45 wip: do not use private property yet
Support is not ready for us.
2024-06-14 16:55:36 +02:00
Yohan Boniface
05ea45acd2 wip: use getter/setter for Rule dynamic properties 2024-06-14 16:55:36 +02:00
Yohan Boniface
7367de5545 wip: deal with boolean values in conditional rules 2024-06-14 16:55:36 +02:00
Yohan Boniface
5ec944fce0 wip: deal with gt/lt and numbers in conditional rules 2024-06-14 16:55:36 +02:00
Yohan Boniface
129f46dd6d wip: add minimal tests for conditional rules 2024-06-14 16:55:36 +02:00
Yohan Boniface
d6ae4744a6 wip: make sure we update rule when condition is changed
And make sure we redraw data on map
2024-06-14 16:55:36 +02:00
Yohan Boniface
805c09e34e wip: allow to deactivate a conditional rule from list 2024-06-14 16:55:36 +02:00
Yohan Boniface
a2d04b9ad4 wip: use direct imports instead of L. global 2024-06-14 16:55:36 +02:00
Yohan Boniface
4f8e453012 wip: allow to reorder rules 2024-06-14 16:55:36 +02:00
Yohan Boniface
05eab25da4 feat: very minimal experimental conditional style rules 2024-06-14 16:55:33 +02:00
Yohan Boniface
15de486425 fix: use correct icon class in edit feature panel 2024-06-14 15:31:16 +02:00
Yohan Boniface
d221a98e78 fix: display an alert on any request error
This used to be the case, but was changed by mistake in the
request refactor (swicht from xhr)
2024-06-14 15:24:01 +02:00
b94995120a refactoring(sync): Simplify the design of the sync engine.
Removes the concept of message dispatcher and message sender, all of
it can be done by the syncengine class, making it easier to grasp.
2024-06-14 00:20:59 +02:00
Yohan Boniface
e968261dff wip: fix more tests 2024-06-13 20:53:07 +02:00
Yohan Boniface
897d4f22f4 chore(tests): make sure we send a valid geojson when data is empty 2024-06-13 20:52:28 +02:00
David Larlet
b863beaec9
chore: fix tests 2024-06-13 14:13:42 -04:00
David Larlet
802d5d9d6c
chore: set default language for tests as en-GB 2024-06-13 13:41:00 -04:00
David Larlet
b197e067e8
fix: listen to the correct event for conflicts 2024-06-12 19:06:28 -04:00
David Larlet
8400b55b9d
chore: direct import of the Alert class in modules 2024-06-12 18:30:40 -04:00
David Larlet
cea2aee88f
chore: rename alert choice to conflict + CSS vars 2024-06-12 18:15:28 -04:00
David Larlet
10e398d222
chore: better alerts CSS 2024-06-12 18:03:05 -04:00
David Larlet
6cb1be1fd4
chore: use direct import for ServerRequest in alerts 2024-06-12 18:03:05 -04:00
David Larlet
ddaafa8cda
chore: scroll when the help box is too big 2024-06-12 18:03:05 -04:00
David Larlet
c0ecc39439
chore: uniformize buttons across panels and alerts 2024-06-12 18:03:05 -04:00
David Larlet
e1f91b393d
chore: do not display zoom alert on save 2024-06-12 18:03:05 -04:00
David Larlet
6bbdec49bf
chore: refactor web components with templates 2024-06-12 18:03:04 -04:00
David Larlet
6f715c109b
chore: improve message/choice in case of conflicts 2024-06-12 18:03:04 -04:00
David Larlet
5c2528900e
chore: Use web components to display alerts + a11y roles 2024-06-12 18:03:04 -04:00
Yohan Boniface
8967ab5901 whore: prettier 2024-06-11 14:12:33 +02:00
Yohan Boniface
50ef073d36
Merge pull request #1883 from umap-project/remove-u-keys
chore: remove U.Keys, and refactor global shorcuts
2024-06-07 18:35:49 +02:00
fc2de3fc53 tests(sync): Change the way the websocket server is run in the tests
Using [pytest-xprocess](https://pytest-xprocess.readthedocs.io/) proved
not being as useful as I thought at first, because it was causing
intermitent failures when starting the process.

The code now directly uses `subprocess.popen` calls to start the server.
The tests are grouped together using the following decorator:

`@pytest.mark.xdist_group(name="websockets")`

Tests now need to be run with the `pytest --dist loadgroup` so that all
tests of the same group happen on the same process.

More details on this blogpost:

  https://blog.notmyidea.org/start-a-process-when-using-pytest-xdist.html
2024-06-07 18:21:30 +02:00
98a7a56701 refactor(sync): rename ws.py to websocket_server.py
Hopefully this is clearer :-)
2024-06-07 18:21:30 +02:00
f42498d195 refactor(sync): Sync layers creation with map.createDataLayer utility.
Rather than having it done inside the datalayer itself. This gives us
more control.
2024-06-07 18:21:30 +02:00
149a0c1680 refactor: rename geometrytoFeatures to geoJSONToLeaflet
Because we are dealing with technologies using overlapping vocabulary,
it is easy to get lost. Hopefully this change makes it clear that it
converts geoJSON inputs in Leaflet / uMap objects.
2024-06-07 18:21:30 +02:00
137cc21af2 feat(sync): Add a proxy to the SyncEngine objects.
It is now possible to create proxy objects using `sync_engine.proxy(object)`.
The returned proxy object will automatically inject `metadata` and
`subject` parameters, after looking for them in the `getSyncMetadata`
method (these are only known to the synced objects).

As a result, the calls are now simplified:

```
this.sync.update("key", "value")
```
2024-06-07 18:21:30 +02:00
4e7ac23b53 refactor(sync): remove formbuilder this._redraw() callbacks.
They are now handled in the `render()` call, so there is no more need
for them here.
2024-06-07 18:21:30 +02:00
5247bf77d3 refactor(sync): Remove syncUpdateProperties function.
The function was only used once, so removing it  simplified the whole
flow.
2024-06-07 18:21:30 +02:00
d3730a99ff fix: use array.includes(string) the proper way.
Because this `syncUpdatedProperties` function is only called once, it
didn't trigger any issue in practice (as the check was always returning
true).
2024-06-07 18:21:30 +02:00
d91c86e7fa feat(websockets): run the WS server as a django management command.
This allows to handle the loading of the settings in a consistant way,
and aditionnaly to provide a way to override the `WEBSOCKET_BACK_HOST`
and `WEBSOCKET_BACK_PORT` settings with arg commands `--host` and
`--port`.

Without this change, because of how we are currently loading our
settings, we would require the settings the be exposed by the
`umap.settings.__init__` file.

Previous implementations were exposing these settings, with the
following code:

```python
settings_as_dict = {k: v for k, v in globals().items() if k.isupper()}
  ```
2024-06-07 18:21:30 +02:00
940ae77602 settings: Make the websocket settings clearer.
It is now using `WEBSOCKET_BACK_HOST`, `WEBSOCKET_BACK_PORT` and
`WEBSOCKET_FRONT_URI`.

We need to take in consideration that the "front" WebSocket address
(that clients will connect to) might be different than the "back" ip and
port which are bound in the host.

This happens for instance for reverse proxies, or when running inside
a container.

We considered using a `WEBSOCKET_TLS` setting, to try guessing the
"front" address based on `WEBSOCKET_HOST`, `WEBSOCKET_PORT` and
`WEBSOCKET_TLS`, but as the back and front address can differ, this
would need to introduce a `WEBSOCKET_URI` in any case, so we went with
just using it, and not adding an extra `WEBSOCKET_TLS`.
2024-06-07 18:21:30 +02:00
90780fbf6d fixup: changes after @ybon's review. 2024-06-07 18:21:30 +02:00
50b7188647 fix(sync): sync the reference-version across peers
This allows the merge algorithm to not be lost when receiving changes.
Without this change, the optimistic merge algorithm isn't able to make
the distinction between peers, and features end up duplicated.
2024-06-07 18:21:30 +02:00
516c3d9a0d tests(sync): Add a test ensuring cloned features aren't duplicated
This is currently a bug in the current implementation. Hopefully fixed
in later commits.
2024-06-07 18:21:30 +02:00
b5eee142e7 test(sync): Ensure feature properties are synced 2024-06-07 18:21:30 +02:00
b1a4053b2e chore(sync): remove belongsTo for now
As it requires more discussion, it will happen in a separate
pull-request.
2024-06-07 18:21:30 +02:00
8fc116e7a8 chore(test): remove empty test 2024-06-07 18:21:30 +02:00
dfbdc1f975 chore(test): fix a typo
(but I would really like to see what web socker would look like)
2024-06-07 18:21:30 +02:00
db50c6cdd6 chore(sync): relax some validation logic on the websocket server
Messages are now checked for conformity with the procol we defined, but
stop at the `operation` boundary. Values aren't checked.
2024-06-07 18:21:30 +02:00
bc1dec245b chore(sync): Sync engine now retrieves auth token
It's now it's responsability to get the authentication token from
the http server and pass it to the websocket server, it will make it
possible to redo the roundtrip when getting disconnected.
2024-06-07 18:21:30 +02:00
82ede035d6 chore(sync): use sync=false everywhere to stop propagation
In some cases, you want to stop the propagation of events. The previous
code was using `fromSync=true` and `sync=false` interchangeably. This
makes it use `sync=false` everywhere.
2024-06-07 18:21:30 +02:00
637ab67b93 chore(utils): remove console.log calls 2024-06-07 18:21:30 +02:00
5a565dd2ee fix(schema): dashArray belongs to features as well 2024-06-07 18:21:30 +02:00
10a68a75e4 test(sync): Ensure datalayer properties are synced 2024-06-07 18:21:30 +02:00
d10a7b70f1 test(sync): Ensure map properties are synced
This tests that the name of the map, and that zoom-control visibility is
properly synced over websockets.
2024-06-07 18:21:30 +02:00
6f7dd61023 test(sync): ensure polygon drag-n-drop is synced 2024-06-07 18:21:30 +02:00
ad4d6ac672 test(sync): Ensure polygons and their edits can be synced 2024-06-07 18:21:30 +02:00
5feabd4c14 test(sync): Marker drag-n-drop and delete are synced 2024-06-07 18:21:30 +02:00
80f7efc810 tests(sync): Test that marker sync works properly
This commit handles the start and stop of the websocket server during
the tests, using the xprocess library
2024-06-07 18:21:30 +02:00
d0e2d900f7 chore(tests): Rename "collaboration" tests to "optimistic merge"
As "collaboration" can be mistaken between "websocket" and
"server-merge". This naming makes it explicit.
2024-06-07 18:21:30 +02:00
92676e03ae chore(sync): Add message-dispatcher unit tests 2024-06-07 18:21:30 +02:00
74a1670c9d feat(sync): Add JS unittests for updateObjectValue, and refactor.
The new implementation uses `reduce`, in the hopes of producing a more
readable version than old-style loops and reassignment of object values.
2024-06-07 18:21:30 +02:00
9be613e3ce feat(sync): add tests for the websocket token view 2024-06-07 18:21:30 +02:00
80eaa151de refactor(sync): Remove unnecessary complexity
Because we're relying on the `geoJSONToFeatures` method, we don't need
anymore updaters, the default ones (map, datalayer, feature) are enough.

It also makes the codebase compatible with our eslint configuration.
2024-06-07 18:21:30 +02:00
9e36476abe chore(sync) make the test pass 2024-06-07 18:21:30 +02:00
d5bff22081 fix(sync) only send datalayer options 2024-06-07 18:21:30 +02:00
898a3e93b2 fix(sync): do not call getSyncMetadata if it doesn't exist
This can arise when the form isn't bound to a "syncable" object. We
might want to provide an utility to check an object is *syncable*, or a
specific form to not attempt to sync objects which don't need it.
2024-06-07 18:21:30 +02:00
8e5c434988 feat(sync): Allow the sync of datalayer creation 2024-06-07 18:21:30 +02:00
458d68a4bb fix(sync): allow features geometries to be synced
By defining the `geometry` property in the schema.
2024-06-07 18:21:30 +02:00
1d9b086115 chore(sync): remove useless dependencies from ws.py 2024-06-07 18:21:30 +02:00
def915c561 feat(settings): allow reading socket-related settings from ENV variables 2024-06-07 18:21:30 +02:00
01408254c9 fix(sync): intialize the sync engine before entering edit mode.
Otherwise `this.sync` is not defined.
2024-06-07 18:21:30 +02:00
46207741ff feat(sync): handle syncing of map limitbounds. 2024-06-07 18:21:30 +02:00
9cb87392c0 feat(sync): Avoid syncing remote datalayers' features
They will be synced on their own, and we dont want them to be present
twice on the map.
2024-06-07 18:21:30 +02:00
b99c242648 fix(sync): Initialize tilelayerand remoteData earlier.
It makes it possible to set these values on a remote peer.
2024-06-07 18:21:30 +02:00
059103b66c fix(sync): Allow overlays to sync
`this.options.overlay` is now set during `map.initialize()`, which makes
it possible to be set by incoming websocket operations.
2024-06-07 18:21:30 +02:00
2fafad714e chore(sync): Ensure properties can be updated before doing it.
When receiving a message, this checks the given properties belong to
the "subject" before applying the message.
2024-06-07 18:21:30 +02:00
25ccdde0b0 chore(schema): Add a belongsTo field in the schema.
The goal is to use this as a security measure, to check that the
updated properties belong the the "subject" when receiving sync
operations.
2024-06-07 18:21:30 +02:00
28a359e03f fix(sync): Allow cloning of features
Removing the `id` from the feature when cloning makes it generate a new
one. Without this change, the cloned feature keep the already existing
`id`, and during sync, the original object is lost (replaced by the
clone).

Nobody wants to be replaced by a clone.
2024-06-07 18:21:30 +02:00
e4bcb53c6f feat(sync): Sync only when the edition of a feature is over.
It's less spectacular than sending the position as it changes, but takes
less bandwidth and seems good enough.
2024-06-07 18:21:30 +02:00
ce0f3c9d3e fix(sync): Import the data when syncing GeoJSON objects.
Prior to these changes, the data wasn't transmitted over WebSocket, and
even if present it wasn't taken into account.
2024-06-07 18:21:30 +02:00
e24173eb9f fix(sync): Keep features IDs for Polygons and Lines
It wasn't passed previously, so objects where duplicated.
2024-06-07 18:21:30 +02:00
c6ee25b906 feat(sync): Only sync when on edit mode
The is done to save server resources, for accessed maps which
aren't currently being edited.
2024-06-07 18:21:30 +02:00
66eb90ffd1 chore(sync): Move the sync flag in the options
The goal being for it to be hidden for now.

- Add a `is_owner` method on the map and use it in the view
- Remove duplicated line in `global.js`
- Rename `Datalayer` to `DataLayer` everywhere
- Move the sync flag in the map options (next to slideshow)
2024-06-07 18:21:30 +02:00
32a4f3feda feat(sync): Add WebSocket specific settings
`WEBSOCKET_ENABLED`, `WEBSOCKET_HOST`, `WEBSOCKET_PORT` and
`WEBSOCKET_URI` have been added.

They are being transmitted to the client via the `map.options`.
When `WEBSOCKET_ENABLED` is set to `False`, the client doesn't have
the ability to be synced.
2024-06-07 18:21:30 +02:00
5e692d2280 feat(sync): Add a enableSync option.
This changes how the syncEngine works. At the moment, it's always
instanciated, even if no syncing is configured. It just does nothing.

This is to avoid doing `if (engine) engine.update()` calls everywhere
we use it.

You now need to `start()` and `stop()` it.
2024-06-07 18:21:30 +02:00
9a74cc370c feat(sync): initialize datalayers internal objects in the constructor.
Otherwise, an event can come from the websocket, trying to update an
`undefined` property.
2024-06-07 18:21:30 +02:00
b956101d5d feat(sync): sync layer's properties.
This also changes the interface between the synced classes and the sync
engine.

The sync engines only requires two methods now:

- `getSyncMetadata()` which returns all the metadata needed, including
the `engine`.
- `render()` which renders the object, updating the needed parts.
2024-06-07 18:21:30 +02:00
66105127cb feat(sync): Sync features over websockets
Added a new `geometryToFeature` method in `umap.layer.js` which can
update a given geometry if needed.

A new `id` property can also be passed to the features on creation, to
make it possible to have the same features `id` on different peers.
2024-06-07 18:21:30 +02:00
c9abb15dd1 feat(sync): sync map properties over websocket
All keystrokes are currently sent, which is not ideal because it will
use a lot of bandwidth.
2024-06-07 18:21:30 +02:00
698c926997 feat(sync): sync features and map properties
Synced objects now expose different methods, such as:
- `getSyncEngine` which returns the location of the sync object.
- `getMetadata` which returns the associated metadata with the object.

Hooks have been added when features are created or changed, so the
changes can be synced with other peers.
2024-06-07 18:21:30 +02:00
f255c3c8a5 feat(websockets): Authenticate with signed tokens.
Authentication is now done using a signed token provided by the Django
server, sent by the JS client and checked by the WebSocket server.

The token contains a `permissions` key that's checked to ensure the user
has access to the map "room", where events will be shared by the peers.
2024-06-07 18:21:30 +02:00
e2b9b161e6 feat(websockets): First SyncEngine appearance
A new SyncEngine module has been added to the JavaScript code. It aims
to sync the local changes with remote ones. This first implementation
relies on a websocket connection.
2024-06-07 18:21:30 +02:00
1128348db6 feat(WebSockets): Features a WebSocket server.
There is one "room" per map, and the server relays messages to all the
other connected peers.

Messages are checked for compliance with what's allowed as a security
measure. They should also be checked in the clients to avoid potential
attack vectors.
2024-06-07 18:21:30 +02:00
ee3dbb85ca doc: update cookie-related comment 2024-06-07 18:21:30 +02:00
2daeaf12e0 WIP 2024-06-07 18:21:30 +02:00
c1fe86747b feat(settings): Expose settings as a dict.
This makes it possible to use them in standalone scripts, when using
`django.settings.configure(**settings_dict)`.
2024-06-07 18:21:30 +02:00
Yohan Boniface
9d211005b1 chore: remove U.Keys, and refactor global shorcuts 2024-06-06 07:15:49 +02:00
Yohan Boniface
c70951a994 chore: move help to a separate module 2024-06-05 19:42:15 +02:00
Yohan Boniface
b7b39fa2f5 i18n 2024-06-05 10:50:21 +02:00
Yohan Boniface
50d16b633c fix: display layer in naturel order in caption
This was broken in e6b4a54499

fix #1874
2024-06-03 14:57:20 +02:00
Yohan Boniface
88103f284a
Merge pull request #1868 from umap-project/fix-layer-old-storage
fix: support old storage options when importing a umap file
2024-05-30 16:14:45 +02:00
Yohan Boniface
5f5805dc09 fix: support old storage options when importing a umap file 2024-05-30 15:05:45 +02:00
Yohan Boniface
3a12865d62
Merge pull request #1867 from umap-project/catch-xml-error
fix: show message in case of xml parsing error
2024-05-29 20:17:40 +02:00
Yohan Boniface
442928f608
Merge pull request #1865 from umap-project/popup-newlines
fix: refactor new line management in popups
2024-05-29 20:03:27 +02:00
Yohan Boniface
16ab193b5d fix: show message in case of xml parsing error
fix #1866
2024-05-29 11:51:47 +02:00
Yohan Boniface
fa2bef85d3 fix: refactor new line management in popups
Basically, we do not add `<br>` anymore, but instead let the newline
and use the css `white-space: pre-line;`. Also remove new lines after
title.

While doing that change, I needed to reorder regex so the ones needing
a newline before would still have it (bullets points).

I've added tests and removed some to cover those changes.

fix #1854
2024-05-29 10:35:25 +02:00
Yohan Boniface
fe74ffb008 fix: caption title rendering on multiple lines
fix #1853
2024-05-29 08:59:26 +02:00
Yohan Boniface
c10bc27fed fix: panel condensed height should never be bigger than screen 2024-05-24 18:39:11 +02:00
Yohan Boniface
ebf9be296d chore: move importer to modules/ 2024-05-23 19:32:07 +02:00
Yohan Boniface
109545d006 chore: prettier 2024-05-23 18:26:36 +02:00
Yohan Boniface
1836647c00 chore: move autocomplete to modules/ 2024-05-23 15:10:46 +02:00
David Larlet
d6a20b3dda
Merge pull request #1847 from umap-project/ui-to-modules
chore: move ui to dedicated modules
2024-05-22 13:05:32 -04:00
David Larlet
ef705a862e
Merge pull request #1851 from umap-project/audio-video-tags
fix: allow audio and video tags (+attributes) in HTML
2024-05-22 12:52:16 -04:00
David Larlet
5f29b8b0d5
fix: invert star icons when map is starred or not
Fixes #1848
2024-05-22 11:05:44 -04:00
David Larlet
5b624167c0
fix: allow audio and video tags (+attributes) in HTML
Refs https://forum.openstreetmap.fr/t/umap-audio-video-et-panneau-lateral/2804/2
2024-05-22 10:54:24 -04:00
Yohan Boniface
776d92e7cc chore: add minimal dialog class to replace custom made help box 2024-05-22 14:00:53 +02:00
Yohan Boniface
8e446dbe70 chore: move panel.js to ui/ subfolder 2024-05-22 11:50:59 +02:00
Yohan Boniface
2ed9bc65ee chore: move tooltip to a dedicated module 2024-05-22 11:40:48 +02:00
Yohan Boniface
8ddc570e23 chore: move alert to dedicated module 2024-05-22 11:39:16 +02:00
Yohan Boniface
c44e7ec38d 2.3.1 2024-05-17 17:45:55 +02:00