Skip to content

Commit

Permalink
Merge branch 'master' into source-general-infos
Browse files Browse the repository at this point in the history
  • Loading branch information
submarcos authored Jan 24, 2024
2 parents c89f83e + c12cb7c commit 2ba646b
Show file tree
Hide file tree
Showing 17 changed files with 93 additions and 68 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- name: Cache admin
id: cache-admin
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ./admin/build
key: admin-${{ env.ADMIN_CACHE_KEY }}
Expand Down Expand Up @@ -70,7 +70,7 @@ jobs:
- name: Cache front
id: cache-front
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ./front/build
key: front-${{ env.FRONT_CACHE_KEY }}
Expand All @@ -93,7 +93,7 @@ jobs:
if: steps.cache-front.outputs.cache-hit != 'true'
working-directory: ./front
run: |
npx react-scripts build
npm run build
- uses: docker/setup-buildx-action@v3

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
run: |
docker compose run --user root --rm web ./manage.py makemessages -a --no-location --no-obsolete
- uses: tj-actions/verify-changed-files@v16
- uses: tj-actions/verify-changed-files@v17
id: verify-changed-files
with:
files: |
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ build_admin:

build_front:
docker compose -f .docker/frontend/docker-compose.yml pull
docker compose -f .docker/frontend/docker-compose.yml run --rm front bash -c "git config --global url.\"https://github.com/\".insteadOf ssh://[email protected]/ && npm ci --production && npx react-scripts build"
docker compose -f .docker/frontend/docker-compose.yml run --rm front bash -c "git config --global url.\"https://github.com/\".insteadOf ssh://[email protected]/ && npm ci --production && npm run build"
find ./public -maxdepth 1 -type f -exec rm {} \;
if [ -e ./public/static ]; then rm -r ./public/static ./public/images ./public/locales; fi
mv ./front/build/* ./public/
Expand Down
56 changes: 10 additions & 46 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ alabaster==0.7.13
# via
# -r docs/requirements.txt
# sphinx
annotated-types==0.6.0
# via pydantic
asgiref==3.6.0
# via
# -c requirements.txt
Expand All @@ -18,12 +16,10 @@ babel==2.12.1
# via
# -r docs/requirements.txt
# sphinx
black==23.11.0
black==23.12.1
# via -r dev-requirements.in
build==0.10.0
# via pip-tools
cerberus==1.3.5
# via plette
certifi==2023.7.22
# via
# -c requirements.txt
Expand All @@ -39,18 +35,14 @@ click==8.1.3
# -c requirements.txt
# black
# pip-tools
coverage==7.3.2
coverage==7.4.0
# via -r dev-requirements.in
distlib==0.3.7
# via requirementslib
django==4.1.13
django==4.2.9
# via
# -c requirements.txt
# django-debug-toolbar
django-debug-toolbar==4.2.0
# via -r dev-requirements.in
docopt==0.6.2
# via pipreqs
docutils==0.18.1
# via
# -r docs/requirements.txt
Expand All @@ -60,9 +52,9 @@ factory-boy==3.3.0
# via -r dev-requirements.in
faker==19.3.1
# via factory-boy
flake8==6.1.0
flake8==7.0.0
# via -r dev-requirements.in
freezegun==1.3.1
freezegun==1.4.0
# via -r dev-requirements.in
idna==3.4
# via
Expand All @@ -73,9 +65,9 @@ imagesize==1.4.1
# via
# -r docs/requirements.txt
# sphinx
isort==5.13.0
isort==5.13.2
# via -r dev-requirements.in
jinja2==3.1.2
jinja2==3.1.3
# via
# -r docs/requirements.txt
# sphinx
Expand All @@ -96,27 +88,13 @@ packaging==23.1
# sphinx
pathspec==0.11.2
# via black
pep517==0.13.1
# via requirementslib
pip-api==0.0.30
# via isort
pip-tools==7.3.0
# via -r dev-requirements.in
pipreqs==0.4.13
# via isort
platformdirs==3.10.0
# via
# black
# requirementslib
plette[validation]==0.4.4
# via requirementslib
# via black
pycodestyle==2.11.0
# via flake8
pydantic==2.5.2
# via requirementslib
pydantic-core==2.14.5
# via pydantic
pyflakes==3.1.0
pyflakes==3.2.0
# via flake8
pygments==2.16.1
# via
Expand All @@ -133,11 +111,7 @@ requests==2.31.0
# via
# -c requirements.txt
# -r docs/requirements.txt
# requirementslib
# sphinx
# yarg
requirementslib==3.0.0
# via isort
six==1.16.0
# via
# -c requirements.txt
Expand Down Expand Up @@ -195,27 +169,17 @@ tomli==2.0.1
# via
# black
# build
# pep517
# pip-tools
# pyproject-hooks
tomlkit==0.12.3
# via
# plette
# requirementslib
typing-extensions==4.7.1
# via
# black
# pydantic
# pydantic-core
# via black
urllib3==1.26.18
# via
# -c requirements.txt
# -r docs/requirements.txt
# requests
wheel==0.41.2
# via pip-tools
yarg==0.1.9
# via pipreqs

# The following packages are considered to be unsafe in a requirements file:
# pip
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ idna==3.4
# requests
imagesize==1.4.1
# via sphinx
jinja2==3.1.2
jinja2==3.1.3
# via sphinx
markupsafe==2.1.3
# via jinja2
Expand Down
24 changes: 23 additions & 1 deletion docs/source/others/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Changelog
==========

2023.11.2+dev (XXXX-XX-XX)
2024.01.2+dev (XXXX-XX-XX)
---------------------------

**Improvements:**
Expand All @@ -11,6 +11,28 @@ Changelog
- Add author to Source


2024.01.1 (2024-01-22)
---------------------------

**Improvements:**
- Terra-front is now part of Visu-front

**New features:**
- Support for layers grouped by variables (admin & front)

**Bug fixes:**
- New icon for layer's informations (front)
- Fix piecharts going over legends (front)
- Remove options to display labels on secondary styles (admin)

2024.01.0 (2024-01-12)
---------------------------

**Improvements:**

- Backend preparation to group layer by variables


2023.11.2 (2023-11-22)
---------------------------

Expand Down
2 changes: 1 addition & 1 deletion front
Submodule front updated 440 files
2 changes: 1 addition & 1 deletion project/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023.11.2
2024.01.1
4 changes: 3 additions & 1 deletion project/geosource/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class Status(models.IntegerChoices):

id_field = models.CharField(max_length=255, default="id")
geom_type = models.IntegerField(
choices=GeometryTypes.choices(), null=True, blank=True
choices=GeometryTypes.choices, null=True, blank=True
)

settings = models.JSONField(default=dict, blank=True)
Expand Down Expand Up @@ -262,6 +262,8 @@ def update_fields(self):
records, _ = self._get_records(50)

fields = {}
if records is None:
return {"count": 0}

for record in records:
record.pop(self.SOURCE_GEOM_ATTRIBUTE)
Expand Down
4 changes: 2 additions & 2 deletions project/geosource/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from django.contrib.gis.geos import GEOSGeometry
from django.db import transaction
from django.utils.translation import gettext as _
from geostore import GeometryTypes
from psycopg2 import sql
from rest_framework import serializers
from rest_framework.exceptions import ValidationError
Expand All @@ -15,7 +16,6 @@
CSVSource,
Field,
GeoJSONSource,
GeometryTypes,
PostGISSource,
ShapefileSource,
Source,
Expand Down Expand Up @@ -368,7 +368,7 @@ class CSVSourceSerializer(FileSourceSerializer):
coordinates_field_count = serializers.CharField(required=False)
coordinates_separator = serializers.CharField(required=False)
geom_type = serializers.ChoiceField(
default=GeometryTypes.Point, choices=GeometryTypes.choices()
default=GeometryTypes.Point, choices=GeometryTypes.choices
)

class Meta:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 4.1.13 on 2024-01-12 14:51

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("terra_layer", "0012_layer_advanced_style"),
]

operations = [
migrations.AddField(
model_name="layer",
name="variables",
field=models.JSONField(blank=True, default=list),
),
migrations.AddField(
model_name="layergroup",
name="by_variable",
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name="layergroup",
name="variables",
field=models.JSONField(blank=True, default=list),
),
]
6 changes: 6 additions & 0 deletions project/terra_layer/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ def tree2models(self, current_node=None, parent=None, order=0):
view=self,
label=current_node["label"],
exclusive=current_node.get("exclusive", False),
variables=current_node.get("variables", []),
by_variable=current_node.get("byVariable", False),
selectors=current_node.get("selectors"),
settings=current_node.get("settings", {}),
order=order,
Expand All @@ -102,6 +104,7 @@ def tree2models(self, current_node=None, parent=None, order=0):
# Handle layers
layer = Layer.objects.get(pk=current_node["geolayer"])
layer.group = parent
layer.variables = current_node.get("variables", [])
layer.order = order
layer.save(wizard_update=False)

Expand Down Expand Up @@ -164,6 +167,8 @@ class LayerGroup(models.Model):
)
order = models.IntegerField(default=0)
exclusive = models.BooleanField(default=False)
by_variable = models.BooleanField(default=False)
variables = models.JSONField(default=list, blank=True)
selectors = models.JSONField(null=True, default=None)
settings = models.JSONField(default=dict)
created_at = models.DateTimeField(auto_now_add=True)
Expand Down Expand Up @@ -220,6 +225,7 @@ class Layer(CloneMixin, models.Model):
)
interactions = models.JSONField(default=list, blank=True)
advanced_style = models.JSONField(default=dict, blank=True)
variables = models.JSONField(default=list, blank=True)
fields = models.ManyToManyField(Field, through="FilterField")
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
Expand Down
1 change: 1 addition & 0 deletions project/terra_layer/tests/test_commands/test_layer_dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def test_command_launch_without_custom_style(self, mock_sdout):
"main_field": None,
"view": None,
"style_images": [],
"variables": [],
},
)

Expand Down
3 changes: 3 additions & 0 deletions project/terra_layer/views/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,8 @@ def get_group_dict(self, group):
group_content = {
"group": group.label,
"exclusive": group.exclusive,
"byVariable": group.by_variable,
"variables": group.variables,
"selectors": group.selectors,
"order": group.order,
"layers": [],
Expand Down Expand Up @@ -524,6 +526,7 @@ def get_layer_dict(self, layer):
"source_filter": layer.source_filter,
"layers": self.get_layers_list_for_layer(layer),
"legends": layer.legends,
"variables": layer.variables,
"mainField": main_field,
"filters": {
"layer": layer.source.slug,
Expand Down
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
django==4.1.*
django==4.2.*
django-grappelli
django-geostore
psycopg2
Expand Down
Loading

0 comments on commit 2ba646b

Please sign in to comment.