Skip to content

Commit

Permalink
GNIP-84: Upload Page Enhancements #7154 (#7204)
Browse files Browse the repository at this point in the history
* - Fix the "Upload" models fields and correctly link it to the "GeoNode Layer"

* - Adding REST Interfaces for the "Upload" models

* - [WIP] Upload api test cases

* - [WIP] Hide non processed resources

* - [WIP] Management of the Importer Session during Resume

* - [WIP] Hide dirty resources to everyone / Make sure Upload delete cascade is invoked everytime

* - [WIP] Update the UploaderSession state everytime we reload the importer session

* - [WIP] Set Uploader Session state to INVALID if any error occurs

* - [WIP] Get rid of incomplete uploads on templates that are not related to layer uploads

* - [WIP] Exposing Upload resume, delete and import URLs via REST APIs

* update workflow and ui of incomplete upload list

* replace import_id with id for the request to the api

* improve link button behaviour

* - Adapt failing test cases to the new "dirty_state" filtering condition

* - [WIP] Do not throw an exception when creating the "resume_url"

* - [WIP] Move the "Layer Info" button to the upload list

* add pagination and remove modal on list of incomplete upload

* Revert " - Adapt failing test cases to the new "dirty_state" filtering condition"

This reverts commit bee78bd.

* - [WIP] Make the Upload return URLs "state" aware

* - [WIP] Handle upload POST via REST interface

* - [WIP] Make "resourcebase_api" use "get_visible_resources" more efficiently

 - General code optimization and test case fixing

* - [WIP] Do not delete the Upload associated Layer

* - [WIP] Adding Upload Test Cases

* - Test fixes

* - Test fixes

* - Adding Upload Selenium Live Tests

* add processed item to the upload table

* - [WIP] Adding "create_date" to the Upload session

* sort the table by created date

* - Test fixes

* - Updating translations

* - Test fixes

* - Test fixes

Co-authored-by: allyoucanmap <[email protected]>
(cherry picked from commit 14070b2)

