From de0845da114bcb020c86682d87d8c76eaf21613c Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sun, 12 Feb 2023 11:25:05 +0100 Subject: [PATCH] feat: use categories of current jdr --- src/components/tableaux/DynTable.vue | 14 ++++++++++++-- src/types/JdrConfig.ts | 1 + src/views/ObjetsView.vue | 9 ++++++--- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/components/tableaux/DynTable.vue b/src/components/tableaux/DynTable.vue index dbb5efe..d7a45b1 100644 --- a/src/components/tableaux/DynTable.vue +++ b/src/components/tableaux/DynTable.vue @@ -14,6 +14,10 @@ const props = defineProps({ type: Array as PropType, default: () => [], }, + category: { + type: String, + default: "", + }, }); const DEFAULT_MAX_ITEM_BY_PAGE = 10; @@ -33,15 +37,21 @@ const paginatedList = computed(() => { }); onMounted(() => { + setTimeout(() => { + refresh(); + }, 100); +}); + +function refresh() { table.fields = props.fields; for (const file of props.files) { - const listItems = `/jdr/objets/${file}.json`; + const listItems = `/jdr/${props.category}/${file}.json`; axios.get(listItems).then((response) => { table.addItems(response.data); table.currentPage = 0; }); } -}); +} function switchFilter(filterSet: string | number, filterName: string | number) { table.switchFilter(filterSet as string, filterName as string); diff --git a/src/types/JdrConfig.ts b/src/types/JdrConfig.ts index 8d67365..55722b3 100644 --- a/src/types/JdrConfig.ts +++ b/src/types/JdrConfig.ts @@ -6,4 +6,5 @@ export default interface JdrConfig { sidebar: LinkList[]; hideLinks: HideLink[]; vars: { name: string; value: string }[]; + objects: string[]; } diff --git a/src/views/ObjetsView.vue b/src/views/ObjetsView.vue index 50ee43c..870fc50 100644 --- a/src/views/ObjetsView.vue +++ b/src/views/ObjetsView.vue @@ -1,24 +1,27 @@