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

Added a display/visible value to the annotation schema #1299

Merged
merged 1 commit into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Features
- Added a noCache option to opening tile sources ([#1296](../../pull/1296))
- Added a display/visible value to the annotation schema ([#1299](../../pull/1299))

### Changes
- Changed the cdn used for the SlideAtlas viewer ([#1297](../../pull/1297))
Expand Down
7 changes: 7 additions & 0 deletions girder_annotation/docs/annotations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ the comments are not part of a valid annotation:
{
"name": "MyAnnotationName", # Non-empty string. Optional
"description": "This is a description", # String. Optional
"display": { # Object. Optional
"visible": "new", # String or boolean. Optional.
# If "new", display this annotation when it first is added
# to the system. If false, don't display the annotation by
# default. If true, display the annotation when the item
# is loaded.
},
"attributes": { # Object. Optional
"key1": "value1",
"key2": ["any", {"value": "can"}, "go", "here"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,21 @@ class AnnotationSchema:
'minLength': 1,
},
'description': {'type': 'string'},
'display': {
'type': 'object',
'properties': {
'visible': {
'type': ['boolean', 'string'],
'enum': ['new', True, False],
'description': 'This advises viewers on when the '
'annotation should be shown. If "new" (the default), '
'show the annotation when it is first added to the '
"system. If false, don't show the annotation by "
'default. If true, show the annotation when the item '
'is displayed.',
},
},
},
'attributes': {
'type': 'object',
'additionalProperties': True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ def find(self, params):
query['annotation.name'] = params['name']
fields = list(
(
'annotation.name', 'annotation.description', 'annotation.attributes',
'annotation.name', 'annotation.description',
'annotation.attributes', 'annotation.display',
'access', 'groups', '_version',
) + Annotation().baseFields)
return Annotation().findWithPermissions(
Expand Down
Loading