From c860d37db1a419f22a69ca733e07616f7ccc13ec Mon Sep 17 00:00:00 2001 From: Nulo Date: Fri, 8 Dec 2023 01:03:05 -0300 Subject: [PATCH] filtrar datasets --- frontend/src/lib/routes/DumpIndex.svelte | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/routes/DumpIndex.svelte b/frontend/src/lib/routes/DumpIndex.svelte index 0266222..775c7a0 100644 --- a/frontend/src/lib/routes/DumpIndex.svelte +++ b/frontend/src/lib/routes/DumpIndex.svelte @@ -4,6 +4,7 @@ import ExternalLink from "eva-icons/outline/svg/external-link-outline.svg?component"; import { fetchData, fetchErrors } from "../dump"; import { routes } from "../router"; + import type { Dataset } from "../schema"; export let params: { dumpUrl: string }; const url = decodeURIComponent(params.dumpUrl); @@ -17,6 +18,14 @@ return `https://${url}`; return url; } + + let query: string = ""; + function filterDatasets(datasets: Dataset[], query: string): Dataset[] { + return datasets.filter( + (dataset) => + dataset.identifier.includes(query) || dataset.title.includes(query), + ); + }
@@ -48,8 +57,18 @@ {/if} + +
+ +
+