From 7c80933840f338d1a333b9696c5e14f4f119534f Mon Sep 17 00:00:00 2001 From: Hironsan Date: Wed, 1 Dec 2021 10:19:25 +0900 Subject: [PATCH] Enable to list all labels --- .../tasks/sequenceLabeling/EntityEditor.vue | 49 +++++++++++++++++-- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/frontend/components/tasks/sequenceLabeling/EntityEditor.vue b/frontend/components/tasks/sequenceLabeling/EntityEditor.vue index 5eb1be43..321704ed 100644 --- a/frontend/components/tasks/sequenceLabeling/EntityEditor.vue +++ b/frontend/components/tasks/sequenceLabeling/EntityEditor.vue @@ -29,6 +29,34 @@ max-height="400" class="overflow-y-auto" > + + + + + label.suffixKey !== null) + }, + currentLabel(): any { + if (this.entity) { + const label = this.entityLabels.find((label: any) => label.id === this.entity!.label) + return label + } else { + return null + } } }, @@ -134,7 +171,7 @@ export default Vue.extend({ }, setEntity(entityId: number) { - this.entityId = entityId + this.entity = this.entities.find((entity: any) => entity.id === entityId) }, showEntityLabelMenu(e: any) { @@ -158,7 +195,7 @@ export default Vue.extend({ }, addOrUpdateEntity(labelId: number) { - if (this.entityId !== -1) { + if (this.entity) { this.updateEntity(labelId) } else { this.addEntity(labelId) @@ -166,7 +203,7 @@ export default Vue.extend({ this.showMenu = false this.startOffset = 0 this.endOffset = 0 - this.entityId = -1 + this.entity = null }, addEntity(labelId: number) { @@ -174,11 +211,13 @@ export default Vue.extend({ }, updateEntity(labelId: number) { - this.$emit('click:entity', this.entityId, labelId) + this.$emit('click:entity', this.entity!.id, labelId) }, deleteEntity(entity: any) { this.$emit('contextmenu:entity', entity.id) + this.entity = null + this.showMenu = false }, updateRelation() {