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

fix(frontend): fetch all files for all import processes

parent 8da5c45f5f48
No related branches found
No related tags found
1 merge request!32fix(frontend): fetch all files for all import processes
Pipeline #230032 passed
...@@ -306,7 +306,8 @@ ...@@ -306,7 +306,8 @@
// the state to fetch the TrInfo which leads to this state, and with the TrInfo entity you do have the // 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 // creation_date, the comment and so on
return ( return (
"Any X, MAX(VAL_DATE), VAL_RECIPE, VAL_PROJECT, VAL_STATE, ATTR_SHACL_VALID " + "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 " + "DATA.download_url(), LOG.download_url(), SHACL.download_url() " +
"GROUPBY X, VAL_RECIPE, VAL_PROJECT, VAL_STATE, ATTR_SHACL_VALID, DATA, LOG, SHACL " +
"ORDERBY MAX(VAL_DATE) DESC " + "ORDERBY MAX(VAL_DATE) DESC " +
"WHERE X is ImportProcess, X shacl_valid ATTR_SHACL_VALID, " + "WHERE X is ImportProcess, X shacl_valid ATTR_SHACL_VALID, " +
...@@ -311,5 +312,6 @@ ...@@ -311,5 +312,6 @@
"ORDERBY MAX(VAL_DATE) DESC " + "ORDERBY MAX(VAL_DATE) DESC " +
"WHERE X is ImportProcess, X shacl_valid ATTR_SHACL_VALID, " + "WHERE X is ImportProcess, X shacl_valid ATTR_SHACL_VALID, " +
"X has_output_dataset DATA?, X import_report LOG?, X shacl_report SHACL?, " +
getImportRecipePart(hasDataService, hasRecipe) + getImportRecipePart(hasDataService, hasRecipe) +
getImportProcedurePart(hasProject) + getImportProcedurePart(hasProject) +
"X in_state S, S name VAL_STATE, " + "X in_state S, S name VAL_STATE, " +
...@@ -319,7 +321,6 @@ ...@@ -319,7 +321,6 @@
return async ({ dataServiceEid, recipeEid, projectEid }) => { return async ({ dataServiceEid, recipeEid, projectEid }) => {
try { try {
const transaction = new Transaction();
const params: RQLParams = {}; const params: RQLParams = {};
if (dataServiceEid) { if (dataServiceEid) {
params["dataservice_eid"] = dataServiceEid; params["dataservice_eid"] = dataServiceEid;
...@@ -330,7 +331,7 @@ ...@@ -330,7 +331,7 @@
if (projectEid) { if (projectEid) {
params["project_eid"] = projectEid; params["project_eid"] = projectEid;
} }
const importProcessListQuery = transaction.push( const importProcessListResult = await client.execute(
getRql( getRql(
dataServiceEid !== undefined, dataServiceEid !== undefined,
recipeEid !== undefined, recipeEid !== undefined,
...@@ -338,26 +339,6 @@ ...@@ -338,26 +339,6 @@
), ),
params, params,
); );
// 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(), 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);
const importProcessListResult = result.resolveQuery(
importProcessListQuery.ref(),
);
const dataLogListResult = result.resolveQuery(dataLogQuery.ref());
for (const result of importProcessListResult) {
const dataLog = dataLogListResult.find((e) => e[0] === result[0]);
if (dataLog != undefined) {
result[6] = dataLog[1];
result[7] = dataLog[2];
result[8] = dataLog[3];
}
}
return importProcessListResultSetToObject(importProcessListResult); return importProcessListResultSetToObject(importProcessListResult);
} catch (e) { } catch (e) {
if (e && typeof e === "object" && "title" in e) { if (e && typeof e === "object" && "title" in e) {
......
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