Skip to content

Commit

Permalink
feat: ajoute possibilité de reprendre l'intégration d'une livraison n…
Browse files Browse the repository at this point in the history
…on terminée
  • Loading branch information
ocruze committed Oct 10, 2023
1 parent fbc3dfe commit 0ae16c7
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { fr } from "@codegouvfr/react-dsfr";
import { FC } from "react";

import DatastoreLayout from "../../../../components/Layout/DatastoreLayout";
Expand All @@ -9,8 +10,13 @@ type DatasheetNewIntegrationProps = {
};
const DatasheetNewIntegration: FC<DatasheetNewIntegrationProps> = ({ datastoreId, uploadId }) => {
return (
<DatastoreLayout datastoreId={datastoreId} documentTitle="Intégration de votre donnée en base">
<DatasheetNewIntegrationDialog datastoreId={datastoreId} uploadId={uploadId} />
<DatastoreLayout datastoreId={datastoreId} documentTitle="Intégration des données">
<div className={fr.cx("fr-grid-row")}>
<h1>Intégration des données</h1>
</div>
<div className={fr.cx("fr-grid-row", "fr-grid-row--middle", "fr-grid-row--center", "fr-mt-2v")}>
<DatasheetNewIntegrationDialog datastoreId={datastoreId} uploadId={uploadId} />
</div>
</DatastoreLayout>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { fr } from "@codegouvfr/react-dsfr";
import Button from "@codegouvfr/react-dsfr/Button";
import { FC } from "react";
import { FC, useMemo } from "react";
import { symToStr } from "tsafe/symToStr";

import { type DatasheetDetailed } from "../../../../types/app";
import VectorDbList from "./VectorDbList";
import PyramidList from "./PyramidList";
import UnfinishedUploadList from "./UnfinishedUploadList";
import VectorDbList from "./VectorDbList";

type DataListTabProps = {
datastoreId: string;
Expand All @@ -13,12 +15,25 @@ type DataListTabProps = {

const DatasetListTab: FC<DataListTabProps> = ({ datastoreId, datasheet }) => {
// TODO : il y en aura d'autres types de données aussi (pyramid vector, raster, etc)

// liste des uploads/livraisons dont l'intégration en base de données n'a pas réussi ou n'a pas terminé
const unfinishedUploads = useMemo(() => {
return datasheet?.upload_list?.filter((upload) => upload.tags.integration_current_step !== "3");
}, [datasheet?.upload_list]);

return (
<>
<div className={fr.cx("fr-grid-row", "fr-grid-row--right", "fr-grid-row--middle")}>
<Button iconId="fr-icon-add-line">Ajouter un fichier de données</Button>
</div>
<div className={fr.cx("fr-grid-row", "fr-grid-row--center", "fr-grid-row--middle")}>
{unfinishedUploads && unfinishedUploads.length > 0 && (
<div className={fr.cx("fr-grid-row", "fr-grid-row--center", "fr-grid-row--middle")}>
<div className={fr.cx("fr-col")}>
<UnfinishedUploadList datastoreId={datastoreId} uploadList={unfinishedUploads} title="Livraisons non terminées" />
</div>
</div>
)}
<div className={fr.cx("fr-grid-row", "fr-grid-row--center", "fr-grid-row--middle", "fr-mt-4w")}>
<div className={fr.cx("fr-col")}>
<VectorDbList datastoreId={datastoreId} vectorDbList={datasheet?.vector_db_list} />
</div>
Expand All @@ -32,4 +47,6 @@ const DatasetListTab: FC<DataListTabProps> = ({ datastoreId, datasheet }) => {
);
};

DatasetListTab.displayName = symToStr({ DatasetListTab });

export default DatasetListTab;
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { fr } from "@codegouvfr/react-dsfr";
import Button from "@codegouvfr/react-dsfr/Button";
import { FC } from "react";
import { symToStr } from "tsafe/symToStr";

import { routes } from "../../../../router/router";
import { Upload } from "../../../../types/app";

type UnfinishedUploadListProps = {
datastoreId: string;
uploadList?: Upload[];
title?: string;
};
const UnfinishedUploadList: FC<UnfinishedUploadListProps> = ({ datastoreId, uploadList, title = "Livraisons" }) => {
return (
<>
<div className={fr.cx("fr-grid-row")}>
<h5>
<i className={fr.cx("fr-icon-database-fill")} />
&nbsp;{title} ({uploadList?.length ?? 0})
</h5>
</div>

{uploadList?.map((upload) => (
<div key={upload._id} className={fr.cx("fr-grid-row", "fr-grid-row--middle", "fr-mt-2v")}>
<div className={fr.cx("fr-col")}>
<div className={fr.cx("fr-grid-row", "fr-grid-row--middle")}>{upload.name}</div>
</div>

<div className={fr.cx("fr-col")}>
<div className={fr.cx("fr-grid-row", "fr-grid-row--right", "fr-grid-row--middle")}>
<Button linkProps={routes.datastore_datasheet_new_integration({ datastoreId, uploadId: upload._id }).link}>
{"Reprendre l'intégration"}
</Button>
</div>
</div>
</div>
))}
</>
);
};

UnfinishedUploadList.displayName = symToStr({ UnfinishedUploadList });

export default UnfinishedUploadList;

0 comments on commit 0ae16c7

Please sign in to comment.