# HG changeset patch # User Arnaud Vergnet <arnaud.vergnet@logilab.fr> # Date 1711116832 -3600 # Fri Mar 22 15:13:52 2024 +0100 # Node ID 1820d93a1a8cdefd81e58aae9cdd64b6df1db65d # Parent 8da5c45f5f48b4e9d2b7a713d94df1763ab0c872 fix(frontend): fetch all files for all import processes diff --git a/frontend/src/api/cubicweb.ts b/frontend/src/api/cubicweb.ts --- a/frontend/src/api/cubicweb.ts +++ b/frontend/src/api/cubicweb.ts @@ -306,10 +306,12 @@ // 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, ATTR_SHACL_VALID " + - "GROUPBY X, VAL_RECIPE, VAL_PROJECT, VAL_STATE, ATTR_SHACL_VALID " + + "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 " + "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?, " + getImportRecipePart(hasDataService, hasRecipe) + getImportProcedurePart(hasProject) + "X in_state S, S name VAL_STATE, " + @@ -319,7 +321,6 @@ return async ({ dataServiceEid, recipeEid, projectEid }) => { try { - const transaction = new Transaction(); const params: RQLParams = {}; if (dataServiceEid) { params["dataservice_eid"] = dataServiceEid; @@ -330,7 +331,7 @@ if (projectEid) { params["project_eid"] = projectEid; } - const importProcessListQuery = transaction.push( + const importProcessListResult = await client.execute( getRql( dataServiceEid !== undefined, recipeEid !== undefined, @@ -338,26 +339,6 @@ ), 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); } catch (e) { if (e && typeof e === "object" && "title" in e) {