diff --git a/CHANGELOG.md b/CHANGELOG.md index ae787834d..d89b03782 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) diff --git a/girder_annotation/docs/annotations.rst b/girder_annotation/docs/annotations.rst index 3376af761..55e200d9f 100644 --- a/girder_annotation/docs/annotations.rst +++ b/girder_annotation/docs/annotations.rst @@ -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"] diff --git a/girder_annotation/girder_large_image_annotation/models/annotation.py b/girder_annotation/girder_large_image_annotation/models/annotation.py index 178178404..6b37ee5fb 100644 --- a/girder_annotation/girder_large_image_annotation/models/annotation.py +++ b/girder_annotation/girder_large_image_annotation/models/annotation.py @@ -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, diff --git a/girder_annotation/girder_large_image_annotation/rest/annotation.py b/girder_annotation/girder_large_image_annotation/rest/annotation.py index c47abcb26..c8bdcdc70 100644 --- a/girder_annotation/girder_large_image_annotation/rest/annotation.py +++ b/girder_annotation/girder_large_image_annotation/rest/annotation.py @@ -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(