diff options
| author | Terry Truong <terry06890@gmail.com> | 2022-04-25 01:33:08 +1000 |
|---|---|---|
| committer | Terry Truong <terry06890@gmail.com> | 2022-04-25 01:33:08 +1000 |
| commit | 2ab48497797441164e7f57fca2660097d93398ca (patch) | |
| tree | a6f22d3edff60d182de454359bc40beda82fb5d8 /src/components/SearchModal.vue | |
| parent | 23436a9ad4c2a710c7f0d49a07a720e0153d8225 (diff) | |
Adapt to handle open-tree-of-life data
Added data_otol/ with script that converts data from 'Open Tree of Life' release 13.4 into a JSON form.
Moved old tree-of-life data and images into data_tol_old/.
Added TolMap type to tol.ts, changed TolNode, and adapted other code to handle it.
Temporarily disabling tile images until image data is added.
Diffstat (limited to 'src/components/SearchModal.vue')
| -rw-r--r-- | src/components/SearchModal.vue | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/components/SearchModal.vue b/src/components/SearchModal.vue index 91f06ae..22b6896 100644 --- a/src/components/SearchModal.vue +++ b/src/components/SearchModal.vue @@ -1,15 +1,13 @@ <script lang="ts"> import {defineComponent, PropType} from 'vue'; import SearchIcon from './icon/SearchIcon.vue'; -import {TolNode} from '../tol'; import {LayoutNode} from '../layout'; +import type {TolMap} from '../tol'; // Displays a search box, and sends search requests export default defineComponent({ props: { - // Map from tree-of-life node names to TolNode objects - tolMap: {type: Object as PropType<Map<string,TolNode>>, required: true}, - // Options + tolMap: {type: Object as PropType<TolMap>, required: true}, uiOpts: {type: Object, required: true}, }, methods: { @@ -20,15 +18,14 @@ export default defineComponent({ }, onSearchEnter(){ let input = this.$refs.searchInput as HTMLInputElement; - let tolNode = this.tolMap.get(input.value); - if (tolNode == null){ + if (this.tolMap.hasOwnProperty(input.value)){ + this.$emit('search-node', input.value); + } else { input.value = ''; // Trigger failure animation input.classList.remove('animate-red-then-fade'); input.offsetWidth; // Triggers reflow input.classList.add('animate-red-then-fade'); - } else { - this.$emit('search-node', tolNode); } }, focusInput(){ |
