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

Implement controlled list manager and reference datatype #10541 #10569

Merged
merged 529 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
529 commits
Select commit Hold shift + click to select a range
f4492b7
Simplify copy
jacobtylerwalls May 20, 2024
3eebbe0
Improve constant handling for metadata choices
jacobtylerwalls May 20, 2024
2192acf
const.ts -> constants.ts
jacobtylerwalls May 20, 2024
b9a4bd0
Remove comments from JS sanity check errors
jacobtylerwalls May 20, 2024
68d271a
Remove % padding
jacobtylerwalls May 20, 2024
36cac54
Remove magic height
jacobtylerwalls May 20, 2024
77b4700
Allow multiple list items with blank URIs
jacobtylerwalls May 20, 2024
9e5122e
Make columns more consistent
jacobtylerwalls May 20, 2024
5340333
"Squash" migrations (but without replaces=)
jacobtylerwalls May 20, 2024
eb41755
fixup! Allow multiple list items with blank URIs
jacobtylerwalls May 21, 2024
19b499a
fixup! "Squash
jacobtylerwalls May 21, 2024
a7fbbc8
Factor out <TreeRow>
jacobtylerwalls May 21, 2024
528ca37
Factor out <ItemImages> and <ItemURI>
jacobtylerwalls May 21, 2024
a5314b5
Add title attribute to <img>
jacobtylerwalls May 21, 2024
2572147
fixup! Factor out <ItemURI>
jacobtylerwalls May 21, 2024
3847aac
Factor out <ImageMetadata>
jacobtylerwalls May 21, 2024
2d46998
Copy splash icon CSS
jacobtylerwalls May 21, 2024
02f5088
Reenable type-checking in templates
jacobtylerwalls May 21, 2024
cee7755
Fix TS issues in templates
jacobtylerwalls May 21, 2024
564ef94
Merge branch 'controlled-list-item-editor' into 10883_migrate_collect…
johnatawnclementawn May 21, 2024
9cce931
Merge branch 'controlled-list-item-editor' into 10848_support_control…
johnatawnclementawn May 21, 2024
61c4178
Update comment
jacobtylerwalls May 21, 2024
74231ab
fix migration dependency #10883
johnatawnclementawn May 21, 2024
7718ef9
Better filtering of non collections #10883
johnatawnclementawn May 22, 2024
7251808
Move function description so it's maintained in pg after init #10883
johnatawnclementawn May 22, 2024
8c8f5de
Accept concept identifier as an function input #10883
johnatawnclementawn May 22, 2024
71a0d8c
nit #10883
johnatawnclementawn May 22, 2024
cc2d3c0
Remove field that is defautled to false in model definition #10883
johnatawnclementawn May 22, 2024
6def92f
Revert "Remove field that is defautled to false in model definition #…
johnatawnclementawn May 22, 2024
6870c4a
Better error handling for single user provided value not in collectio…
johnatawnclementawn May 22, 2024
d72c719
Keep reactivity pattern in sync post-refactor
jacobtylerwalls May 22, 2024
25379a4
LabelEditor -> ValueEditor, add note capability
jacobtylerwalls May 22, 2024
ab3437f
Save notes (as scope notes for now)
jacobtylerwalls May 22, 2024
a68b7aa
Remove inadvertent duplicates when handling multiple languages #10883
johnatawnclementawn May 22, 2024
d36589f
fixup! Save notes
jacobtylerwalls May 22, 2024
74bd851
Only create items and item values for lists being migrated in this tr…
johnatawnclementawn May 22, 2024
e2a2c3e
nit #10883
johnatawnclementawn May 22, 2024
36c7b80
Allow saving various note types
jacobtylerwalls May 22, 2024
e7465f6
fixup! Allow saving various
jacobtylerwalls May 22, 2024
eca6de5
feedback nits #10848
johnatawnclementawn May 22, 2024
b6d2b51
Account for future graphs
jacobtylerwalls May 23, 2024
4686fe1
Add friendly constraint violation messages; remake migrations
jacobtylerwalls May 23, 2024
d463622
nit
chiatt May 22, 2024
d6c50ed
Raise error for invalid node config
chiatt May 22, 2024
a49ec9a
Remove duplicate line
chiatt May 22, 2024
34617b7
Remove redundant ternary
chiatt May 22, 2024
864e13a
Handle for undefined lists
chiatt May 23, 2024
93ee214
Remove unnecessary method
chiatt May 23, 2024
0a24b5c
nit
chiatt May 23, 2024
fa6a1e2
Merge pull request #10968 from archesproject/ref_datatype_cleanup
chrabyrd May 23, 2024
bba6f9f
Remove editing rows if unique constraints violated
jacobtylerwalls May 23, 2024
8160426
Add back toast life
jacobtylerwalls May 23, 2024
2dc1199
Default next label entry to next language
jacobtylerwalls May 23, 2024
8b79c1e
Default next note entry to next note type
jacobtylerwalls May 23, 2024
9e319c0
Add error handling to image upload
jacobtylerwalls May 23, 2024
ad0ef77
Hide successfully uploaded files from file uploader
jacobtylerwalls May 23, 2024
8979f0a
fixup! Default next note entry
jacobtylerwalls May 23, 2024
74e5da7
Remove prefetchDepth param
jacobtylerwalls May 23, 2024
1abcade
Fix label in banner
jacobtylerwalls May 23, 2024
8601555
Add PATCH methods to speed up editing of large lists
jacobtylerwalls May 24, 2024
cbf86ed
Add shortcut new label entry box in tree
jacobtylerwalls May 24, 2024
cf2bb2e
fixup! Add shortcut new label entry box in tree
jacobtylerwalls May 28, 2024
49cce22
Add highlighting to search results
jacobtylerwalls May 28, 2024
6b6afac
Make enter press save single text fields
jacobtylerwalls May 28, 2024
b45b171
Standardize dropdown styling
jacobtylerwalls May 28, 2024
eb9d05d
Focus input text boxes in tables
jacobtylerwalls May 28, 2024
3f36f4f
Extend auto-focusing to new label entry
jacobtylerwalls May 28, 2024
2970fba
Reduce margin
jacobtylerwalls May 28, 2024
c0c0710
Improve signposting for moving item
jacobtylerwalls May 28, 2024
f221b4f
Merge branch 'controlled-list-item-editor' into 10883_migrate_collect…
johnatawnclementawn May 28, 2024
e4eae4b
Merge branch 'controlled-list-item-editor' into 10848_support_control…
johnatawnclementawn May 28, 2024
4e5280d
Sort by prefLabels in user provided language #10883
johnatawnclementawn May 29, 2024
5e28155
Ignore case during sorting #10883
johnatawnclementawn May 29, 2024
dd3f759
Make english default #10883
johnatawnclementawn May 29, 2024
98adbb8
fixup! Improve signposting
jacobtylerwalls May 29, 2024
f652b36
nit #10883
johnatawnclementawn May 29, 2024
5f86c08
Default sorting by first language in languages table #10883
johnatawnclementawn May 29, 2024
69fc9ea
Reorganize TreeRow buttons
jacobtylerwalls May 29, 2024
c8b3d0b
Make TreeRow buttons raised
jacobtylerwalls May 29, 2024
41dde2a
Add shortcut name entry for new list also
jacobtylerwalls May 29, 2024
36505a2
Move default list name to model
jacobtylerwalls May 29, 2024
99f3a08
nit #10883
johnatawnclementawn May 29, 2024
ff55f49
Stub out cli interface for migrating collections to controlled lists …
johnatawnclementawn May 29, 2024
df3821a
fixup! Move default list name
jacobtylerwalls May 29, 2024
9937005
Add tooltips to tree row buttons
jacobtylerwalls May 29, 2024
19bf861
fixup! Add shortcut name entry for new list also
jacobtylerwalls May 30, 2024
6480606
Fix highlighting when deleting entire search value
jacobtylerwalls May 30, 2024
528eabd
Trim spaces
jacobtylerwalls May 30, 2024
c40992f
fixup! Save notes
jacobtylerwalls Jun 3, 2024
6a03157
Implement guide items
jacobtylerwalls Jun 3, 2024
b0e7180
Use Textarea for note entries
jacobtylerwalls Jun 3, 2024
ce8b65e
Annotate languages with codes
jacobtylerwalls Jun 3, 2024
6ab902e
Factor out <MoveRow>
jacobtylerwalls Jun 3, 2024
93aeb5a
Fix selection collapse bug
jacobtylerwalls Jun 3, 2024
ccea2cc
Improve multi-delete
jacobtylerwalls Jun 3, 2024
b02270b
fixup! Annotate language with codes
jacobtylerwalls Jun 3, 2024
6af3e49
"expand all" & "collapse all"
jacobtylerwalls Jun 3, 2024
92994cc
Add "Show labels in:" label
jacobtylerwalls Jun 3, 2024
360eb41
Expand paths to search results
jacobtylerwalls Jun 4, 2024
3bd6edb
Hoist translations out of <MoveRow>
jacobtylerwalls Jun 4, 2024
9c10b3d
Remove whitespace from $gettext interpolation
jacobtylerwalls Jun 4, 2024
8044256
Polish font sizes, spacing
jacobtylerwalls Jun 4, 2024
bac06e8
Add missing column headers
jacobtylerwalls Jun 4, 2024
f98bf81
Make views/api a package
jacobtylerwalls Jun 4, 2024
fb740ae
Make serializers model methods
jacobtylerwalls Jun 4, 2024
ce0e85c
fixup! Add PATCH methods
jacobtylerwalls Jun 4, 2024
0470d15
fixup! Add missing column headers
jacobtylerwalls Jun 4, 2024
1b05c62
fixup! Polish font sizes
jacobtylerwalls Jun 4, 2024
d930606
Make filter lookups (searches) lazy
jacobtylerwalls Jun 4, 2024
6d6fbd2
Merge branch 'dev/8.0.x' into controlled-list-item-editor
jacobtylerwalls Jun 4, 2024
79f6e94
fixup! Make filter lookups (searches) lazy
jacobtylerwalls Jun 4, 2024
0552f70
Retain focus on search input when deleting
jacobtylerwalls Jun 5, 2024
a21cb6b
Stub out clm package tests #10848
johnatawnclementawn Jun 5, 2024
124c3f0
fixup! Expand path to search results
jacobtylerwalls Jun 5, 2024
467ec48
fixup! Improve multi-delete
jacobtylerwalls Jun 5, 2024
a58f24d
fixup! Expand path to search results
jacobtylerwalls Jun 5, 2024
c286907
Factor out getToken(), prefer positive if
jacobtylerwalls Jun 6, 2024
3634099
Simplify error message parsing, use toast details
jacobtylerwalls Jun 6, 2024
c91fb37
Continue measuring coverage on existing API
jacobtylerwalls Jun 6, 2024
5b46b68
Merge branch 'controlled-list-item-editor' into 10848_support_control…
johnatawnclementawn Jun 10, 2024
a201ff1
Merge branch 'controlled-list-item-editor' into 10883_migrate_collect…
johnatawnclementawn Jun 10, 2024
9c2a4fb
Handle collections not in db before pg func is called #10883
johnatawnclementawn Jun 10, 2024
cb34e46
Format output text nicely #10883
johnatawnclementawn Jun 10, 2024
db2b710
Avoid callback names like "on..."
jacobtylerwalls Jun 10, 2024
1517cd9
Remove double cast
jacobtylerwalls Jun 10, 2024
7478373
Define consts for 1000
jacobtylerwalls Jun 10, 2024
b1b01ea
Naming nits
jacobtylerwalls Jun 10, 2024
bc19e9e
Fallback to another title if none in active lang
jacobtylerwalls Jun 10, 2024
296a002
Use error from file upload event
jacobtylerwalls Jun 10, 2024
d0b0d78
Define toast life constant
jacobtylerwalls Jun 10, 2024
e67d808
Move deletion to api.ts
jacobtylerwalls Jun 10, 2024
026fd41
Avoid direct HTML manipulation
jacobtylerwalls Jun 10, 2024
496880e
Improve utils names
jacobtylerwalls Jun 10, 2024
87cb538
Adjust import order
jacobtylerwalls Jun 10, 2024
5de1f21
Move fetchLists() to api.ts
jacobtylerwalls Jun 10, 2024
3447e79
Avoid 1000 constant
jacobtylerwalls Jun 10, 2024
fbefa91
fixup! Move fetchLists() to api.ts
jacobtylerwalls Jun 11, 2024
f96a22c
Allow for controlled list overwrite #10883
johnatawnclementawn Jun 11, 2024
b35623b
Allow overwrite of collection from CLI #10883
johnatawnclementawn Jun 11, 2024
9b5408d
nit #10883
johnatawnclementawn Jun 11, 2024
99d9795
Merge branch 'controlled-list-item-editor' into 10848_support_control…
johnatawnclementawn Jun 11, 2024
91de3ce
Cover PATCH methods
jacobtylerwalls Jun 11, 2024
413c57c
Assert against HTTPStatus enum
jacobtylerwalls Jun 11, 2024
3ac7b4c
Remove empty JSONErrorResponse
jacobtylerwalls Jun 11, 2024
8b7808d
Warn if language code is not present in this arches instance #10848
johnatawnclementawn Jun 11, 2024
b4e16e5
Merge branch 'controlled-list-item-editor' into 10883_migrate_collect…
johnatawnclementawn Jun 11, 2024
1302c2a
fixup! Move deletion
jacobtylerwalls Jun 11, 2024
df10979
fixup! Move fetchLists
jacobtylerwalls Jun 11, 2024
c6f8cd8
fixup! Avoid 1000 constant
jacobtylerwalls Jun 11, 2024
e9907e1
fixup! Assert against HTTPStatus enum
jacobtylerwalls Jun 11, 2024
2c6d296
fixup! Avoid callback names like
jacobtylerwalls Jun 11, 2024
6cef57b
Don't swallow deletion errors during multi-delete
jacobtylerwalls Jun 11, 2024
ac900e3
Improve duck-typing
jacobtylerwalls Jun 11, 2024
0ba0217
Introduce one level of subdirectories
jacobtylerwalls Jun 11, 2024
e237727
Copy over two more old css classes
jacobtylerwalls Jun 11, 2024
a383a34
Prefer rem unless purely graphic (e.g. border-radius)
jacobtylerwalls Jun 11, 2024
8854fb9
Reduce size of editor columns
jacobtylerwalls Jun 11, 2024
3244e38
fixup! Improve duck-typing
jacobtylerwalls Jun 11, 2024
b06a75b
Decompose <ListTreeControls>
jacobtylerwalls Jun 11, 2024
012ce76
Simplify client state
jacobtylerwalls Jun 11, 2024
1ecd939
Merge branch 'dev/8.0.x' into controlled-list-item-editor
jacobtylerwalls Jun 12, 2024
0a4e7a5
[controlled-lists] Format frontend
jacobtylerwalls Jun 12, 2024
1d7d411
[controlled-lists] Format backend
jacobtylerwalls Jun 12, 2024
3cfcba8
Add formatting hashes to ignore revs
jacobtylerwalls Jun 12, 2024
4ddccb1
Move bulk sortorder util out of view
jacobtylerwalls Jun 12, 2024
ed283a2
Merge branch 'controlled-list-item-editor' into 10883_migrate_collect…
johnatawnclementawn Jun 12, 2024
fa50e46
Merge branch 'controlled-list-item-editor' into 10848_support_control…
johnatawnclementawn Jun 12, 2024
1f71456
Move deletion validation to models
jacobtylerwalls Jun 12, 2024
5bb543b
Concat errors with newlines, not spaces
jacobtylerwalls Jun 12, 2024
779a4fd
Remove unused postList
jacobtylerwalls Jun 12, 2024
b6ecd95
Move postItem to api.ts
jacobtylerwalls Jun 12, 2024
cb36cc4
Add progress spinner for move operations
jacobtylerwalls Jun 12, 2024
1890e50
Reject recursive structures in list item PATCH method too
jacobtylerwalls Jun 12, 2024
a8e450d
Dynamic URI generation from user provided host + blackens #10883
johnatawnclementawn Jun 12, 2024
1f3bd47
Move tests into one py file #10848
johnatawnclementawn Jun 12, 2024
439216c
formatting fixes #10848
johnatawnclementawn Jun 12, 2024
2ec831b
Improve validation of new list names
jacobtylerwalls Jun 12, 2024
249ae8a
fixup! Move deletion validation
jacobtylerwalls Jun 12, 2024
9334930
Move nodegroup filtering closer to serialization
jacobtylerwalls Jun 12, 2024
7188db5
Add test data for CLM CLI tests #10883
johnatawnclementawn Jun 13, 2024
7af4440
Revert "Add test data for CLM CLI tests #10883"
johnatawnclementawn Jun 13, 2024
24871ba
Add test data for CLM CLI tests #10848
johnatawnclementawn Jun 13, 2024
460e01a
nit #10848
johnatawnclementawn Jun 13, 2024
471a22c
Factor out querysets
jacobtylerwalls Jun 13, 2024
adb0daa
Improve move interaction
jacobtylerwalls Jun 13, 2024
2567239
Add coverage
jacobtylerwalls Jun 13, 2024
004f543
Make prefetch_terms helper private
jacobtylerwalls Jun 13, 2024
5ff6b98
fixup! Decompose <ListTreeControls>
jacobtylerwalls Jun 17, 2024
9599a80
Merge branch 'controlled-list-item-editor' into 10848_support_control…
johnatawnclementawn Jun 17, 2024
f134858
Merge branch 'controlled-list-item-editor' into 10883_migrate_collect…
johnatawnclementawn Jun 17, 2024
790dbcb
Fix value/label confusion in reference select widget
jacobtylerwalls Jun 18, 2024
a436449
Add white-space pre-wrap CSS in lengthier cells
jacobtylerwalls Jun 18, 2024
96cb9ec
Refactor fetch pattern
jacobtylerwalls Jun 19, 2024
1315367
Clean up imports
jacobtylerwalls Jun 19, 2024
2842230
fixup! Add PATCH methods
jacobtylerwalls Jun 19, 2024
e7928ac
Remove some multi-line ternaries
jacobtylerwalls Jun 19, 2024
f584e89
Move all managers to querysets.py
jacobtylerwalls Jun 19, 2024
3c0ef0e
Add RDM to CLM migration test #10883
johnatawnclementawn Jun 20, 2024
12ce9df
Removing CLI & tests in favor of further discussion re #11070
johnatawnclementawn Jun 20, 2024
c5ab303
Merge branch 'controlled-list-item-editor' into 10883_migrate_collect…
johnatawnclementawn Jun 20, 2024
a73a264
Merge branch 'controlled-list-item-editor' into 10848_support_control…
johnatawnclementawn Jun 20, 2024
9e9beb1
Only validate Lists/Items/Values created in this run of the ETL #10848
johnatawnclementawn Jun 20, 2024
dfb7ae0
nit #10848
johnatawnclementawn Jun 20, 2024
ae8981c
Merge pull request #10927 from archesproject/10883_migrate_collection…
johnatawnclementawn Jun 25, 2024
aabc4d6
Merge pull request #10882 from archesproject/10848_support_controlled…
johnatawnclementawn Jun 25, 2024
4251152
let -> const
jacobtylerwalls Jun 25, 2024
9896cde
Fix key -> keyup typo
jacobtylerwalls Jun 25, 2024
1e40ec2
Focus additional text input elements
jacobtylerwalls Jun 25, 2024
81ca9d0
Fix typescript issues
jacobtylerwalls Jun 25, 2024
aa8b8d4
Standardize icons
jacobtylerwalls Jun 25, 2024
74c055e
Seed multi-delete state with displayed row
jacobtylerwalls Jun 25, 2024
22a8ab3
Fix clearing initial label entry
jacobtylerwalls Jun 25, 2024
0df502a
Reduce test verbosity
jacobtylerwalls Jun 25, 2024
18696a8
Assign view plugin perm to RDM Administrators
jacobtylerwalls Jun 26, 2024
720dd16
Improve color contrast
jacobtylerwalls Jun 26, 2024
f4eb600
Improve enter key handling for shortcut entries
jacobtylerwalls Jun 26, 2024
5fe1ae0
Add additional aria-labels
jacobtylerwalls Jun 26, 2024
efecc3d
Fix error message priority
jacobtylerwalls Jun 26, 2024
e7c57e4
Remove helper POST methods
jacobtylerwalls Jun 27, 2024
359517a
Simplify handling of item/list parent changes
jacobtylerwalls Jun 27, 2024
53896cc
Temporarily revert to primevue 3.53.0
jacobtylerwalls Jun 27, 2024
60e96de
Create first new labels in selected language
jacobtylerwalls Jun 28, 2024
a78bd6e
Preserve existing list order when deleting
jacobtylerwalls Jun 28, 2024
0c7babc
Remove ill-advised feature to collapse other lists
jacobtylerwalls Jun 28, 2024
d5d7608
Remove cancel button from file upload
jacobtylerwalls Jun 28, 2024
a8bb74f
Restore state of tree expansion when removing search term
jacobtylerwalls Jun 28, 2024
57efe61
Improve focusing of first label entry
jacobtylerwalls Jun 28, 2024
a2f3315
Adjust TreeNode.key type guards as of primevue 3.53.0
jacobtylerwalls Jun 28, 2024
2b2b036
Increase setTimeout value
jacobtylerwalls Jul 2, 2024
6726096
Adjust button colors to contrast with focus
jacobtylerwalls Jul 2, 2024
6955250
Add border to list name and item URI entries
jacobtylerwalls Jul 2, 2024
a136371
Maintain focus on move buttons
jacobtylerwalls Jul 3, 2024
19259b7
Use nodeIsList util
jacobtylerwalls Jul 3, 2024
345f754
Improve typing
jacobtylerwalls Jul 3, 2024
341b5db
Fix hiding of file content div
jacobtylerwalls Jul 3, 2024
4639af6
Extend row focusing pattern to image metadata
jacobtylerwalls Jul 3, 2024
a85f3f3
Shorten try blocks
jacobtylerwalls Jul 5, 2024
8c5ee69
Prefer set difference over filtered set comprehension
jacobtylerwalls Jul 5, 2024
1a30b62
Further simplify views
jacobtylerwalls Jul 5, 2024
5ad25c5
Factor out PUT methods for value/metadata updates
jacobtylerwalls Jul 5, 2024
419d409
Restructure file hierarchy by topic/*.ts and topic/components/*
jacobtylerwalls Jul 5, 2024
fc14e27
Rename arches types file
jacobtylerwalls Jul 5, 2024
ac48661
Move theme.ts and types.ts under src/arches
jacobtylerwalls Jul 8, 2024
fa06249
`@/controlledlists` -> `@/controlled-lists`
jacobtylerwalls Jul 8, 2024
da2b974
Move src/plugins under src/arches
jacobtylerwalls Jul 9, 2024
ea60f9b
Merge branch 'dev/8.0.x' into controlled-list-item-editor
jacobtylerwalls Jul 9, 2024
9fa11b7
Avoid shadowing builtin `id` in view args
jacobtylerwalls Jul 9, 2024
72aa381
Cope with get_nodegroups_by_perm() change
jacobtylerwalls Jul 9, 2024
a26e142
Inherit from APIBase
jacobtylerwalls Jul 10, 2024
4f25c97
Fix file upload show/hide logic
jacobtylerwalls Jul 11, 2024
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
1 change: 0 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ omit =
*/urls.py
*/wsgi.py
*/celery.py
*/__init__.py

