Skip to content

Commit

Permalink
feat(breadcrumb): ajout datasheetName dans les rapports détaillés (refs
Browse files Browse the repository at this point in the history
  • Loading branch information
slafayIGN committed Oct 16, 2024
1 parent 60b671f commit b0a6f52
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ const DatasheetUploadForm: FC<DatasheetUploadFormProps> = ({ datastoreId }) => {

{addUploadMutation.isSuccess && addUploadMutation.data?._id !== undefined && (
<Wait>
<DatasheetUploadIntegrationDialog datastoreId={datastoreId} uploadId={addUploadMutation.data?._id} />
<DatasheetUploadIntegrationDialog datastoreId={datastoreId} uploadId={addUploadMutation.data?._id} datasheetName={datasheetName} />
</Wait>
)}
</DatastoreLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ type IntegrationStatus = "at_lease_one_failure" | "proc_int_launched" | "all_suc

type DatasheetUploadIntegrationDialogProps = {
datastoreId: string;
datasheetName: string | undefined;
uploadId: string;
};

const DatasheetUploadIntegrationDialog: FC<DatasheetUploadIntegrationDialogProps> = ({ datastoreId, uploadId }) => {
const DatasheetUploadIntegrationDialog: FC<DatasheetUploadIntegrationDialogProps> = ({ datastoreId, datasheetName, uploadId }) => {
const [shouldPingIntProg, setShouldPingIntProg] = useState<boolean>(true);

const queryClient = useQueryClient();
Expand Down Expand Up @@ -210,7 +211,11 @@ const DatasheetUploadIntegrationDialog: FC<DatasheetUploadIntegrationDialogProps
buttons={[
{
children: "Voir le rapport d’erreur",
linkProps: routes.datastore_stored_data_details({ datastoreId, storedDataId: uploadQuery.data?.tags?.vectordb_id }).link,
linkProps: routes.datastore_stored_data_details({
datastoreId,
storedDataId: uploadQuery.data?.tags?.vectordb_id,
datasheetName,
}).link,
},
{
children: "Revenir à mes données",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ import DatasheetUploadIntegrationDialog from "./DatasheetUploadIntegrationDialog
type DatasheetUploadIntegrationPageProps = {
datastoreId: string;
uploadId: string;
datasheetName: string | undefined;
};
const DatasheetUploadIntegrationPage: FC<DatasheetUploadIntegrationPageProps> = ({ datastoreId, uploadId }) => {
const DatasheetUploadIntegrationPage: FC<DatasheetUploadIntegrationPageProps> = ({ datastoreId, uploadId, datasheetName }) => {
return (
<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")}>
<DatasheetUploadIntegrationDialog datastoreId={datastoreId} uploadId={uploadId} />
<DatasheetUploadIntegrationDialog datastoreId={datastoreId} uploadId={uploadId} datasheetName={datasheetName} />
</div>
</DatastoreLayout>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const PyramidListItem: FC<PyramidListItemProps> = ({ datasheetName, datastoreId,
{
text: t("show_details"),
iconId: "fr-icon-file-text-fill",
linkProps: routes.datastore_stored_data_details({ datastoreId, storedDataId: pyramid._id }).link,
linkProps: routes.datastore_stored_data_details({ datastoreId, datasheetName, storedDataId: pyramid._id }).link,
},
{
text: tCommon("delete"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ const VectorDbListItem: FC<VectorDbListItemProps> = ({ datasheetName, datastoreI
{
text: t("show_details"),
iconId: "fr-icon-file-text-fill",
linkProps: routes.datastore_stored_data_details({ datastoreId, storedDataId: vectorDb._id }).link,
linkProps: routes.datastore_stored_data_details({ datastoreId, datasheetName, storedDataId: vectorDb._id }).link,
},
{
text: tCommon("delete"),
Expand Down
6 changes: 6 additions & 0 deletions assets/modules/entrepot/breadcrumbs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@ const getBreadcrumb = (route: Route<typeof routes>, datastore?: Datastore): Brea
{ label: datastore?.name, linkProps: routes.datasheet_list({ datastoreId: route.params.datastoreId }).link },
],
];
if ("datasheetName" in route.params && route.params.datasheetName) {
defaultProps.segments.push({
label: route.params.datasheetName,
linkProps: routes.datastore_datasheet_view({ datastoreId: route.params.datastoreId, datasheetName: route.params.datasheetName }).link,
});
}
return { ...defaultProps, currentPageLabel: t("datastore_stored_data_details") };

case "datastore_wfs_service_new":
Expand Down
8 changes: 7 additions & 1 deletion assets/router/RouterRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,13 @@ const RouterRenderer: FC = () => {
case "datastore_datasheet_upload":
return <DatasheetUploadForm datastoreId={route.params.datastoreId} />;
case "datastore_datasheet_upload_integration":
return <DatasheetUploadIntegrationPage datastoreId={route.params.datastoreId} uploadId={route.params.uploadId} />;
return (
<DatasheetUploadIntegrationPage
datastoreId={route.params.datastoreId}
uploadId={route.params.uploadId}
datasheetName={route.params.datasheetName}
/>
);
case "datastore_datasheet_view":
return <DatasheetView datastoreId={route.params.datastoreId} datasheetName={route.params.datasheetName} />;
case "datastore_stored_data_details":
Expand Down
2 changes: 2 additions & 0 deletions assets/router/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ const routeDefs = {
{
datastoreId: param.path.string,
uploadId: param.query.string,
datasheetName: param.query.optional.string,
},
(p) => `${appRoot}/entrepot/${p.datastoreId}/donnees/integration`
),
Expand All @@ -136,6 +137,7 @@ const routeDefs = {
{
datastoreId: param.path.string,
storedDataId: param.path.string,
datasheetName: param.query.optional.string,
},
(p) => `${appRoot}/entrepot/${p.datastoreId}/donnees/${p.storedDataId}/details`
),
Expand Down

0 comments on commit b0a6f52

Please sign in to comment.