Commit graph

2897 commits

Author SHA1 Message Date
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
cc773e7feb
docs: update screenshots 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
David Larlet
c4306b4a7d
Merge pull request #1891 from umap-project/dependabot/npm_and_yarn/braces-3.0.3
chore: bump braces from 3.0.2 to 3.0.3
2024-06-11 10:35:24 -04:00
Yohan Boniface
8967ab5901 whore: prettier 2024-06-11 14:12:33 +02:00
Yohan Boniface
b36f5d1ce3
Merge pull request #1889 from umap-project/dependabot/pip/mkdocs-material-9.5.26
chore: bump mkdocs-material from 9.5.25 to 9.5.26
2024-06-11 10:32:17 +02:00
dependabot[bot]
f5867120f8
chore: bump mkdocs-material from 9.5.25 to 9.5.26
Bumps [mkdocs-material](https://github.com/squidfunk/mkdocs-material) from 9.5.25 to 9.5.26.
- [Release notes](https://github.com/squidfunk/mkdocs-material/releases)
- [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG)
- [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.5.25...9.5.26)

---
updated-dependencies:
- dependency-name: mkdocs-material
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-11 08:32:03 +00:00
dependabot[bot]
255347a46f
chore: bump braces from 3.0.2 to 3.0.3
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-11 08:31:31 +00:00
Yohan Boniface
6a9147b824
Merge pull request #1888 from umap-project/dependabot/pip/pydantic-2.7.3
chore: bump pydantic from 2.7.0 to 2.7.3
2024-06-11 10:31:30 +02:00
Yohan Boniface
efd5baa8db
Merge pull request #1887 from umap-project/dependabot/pip/pytest-8.2.2
chore: bump pytest from 8.2.1 to 8.2.2
2024-06-11 10:31:15 +02:00
Yohan Boniface
089a291d7b
Merge pull request #1890 from umap-project/dependabot/pip/ruff-0.4.8
chore: bump ruff from 0.4.7 to 0.4.8
2024-06-11 10:30:58 +02:00
dependabot[bot]
d7c850a311
chore: bump ruff from 0.4.7 to 0.4.8
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.4.7 to 0.4.8.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/v0.4.7...v0.4.8)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-10 17:32:50 +00:00
dependabot[bot]
b1fa97fd1b
chore: bump pydantic from 2.7.0 to 2.7.3
Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.7.0 to 2.7.3.
- [Release notes](https://github.com/pydantic/pydantic/releases)
- [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md)
- [Commits](https://github.com/pydantic/pydantic/compare/v2.7.0...v2.7.3)

---
updated-dependencies:
- dependency-name: pydantic
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-10 17:32:33 +00:00
dependabot[bot]
41fa1ad7d1
chore: bump pytest from 8.2.1 to 8.2.2
Bumps [pytest](https://github.com/pytest-dev/pytest) from 8.2.1 to 8.2.2.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/8.2.1...8.2.2)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-10 17:32:28 +00: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
b316bde47c docs(sync): Document WEBSOCKET_* settings 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