data_file = coverage/python/.coverage

Expand Down
6 changes: 5 additions & 1 deletion .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
eea27d316c5ff975556e15ccd4c11d7c393dd95c
8de09526329685ee4d80c816c3475a66b19d46e9
e3d8197d5a7d1f03ed125fe2f47d4fbef0913404
9740c846eda0cc067f49d7abffdcb1a93fe3e0a9
eff6710e8b44faef5a628b0ea1373cd99cb47e9e
# Reformatting of 7.6 features under dev (2024)
9740c846eda0cc067f49d7abffdcb1a93fe3e0a9
# Reformatting of 8.0 features under dev (2024)
0a4e7a54dc9795756208a5356bd92a3a11d467f2
1d7d411aba53e32f6be2e998c8b9b22bba72e56f
# Relevant subset of git log --grep black
9b7e30d4499cb02dec6d17c7c99f9a7087fcdd47
b959f1139a1d789e6c116d43d8be7daa0baa6075
Expand Down
8 changes: 8 additions & 0 deletions arches/app/datatypes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,3 +517,11 @@ 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: 121 additions & 1 deletion 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 conifg: {1}".format(
"No domain option found for option id {0}, in node config: {1}".format(
option_id, node.config["options"]
)
)
Expand Down Expand Up @@ -3272,3 +3272,123 @@ 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:
chrabyrd marked this conversation as resolved.
Show resolved Hide resolved
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):
chrabyrd marked this conversation as resolved.
Show resolved Hide resolved
raise GraphValidationError(
_("A reference datatype node requires a controlled list")
)
17 changes: 2 additions & 15 deletions arches/app/media/js/utils/create-vue-application.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,12 @@ 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';

