diff --git a/src/components/MapView.vue b/src/components/MapView.vue index 604d2506f93804fe3d83a6596f11994b9c12a0e9..dc9a43672a0f613f3d1db9f6808e970d07b90743 100644 --- a/src/components/MapView.vue +++ b/src/components/MapView.vue @@ -239,6 +239,11 @@ function recreate(cmEntry: ConceptMappingEntry) { concept.value = cm.concept } +function clearMappings() { + mappings.clearMappings() + console.log('Cleared all mappings') +} + const expanded = ref([0]) </script> @@ -252,6 +257,7 @@ const expanded = ref([0]) <v-expansion-panel title="Created Mappings"> <template v-slot:text> <MappingsTable show-view @showMapping="recreate"></MappingsTable> + <v-btn size="small" @click="clearMappings">Clear All Mappings</v-btn> </template> </v-expansion-panel> </v-expansion-panels> diff --git a/src/services/mappingStore.ts b/src/services/mappingStore.ts index 67a581d17e071393b415058e6199729cb3e04308..3928b219078dbecd3977a86813ec4329aac8b620 100644 --- a/src/services/mappingStore.ts +++ b/src/services/mappingStore.ts @@ -50,9 +50,17 @@ export const useMappingStore = defineStore('mappings', () => { } } - function $reset() { + function clearMappings() { currentMappings.value = [] } - return {currentMappings, saveMapping, saveMappings, removeMapping, downloadMapping, $reset} + return { + currentMappings, + saveMapping, + saveMappings, + removeMapping, + downloadMapping, + clearMappings, + $reset: clearMappings + } }, {persist: {pick: ['currentMappings']}})