From b9bd8eb0a93c0138bf064f1cde0a84f37d332861 Mon Sep 17 00:00:00 2001 From: orlinmalkja Date: Wed, 6 Nov 2024 16:53:25 +0100 Subject: [PATCH 1/2] fix: update the variants list according to witnesses selection when disabling single select mode --- .../annotations/variants/VariantsTopBar.vue | 9 ++++-- src/stores/annotations.ts | 30 ++++++++++++++++--- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/components/annotations/variants/VariantsTopBar.vue b/src/components/annotations/variants/VariantsTopBar.vue index 0d9e888f..d3d4668b 100644 --- a/src/components/annotations/variants/VariantsTopBar.vue +++ b/src/components/annotations/variants/VariantsTopBar.vue @@ -11,15 +11,16 @@ import BaseCheckbox from "@/components/base/BaseCheckbox.vue"; const annotationsStore = useAnnotationsStore() const witnesses = computed(() => annotationsStore.witnesses) -const amountActiveWitnesses = computed(() => Object.keys(activeWitnessesIds).filter(key => !!(activeWitnessesIds[key])).length) -const activeWitnessesIds = reactive({}) +const amountActiveWitnesses = computed(() => Object.keys(annotationsStore.activeWitnessesIds).filter(key => !!(annotationsStore.activeWitnessesIds[key])).length) const witnessesDetailsDialogOpen = ref(false); const showWitnessesDropdown = ref(false); const variantsDetailsDialogOpen = ref(false); watch(witnesses, (value) => { + let activeWitnessesIds = annotationsStore.activeWitnessesIds if(value?.length > 0) { value.forEach(witness => activeWitnessesIds[witness.idno] = true); + annotationsStore.setActiveWitnessesIds(activeWitnessesIds) } }, { immediate: true } @@ -28,8 +29,10 @@ function getWitnessColor(witness: string) { return annotationsStore.variantItemsColors[witness]; } function toggleWitness(witness: Witness, isActive: boolean) { + let activeWitnessesIds = annotationsStore.activeWitnessesIds activeWitnessesIds[witness.idno] = isActive annotationsStore.filterAnnotationsByWitnesses(Object.keys(activeWitnessesIds).filter(key => !!(activeWitnessesIds[key]))) + annotationsStore.setActiveWitnessesIds(activeWitnessesIds) } @@ -53,7 +56,7 @@ function toggleWitness(witness: Witness, isActive: boolean) { >