const DEFAULT_THEME = {
theme: {
preset: Aura,
options: {
prefix: 'p',
darkModeSelector: 'system',
cssLayer: false
}
}
};

export default async function createVueApplication(vueComponent, themeConfiguration) {
export default async function createVueApplication(vueComponent) {
/**
* 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 @@ -53,7 +40,7 @@ export default async function createVueApplication(vueComponent, themeConfigurat

const app = createApp(vueComponent);

app.use(PrimeVue, themeConfiguration || DEFAULT_THEME);
app.use(PrimeVue);
app.use(gettext);
app.use(ConfirmationService);
app.use(DialogService);
Expand Down
167 changes: 167 additions & 0 deletions arches/app/media/js/viewmodels/reference-select.js
jacobtylerwalls marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
define([
'jquery',
'knockout',
'knockout-mapping',
'arches',
'viewmodels/widget',
], function($, ko, koMapping, arches, WidgetViewModel) {
var NAME_LOOKUP = {};
var ReferenceSelectViewModel = function(params) {
var self = this;

params.configKeys = ['placeholder'];
this.multiple = !!ko.unwrap(params.node.config.multiValue);
this.displayName = ko.observable('');
this.selectionValue = ko.observable([]); // formatted version of this.value that select2 can use
this.activeLanguage = arches.activeLanguage;

WidgetViewModel.apply(this, [params]);

this.getPrefLabel = function(labels){
return koMapping.toJS(labels)?.find(
label => label.language_id === arches.activeLanguage && label.valuetype_id === 'prefLabel'
)?.value || arches.translations.unlabeledItem;
};

this.isLabel = function (value) {
return ['prefLabel', 'altLabel'].includes(value.valuetype_id);
};

this.displayValue = ko.computed(function() {
const val = self.value();
let name = null;
if (val) {
name = val.map(item => self.getPrefLabel(item.labels)).join(", ");
}
return name;
});

this.valueAndSelectionDiffer = function(value, selection) {
if (!(ko.unwrap(value) instanceof Array)) {
return true;
}
const valueUris = ko.unwrap(value).map(val=>ko.unwrap(val.uri));
return JSON.stringify(selection) !== JSON.stringify(valueUris);
};

this.selectionValue.subscribe(selection => {
if (selection) {
if (!(selection instanceof Array)) { selection = [selection]; }
if (self.valueAndSelectionDiffer(self.value, selection)) {
const newItem = selection.map(uri => {
return {
"labels": NAME_LOOKUP[uri].labels,
"listid": NAME_LOOKUP[uri]["listid"],
"uri": uri
};
});
self.value(newItem);
}
} else {
self.value(null);
}
});

this.value.subscribe(val => {
if (val?.length) {
self.selectionValue(val.map(item=>ko.unwrap(item.uri)));
} else {
self.selectionValue(null);
}
});

this.select2Config = {
value: self.selectionValue,
clickBubble: true,
multiple: this.multiple,
closeOnSelect: true,
placeholder: self.placeholder,
allowClear: true,
ajax: {
url: arches.urls.controlled_list(ko.unwrap(params.node.config.controlledList)),
dataType: 'json',
quietMillis: 250,
data: function(requestParams) {

return {
flat: true
};
},
processResults: function(data) {
const items = data.items;
items.forEach(item => {
item["listid"] = item.id;
item.id = item.uri;
item.disabled = item.guide;
item.labels = item.values.filter(val => self.isLabel(val));
});
return {
"results": items,
"pagination": {
"more": false
}
};
}
},
templateResult: function(item) {
let indentation = '';
for (let i = 0; i < item.depth; i++) {
indentation += '&nbsp;&nbsp;&nbsp;&nbsp;';
}

if (item.uri) {
const text = self.getPrefLabel(item.labels) || arches.translations.searching + '...';
NAME_LOOKUP[item.uri] = {"prefLabel": text, "labels": item.labels, "listid": item.controlled_list_id};
return indentation + text;
}
},
templateSelection: function(item) {
if (!item.uri) { // option has a different shape when coming from initSelection vs templateResult
return item.text;
} else {
return NAME_LOOKUP[item.uri]["prefLabel"];
}
},
escapeMarkup: function(markup) { return markup; },
initComplete: false,
initSelection: function(el, callback) {

const setSelectionData = function(data) {
const valueData = koMapping.toJS(self.value());
valueData.forEach(function(value) {
NAME_LOOKUP[value.uri] = {
"prefLabel": self.getPrefLabel(value.labels),
"labels": value.labels,
"listid": value.listid
};
});

if(!self.select2Config.initComplete){
valueData.forEach(function(data) {
const option = new Option(
self.getPrefLabel(data.labels),
data.uri,
true,
true
);
$(el).append(option);
self.selectionValue().push(data.uri);
});
self.select2Config.initComplete = true;
}
callback(valueData);
};

if (self.value()?.length) {
setSelectionData();
} else {
callback([]);
}

}
};

};

return ReferenceSelectViewModel;
});
Loading
Loading