diff --git a/frontend/src/api/cubicweb.ts b/frontend/src/api/cubicweb.ts index dffff67ed7eb96a845350eece1e697f12f9c9029_ZnJvbnRlbmQvc3JjL2FwaS9jdWJpY3dlYi50cw==..4566fac7ea335c5c29eabe7e60bccd765790fafd_ZnJvbnRlbmQvc3JjL2FwaS9jdWJpY3dlYi50cw== 100644 --- a/frontend/src/api/cubicweb.ts +++ b/frontend/src/api/cubicweb.ts @@ -307,7 +307,7 @@ // creation_date, the comment and so on return ( "Any X, MAX(VAL_DATE), VAL_RECIPE, VAL_PROJECT, VAL_STATE, ATTR_SHACL_VALID, " + - "DATA.download_url(), LOG.download_url(), SHACL.download_url() " + - "GROUPBY X, VAL_RECIPE, VAL_PROJECT, VAL_STATE, ATTR_SHACL_VALID, DATA, LOG, SHACL " + + "OUTPUT_DATA.download_url(), INPUT_DATA.download_url(), LOG.download_url(), SHACL.download_url() " + + "GROUPBY X, VAL_RECIPE, VAL_PROJECT, VAL_STATE, ATTR_SHACL_VALID, OUTPUT_DATA, INPUT_DATA, LOG, SHACL " + "ORDERBY MAX(VAL_DATE) DESC " + "WHERE X is ImportProcess, X shacl_valid ATTR_SHACL_VALID, " + @@ -312,6 +312,6 @@ "ORDERBY MAX(VAL_DATE) DESC " + "WHERE X is ImportProcess, X shacl_valid ATTR_SHACL_VALID, " + - "X has_output_dataset DATA?, X import_report LOG?, X shacl_report SHACL?, " + + "X has_output_dataset OUTPUT_DATA?, X has_input_dataset INPUT_DATA?, X import_report LOG?, X shacl_report SHACL?, " + getImportRecipePart(hasDataService, hasRecipe) + getImportProcedurePart(hasProject) + "X in_state S, S name VAL_STATE, " + @@ -361,9 +361,10 @@ project: r[3], state: r[4], shacl_valid: r[5], - dataset_url: r[6], - log_url: r[7], - shacl_report_url: r[8], + output_dataset_url: r[6], + input_dataset_url: r[7], + log_url: r[8], + shacl_report_url: r[9], } as ImportProcess; }); } diff --git a/frontend/src/components/ImportProcessTable.tsx b/frontend/src/components/ImportProcessTable.tsx index dffff67ed7eb96a845350eece1e697f12f9c9029_ZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvSW1wb3J0UHJvY2Vzc1RhYmxlLnRzeA==..4566fac7ea335c5c29eabe7e60bccd765790fafd_ZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvSW1wb3J0UHJvY2Vzc1RhYmxlLnRzeA== 100644 --- a/frontend/src/components/ImportProcessTable.tsx +++ b/frontend/src/components/ImportProcessTable.tsx @@ -11,6 +11,8 @@ IconButton, Tooltip, Box, + Menu, + MenuItem, } from "@mui/material"; import CheckIcon from "@mui/icons-material/Check"; import CloseIcon from "@mui/icons-material/Close"; @@ -23,4 +25,5 @@ import { LoadingScreen } from "./LoadingScreen"; import { downloadFile, openFile } from "@/utils"; import { ButtonTooltip } from "./ButtonTooltip"; +import { useState } from "react"; @@ -26,5 +29,5 @@ -export interface ImprotProcessTableProps { +export interface ImportProcessTableProps { dataServiceEid?: number; recipeEid?: number; projectEid?: number; @@ -39,7 +42,7 @@ } } -export function ImportProcessTable(props: ImprotProcessTableProps) { +export function ImportProcessTable(props: ImportProcessTableProps) { const { data: importProcessList, error, @@ -95,7 +98,6 @@ }: { importProcess: ImportProcess; }) { - const hasDataset = importProcess.dataset_url != null; const hasLog = importProcess.log_url != null; return ( @@ -109,23 +111,7 @@ <StateIcon state={importProcess.state} /> </TableCell> <TableCell>{importProcess.project}</TableCell> - <TableCell> - <ButtonTooltip - title={ - hasDataset - ? "Voir le fichier de Dataset" - : "Aucun Dataset disponible" - } - > - <IconButton - color="primary" - disabled={!hasDataset} - onClick={() => showFile(importProcess.dataset_url)} - > - {hasDataset ? <Visibility /> : <VisibilityOff />} - </IconButton> - </ButtonTooltip> - </TableCell> + <DatasetButton importProcess={importProcess} /> <TableCell> <ButtonTooltip title={hasLog ? "Voir le fichier de log" : "Aucun log disponible"} @@ -144,6 +130,67 @@ ); } +function DatasetButton({ importProcess }: { importProcess: ImportProcess }) { + const hasDataset = + importProcess.input_dataset_url != null || + importProcess.output_dataset_url != null; + + const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null); + const open = Boolean(anchorEl); + const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => { + setAnchorEl(event.currentTarget); + }; + const handleClose = () => { + setAnchorEl(null); + }; + + return ( + <TableCell> + <ButtonTooltip + title={ + hasDataset ? "Voir le fichier de Dataset" : "Aucun Dataset disponible" + } + > + <IconButton + color="primary" + disabled={!hasDataset} + onClick={handleClick} + > + {hasDataset ? <Visibility /> : <VisibilityOff />} + </IconButton> + </ButtonTooltip> + <Menu + id="dataset-menu" + anchorEl={anchorEl} + open={open} + onClose={handleClose} + MenuListProps={{ + "aria-labelledby": "dataset-menu", + }} + > + <MenuItem + onClick={() => { + showFile(importProcess.input_dataset_url); + handleClose(); + }} + disabled={importProcess.input_dataset_url == null} + > + Entrée + </MenuItem> + <MenuItem + onClick={() => { + showFile(importProcess.output_dataset_url); + handleClose(); + }} + disabled={importProcess.output_dataset_url == null} + > + Sortie + </MenuItem> + </Menu> + </TableCell> + ); +} + function ShaclButton({ importProcess }: { importProcess: ImportProcess }) { if (importProcess.shacl_valid) { return ( diff --git a/frontend/src/types.ts b/frontend/src/types.ts index dffff67ed7eb96a845350eece1e697f12f9c9029_ZnJvbnRlbmQvc3JjL3R5cGVzLnRz..4566fac7ea335c5c29eabe7e60bccd765790fafd_ZnJvbnRlbmQvc3JjL3R5cGVzLnRz 100644 --- a/frontend/src/types.ts +++ b/frontend/src/types.ts @@ -39,7 +39,8 @@ recipe: string; project: string; state: "waiting" | "ongoing" | "error" | "successful"; - dataset_url?: string; + input_dataset_url?: string; + output_dataset_url?: string; log_url?: string; shacl_valid: boolean; shacl_report_url?: string;