Browse Source

agganciata anche la cancellazione

rimossa la modifica del tipo di relazione
pull/1384/head
mauro 3 years ago
parent
commit
23c32e7403
3 changed files with 6 additions and 78 deletions
  1. 50
      frontend/components/tasks/sequenceLabeling/EntityItem.vue
  2. 6
      frontend/components/tasks/sequenceLabeling/EntityItemBox.vue
  3. 28
      frontend/pages/projects/_id/sequence-labeling/index.vue

50
frontend/components/tasks/sequenceLabeling/EntityItem.vue

@ -71,12 +71,6 @@
<v-list-item-subtitle v-text="link.targetLabel"></v-list-item-subtitle>
</v-list-item-content>
<v-list-item-action>
<v-btn icon @click.stop="selectLinkAndShowTypes(link)">
<v-icon color="grey lighten-1">mdi-lead-pencil</v-icon>
</v-btn>
</v-list-item-action>
<v-list-item-action>
<v-btn icon @click.stop="deleteLink(link, i)">
<v-icon color="grey lighten-1">mdi-delete</v-icon>
@ -123,43 +117,6 @@
</v-list>
</v-menu>
<v-menu
v-else-if="label && activeMenu==='change-link'"
v-model="showChangeLinkMenu"
offset-y
>
<template v-slot:activator="{ on }">
<span :id="'spn-' + spanid" :style="{ borderColor: color }" class="highlight bottom" v-on="on">
<span class="highlight__content">{{ content }}<v-icon class="delete" @click.stop="remove">mdi-close-circle</v-icon><span
class="active-link-source" @click.stop="abortNewLink"></span></span><span
:data-label="label" :style="{ backgroundColor: color, color: textColor }" class="highlight__label"/>
</span>
</template>
<v-list
dense
min-width="150"
max-height="400"
class="overflow-y-auto"
>
<v-list-item>
<v-list-item-content>
<v-list-item-title>change relation type:</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-list-item
v-for="(type, i) in linkTypes"
:key="i"
@click="changeLinkType(type)"
>
<v-list-item-action>
<v-list-item-action-text v-text="type.name"/>
</v-list-item-action>
</v-list-item>
</v-list>
</v-menu>
<span v-else :class="[newline ? 'newline' : '']">{{ content }}</span>
</template>
@ -259,13 +216,6 @@ export default {
this.showNewLinkMenu = true;
},
selectLinkAndShowTypes(link) {
this.closeAllMenus();
this.activeMenu = 'change-link';
this.showChangeLinkMenu = true;
this.$emit('selectLink', link);
},
deleteLink(link, i) {
this.$emit('deleteLink', {id: link.id, ndx: i});
},

6
frontend/components/tasks/sequenceLabeling/EntityItemBox.vue

@ -17,7 +17,6 @@
@update="updateEntity($event.id, chunk.id)"
@selectSource="selectSource(chunk)"
@selectTarget="selectTarget(chunk)"
@selectLink="selectLink($event)"
@deleteLink="deleteLink($event.id, $event.ndx)"
@selectNewLinkType="selectNewLinkType($event)"
@changeLinkType="changeLinkType($event)"
@ -125,11 +124,6 @@ export default {
default: () => ([]),
required: true
},
selectLink: {
type: Function,
default: () => ([]),
required: true
},
deleteLink: {
type: Function,
default: () => ([]),

28
frontend/pages/projects/_id/sequence-labeling/index.vue

@ -32,7 +32,6 @@
:source-link-type="sourceLinkType"
:select-source="selectSource"
:select-target="selectTarget"
:select-link="selectLink"
:delete-link="deleteLink"
:select-new-link-type="selectNewLinkType"
:change-link-type="changeLinkType"
@ -201,32 +200,17 @@ export default {
},
async selectTarget(chunk) {
// skips duplicated links
// to avoid duplicated links:
if (!chunk.links.find(ch => ch.id === this.sourceChunk.id)) {
await this.$services.sequenceLabeling.createLink(this.projectId, this.sourceChunk.id, chunk.id, this.sourceLinkType.id, this.getUserId)
await this.list(this.doc.id)
// this.sourceChunk.links.push({
// id: -1,
// type: this.sourceLinkType.id,
// color: this.sourceLinkType.color,
// targetId: chunk.id,
// targetLabel: chunk.text
// });
await this.$services.sequenceLabeling.createLink(this.projectId, this.sourceChunk.id, chunk.id, this.sourceLinkType.id, this.getUserId);
await this.list(this.doc.id);
}
this.hideAllLinkMenus();
},
selectLink(link) {
this.sourceLink = link;
},
deleteLink(id, ndx) {
// await this.$services.sequenceLabeling.deleteLink(this.projectId, this.sourceChunk.links[ndx].id)
// await this.list(this.doc.id)
this.sourceChunk.links.splice(ndx, 1);
this.sourceLink = NONE;
async deleteLink(id, ndx) {
await this.$services.sequenceLabeling.deleteLink(this.projectId, this.sourceChunk.links[ndx].id)
await this.list(this.doc.id)
this.hideAllLinkMenus();
},

Loading…
Cancel
Save