aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/components/LdTagInput.vue
diff options
context:
space:
mode:
Diffstat (limited to 'viewer/src/components/LdTagInput.vue')
-rw-r--r--viewer/src/components/LdTagInput.vue9
1 files changed, 8 insertions, 1 deletions
diff --git a/viewer/src/components/LdTagInput.vue b/viewer/src/components/LdTagInput.vue
index b1b9e3e..6b6e749 100644
--- a/viewer/src/components/LdTagInput.vue
+++ b/viewer/src/components/LdTagInput.vue
@@ -57,10 +57,17 @@ export default class LdTagInput extends Vue {
57 return `${option.display} (${option.items.length})`; 57 return `${option.display} (${option.items.length})`;
58 } 58 }
59 59
60 filterAlreadyPresent(newSearch: Tag.Search) {
61 return !this.model.find(
62 currentSearch =>
63 currentSearch.tag === newSearch.tag && (!currentSearch.parent || currentSearch.parent === newSearch.parent)
64 );
65 }
66
60 searchTags(filter: string) { 67 searchTags(filter: string) {
61 this.currentFilter = filter; 68 this.currentFilter = filter;
62 this.filteredTags = IndexFactory.searchTags(this.tagsIndex, filter, false) 69 this.filteredTags = IndexFactory.searchTags(this.tagsIndex, filter, false)
63 .filter(newSearch => !this.model.find(currentSearch => currentSearch.tag === newSearch.tag)) 70 .filter(this.filterAlreadyPresent)
64 .sort((a, b) => b.items.length - a.items.length); 71 .sort((a, b) => b.items.length - a.items.length);
65 } 72 }
66 73