From 36019a0013875ac166861c59a5201f73ad297fdf Mon Sep 17 00:00:00 2001
From: Remi  PLANEL <rplanel@pasteur.fr>
Date: Mon, 18 Sep 2023 14:28:36 +0200
Subject: [PATCH] WIP: compute headers

---
 content/2.defense-systems/abie.md |  3 +++
 pages/defense-systems.vue         | 18 ++++++++++++++++++
 2 files changed, 21 insertions(+)
 create mode 100644 pages/defense-systems.vue

diff --git a/content/2.defense-systems/abie.md b/content/2.defense-systems/abie.md
index d24eab50..a4e50c27 100644
--- a/content/2.defense-systems/abie.md
+++ b/content/2.defense-systems/abie.md
@@ -1,5 +1,8 @@
 ---
 title: AbiE
+tableDescription: 
+  doi: 10.1093/nar/gkt1419
+  other: blabla
 ---
 
 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/pages/defense-systems.vue b/pages/defense-systems.vue
new file mode 100644
index 00000000..81535462
--- /dev/null
+++ b/pages/defense-systems.vue
@@ -0,0 +1,18 @@
+<script setup lang="ts">
+const { data, error, pending } = await useAsyncData('list-defense-systems', () => queryContent('/defense-systems').find())
+const defaultHeaders = ref([{ title: 'System', key: "title" }])
+console.log(data.value)
+const tableDescriptionKey = ref("tableDescription")
+const headers = data.value ? ref(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())).map(value => { return { title: value, key: value } })
+
+) : defaultHeaders
+console.log(headers.value)
+</script>
+<template>
+    <v-card :loading="pending"></v-card>
+</template>
\ No newline at end of file
-- 
GitLab