From 9cd781e12fd41cc4a740330df6fe0f732171d604 Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Fri, 12 Apr 2024 14:52:58 +0200 Subject: [PATCH] Filter workflow outputs by type in markdown directives --- .../src/components/Markdown/MarkdownToolBox.vue | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/client/src/components/Markdown/MarkdownToolBox.vue b/client/src/components/Markdown/MarkdownToolBox.vue index c8f7341f6fed..d382dad028b7 100644 --- a/client/src/components/Markdown/MarkdownToolBox.vue +++ b/client/src/components/Markdown/MarkdownToolBox.vue @@ -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() + @@ -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) {