Skip to content

Commit

Permalink
interim multi-add commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tomolopolis committed Dec 19, 2023
1 parent 1f90f91 commit 71dd82f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
6 changes: 2 additions & 4 deletions webapp/frontend/src/components/anns/AddAnnotation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export default {
}
this.$http.post('/api/add-annotation/', payload).then(resp => {
this.$emit('request:addAnnotationComplete', resp.data.id)
this.$emit('request:addAnnotationsComplete', [resp.data.id])
this.selectedCUI = null
})
},
Expand All @@ -177,9 +177,7 @@ export default {
}
this.$http.post('/api/add-annotations/', payload).then(resp => {
for (const i of resp.data.ids) {
this.$emit('request:addAnnotationComplete', i)
}
this.$emit('request:addAnnotationsComplete', resp.data.ids)
this.selectedCUI = null
})
},
Expand Down
22 changes: 12 additions & 10 deletions webapp/frontend/src/views/TrainAnnotations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
<transition name="slide-left">
<add-annotation v-if="conceptSynonymSelection" :selection="conceptSynonymSelection"
:project="project" :documentId="currentDoc.id" :searchFilterDBIndex="searchFilterDBIndex"
@request:addAnnotationComplete="addAnnotationComplete" class="add-annotation"></add-annotation>
@request:addAnnotationsComplete="addAnnotationsComplete" class="add-annotation"></add-annotation>
</transition>
</div>
</div>
Expand Down Expand Up @@ -608,16 +608,18 @@ export default {
this.markCorrect()
}
},
addAnnotationComplete (addedAnnotationId) {
addAnnotationsComplete (addedAnnotationIds) {
this.conceptSynonymSelection = null
if (addedAnnotationId) {
this.$http.get(`/api/annotated-entities/${addedAnnotationId}/`).then(resp => {
let newEnt = resp.data
newEnt.assignedValues = {}
newEnt.assignedValues[TASK_NAME] = CONCEPT_CORRECT
this.ents = null
this.currentEnt = null
this.fetchEntities(newEnt.id)
if (addedAnnotationIds.length > 0) {
Promise.all(addedAnnotationIds.map(annoId => this.$http.get(
`/api/annotated-entities/${annoId}/`))).then(resps => {
// use last resp data
let newEnt = resps.slice(-1).data
newEnt.assignedValues = {}
newEnt.assignedValues[TASK_NAME] = CONCEPT_CORRECT
this.ents = null
this.currentEnt = null
this.fetchEntities(newEnt.id)
})
}
},
Expand Down

0 comments on commit 71dd82f

Please sign in to comment.