Skip to content
Snippets Groups Projects
Commit 0558e92efffa authored by Arnaud Vergnet's avatar Arnaud Vergnet :sun_with_face:
Browse files

feat(frontend): add button to download import process shacl reports

parent f51fd48d5aef
No related branches found
No related tags found
1 merge request!28feat(frontend): add button to download import process shacl reports
Pipeline #229898 passed
......@@ -306,6 +306,6 @@
// the state to fetch the TrInfo which leads to this state, and with the TrInfo entity you do have the
// creation_date, the comment and so on
return (
"Any X, MAX(VAL_DATE), VAL_RECIPE, VAL_PROJECT, VAL_STATE " +
"GROUPBY X, VAL_RECIPE, VAL_PROJECT, VAL_STATE " +
"Any X, MAX(VAL_DATE), VAL_RECIPE, VAL_PROJECT, VAL_STATE, ATTR_SHACL_VALID " +
"GROUPBY X, VAL_RECIPE, VAL_PROJECT, VAL_STATE, ATTR_SHACL_VALID " +
"ORDERBY MAX(VAL_DATE) DESC " +
......@@ -311,5 +311,5 @@
"ORDERBY MAX(VAL_DATE) DESC " +
"WHERE X is ImportProcess, " +
"WHERE X is ImportProcess, X shacl_valid ATTR_SHACL_VALID, " +
getImportRecipePart(hasDataService, hasRecipe) +
getImportProcedurePart(hasProject) +
"X in_state S, S name VAL_STATE, " +
......@@ -341,8 +341,8 @@
// TODO fetch files for all import processes
// See https://forge.extranet.logilab.fr/cubicweb/RQL/-/merge_requests/99
const dataLogQuery = transaction.push(
"Any X, DATA.download_url(), LOG.download_url() WHERE X eid %(eid)s, " +
"X has_output_dataset DATA?, X import_report LOG?",
"Any X, DATA.download_url(), LOG.download_url(), SHACL.download_url() WHERE X eid %(eid)s, " +
"X has_output_dataset DATA?, X import_report LOG?, X shacl_report SHACL?",
{ eid: importProcessListQuery.ref().row(0).column(0) },
);
const result = await client.executeTransaction(transaction);
......@@ -353,8 +353,9 @@
for (const result of importProcessListResult) {
const dataLog = dataLogListResult.find((e) => e[0] === result[0]);
if (dataLog != undefined) {
result[5] = dataLog[1];
result[6] = dataLog[2];
result[6] = dataLog[1];
result[7] = dataLog[2];
result[8] = dataLog[3];
}
}
return importProcessListResultSetToObject(importProcessListResult);
......@@ -378,8 +379,10 @@
recipe: r[2],
project: r[3],
state: r[4],
dataset_url: r[5],
log_url: r[6],
shacl_valid: r[5],
dataset_url: r[6],
log_url: r[7],
shacl_report_url: r[8],
} as ImportProcess;
});
}
......
......@@ -9,6 +9,8 @@
CircularProgress,
Typography,
IconButton,
Tooltip,
Box,
} from "@mui/material";
import CheckIcon from "@mui/icons-material/Check";
import CloseIcon from "@mui/icons-material/Close";
......@@ -32,6 +34,8 @@
if (url) {
const fileToOpen = await downloadFile(url);
openFile(fileToOpen);
} else {
console.error("No file to open");
}
}
......@@ -73,6 +77,7 @@
<TableCell>Projet</TableCell>
<TableCell width={50}>Dataset</TableCell>
<TableCell width={50}>Log</TableCell>
<TableCell width={50}>SHACL</TableCell>
</TableRow>
</TableHead>
<TableBody>
......@@ -134,7 +139,8 @@
</IconButton>
</ButtonTooltip>
</TableCell>
<ShaclButton importProcess={importProcess} />
</TableRow>
);
}
......@@ -137,7 +143,39 @@
</TableRow>
);
}
function ShaclButton({ importProcess }: { importProcess: ImportProcess }) {
if (importProcess.shacl_valid) {
return (
<TableCell>
<Tooltip title="La validation SHACL a réussi">
<Box
style={{
display: "flex",
justifyContent: "center",
alignItems: "center",
}}
>
<CheckIcon />
</Box>
</Tooltip>
</TableCell>
);
}
return (
<TableCell>
<ButtonTooltip title={"Voir le rapport d'erreur SHACL"}>
<IconButton
color="primary"
onClick={() => showFile(importProcess.shacl_report_url)}
>
<Visibility color="warning" />
</IconButton>
</ButtonTooltip>
</TableCell>
);
}
function StateIcon({ state }: { state: ImportProcess["state"] }) {
if (state === "successful") {
return <CheckIcon />;
......
......@@ -41,4 +41,6 @@
state: "waiting" | "ongoing" | "error" | "successful";
dataset_url?: string;
log_url?: string;
shacl_valid: boolean;
shacl_report_url?: string;
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment