diff --git a/components/content/ListSystems.vue b/components/content/ListSystems.vue index 94628e9dbc5ac62c3225894690ce317b5d02b06e..beb7ef1162bd50e3cf0af3bf8c1eafc8fcaa564f 100644 --- a/components/content/ListSystems.vue +++ b/components/content/ListSystems.vue @@ -7,26 +7,34 @@ const props = defineProps<{ const itemsPerParge = ref(25) const search = ref('') const sortBy = ref([{ key: 'system', order: 'asc' }]) -// const headers = ref([{ -// title: "Systems", -// key: "system" -// }, { title: "Articles", key: "doi" } -// ]) +function filterOnlyCapsText(value, query, item) { + if (value != null && query != null) { + if (typeof value === 'string') { + return value.toString().toLowerCase().indexOf(query.toLowerCase()) !== -1 + } + if (typeof value == 'object') { + if (value?.name) { + return value.name.toString().toLowerCase().indexOf(query.toLowerCase()) !== -1 + } + } + } + return false +} </script> <template> <v-card flat color="transparent" class="my-5"> <v-toolbar> <v-toolbar-title>Defense Systems</v-toolbar-title> - <v-text-field v-model="search" density="compact" variant="underlined" append-inner-icon="mdi-magnify" - label="Search" single-line hide-details class="mx-2"></v-text-field> + <v-text-field v-model="search" density="compact" variant="underlined" prepend-inner-icon="mdi-magnify" + label="Search for defense systems" single-line hide-details class="mx-2" clearable></v-text-field> </v-toolbar> - <v-data-table :items-per-page="itemsPerParge" v-model:sort-by="sortBy" :headers="props.headers" :items="props.systems" - :search="search"> + <v-data-table :items-per-page="itemsPerParge" v-model:sort-by="sortBy" :headers="props.headers" + :custom-filter="filterOnlyCapsText" :items="props.systems" :search="search"> <template #[`item.system`]="{ item }"> - <v-chip variant="text" link :to="`/defense-systems/${item.columns.system.toLowerCase()}`">{{ - item.columns.system }}</v-chip> + <v-chip variant="text" link :to="`${item.columns.system.path}`">{{ + item.columns.system.name }}</v-chip> </template> <template #[`item.doi`]="{ item }"> <ArticleDoiList v-if="item.columns?.doi" :items="[item.columns.doi]" :divider="false" /> diff --git a/content/2.defense-systems/abi2.md b/content/2.defense-systems/abi2.md index 7bd6e7b41b76eef226e9377f1d10792a46ecdb8a..b7f40795ec77821552d12ecd1adaf600627313ad 100644 --- a/content/2.defense-systems/abi2.md +++ b/content/2.defense-systems/abi2.md @@ -1,6 +1,6 @@ --- title: Abi2 -tableDescription: +tableColumns: doi: 10.1016/j.mib.2005.06.006 --- diff --git a/content/2.defense-systems/abia.md b/content/2.defense-systems/abia.md index 1c086536cafea19ed76e08b724046d08d3119f0f..bb5ea85175fa0591a5b3a9ec84915fe1bb113b16 100644 --- a/content/2.defense-systems/abia.md +++ b/content/2.defense-systems/abia.md @@ -1,5 +1,7 @@ --- title: AbiA +tableColumns: + doi: 10.1016/j.mib.2005.06.006 --- The AbiA system have been describe in a total of 2 subsystems. diff --git a/content/2.defense-systems/abib.md b/content/2.defense-systems/abib.md index e3bfe66954185a5ed143fc7fc340a3dd29f09cd9..0428f5350d231959de2f73c8d626538f44426bf9 100644 --- a/content/2.defense-systems/abib.md +++ b/content/2.defense-systems/abib.md @@ -1,5 +1,7 @@ --- title: AbiB +tableColumns: + doi: 10.1016/j.mib.2005.06.006 --- The AbiB system is composed of one protein: AbiB. diff --git a/content/2.defense-systems/abic.md b/content/2.defense-systems/abic.md index 1a332dd703fb4349ce52be7e0b2e496de78b7d79..26d4e748ffc0bbf72e64bc8f7e3a8510e9cd4c0d 100644 --- a/content/2.defense-systems/abic.md +++ b/content/2.defense-systems/abic.md @@ -1,5 +1,7 @@ --- title: AbiC +tableColumns: + doi: 10.1016/j.mib.2005.06.006 --- The AbiC system is composed of one protein: AbiC. diff --git a/content/2.defense-systems/abid.md b/content/2.defense-systems/abid.md index d42808628c3b7aea0d4b17d161ac0064b0937bc1..6b1230e0ad38a5de95a887f41a34f7368efa0f8f 100644 --- a/content/2.defense-systems/abid.md +++ b/content/2.defense-systems/abid.md @@ -1,5 +1,7 @@ --- title: AbiD +tableColumns: + doi: 10.1016/j.mib.2005.06.006 --- The AbiD system is composed of one protein: AbiD. diff --git a/content/2.defense-systems/abie.md b/content/2.defense-systems/abie.md index a4e50c276f4a1d7896f6bf4ba9fb54a1f6ffb162..b83cbadb2765f6cc52db0b6d73979019a3f64114 100644 --- a/content/2.defense-systems/abie.md +++ b/content/2.defense-systems/abie.md @@ -1,8 +1,7 @@ --- title: AbiE -tableDescription: - doi: 10.1093/nar/gkt1419 - other: blabla +tableColumns: + doi: 10.1016/j.mib.2005.06.006 --- AbiE is a family of an anti-phage defense systems. They act through a Toxin-Antitoxin mechanism, and are comprised of a pair of genes, with one gene being toxic while the other confers immunity to this toxicity. diff --git a/content/2.defense-systems/abig.md b/content/2.defense-systems/abig.md index 1f46ad07164fcf37eab985ea78bc1d532543f0d5..b21a9877ffff4db9ef015ed6073b418494bba538 100644 --- a/content/2.defense-systems/abig.md +++ b/content/2.defense-systems/abig.md @@ -1,5 +1,7 @@ --- title: AbiG +tableColumns: + doi: 10.1016/j.mib.2005.06.006 --- The AbiG system is composed of 2 proteins: AbiGi and, AbiGii. diff --git a/content/2.defense-systems/abih.md b/content/2.defense-systems/abih.md index d304055220068389440e7c89e3cca6cee7266d71..32d4ddc2264c9d617486af03b0ff6bef7f0cd372 100644 --- a/content/2.defense-systems/abih.md +++ b/content/2.defense-systems/abih.md @@ -1,5 +1,7 @@ --- title: AbiH +tableColumns: + doi: 10.1111/j.1574-6968.1996.tb08446.x --- ## Example of genomic structure diff --git a/content/2.defense-systems/abiv.md b/content/2.defense-systems/abiv.md index a8f2a98514d6922ad53e88fc74bf7d96b9027419..162b5edd31ab24883c5536930240fa00eefded69 100644 --- a/content/2.defense-systems/abiv.md +++ b/content/2.defense-systems/abiv.md @@ -1,5 +1,7 @@ --- title: AbiV +tableColumns: + doi: 10.1128/AEM.00780-08 --- ## Example of genomic structure diff --git a/content/2.defense-systems/rst_paris.md b/content/2.defense-systems/rst_paris.md index 8422d20773d25e2a55a98d08082b6403717676f9..3e49e7b8823a496d6f48aef42c26ea4b6082225c 100644 --- a/content/2.defense-systems/rst_paris.md +++ b/content/2.defense-systems/rst_paris.md @@ -1,5 +1,7 @@ --- title: Rst_PARIS +tableColumns: + doi: https://doi.org/10.1101/2021.01.21.427644 --- ## Description diff --git a/pages/defense-systems.vue b/pages/defense-systems.vue index b744ef92ec3b33ae0c29f5cb1a2bc5a05072a6d5..a417b5f1ea4b0e0ad01694761279570f95b01bb2 100644 --- a/pages/defense-systems.vue +++ b/pages/defense-systems.vue @@ -1,38 +1,47 @@ <script setup lang="ts"> -const { data, error, pending } = await useAsyncData('list-defense-systems', () => queryContent('/defense-systems').find()) +const { data, error, pending } = await useAsyncData( + 'list-defense-systems', + () => queryContent('/defense-systems').find() +) const defaultHeaders = ref([{ title: 'System', key: "system" }]) -const tableDescriptionKey = ref("tableDescription") -const headers = computed(() => { - if (data?.value && data.value?.length > 0) { - const uniqHeaders = Array.from(data.value.reduce((headerSet, df) => { - if (df?.[tableDescriptionKey.value]) { - return new Set([...headerSet, ...Object.keys(df[tableDescriptionKey.value])]) - } - else { return headerSet } - }, new Set())) - return [...defaultHeaders.value, ...uniqHeaders.map(value => { return { title: value, key: value } })] - } - else { - return [] - } -}) -const systems = computed(() => { +const tableKey = "tableColumns" + +const sanitizedData = computed(() => { if (data?.value && data.value?.length > 0) { - return data.value.map(({ title, tableDescription }) => { - return { - system: title, - ...tableDescription + return data.value?.filter(entry => { + if (entry._dir === "old" || entry._dir === "") { + return false } + return true }) } else { return [] } +}) + +const headers = computed(() => { + + const uniqHeaders = Array.from(sanitizedData.value.reduce((headerSet, df) => { + if (df?.[tableKey]) { + return new Set([...headerSet, ...Object.keys(df[tableKey])]) + } + else { return headerSet } + }, new Set())) + return [...defaultHeaders.value, ...uniqHeaders.map(value => { return { title: value, key: value } })] + +}) +const systems = computed(() => { + return sanitizedData.value.map((content) => { + return { + system: { name: content.title, path: content._path }, + ...content[tableKey] + } + }) + }) -console.log(headers.value) -console.log(systems.value) </script> <template> <v-card>