# Conflicts:
#	geonode/api/tests.py
#	geonode/locale/af/LC_MESSAGES/django.po
#	geonode/locale/af/LC_MESSAGES/djangojs.po
#	geonode/locale/al/LC_MESSAGES/django.po
#	geonode/locale/al/LC_MESSAGES/djangojs.po
#	geonode/locale/am/LC_MESSAGES/django.po
#	geonode/locale/am/LC_MESSAGES/djangojs.po
#	geonode/locale/ar/LC_MESSAGES/django.mo
#	geonode/locale/ar/LC_MESSAGES/django.po
#	geonode/locale/ar/LC_MESSAGES/djangojs.po
#	geonode/locale/bg_BG/LC_MESSAGES/django.po
#	geonode/locale/bg_BG/LC_MESSAGES/djangojs.po
#	geonode/locale/bn/LC_MESSAGES/django.po
#	geonode/locale/bn/LC_MESSAGES/djangojs.po
#	geonode/locale/de/LC_MESSAGES/django.mo
#	geonode/locale/de/LC_MESSAGES/django.po
#	geonode/locale/de/LC_MESSAGES/djangojs.po
#	geonode/locale/el/LC_MESSAGES/django.mo
#	geonode/locale/el/LC_MESSAGES/django.po
#	geonode/locale/el/LC_MESSAGES/djangojs.po
#	geonode/locale/en/LC_MESSAGES/django.mo
#	geonode/locale/en/LC_MESSAGES/django.po
#	geonode/locale/en/LC_MESSAGES/djangojs.po
#	geonode/locale/es/LC_MESSAGES/django.mo
#	geonode/locale/es/LC_MESSAGES/django.po
#	geonode/locale/es/LC_MESSAGES/djangojs.po
#	geonode/locale/fa/LC_MESSAGES/django.po
#	geonode/locale/fa/LC_MESSAGES/djangojs.po
#	geonode/locale/fa_IR/LC_MESSAGES/django.po
#	geonode/locale/fa_IR/LC_MESSAGES/djangojs.po
#	geonode/locale/fi/LC_MESSAGES/django.po
#	geonode/locale/fi/LC_MESSAGES/djangojs.po
#	geonode/locale/fil/LC_MESSAGES/django.po
#	geonode/locale/fil/LC_MESSAGES/djangojs.po
#	geonode/locale/fr/LC_MESSAGES/django.mo
#	geonode/locale/fr/LC_MESSAGES/django.po
#	geonode/locale/fr/LC_MESSAGES/djangojs.po
#	geonode/locale/hu/LC_MESSAGES/django.po
#	geonode/locale/hu/LC_MESSAGES/djangojs.po
#	geonode/locale/id/LC_MESSAGES/django.po
#	geonode/locale/id/LC_MESSAGES/djangojs.po
#	geonode/locale/it/LC_MESSAGES/django.mo
#	geonode/locale/it/LC_MESSAGES/django.po
#	geonode/locale/it/LC_MESSAGES/djangojs.mo
#	geonode/locale/it/LC_MESSAGES/djangojs.po
#	geonode/locale/ja/LC_MESSAGES/django.po
#	geonode/locale/ja/LC_MESSAGES/djangojs.po
#	geonode/locale/ka/LC_MESSAGES/django.po
#	geonode/locale/ka/LC_MESSAGES/djangojs.po
#	geonode/locale/km/LC_MESSAGES/django.po
#	geonode/locale/km/LC_MESSAGES/djangojs.po
#	geonode/locale/ko/LC_MESSAGES/django.po
#	geonode/locale/ko/LC_MESSAGES/djangojs.po
#	geonode/locale/lt/LC_MESSAGES/django.po
#	geonode/locale/lt/LC_MESSAGES/djangojs.po
#	geonode/locale/ne/LC_MESSAGES/django.po
#	geonode/locale/ne/LC_MESSAGES/djangojs.po
#	geonode/locale/nl_NL/LC_MESSAGES/django.po
#	geonode/locale/nl_NL/LC_MESSAGES/djangojs.po
#	geonode/locale/no/LC_MESSAGES/django.po
#	geonode/locale/no/LC_MESSAGES/djangojs.po
#	geonode/locale/pl/LC_MESSAGES/django.mo
#	geonode/locale/pl/LC_MESSAGES/django.po
#	geonode/locale/pl/LC_MESSAGES/djangojs.po
#	geonode/locale/pt/LC_MESSAGES/django.mo
#	geonode/locale/pt/LC_MESSAGES/django.po
#	geonode/locale/pt/LC_MESSAGES/djangojs.po
#	geonode/locale/pt_BR/LC_MESSAGES/django.po
#	geonode/locale/pt_BR/LC_MESSAGES/djangojs.po
#	geonode/locale/ro/LC_MESSAGES/django.po
#	geonode/locale/ro/LC_MESSAGES/djangojs.po
#	geonode/locale/ru/LC_MESSAGES/django.po
#	geonode/locale/ru/LC_MESSAGES/djangojs.po
#	geonode/locale/si/LC_MESSAGES/django.po
#	geonode/locale/si/LC_MESSAGES/djangojs.po
#	geonode/locale/sk/LC_MESSAGES/django.po
#	geonode/locale/sk/LC_MESSAGES/djangojs.po
#	geonode/locale/sq/LC_MESSAGES/django.po
#	geonode/locale/sq/LC_MESSAGES/djangojs.po
#	geonode/locale/sv/LC_MESSAGES/django.po
#	geonode/locale/sv/LC_MESSAGES/djangojs.po
#	geonode/locale/sw/LC_MESSAGES/django.po
#	geonode/locale/sw/LC_MESSAGES/djangojs.po
#	geonode/locale/ta/LC_MESSAGES/django.po
#	geonode/locale/ta/LC_MESSAGES/djangojs.po
#	geonode/locale/th/LC_MESSAGES/django.po
#	geonode/locale/th/LC_MESSAGES/djangojs.po
#	geonode/locale/tl/LC_MESSAGES/django.po
#	geonode/locale/tl/LC_MESSAGES/djangojs.po
#	geonode/locale/uk/LC_MESSAGES/django.po
#	geonode/locale/uk/LC_MESSAGES/djangojs.po
#	geonode/locale/vi/LC_MESSAGES/django.po
#	geonode/locale/vi/LC_MESSAGES/djangojs.po
#	geonode/locale/zh/LC_MESSAGES/django.po
#	geonode/locale/zh/LC_MESSAGES/djangojs.po
  • Loading branch information
Alessio Fabiani committed Apr 8, 2021
1 parent 1f2f80c commit 7fce10c
Show file tree
Hide file tree
Showing 172 changed files with 5,940 additions and 3,055 deletions.
20 changes: 10 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,40 +146,40 @@ workflows:
requires:
- geonode_test_suite_smoke
- build:
name: geonode_test_integration_upload
name: geonode_test_integration_monitoring
load_docker_cache: true
save_docker_cache: false
test_suite: ./test_upload.sh
test_suite: ./test.sh geonode.tests.smoke geonode.monitoring.tests.integration
requires:
- geonode_test_suite_smoke
- build:
name: geonode_test_integration_monitoring
name: geonode_test_integration_upload
load_docker_cache: true
save_docker_cache: false
test_suite: ./test.sh geonode.tests.smoke geonode.monitoring.tests.integration
test_suite: ./test.sh geonode.upload.api.tests
requires:
- geonode_test_suite_smoke

