Skip to content

Commit

Permalink
[ATL-50] Introduced Cohort Pathway Shiny app download and publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg-odysseus committed Sep 9, 2024
1 parent 8865dfa commit b5f2581
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
29 changes: 24 additions & 5 deletions js/components/analysisExecution/analysis-execution-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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) {
Expand Down
6 changes: 4 additions & 2 deletions js/components/analysisExecution/shiny-const.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit b5f2581

Please sign in to comment.