From 8b4d6a971699bc35c03fea2d449ff599a0c0733f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Pereira?= Date: Thu, 8 Oct 2020 11:11:42 -0300 Subject: [PATCH] Added match button action --- src/App.vue | 15 ++++++-- src/components/List.vue | 69 ++++++++++++++++++++++++++++++++---- src/components/OtuWidget.vue | 39 ++++++++++++++------ 3 files changed, 102 insertions(+), 21 deletions(-) diff --git a/src/App.vue b/src/App.vue index f1a1a00..af36b9b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,8 +1,11 @@ @@ -20,7 +23,13 @@ export default { data () { return { otuList: OtuList, - taxonList: taxonNames + taxonList: taxonNames, + matchedList: [] + } + }, + methods: { + setMatches (list) { + this.matchedList = list } } } diff --git a/src/components/List.vue b/src/components/List.vue index f4b76c9..1f09e80 100644 --- a/src/components/List.vue +++ b/src/components/List.vue @@ -1,16 +1,16 @@ @@ -23,13 +26,21 @@ export default { MappingView }, props: { - otuList: { + nameList: { type: Array, default: () => [] }, - taxonList: { + possibleMatchesList: { type: Array, default: () => [] + }, + columnName: { + type: String, + required: true + }, + columnMatch: { + type: String, + required: true } }, data () { @@ -37,14 +48,15 @@ export default { mappers: [], mappingOptions: [], temporaryNameList: [], - mappedTaxon: [], - selectedOtus: [] + mappedList: [], + selectedOtus: [], + matchedNames: [] } }, watch: { mappingOptions: { handler (newVal) { - this.temporaryNameList = this.otuList.map(otu => this.getTemporaryName(otu.name)) + this.temporaryNameList = this.nameList.map(otu => this.getTemporaryName(otu.name)) }, deep: true } @@ -61,8 +73,13 @@ export default { }) return name.trim() }, - mappingTaxon () { - this.mappedTaxon = this.temporaryNameList.map(name => this.taxonList.filter(taxon => taxon.name === name)) + mappingList () { + this.mappedList = this.temporaryNameList.map(name => this.possibleMatchesList.filter(taxon => taxon.name === name)) + }, + addMatched (event) { + this.matchedNames.push(event.mapped) + this.nameList.splice(event.index, 1) + this.mappedList.splice(event.index, 1) } } }