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

Update 74x with 62x #10188

Merged
merged 20 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
c9e38d5
Fixed function call parameters #9953
khodgkinson-he Aug 22, 2023
9a6d664
Merge pull request #9954 from HistoricEngland/9953_fix_multiproc_inde…
chiatt Aug 23, 2023
0489e6d
Correct version number of arches-django-revproxy
jacobtylerwalls Sep 11, 2023
35bb8d8
Merge pull request #10025 from archesproject/fix-package-number-6.2
chiatt Sep 15, 2023
94a8f47
Ensure link property is a string not a uuid, re #10084 (#10085)
chiatt Sep 28, 2023
5cec264
Prep 6.2.5 release (#10086)
chiatt Sep 28, 2023
b89c58b
Check 'to' type and add better error logging
aarongundel Sep 29, 2023
e62ade0
Merge pull request #10093 from archesproject/10084_email_to_type
chiatt Sep 29, 2023
2bacfcb
Fix validation of required list nodes #10077
jacobtylerwalls Oct 13, 2023
90b5424
Implement clean() instead
jacobtylerwalls Oct 18, 2023
5d4ee8c
Handle ResourceInstanceDataType also re #10077
jacobtylerwalls Oct 18, 2023
13c7f7e
Merge pull request #10132 from archesproject/10077-required-file-list
chiatt Oct 18, 2023
ad10013
Prevents undefined graph error, re #10151
chiatt Oct 18, 2023
8f9ef93
Merge pull request #10152 from archesproject/10151_ri_widget_iconclas…
jacobtylerwalls Oct 18, 2023
b9763ce
Add RENDERERS to settings.py template
jacobtylerwalls Oct 20, 2023
f9d7524
Merge pull request #10171 from archesproject/add-renderers-to-template
chiatt Oct 24, 2023
84ad189
Merge branch 'dev/6.2.x' into update_74x_with_62x
chiatt Oct 24, 2023
bc81342
match with multiple EDTF nodes in card criteria
aj-he Oct 27, 2023
966f53e
Merge pull request #10202 from HistoricEngland/10112_fix_edtf_search_…
apeters Oct 27, 2023
ea3197b
Merge branch 'dev/6.2.x' into update_74x_with_62x
chiatt Oct 30, 2023
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
15 changes: 15 additions & 0 deletions arches/app/datatypes/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1538,6 +1538,11 @@ def format_bytes(size):
errors.append({"type": "ERROR", "message": message, "title": title})
return errors

def clean(self, tile, nodeid):
super().clean(tile, nodeid)
if tile.data[nodeid] == []:
tile.data[nodeid] = None

def append_to_document(self, document, nodevalue, nodeid, tile, provisional=False):
try:
for f in tile.data[str(nodeid)]:
Expand Down Expand Up @@ -2097,6 +2102,11 @@ def get_search_terms(self, nodevalue, nodeid=None):

return terms

def clean(self, tile, nodeid):
super().clean(tile, nodeid)
if tile.data[nodeid] == []:
tile.data[nodeid] = None

def append_to_document(self, document, nodevalue, nodeid, tile, provisional=False):
domain_text_values = set([])
node = models.Node.objects.get(nodeid=nodeid)
Expand Down Expand Up @@ -2232,6 +2242,11 @@ def validate(self, value, row_number=None, source="", node=None, nodeid=None, st

return errors

def clean(self, tile, nodeid):
super().clean(tile, nodeid)
if tile.data[nodeid] == []:
tile.data[nodeid] = None

def pre_tile_save(self, tile, nodeid):
relationships = tile.data[nodeid]
if relationships:
Expand Down
25 changes: 25 additions & 0 deletions arches/install/arches-templates/project_name/settings.py-tpl
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,31 @@ CANTALOUPE_HTTP_ENDPOINT = "http://localhost:8182/"

ACCESSIBILITY_MODE = False

RENDERERS = [
{
"name": "imagereader",
"title": "Image Reader",
"description": "Displays most image file types",
"id": "5e05aa2e-5db0-4922-8938-b4d2b7919733",
"iconclass": "fa fa-camera",
"component": "views/components/cards/file-renderers/imagereader",
"ext": "",
"type": "image/*",
"exclude": "tif,tiff,psd",
},
{
"name": "pdfreader",
"title": "PDF Reader",
"description": "Displays pdf files",
"id": "09dec059-1ee8-4fbd-85dd-c0ab0428aa94",
"iconclass": "fa fa-file",
"component": "views/components/cards/file-renderers/pdfreader",
"ext": "pdf",
"type": "application/pdf",
"exclude": "tif,tiff,psd",
},
]

# By setting RESTRICT_MEDIA_ACCESS to True, media file requests outside of Arches will checked against nodegroup permissions.
RESTRICT_MEDIA_ACCESS = False

Expand Down
34 changes: 31 additions & 3 deletions tests/models/tile_model_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
from django.contrib.auth.models import User
from django.db.utils import ProgrammingError
from django.http import HttpRequest
from arches.app.models.tile import Tile
from arches.app.models.tile import Tile, TileValidationError
from arches.app.models.resource import Resource
from arches.app.models.models import ResourceXResource
from arches.app.models.models import Node, NodeGroup, ResourceXResource



Expand Down Expand Up @@ -62,6 +62,9 @@ def setUpClass(cls):

INSERT INTO node_groups(nodegroupid, legacygroupid, cardinality)
VALUES ('21111111-0000-0000-0000-000000000000', '', 'n');

INSERT INTO node_groups(nodegroupid, legacygroupid, cardinality)
VALUES ('41111111-0000-0000-0000-000000000000', '', 'n');
"""

cursor = connection.cursor()
Expand All @@ -74,7 +77,8 @@ def tearDownClass(cls):
WHERE nodegroupid = '99999999-0000-0000-0000-000000000001' OR
nodegroupid = '32999999-0000-0000-0000-000000000000' OR
nodegroupid = '19999999-0000-0000-0000-000000000000' OR
nodegroupid = '21111111-0000-0000-0000-000000000000';
nodegroupid = '21111111-0000-0000-0000-000000000000' OR
nodegroupid = '42999999-0000-0000-0000-000000000000';

DELETE FROM public.resource_instances
WHERE resourceinstanceid = '40000000-0000-0000-0000-000000000000';
Expand Down Expand Up @@ -582,3 +586,27 @@ def test_related_resources_managed(self):

# t2 = Tile(json)
# self.assertFalse(t2.validate()['is_valid'])

def test_check_for_missing_nodes(self):
# Required file list node.
node_group = NodeGroup.objects.get(pk=UUID("41111111-0000-0000-0000-000000000000"))
required_file_list_node = Node(
name="Required file list",
datatype="file-list",
nodegroup=node_group,
isrequired=True,
istopnode=False,
)
required_file_list_node.save()

json = {
"resourceinstance_id": "40000000-0000-0000-0000-000000000000",
"parenttile_id": "",
"nodegroup_id": str(node_group.pk),
"tileid": "",
"data": {required_file_list_node.nodeid: []},
}
tile = Tile(json)

with self.assertRaises(TileValidationError):
tile.check_for_missing_nodes()
Loading