Skip to content

Commit

Permalink
Merge pull request #17977 from davelopez/24.0_fix_output_filtering_ma…
Browse files Browse the repository at this point in the history
…rkdown_directives

[24.0] Fix filtering workflow outputs by type in markdown directives
  • Loading branch information
mvdbeek authored Apr 12, 2024
2 parents 32327ae + 9cd781e commit fefdfd1
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions client/src/components/Markdown/MarkdownToolBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -259,18 +259,25 @@ export default {
});
return steps;
},
getOutputs() {
getOutputs(filterByType = undefined) {
const outputLabels = [];
this.steps &&
Object.values(this.steps).forEach((step) => {
step.workflow_outputs.forEach((workflowOutput) => {
if (workflowOutput.label) {
outputLabels.push(workflowOutput.label);
if (!filterByType || this.stepOutputMatchesType(step, workflowOutput, filterByType)) {
outputLabels.push(workflowOutput.label);
}
}
});
});
return outputLabels;
},
stepOutputMatchesType(step, workflowOutput, type) {
return Boolean(
step.outputs.find((output) => output.name === workflowOutput.output_name && output.type === type)
);
},
getArgumentTitle(argumentName) {
return (
argumentName[0].toUpperCase() +
Expand Down Expand Up @@ -331,13 +338,13 @@ export default {
onHistoryDatasetId(argumentName) {
this.selectedArgumentName = argumentName;
this.selectedType = "history_dataset_id";
this.selectedLabels = this.getOutputs();
this.selectedLabels = this.getOutputs("data");
this.selectedShow = true;
},
onHistoryCollectionId(argumentName) {
this.selectedArgumentName = argumentName;
this.selectedType = "history_dataset_collection_id";
this.selectedLabels = this.getOutputs();
this.selectedLabels = this.getOutputs("collection");
this.selectedShow = true;
},
onWorkflowId(argumentName) {
Expand Down

0 comments on commit fefdfd1

Please sign in to comment.