+
diff --git a/arches_lingo/src/arches_lingo/components/generic/resource-instance-relationships/ResourceInstanceRelationshipsEditor.vue b/arches_lingo/src/arches_lingo/components/generic/resource-instance-relationships/ResourceInstanceRelationshipsEditor.vue
index 42d90a8a..f47d2c69 100644
--- a/arches_lingo/src/arches_lingo/components/generic/resource-instance-relationships/ResourceInstanceRelationshipsEditor.vue
+++ b/arches_lingo/src/arches_lingo/components/generic/resource-instance-relationships/ResourceInstanceRelationshipsEditor.vue
@@ -1,32 +1,90 @@
+ :aria-labelledby="ptAriaLabeledBy"
+ >
+
+
+
+
+
+
+
diff --git a/arches_lingo/src/arches_lingo/components/generic/resource-instance-relationships/ResourceInstanceRelationshipsViewer.vue b/arches_lingo/src/arches_lingo/components/generic/resource-instance-relationships/ResourceInstanceRelationshipsViewer.vue
index f5757350..39297a89 100644
--- a/arches_lingo/src/arches_lingo/components/generic/resource-instance-relationships/ResourceInstanceRelationshipsViewer.vue
+++ b/arches_lingo/src/arches_lingo/components/generic/resource-instance-relationships/ResourceInstanceRelationshipsViewer.vue
@@ -17,7 +17,7 @@ withDefaults(defineProps<{ value?: ResourceInstanceReference[] }>(), {
class="resource-instance-relationship-view"
>
- {{ val.display_value }}
+ {{ val.displayValue }}
diff --git a/arches_lingo/src/arches_lingo/components/scheme/report/SchemeStandard.vue b/arches_lingo/src/arches_lingo/components/scheme/report/SchemeStandard.vue
index cf19a645..f175d803 100644
--- a/arches_lingo/src/arches_lingo/components/scheme/report/SchemeStandard.vue
+++ b/arches_lingo/src/arches_lingo/components/scheme/report/SchemeStandard.vue
@@ -1,5 +1,5 @@
@@ -189,7 +129,8 @@ function onCreationUpdate(val: string[]) {
diff --git a/arches_lingo/src/arches_lingo/constants.ts b/arches_lingo/src/arches_lingo/constants.ts
index ad59090c..97ec71d6 100644
--- a/arches_lingo/src/arches_lingo/constants.ts
+++ b/arches_lingo/src/arches_lingo/constants.ts
@@ -9,6 +9,7 @@ export const CONTRAST = "contrast";
export const EDIT = "edit";
export const VIEW = "view";
export const OPEN_EDITOR = "openEditor";
+export const CREATE_NEW_RESOURCE = "createNewResource";
export const UPDATED = "updated";
export const NEW = "new";
export const MAXIMIZE = "maximize";
diff --git a/arches_lingo/src/arches_lingo/types.ts b/arches_lingo/src/arches_lingo/types.ts
index 342c5117..d16fffa5 100644
--- a/arches_lingo/src/arches_lingo/types.ts
+++ b/arches_lingo/src/arches_lingo/types.ts
@@ -75,13 +75,24 @@ export interface ResourceInstanceReference {
ontologyProperty: string;
resourceXresourceId?: string;
inverseOntologyProperty: string;
- display_value?: string;
+ displayValue?: string;
+}
+
+export interface NewResourceInstance {
+ displayValue: string;
+ graphId: string;
}
export interface ResourceInstanceResult {
resourceinstanceid: string;
- descriptors: { [key: string]: { name: string } };
+ display_value: string;
+}
+
+export interface GraphInfo {
+ graphid: string;
+ name: string;
}
+
interface ControlledListItemValue {
value: string;
}
diff --git a/arches_lingo/urls.py b/arches_lingo/urls.py
index ab354963..a5a8be82 100644
--- a/arches_lingo/urls.py
+++ b/arches_lingo/urls.py
@@ -4,6 +4,7 @@
from django.urls import include, path
from arches_lingo.views.root import LingoRootView
+from arches_lingo.views.api.relatable_resources import RelatableResourcesView
from arches_lingo.views.api.concepts import ConceptTreeView, ValueSearchView
from arches_lingo.views.api.generic import (
LingoResourceDetailView,
@@ -23,6 +24,11 @@
path("concept/", LingoRootView.as_view(), name="concept"),
path("api/concept-tree", ConceptTreeView.as_view(), name="api-concepts"),
path("api/search", ValueSearchView.as_view(), name="api-search"),
+ path(
+ "api/lingo//node//relatable-resources",
+ RelatableResourcesView.as_view(),
+ name="api-node-relatable-resources",
+ ),
path(
"api/lingo/",
LingoResourceListCreateView.as_view(),
diff --git a/arches_lingo/views/api/relatable_resources.py b/arches_lingo/views/api/relatable_resources.py
new file mode 100644
index 00000000..ae1687a4
--- /dev/null
+++ b/arches_lingo/views/api/relatable_resources.py
@@ -0,0 +1,56 @@
+from django.core.paginator import Paginator
+from django.utils.decorators import method_decorator
+from arches.app.utils.decorators import group_required
+from django.views import View
+from django.utils.translation import get_language
+from arches.app.models.models import Node, ResourceInstance, GraphModel
+from arches.app.utils.response import JSONResponse
+from arches.app.utils.betterJSONSerializer import JSONDeserializer
+
+from arches.app.utils.decorators import can_edit_resource_instance
+
+
+@method_decorator(can_edit_resource_instance, name="dispatch")
+class RelatableResourcesView(View):
+ def get(self, request, graph_slug, node_alias):
+ node = Node.objects.get(
+ name=node_alias,
+ graph__slug=graph_slug,
+ graph__is_active=True,
+ graph__publication__isnull=False,
+ )
+ page_number = request.GET.get("page", 1)
+ items_per_page = request.GET.get("items", 25)
+
+ config = JSONDeserializer().deserialize(node.config.value)
+ graphs = [graph["graphid"] for graph in config.get("graphs", [])]
+
+ graph_models = GraphModel.objects.filter(graphid__in=graphs).values(
+ "name", "graphid"
+ )
+
+ resources = ResourceInstance.objects.filter(graph_id__in=graphs).order_by(
+ "descriptors__{}__name".format(get_language())
+ )
+
+ paginator = Paginator(resources, items_per_page)
+ page_object = paginator.get_page(page_number)
+ language = get_language()
+ data = [
+ {
+ "resourceinstanceid": resource.resourceinstanceid,
+ "display_value": resource.descriptors[language]["name"],
+ }
+ for resource in page_object
+ ]
+
+ return JSONResponse(
+ {
+ "graphs": graph_models,
+ "current_page": paginator.get_page(page_number).number,
+ "total_pages": paginator.num_pages,
+ "results_per_page": paginator.per_page,
+ "total_results": paginator.count,
+ "data": data,
+ }
+ )