Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions src/components/explore/GenerationResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,36 @@ const GenerationResults: React.FC<any> = observer((props) => {
});
};

const downloadSnakeFile = (run_id: string, snakemake_name: string) => {
const request = {
run_id: run_id,
file_name: snakemake_name,
};
fetch("/ape/snakemake", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(request),
})
.then((response) => response.text())
.then((data) => {
const blob = new Blob([data], { type: "text/plain" });
const url = URL.createObjectURL(blob);
const link = document.createElement("a");
link.href = url;
link.download = snakemake_name;
link.click();
URL.revokeObjectURL(url);
})
.catch((error) => {
console.error(
"There has been a problem with accessing a snakemake file from the REST APE service:",
error
);
});
};

const downloadInputFile = (run_id: string) => {
fetch(`/ape/cwl_input?run_id=${run_id}`)
.then((response) => response.text())
Expand Down Expand Up @@ -233,6 +263,17 @@ const GenerationResults: React.FC<any> = observer((props) => {
>
CWL
</button>
<button
className="text-blue-500 hover:underline"
onClick={() =>
downloadSnakeFile(
workflow.run_id,
workflow.snakemake_name
)
}
>
SMK
</button>
</div>
</li>
)
Expand Down
1 change: 1 addition & 0 deletions src/stores/WorkflowTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export type WorkflowSolution = {
descriptive_name: string,
description: string,
cwl_name: string,
snakemake_name: string,
figure_name: string,
benchmark_file: string,
isSelected: boolean,
Expand Down