forked from galaxyproject/galaxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes for mapping workflow labels to markdown selection.
- Loading branch information
Showing
5 changed files
with
97 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// abstractions for dealing with workflows labels and | ||
// connecting them to the Markdown editor | ||
|
||
type WorkflowLabelKind = "input" | "output" | "step"; | ||
|
||
export interface WorkflowLabel { | ||
label: string; | ||
type: WorkflowLabelKind; | ||
} | ||
|
||
interface StepOutput { | ||
label?: string; | ||
} | ||
|
||
interface Step { | ||
label?: string; | ||
type: string; | ||
workflow_outputs: StepOutput[]; | ||
} | ||
|
||
export type WorkflowLabels = WorkflowLabel[]; | ||
|
||
export function fromSteps(steps?: Step[]): WorkflowLabels { | ||
const labels: WorkflowLabels = []; | ||
|
||
if (!steps) { | ||
return labels; | ||
} | ||
|
||
Object.values(steps).forEach((step) => { | ||
const stepType = step.type; | ||
if (step.label) { | ||
const isInput = ["data_input", "data_collection_input", "parameter_input"].indexOf(stepType) >= 0; | ||
if (isInput) { | ||
labels.push({ type: "input", label: step.label }); | ||
} else { | ||
labels.push({ type: "step", label: step.label }); | ||
} | ||
} | ||
step.workflow_outputs.forEach((workflowOutput) => { | ||
if (workflowOutput.label) { | ||
labels.push({ type: "output", label: workflowOutput.label }); | ||
} | ||
}); | ||
}); | ||
|
||
return labels; | ||
} |