From 963dc0d05851afa248e071a455004c3264b741c1 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 28 Mar 2024 15:28:27 -0400 Subject: [PATCH] Include output labels when updating report markdown for label changes. --- .../Workflow/Editor/Forms/FormDefault.vue | 15 +++++++++++++-- .../Workflow/Editor/Forms/FormOutput.vue | 5 ++++- .../Workflow/Editor/Forms/FormOutputLabel.vue | 8 ++++++++ .../Workflow/Editor/Forms/FormSection.vue | 4 ++++ .../components/Workflow/Editor/Forms/FormTool.vue | 6 +++++- client/src/components/Workflow/Editor/Index.vue | 12 +++++++++++- 6 files changed, 45 insertions(+), 5 deletions(-) diff --git a/client/src/components/Workflow/Editor/Forms/FormDefault.vue b/client/src/components/Workflow/Editor/Forms/FormDefault.vue index 8ec5d71f984f..72e786d3b6d3 100644 --- a/client/src/components/Workflow/Editor/Forms/FormDefault.vue +++ b/client/src/components/Workflow/Editor/Forms/FormDefault.vue @@ -51,7 +51,8 @@ :key="index" :name="output.name" :step="step" - :show-details="true" /> + :show-details="true" + @onOutputLabel="onOutputLabel" /> @@ -78,7 +79,14 @@ const props = defineProps<{ step: Step; datatypes: DatatypesMapperModel["datatypes"]; }>(); -const emit = defineEmits(["onAnnotation", "onLabel", "onAttemptRefactor", "onEditSubworkflow", "onSetData"]); +const emit = defineEmits([ + "onAnnotation", + "onLabel", + "onAttemptRefactor", + "onEditSubworkflow", + "onSetData", + "onOutputLabel", +]); const stepRef = toRef(props, "step"); const { stepId, contentId, annotation, label, name, type, configForm } = useStepProps(stepRef); const { stepStore } = useWorkflowStores(); @@ -117,4 +125,7 @@ function onChange(values: any) { inputs: values, }); } +function onOutputLabel(oldValue: string | null, newValue: string | null) { + emit("onOutputLabel", oldValue, newValue); +} diff --git a/client/src/components/Workflow/Editor/Forms/FormOutput.vue b/client/src/components/Workflow/Editor/Forms/FormOutput.vue index a0e41c37eb40..554b218df6ef 100644 --- a/client/src/components/Workflow/Editor/Forms/FormOutput.vue +++ b/client/src/components/Workflow/Editor/Forms/FormOutput.vue @@ -1,7 +1,7 @@ @@ -88,7 +89,7 @@ export default { required: true, }, }, - emits: ["onSetData", "onUpdateStep", "onChangePostJobActions", "onAnnotation", "onLabel"], + emits: ["onSetData", "onUpdateStep", "onChangePostJobActions", "onAnnotation", "onLabel", "onOutputLabel"], setup(props, { emit }) { const { stepId, annotation, label, stepInputs, stepOutputs, configForm, postJobActions } = useStepProps( toRef(props, "step") @@ -163,6 +164,9 @@ export default { onLabel(newLabel) { this.$emit("onLabel", this.stepId, newLabel); }, + onOutputLabel(oldValue, newValue) { + this.$emit("onOutputLabel", oldValue, newValue); + }, /** * Change event is triggered on component creation and input changes. * @param { Object } values contains flat key-value pairs `prefixed-name=value` diff --git a/client/src/components/Workflow/Editor/Index.vue b/client/src/components/Workflow/Editor/Index.vue index 34ebf3ff1bce..b045017acc9c 100644 --- a/client/src/components/Workflow/Editor/Index.vue +++ b/client/src/components/Workflow/Editor/Index.vue @@ -95,6 +95,7 @@ @onChangePostJobActions="onChangePostJobActions" @onAnnotation="onAnnotation" @onLabel="onLabel" + @onOutputLabel="onOutputLabel" @onUpdateStep="onUpdateStep" @onSetData="onSetData" /> = 0; const labelType = isInput ? "input" : "step"; + const labelTypeTitle = isInput ? "Input" : "Step"; const newMarkdown = replaceLabel(this.markdownText, labelType, oldLabel, newLabel); if (newMarkdown !== this.markdownText) { - this.debouncedToast("Label updated in workflow report.", 1500); + this.debouncedToast(`${labelTypeTitle} label updated in workflow report.`, 1500); } this.onReportUpdate(newMarkdown); },