Skip to content

Commit

Permalink
Revert "Merge pull request #10569 from archesproject/controlled-list-…
Browse files Browse the repository at this point in the history
…item-editor"

This reverts commit da9165a, reversing
changes made to 491d7fe.
  • Loading branch information
jacobtylerwalls committed Jul 18, 2024
1 parent f560e6d commit 3704d40
Show file tree
Hide file tree
Showing 64 changed files with 69 additions and 7,295 deletions.
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ omit =
*/urls.py
*/wsgi.py
*/celery.py
*/__init__.py

data_file = coverage/python/.coverage

Expand Down
6 changes: 1 addition & 5 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@
eea27d316c5ff975556e15ccd4c11d7c393dd95c
8de09526329685ee4d80c816c3475a66b19d46e9
e3d8197d5a7d1f03ed125fe2f47d4fbef0913404
eff6710e8b44faef5a628b0ea1373cd99cb47e9e
# Reformatting of 7.6 features under dev (2024)
9740c846eda0cc067f49d7abffdcb1a93fe3e0a9
# Reformatting of 8.0 features under dev (2024)
0a4e7a54dc9795756208a5356bd92a3a11d467f2
1d7d411aba53e32f6be2e998c8b9b22bba72e56f
eff6710e8b44faef5a628b0ea1373cd99cb47e9e
# Relevant subset of git log --grep black
9b7e30d4499cb02dec6d17c7c99f9a7087fcdd47
b959f1139a1d789e6c116d43d8be7daa0baa6075
Expand Down
8 changes: 0 additions & 8 deletions arches/app/datatypes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,11 +517,3 @@ def pre_structure_tile_data(self, tile, nodeid, **kwargs):
Adds properties to a tile necessary for some clients, but not essential to the tile
"""
pass

def validate_node(self, node):
"""
Confirms a node is properly configured to collect data.
If improperly configured, this method should raise
a GraphValidationError
"""
pass
122 changes: 1 addition & 121 deletions arches/app/datatypes/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2423,7 +2423,7 @@ def get_localized_option_text(self, node, option_id, return_lang=False):
return get_localized_value(option["text"], return_lang=return_lang)
raise Exception(
_(
"No domain option found for option id {0}, in node config: {1}".format(
"No domain option found for option id {0}, in node conifg: {1}".format(
option_id, node.config["options"]
)
)
Expand Down Expand Up @@ -3272,123 +3272,3 @@ def get_value_from_jsonld(json_ld_node):
return
except IndexError as e:
return


class ReferenceDataType(BaseDataType):
def validate(
self,
value,
row_number=None,
source="",
node=None,
nodeid=None,
strict=False,
**kwargs,
):
errors = []
title = _("Invalid Reference Datatype Value")
if value is None:
return errors

if type(value) == list and len(value):
for reference in value:
if "uri" in reference and len(reference["uri"]):
pass
else:
errors.append(
{
"type": "ERROR",
"message": _(
"Reference objects require a 'uri' property and corresponding value"
),
"title": title,
}
)
if "labels" in reference:
pref_label_languages = []
for label in reference["labels"]:
if not all(
key in label
for key in ("id", "value", "language_id", "valuetype_id")
):
errors.append(
{
"type": "ERROR",
"message": _(
"Reference labels require properties: id(uuid), value(string), language_id(e.g. 'en'), and valuetype_id(e.g. 'prefLabel')"
),
"title": title,
}
)
if label["valuetype_id"] == "prefLabel":
pref_label_languages.append(label["language_id"])

if len(set(pref_label_languages)) < len(pref_label_languages):
errors.append(
{
"type": "ERROR",
"message": _(
"A reference can have only one prefLabel per language"
),
"title": title,
}
)
else:
errors.append(
{
"type": "ERROR",
"message": _("Reference value must be a list of reference objects"),
"title": title,
}
)
return errors

def transform_value_for_tile(self, value, **kwargs):
return value

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

def transform_export_values(self, value, *args, **kwargs):
return ",".join(value)

def get_display_value(self, tile, node, **kwargs):
labels = []
requested_language = kwargs.pop("language", None)
current_language = requested_language or get_language()
for item in self.get_tile_data(tile)[str(node.nodeid)]:
for label in item["labels"]:
if (
label["language_id"] == current_language
and label["valuetype_id"] == "prefLabel"
):
labels.append(label.get("value", ""))
return ", ".join(labels)

def collects_multiple_values(self):
return True

def default_es_mapping(self):
return {
"properties": {
"uri": {"type": "keyword"},
"id": {"type": "keyword"},
"labels": {
"properties": {},
},
}
}

def validate_node(self, node):
from arches.app.models.graph import (
GraphValidationError,
) # prevent circular import

try:
uuid.UUID(node.config["controlledList"])
except (TypeError, KeyError):
raise GraphValidationError(
_("A reference datatype node requires a controlled list")
)
17 changes: 15 additions & 2 deletions arches/app/media/js/utils/create-vue-application.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,25 @@ import StyleClass from 'primevue/styleclass';
import ToastService from 'primevue/toastservice';
import Tooltip from 'primevue/tooltip';

import Aura from '@primevue/themes/aura';

import { createApp } from 'vue';
import { createGettext } from "vue3-gettext";

import arches from 'arches';

export default async function createVueApplication(vueComponent) {
const DEFAULT_THEME = {
theme: {
preset: Aura,
options: {
prefix: 'p',
darkModeSelector: 'system',
cssLayer: false
}
}
};

export default async function createVueApplication(vueComponent, themeConfiguration) {
/**
* This wrapper allows us to maintain a level of control inside arches-core
* over Vue apps. For instance this allows us to abstract i18n setup/config
Expand Down Expand Up @@ -40,7 +53,7 @@ export default async function createVueApplication(vueComponent) {

const app = createApp(vueComponent);

app.use(PrimeVue);
app.use(PrimeVue, themeConfiguration || DEFAULT_THEME);
app.use(gettext);
app.use(ConfirmationService);
app.use(DialogService);
Expand Down
167 changes: 0 additions & 167 deletions arches/app/media/js/viewmodels/reference-select.js

This file was deleted.

Loading

0 comments on commit 3704d40

Please sign in to comment.