Skip to content

Commit

Permalink
improve annotations update logic
Browse files Browse the repository at this point in the history
  • Loading branch information
emiliorighi committed Oct 15, 2024
1 parent 4f0912c commit b218e9d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<!-- Upload Mode: Files -->
<div class="row" v-else>
<div v-if="isLocal" class="flex lg12 md12 sm12 xs12">
<div v-if="name" class="flex lg12 md12 sm12 xs12">
<p>
Update of uploaded files is not supported. If you need to change the file, it is necessary to delete
this
Expand Down Expand Up @@ -142,7 +142,7 @@ async function handleSubmit() {
: await AuthService.createAnnotation(requestData)
init({ message: `${data} saved successfully!`, color: 'success' })
router.push({ name: 'cms-assemblies' })
router.push({ name: 'cms-annotations' })
} catch (error) {
handleError(error)
} finally {
Expand Down
16 changes: 14 additions & 2 deletions server/rest/annotation/annotations_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,21 @@ def get_annotation(name):

def update_annotation(name, data):
ann_obj = get_annotation(name)
ann_obj.update(**data)
valid_data = extract_metadata(data)
ann_obj.update(**valid_data)
return name

def stream_annotation(filename):
mime_type = 'binary/octet-stream'
return send_from_directory(ANNOTATIONS_DATA_PATH, filename, conditional=True, mimetype=mime_type)
return send_from_directory(ANNOTATIONS_DATA_PATH, filename, conditional=True, mimetype=mime_type)

def create_nested_dict(dotted_key, value):
keys = dotted_key.split('.')
nested_dict = current = {}

for key in keys[:-1]:
current[key] = {}
current = current[key]

current[keys[-1]] = value
return nested_dict

0 comments on commit b218e9d

Please sign in to comment.