# HG changeset patch # User ogiorgis <olivier.giorgis@logilab.fr> # Date 1710754430 -3600 # Mon Mar 18 10:33:50 2024 +0100 # Node ID 7e3a95822571fa487e566e20dd7261966dec96b9 # Parent 1c8318f9e53dd1efedb407fc7fc776d9bf338435 fix: display only once projects that use the dataservice in several of these recipes diff --git a/frontend/src/app/data-service/[eid]/page.tsx b/frontend/src/app/data-service/[eid]/page.tsx --- a/frontend/src/app/data-service/[eid]/page.tsx +++ b/frontend/src/app/data-service/[eid]/page.tsx @@ -12,6 +12,7 @@ import { useState } from "react"; import { useRouter } from "next/navigation"; import { useGetDataService } from "@/hooks/useGetDataService"; +import { Project } from "@/types"; export default function DataService({ params: { eid }, @@ -44,6 +45,17 @@ return <ErrorScreen />; } + // get projects that use this dataservice at least once + // FIXME fix RQL to get projets only once juste + const uniqueProjs: Project[] = []; + const uniqueProjNames: string[] = []; + data.projects?.map((p) => { + if (!uniqueProjNames.includes(p.name)) { + uniqueProjs.push(p); + uniqueProjNames.push(p.name); + } + }); + return ( <Container> <BreadcrumbsMenu page="Data Service" /> @@ -62,7 +74,7 @@ </Typography> </Stack> <CardList loading={false} emptyText="Aucun projet"> - {data.projects?.map((p, i) => ( + {uniqueProjs?.map((p, i) => ( <ProjectCard key={i} name={p.name}