# TODO
# - build:
# name: tests_integration
# name: geonode_test_integration_upload
# load_docker_cache: true
# save_docker_cache: false
# test_suite: 'geonode.tests.integration'
# test_suite: ./test_upload.sh
# requires:
# - geonode_test_suite_smoke
# - build:
# name: tests_geoserver_integration
# name: tests_integration
# load_docker_cache: true
# save_docker_cache: false
# test_suite: 'geonode.geoserver.tests.integration'
# test_suite: 'geonode.tests.integration'
# requires:
# - geonode_test_suite_smoke
# - build:
# name: tests_upload_integration
# name: tests_geoserver_integration
# load_docker_cache: true
# save_docker_cache: false
# test_suite: 'geonode.upload.tests.integration'
# test_suite: 'geonode.geoserver.tests.integration'
# requires:
# - geonode_test_suite_smoke

Expand Down
2 changes: 1 addition & 1 deletion .env_test
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ GEOSERVER_LOCATION=http://geoserver:8080/geoserver/
GEOSERVER_ADMIN_USER=admin
GEOSERVER_ADMIN_PASSWORD=geoserver

OGC_REQUEST_TIMEOUT=30
OGC_REQUEST_TIMEOUT=5
OGC_REQUEST_MAX_RETRIES=1
OGC_REQUEST_BACKOFF_FACTOR=0.3
OGC_REQUEST_POOL_MAXSIZE=10
Expand Down
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
FROM python:3.8.7-buster
FROM python:3.8.9-buster
LABEL GeoNode development team

RUN mkdir -p /usr/src/geonode

# Enable postgresql-client-13
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list
RUN echo "deb http://deb.debian.org/debian/ stable main contrib non-free" | tee /etc/apt/sources.list.d/debian.list
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -

# This section is borrowed from the official Django image but adds GDAL and others
RUN apt-get update && apt-get install -y \
libpq-dev python-dev libxml2-dev \
libgdal-dev libpq-dev libxml2-dev \
libxml2 libxslt1-dev zlib1g-dev libjpeg-dev \
libmemcached-dev libldap2-dev libsasl2-dev libffi-dev

RUN apt-get update && apt-get install -y \
gcc zip gettext geoip-bin cron \
postgresql-client-13 \
sqlite3 spatialite-bin libsqlite3-mod-spatialite \
python3-gdal python3-psycopg2 python3-ldap \
python3-dev python3-gdal python3-psycopg2 python3-ldap \
python3-pip python3-pil python3-lxml python3-pylibmc \
python3-dev libgdal-dev \
uwsgi uwsgi-plugin-python3 \
firefox-esr \
--no-install-recommends && rm -rf /var/lib/apt/lists/*

# add bower and grunt command
Expand Down
36 changes: 5 additions & 31 deletions geonode/api/resourcebase_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,47 +226,21 @@ def apply_filters(self, request, applicable_filters):
else:
filtered = semi_filtered

if settings.RESOURCE_PUBLISHING or settings.ADMIN_MODERATE_UPLOADS:
filtered = self.filter_published(filtered, request)

if settings.GROUP_PRIVATE_RESOURCES:
filtered = self.filter_group(filtered, request)

if extent:
filtered = filter_bbox(filtered, extent)

if keywords:
filtered = self.filter_h_keywords(filtered, keywords)

# Hide Dirty State Resources
user = request.user if request else None
if not user or not user.is_superuser:
if user:
filtered = filtered.exclude(Q(dirty_state=True) & ~(
Q(owner__username__iexact=str(user))))
else:
filtered = filtered.exclude(Q(dirty_state=True))
return filtered.filter(metadata_only=metadata_only)

def filter_published(self, queryset, request):
filter_set = get_visible_resources(
queryset,
# return filtered
return get_visible_resources(
filtered,
request.user if request else None,
request=request,
metadata_only=metadata_only,
admin_approval_required=settings.ADMIN_MODERATE_UPLOADS,
unpublished_not_visible=settings.RESOURCE_PUBLISHING)

return filter_set

def filter_group(self, queryset, request):
filter_set = get_visible_resources(
queryset,
request.user if request else None,
request=request,
unpublished_not_visible=settings.RESOURCE_PUBLISHING,
private_groups_not_visibile=settings.GROUP_PRIVATE_RESOURCES)

return filter_set

def filter_h_keywords(self, queryset, keywords):
treeqs = HierarchicalKeyword.objects.none()
if keywords and len(keywords) > 0:
Expand Down
Loading

0 comments on commit 7fce10c

Please sign in to comment.