Skip to content

Commit

Permalink
Merge pull request #11590 from archesproject/jmc/update_dev80x_with_76x
Browse files Browse the repository at this point in the history
Update dev/8.0.x with dev/7.6.x
  • Loading branch information
jacobtylerwalls authored Oct 30, 2024
2 parents 8ed87f3 + 26af817 commit 5006223
Show file tree
Hide file tree
Showing 28 changed files with 1,848 additions and 2,953 deletions.
16 changes: 1 addition & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Issue reports are encouraged! [Please read this article](http://polite.technolog
* [Report a Bug](https://github.com/archesproject/arches/issues/new?template=bug.md)
* [File a Feature Ticket](https://github.com/archesproject/arches/issues/new?template=feature.md)

[Version 7.6.0 release notes](https://github.com/archesproject/arches/blob/dev/7.6.x/releases/7.6.0.md)
[Version 7.6.1 release notes](https://github.com/archesproject/arches/blob/dev/7.6.x/releases/7.6.1.md)

#### Quick Install

Expand Down Expand Up @@ -63,20 +63,6 @@ Our general release cycle will typically be a functional release (either major i

The following a general plan for the Arches project. Be aware this plan is tentative and subject to change.

## 7.6 LTS - Release date: Sept 15, 2024
- Arches Application improvements
- Security enhancements
- Default deny permissions
- Support for pluggable permissions frameworks
- Standalone plugins
- Customizable Search
- Concept label bulk editor module
- Map performance improvments
- Postgres 14 becomes minimum Postgres version

## 7.6 - Supported Applications
- Workflow Builder

## 8.0 - Release date: June 15, 2025
- Activity stream enhancements
- Support for editing and publishing graphs without having to remove resource instances
Expand Down
35 changes: 24 additions & 11 deletions arches/app/datatypes/concept_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,17 +292,15 @@ def to_json(self, tile, node):
)
return self.compile_json(tile, node, **value_data)

def get_rdf_uri(self, node, data, which="r"):
def get_rdf_uri(self, node, data, which="r", c=None):
if not data:
return None
c = ConceptValue(str(data))
c = ConceptValue(str(data)) if c is None else c
assert c.value is not None, "Null or blank concept value"
ext_ids = [
ident.value
for ident in models.Value.objects.all().filter(
concept_id__exact=c.conceptid, valuetype__category="identifiers"
)
]
ext_ids = models.Value.objects.filter(
concept_id=c.conceptid, valuetype__category="identifiers"
).values_list("value", flat=True)

for p in settings.PREFERRED_CONCEPT_SCHEMES:
for id_uri in ext_ids:
if str(id_uri).startswith(p):
Expand Down Expand Up @@ -489,12 +487,27 @@ def get_rdf_uri(self, node, data, which="r"):

def to_rdf(self, edge_info, edge):
g = Graph()
c = ConceptDataType()
cdt = ConceptDataType()
if edge_info["range_tile_data"]:
for r in edge_info["range_tile_data"]:
c = ConceptValue(str(r))
concept_info = edge_info.copy()
concept_info["range_tile_data"] = r
g += c.to_rdf(concept_info, edge)
concept_info["r_uri"] = cdt.get_rdf_uri(None, r, c=c)
g.add(
(
concept_info["r_uri"],
RDF.type,
URIRef(edge.rangenode.ontologyclass),
)
)
g.add(
(
concept_info["d_uri"],
URIRef(edge.ontologyproperty),
concept_info["r_uri"],
)
)
g.add((concept_info["r_uri"], URIRef(RDFS.label), Literal(c.value)))
return g

def from_rdf(self, json_ld_node):
Expand Down
15 changes: 10 additions & 5 deletions arches/app/datatypes/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2276,15 +2276,20 @@ def _add_resource(d, p, r, r_type):
if not isinstance(res_insts, list):
res_insts = [res_insts]

ontologyclass_lookup = {}
for res_inst in res_insts:
rangenode = self.get_rdf_uri(None, res_inst)
try:
res_inst_obj = models.ResourceInstance.objects.get(
res_inst_graphid = models.ResourceInstance.objects.get(
pk=res_inst["resourceId"]
)
r_type = res_inst_obj.graph.node_set.get(
istopnode=True
).ontologyclass
).graph_id
try:
r_type = ontologyclass_lookup[res_inst_graphid]
except KeyError:
r_type = models.Node.objects.get(
graph=res_inst_graphid, istopnode=True
).ontologyclass
ontologyclass_lookup[res_inst_graphid] = r_type
except models.ResourceInstance.DoesNotExist:
# This should never happen excpet if trying to export when the
# referenced resource hasn't been saved to the database yet
Expand Down
2 changes: 1 addition & 1 deletion arches/app/etl_modules/base_import_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ def return_with_error(error):
return return_with_error(read["data"]["message"])

if written["success"]:
return {"success": True, "data": "Succenfully Imported"}
return {"success": True, "data": "Successfully Imported"}
else:
return return_with_error(written["data"]["message"])

Expand Down
37 changes: 31 additions & 6 deletions arches/app/etl_modules/tile_excel_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
from django.core.exceptions import ValidationError
import uuid
from django.db import connection
from django.http import HttpResponse
from django.http import HttpRequest, HttpResponse
from django.utils.translation import gettext as _
from django.core.files.storage import default_storage
from django.contrib.auth.models import User
from arches.app.datatypes.datatypes import DataTypeFactory
from arches.app.etl_modules.decorators import load_data_async
from arches.app.models.models import Node, TileModel
from arches.app.models.models import Node, TileModel, ETLModule
from arches.app.models.system_settings import settings
from arches.app.utils.betterJSONSerializer import JSONSerializer
from arches.app.etl_modules.base_import_module import (
Expand All @@ -24,15 +25,39 @@


class TileExcelImporter(BaseImportModule):
def __init__(self, request=None, loadid=None, temp_dir=None):
self.request = request if request else None
self.userid = request.user.id if request else None
def __init__(self, request=None, loadid=None, temp_dir=None, params=None):
self.loadid = request.POST.get("load_id") if request else loadid
self.userid = (
request.user.id
if request
else settings.DEFAULT_RESOURCE_IMPORT_USER["userid"]
)
self.mode = "cli" if not request and params else "ui"
try:
self.user = User.objects.get(pk=self.userid)
except User.DoesNotExist:
raise User.DoesNotExist(
_(
"The userid {} does not exist. Probably DEFAULT_RESOURCE_IMPORT_USER is not configured correctly in settings.py.".format(
self.userid
)
)
)
if not request and params:
request = HttpRequest()
request.user = self.user
request.method = "POST"
for k, v in params.items():
request.POST.__setitem__(k, v)
self.request = request
self.moduleid = request.POST.get("module") if request else None
self.datatype_factory = DataTypeFactory()
self.legacyid_lookup = {}
self.temp_path = ""
self.loadid = loadid if loadid else None
self.temp_dir = temp_dir if temp_dir else None
self.config = (
ETLModule.objects.get(pk=self.moduleid).config if self.moduleid else {}
)

@load_data_async
def run_load_task_async(self, request):
Expand Down
61 changes: 37 additions & 24 deletions arches/app/media/js/utils/load-component-dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,64 +3,70 @@
define([], function() {
return function loadComponentDependencies(componentPaths){
for (const componentPath of componentPaths) {
try {
if (!ARCHES_APPLICATIONS.length) { // assumption os running Arches without a project
throw new Error()
let componentLoaded = false;

for (const archesApp of ARCHES_APPLICATIONS) {
try {
require(`${SITE_PACKAGES_DIRECTORY}/${archesApp}/media/js/${componentPath}`);
componentLoaded = true;
break;
}
for (const archesApp of ARCHES_APPLICATIONS) {
catch(e) {
try {
require(`${SITE_PACKAGES_DIRECTORY}/${archesApp}/media/js/${componentPath}`);
require(`${LINKED_APPLICATION_PATH_0}/media/js/${componentPath}`);
componentLoaded = true;
break;
}
// Handle editable installations (with pip install -e).
// Webpack needs string literals, hence arbitrary limit of 9.
// https://github.com/archesproject/arches/issues/11274
catch(e) {
catch {
try {
require(`${LINKED_APPLICATION_PATH_0}/media/js/${componentPath}`);
require(`${LINKED_APPLICATION_PATH_1}/media/js/${componentPath}`);
componentLoaded = true;
break;
}
catch {
try {
require(`${LINKED_APPLICATION_PATH_1}/media/js/${componentPath}`);
require(`${LINKED_APPLICATION_PATH_2}/media/js/${componentPath}`);
componentLoaded = true;
break;
}
catch {
try {
require(`${LINKED_APPLICATION_PATH_2}/media/js/${componentPath}`);
require(`${LINKED_APPLICATION_PATH_3}/media/js/${componentPath}`);
componentLoaded = true;
break;
}
catch {
try {
require(`${LINKED_APPLICATION_PATH_3}/media/js/${componentPath}`);
require(`${LINKED_APPLICATION_PATH_4}/media/js/${componentPath}`);
componentLoaded = true;
break;
}
catch {
try {
require(`${LINKED_APPLICATION_PATH_4}/media/js/${componentPath}`);
require(`${LINKED_APPLICATION_PATH_5}/media/js/${componentPath}`);
componentLoaded = true;
break;
}
catch {
try {
require(`${LINKED_APPLICATION_PATH_5}/media/js/${componentPath}`);
require(`${LINKED_APPLICATION_PATH_6}/media/js/${componentPath}`);
componentLoaded = true;
break;
}
catch {
try {
require(`${LINKED_APPLICATION_PATH_6}/media/js/${componentPath}`);
require(`${LINKED_APPLICATION_PATH_7}/media/js/${componentPath}`);
componentLoaded = true;
break;
}
catch {
try {
require(`${LINKED_APPLICATION_PATH_7}/media/js/${componentPath}`);
require(`${LINKED_APPLICATION_PATH_8}/media/js/${componentPath}`);
componentLoaded = true;
break;
}
catch {
try {
require(`${LINKED_APPLICATION_PATH_8}/media/js/${componentPath}`);
break;
}
catch { throw new Error(); } // if all attempts fail within the loop, throw error for outer try/catch
// Component not found in linked paths, continue to next archesApp
}
}
}
Expand All @@ -72,9 +78,16 @@ define([], function() {
}
}
}
catch(e) { // finally, look in Arches core for component
require(`${ARCHES_CORE_DIRECTORY}/app/media/js/${componentPath}`);

if (!componentLoaded) { // Finally, look in Arches core for the component
try {
require(`${ARCHES_CORE_DIRECTORY}/app/media/js/${componentPath}`);
}
catch (e) {
console.error(`Component "${componentPath}" not found in any application or in Arches core.`);
}
}
}
};
});

Loading

0 comments on commit 5006223

Please sign in to comment.