Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fixes #7060] Refactoring of thumbnail creation #7061

Merged
Merged
Show file tree
Hide file tree
Changes from 78 commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
f654111
Merge pull request #626 from geosolutions-it/merge_from_upsteram
giohappy Jan 20, 2021
0df9357
Merge branch 'master' of https://github.com/GeoNode/geonode
allyoucanmap Feb 1, 2021
2a11ead
Bump urllib3 from 1.26.2 to 1.26.3 (#6908)
dependabot[bot] Feb 2, 2021
040772e
[Fixes #6880] Circle CI upload tests fail irregulary (#6881)
t-book Feb 2, 2021
65c6267
[Fixes #6914] Remove "add to basket" tool for documents and maps (#6915)
Feb 2, 2021
158511a
Added malnajdi as contributor
t-book Feb 2, 2021
e9efc3d
[Fixes #6910] meaningful filename for document download (#6911)
gannebamm Feb 2, 2021
91f1a4e
- CircleCI Upload Tests: trying to reduce more the risk of infinite …
afabiani Feb 2, 2021
5e77b39
[Fixes #6916] gsimporter.api.NotFound caused by missing trailing slas…
malnajdi Feb 3, 2021
ec6d728
Bump django-cors-headers from 3.6.0 to 3.7.0 (#6901)
dependabot[bot] Feb 3, 2021
c5432b5
Bump amqp from 5.0.3 to 5.0.5 (#6905)
dependabot[bot] Feb 3, 2021
28424ca
Bump pip from 21.0 to 21.0.1 (#6900)
dependabot[bot] Feb 3, 2021
be313d5
Bump coverage from 5.3.1 to 5.4 (#6903)
dependabot[bot] Feb 3, 2021
f073274
Bump pytest from 6.2.1 to 6.2.2 (#6907)
dependabot[bot] Feb 3, 2021
9a3913e
Bump djangorestframework-gis from 0.16 to 0.17 (#6902)
dependabot[bot] Feb 3, 2021
ae6f6c1
- Algin setup.cfg to requirements.txt
afabiani Feb 3, 2021
0dad216
[Fixes #6922][REST API v2] Expose the curated thumbnail URL if it has…
Feb 3, 2021
30910b2
[Fixes #6918] Removal of QGIS support (#6919)
Feb 3, 2021
dbb4ac0
Merge branch 'master' of https://github.com/GeoNode/geonode
Feb 4, 2021
0bcf2fb
allow Basic authenticated requests in LOCKDOWN mode
bieganowski Feb 5, 2021
af22a3c
fix to avoid circular import
bieganowski Feb 5, 2021
c7ede4f
flake8 check fix
bieganowski Feb 5, 2021
b557f6d
added tests
bieganowski Feb 5, 2021
0a82a14
Merge pull request #652 from geosolutions-it/feature#650_basic_auth_m…
Feb 5, 2021
eea689a
first draft
bieganowski Feb 23, 2021
2436a88
remove service integration
bieganowski Feb 23, 2021
11f40ba
Merge pull request #678 from geosolutions-it/upstream_master
Feb 23, 2021
3968dc7
bbox structure fix
bieganowski Feb 23, 2021
d1b3211
layers and maps endpoints integration
bieganowski Feb 23, 2021
41fbd86
formatting
bieganowski Feb 23, 2021
26e5886
flake formatting
bieganowski Feb 23, 2021
e6bc37f
fix for longitude exceeding world width
bieganowski Feb 24, 2021
2ccfd06
description
bieganowski Feb 24, 2021
115720a
fix for longitude exceeding world width 2
bieganowski Feb 26, 2021
58fd700
fixes requested by PR review
bieganowski Feb 26, 2021
bdec901
exceeding latitude fix
bieganowski Feb 26, 2021
42cf614
immutability fix
bieganowski Feb 26, 2021
4d67393
thumbs background configs
bieganowski Mar 1, 2021
482080a
Merge remote-tracking branch 'upstream/master'
giohappy Mar 1, 2021
6fa7571
poc of refactored wizard layer thumbnail
giohappy Mar 1, 2021
78518b8
missing EPSG prefix
giohappy Mar 1, 2021
8be0a8b
wizard map thumbnail
giohappy Mar 1, 2021
b5d1286
correct layers order in a map
bieganowski Mar 2, 2021
bb1e3d5
Merge remote-tracking branch 'origin/feature#660_thumbnails_refactor'…
bieganowski Mar 2, 2021
d19eea4
security issue fix
bieganowski Mar 2, 2021
4cb9a0d
fix for small thumbnails
bieganowski Mar 2, 2021
35aaea0
comments to wizard wiget refactoring
giohappy Mar 2, 2021
8beaf8c
Merge remote-tracking branch 'origin/master' into feature#660_thumbna…
bieganowski Mar 2, 2021
2f70532
Merge remote-tracking branch 'upstream/master'
giohappy Mar 2, 2021
263683c
preserve thumbnail's ratio
bieganowski Mar 3, 2021
6d3eadf
preserve thumbnail's ratio fix
bieganowski Mar 3, 2021
a8ee8e4
fix thumbnail URL for layer's wizard panels
giohappy Mar 3, 2021
f05420e
typo
giohappy Mar 3, 2021
33383d6
bbox method fix
bieganowski Mar 4, 2021
de43e90
Merge branch 'master' of https://github.com/geosolutions-it/geonode
Mar 4, 2021
4f75b0c
Merge branch 'master' into feature#660_thumbnails_refactor
giohappy Mar 8, 2021
40408a3
Merge remote-tracking branch 'origin/master' into geosolutions-master
giohappy Mar 9, 2021
1daad24
tests ongoing
bieganowski Mar 9, 2021
f8fc8b6
Merge remote-tracking branch 'origin/master' into feature#660_thumbna…
bieganowski Mar 9, 2021
f476357
Merge remote-tracking branch 'origin/feature#660_thumbnails_refactor'…
bieganowski Mar 9, 2021
5336495
tests ongoing
bieganowski Mar 9, 2021
499b19f
preparing the thumbnail.js for the refactoring in MapStore
giohappy Mar 9, 2021
ba10711
tests and formatting
bieganowski Mar 10, 2021
8527ffd
Merge remote-tracking branch 'origin/feature#660_thumbnails_refactor'…
bieganowski Mar 10, 2021
97d7df8
remove legacy thumbnail generation
bieganowski Mar 10, 2021
0f79b45
test fix
bieganowski Mar 10, 2021
7d8398a
minimal documentation of background generator options
giohappy Mar 10, 2021
c7e579b
remove outdated tests
bieganowski Mar 11, 2021
9652fcb
Merge remote-tracking branch 'origin/feature#660_thumbnails_refactor'…
bieganowski Mar 11, 2021
410a4e1
add base.tests.ThumbnailTests cleanup
bieganowski Mar 11, 2021
d1b2f82
formatting
bieganowski Mar 11, 2021
3df08e1
Merge branch 'master' of https://github.com/GeoNode/geonode into feat…
giohappy Mar 11, 2021
59fe84e
failing CI tests fix
bieganowski Mar 11, 2021
8ec4355
Merge branch 'master' into feature#660_thumbnails_refactor
Mar 11, 2021
a188b6f
Merge branch 'master' of https://github.com/GeoNode/geonode into feat…
afabiani Mar 12, 2021
cb54c6c
- Add thumbs tests
afabiani Mar 12, 2021
cd009fe
- Fix test cases
afabiani Mar 12, 2021
e7090d5
- Added few more consistency checks in order to make sure we catch '…
afabiani Mar 12, 2021
855958b
- Fix test cases
afabiani Mar 12, 2021
2287b8b
Merge branch 'feature#660_thumbnails_refactor' of https://github.com/…
giohappy Mar 15, 2021
ed0ffac
- Fix test cases
Mar 15, 2021
4d0d402
Merge branch 'feature#660_thumbnails_refactor' of https://github.com/…
giohappy Mar 15, 2021
cc44709
- Fix test cases
Mar 15, 2021
25409f6
Merge branch 'feature#660_thumbnails_refactor' of https://github.com/…
giohappy Mar 15, 2021
e16179c
fixes to thumbnail set frm detail pages
giohappy Mar 15, 2021
f94ac66
- Fix test cases
afabiani Mar 15, 2021
4c02b1c
- Fix test cases
afabiani Mar 16, 2021
e7d3edd
- Fix test cases
afabiani Mar 16, 2021
3784b7b
Merge branch 'master' of https://github.com/GeoNode/geonode into feat…
afabiani Mar 16, 2021
2e1a837
- Test fixes
afabiani Mar 16, 2021
ff093be
- Test fixes
afabiani Mar 16, 2021
095382d
Merge branch 'master' of https://github.com/GeoNode/geonode into feat…
afabiani Mar 17, 2021
ca6be4a
- Test fixes
afabiani Mar 17, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ workflows:
name: geonode_test_suite
load_docker_cache: true
save_docker_cache: false
test_suite: coverage run --branch --source=geonode manage.py test -v 3 --keepdb $(python -c "import sys;from geonode import settings;sys.stdout.write('\'' '\''.join([a+'\''.tests'\'' for a in settings.GEONODE_APPS]))")
test_suite: coverage run --branch --source=geonode manage.py test -v 3 --keepdb $(python -c "import sys;from geonode import settings;sys.stdout.write('\'' '\''.join([a+'\''.tests'\'' for a in settings.GEONODE_APPS]))") geonode.thumbs.tests
requires:
- geonode_test_suite_smoke
- build:
Expand Down
10 changes: 5 additions & 5 deletions .env_dev
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ POSTGRES_PASSWORD=postgres
GEONODE_DATABASE=geonode
GEONODE_DATABASE_PASSWORD=geonode
GEONODE_GEODATABASE=geonode_data
GEONODE_GEODATABASE_PASSWORD=geonode_data
GEONODE_GEODATABASE_PASSWORD=geonode
GEONODE_DATABASE_SCHEMA=public
GEONODE_GEODATABASE_SCHEMA=public
DATABASE_URL=postgis://geonode:geonode@localhost:5432/geonode
GEODATABASE_URL=postgis://geonode_data:geonode@localhost:5432/geonode_data
GEODATABASE_URL=postgis://geonode:geonode@localhost:5432/geonode_data
GEONODE_DB_CONN_MAX_AGE=0
GEONODE_DB_CONN_TOUT=5
DEFAULT_BACKEND_DATASTORE=datastore
Expand All @@ -39,9 +39,9 @@ SITEURL=http://localhost:8000/

ALLOWED_HOSTS="['django', '*']"

# DEFAULT_BACKEND_UPLOADER=geonode.importer
# TIME_ENABLED=True
# MOSAIC_ENABLED=False
DEFAULT_BACKEND_UPLOADER=geonode.importer
TIME_ENABLED=True
MOSAIC_ENABLED=False
HAYSTACK_SEARCH=False
HAYSTACK_ENGINE_URL=http://elasticsearch:9200/
HAYSTACK_ENGINE_INDEX_NAME=haystack
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ pip-log.txt
MANIFEST
dist
.idea/
.vscode/
.pytest_cache/
pip-wheel-metadata/
# supporting stuff pulled in by paver script
Expand Down
20 changes: 20 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Django",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"envFile": "${workspaceFolder}/.env_dev",
"args": [
"runserver",
"0.0.0.0:8000"
],
"django": true
}
]
}
52 changes: 26 additions & 26 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
codecov:
notify:
require_ci_to_pass: yes
coverage:
precision: 2
round: down
range: "60...100"
status:
project: yes
patch: yes
changes: no
parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no
comment:
layout: "header, diff"
behavior: default
require_changes: no
codecov:
notify:
require_ci_to_pass: yes

coverage:
precision: 2
round: down
range: "60...100"

status:
project: yes
patch: yes
changes: no

parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no

comment:
layout: "header, diff"
behavior: default
require_changes: no
10 changes: 7 additions & 3 deletions geonode/api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#########################################################################
from unittest.case import TestCase
from unittest.mock import patch
from django.conf import settings

Expand Down Expand Up @@ -530,9 +529,14 @@ def test_tags_lockdown(self):
self.assertEqual(len(self.deserialize(resp)['objects']), 5)


class ThesaurusKeywordResourceTests(ResourceTestCaseMixin, TestCase):
class ThesaurusKeywordResourceTests(ResourceTestCaseMixin, GeoNodeBaseTestSupport):
# loading test thesausurs
fixtures = ["test_thesaurus.json"]
fixtures = [
'initial_data.json',
"test_thesaurus.json",
'group_test_data.json',
'default_oauth_apps.json'
]

def setUp(self):
super(ThesaurusKeywordResourceTests, self).setUp()
Expand Down
2 changes: 1 addition & 1 deletion geonode/base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,7 @@ def save_thumbnail(self, filename, image):
(_default_thumb_size['width'], _default_thumb_size['height']),
resample=Image.ANTIALIAS)
cover = ImageOps.fit(im, (_default_thumb_size['width'], _default_thumb_size['height']))
cover.save(storage.path(_upload_path), format='JPEG')
cover.save(storage.path(_upload_path), format='PNG')
except Exception as e:
logger.debug(e)

Expand Down
16 changes: 15 additions & 1 deletion geonode/base/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ def setUp(self):
super(ThumbnailTests, self).setUp()
self.rb = ResourceBase.objects.create()

def tearDown(self):
super().tearDown()

def test_initial_behavior(self):
"""
Tests that an empty resource has a missing image as default thumbnail.
Expand All @@ -100,10 +103,16 @@ def test_monochromatic_image(self, image):
"""
Tests that an monochromatic image does not change the current resource thumbnail.
"""
filename = 'test-thumb'

current = self.rb.get_thumbnail_url()
self.rb.save_thumbnail('test-thumb', image)
self.rb.save_thumbnail(filename, image)
self.assertEqual(current, urlparse(self.rb.get_thumbnail_url()).path)

# cleanup: remove saved thumbnail
thumb_utils.remove_thumbs(filename)
self.assertFalse(thumb_utils.thumb_exists(filename))

@patch('PIL.Image.open', return_value=test_image)
def test_thumb_utils_methods(self, image):
"""
Expand All @@ -120,6 +129,10 @@ def test_thumb_utils_methods(self, image):
self.assertTrue(thumb_utils.thumb_exists(filename))
self.assertEqual(thumb_utils.thumb_size(upload_path), 10000)

# cleanup: remove saved thumbnail
thumb_utils.remove_thumbs(filename)
self.assertFalse(thumb_utils.thumb_exists(filename))


class TestThumbnailUrl(GeoNodeBaseTestSupport):

Expand Down Expand Up @@ -948,6 +961,7 @@ def __get_last_thesaurus():

@override_settings(THESAURUS_DEFAULT_LANG="en")
class TestThesaurusAvailableForm(TestCase):
# loading test thesausurs
fixtures = [
"test_thesaurus.json"
]
Expand Down
4 changes: 2 additions & 2 deletions geonode/client/templates/ol/layers/layer_ol2_map.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
"https://c.tile.openstreetmap.org/${z}/${x}/${y}.png"]),
source
];

var map = new OpenLayers.Map({
// olMap is used by thumbnail.js to POST to the thumbnail update view
var map = window.olMap = new OpenLayers.Map({
div: 'preview_map',
projection: new OpenLayers.Projection('EPSG:900913'),
layers: layers,
Expand Down
3 changes: 2 additions & 1 deletion geonode/client/templates/ol/maps/map_ol2.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
layers.push(source);
{% endif %}
{% endfor %}
var map = new OpenLayers.Map({
// olMap is used by thumbnail.js to POST to the thumbnail update view
window.olMap = new OpenLayers.Map({
div: 'preview_map',
projection: new OpenLayers.Projection('EPSG:900913'),
layers: layers,
Expand Down
Loading