From b5f2581b1a1808cde0125e332819c816e737da64 Mon Sep 17 00:00:00 2001 From: oleg-odysseus Date: Tue, 25 Jun 2024 23:48:51 +0200 Subject: [PATCH] [ATL-50] Introduced Cohort Pathway Shiny app download and publishing --- .../analysis-execution-list.js | 29 +++++++++++++++---- .../analysisExecution/shiny-const.js | 6 ++-- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/js/components/analysisExecution/analysis-execution-list.js b/js/components/analysisExecution/analysis-execution-list.js index 1caa7aacc..4a2f0c819 100644 --- a/js/components/analysisExecution/analysis-execution-list.js +++ b/js/components/analysisExecution/analysis-execution-list.js @@ -174,10 +174,19 @@ define([ if (submission) { submissionId = submission.id; } - let currentAnalysisId=this.analysisId(); + let currentAnalysisId = this.analysisId(); + let resultsPathPrefix = this.resultsPathPrefix; + let apiPath = (resultsPathPrefix && resultsPathPrefix.includes('characterizations')) + ? shinyConsts.apiPaths.downloadShinyCC(submissionId, source.sourceKey) + : shinyConsts.apiPaths.downloadShinyPW(submissionId, source.sourceKey); + + let filePrefix = (resultsPathPrefix && resultsPathPrefix.includes('characterizations')) + ? "Characterization_" + : "Pathway_"; + FileService.loadZip( - config.api.url + shinyConsts.apiPaths.downloadShiny(submissionId, source.sourceKey), - "Characterization_" + currentAnalysisId + "_gv" + submissionId + "_" + source.sourceKey + ".zip" + config.api.url + apiPath, + filePrefix + currentAnalysisId + "_gv" + submissionId + "_" + source.sourceKey + ".zip" ) .catch((e) => console.error("error when downloading: " + e)) .finally(() => this.loading(false)); @@ -190,9 +199,19 @@ define([ if (submission) { submissionId = submission.id; } + + let resultsPathPrefix = this.resultsPathPrefix; + let apiPath = (resultsPathPrefix && resultsPathPrefix.includes('characterizations')) + ? shinyConsts.apiPaths.publishShinyCC(submissionId, source.sourceKey) + : shinyConsts.apiPaths.publishShinyPW(submissionId, source.sourceKey); + + let alertPrefix = (resultsPathPrefix && resultsPathPrefix.includes('characterizations')) + ? "Characterization" + : "Pathway"; + try { - await httpService.doGet(config.api.url + shinyConsts.apiPaths.publishShiny(submissionId, source.sourceKey)); - alert("Cohort Characterization report is published"); + await httpService.doGet(config.api.url + apiPath); + alert("Cohort " + alertPrefix + " report is published"); } catch (e) { console.error('An error has occurred when publishing', e); if (e.status === 403) { diff --git a/js/components/analysisExecution/shiny-const.js b/js/components/analysisExecution/shiny-const.js index e2de82b08..ad17b50cc 100644 --- a/js/components/analysisExecution/shiny-const.js +++ b/js/components/analysisExecution/shiny-const.js @@ -1,8 +1,10 @@ define( (require, exports) => { const apiPaths = { - downloadShiny: (id, sourceKey) => `shiny/download/cohort_characterization/${id}/${sourceKey}`, - publishShiny: (id, sourceKey) => `shiny/publish/cohort_characterization/${id}/${sourceKey}`, + downloadShinyCC: (id, sourceKey) => `shiny/download/cohort_characterization/${id}/${sourceKey}`, + publishShinyCC: (id, sourceKey) => `shiny/publish/cohort_characterization/${id}/${sourceKey}`, + downloadShinyPW: (id, sourceKey) => `shiny/download/cohort_pathway/${id}/${sourceKey}`, + publishShinyPW: (id, sourceKey) => `shiny/publish/cohort_pathway/${id}/${sourceKey}`, }; return { apiPaths