From 2875b275eff8cb309bfa396a5e8a4e0d38fbb16d Mon Sep 17 00:00:00 2001 From: Assunta DeSanto Date: Tue, 30 Jan 2024 17:43:48 -0500 Subject: [PATCH] adding a debounced Toast and step/input differentiation --- client/src/components/Workflow/Editor/Index.vue | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/client/src/components/Workflow/Editor/Index.vue b/client/src/components/Workflow/Editor/Index.vue index 0c31fd994555..dbd9da3da129 100644 --- a/client/src/components/Workflow/Editor/Index.vue +++ b/client/src/components/Workflow/Editor/Index.vue @@ -334,6 +334,7 @@ export default { showSaveAsModal: false, transform: { x: 0, y: 0, k: 1 }, graphOffset: { left: 0, top: 0, width: 0, height: 0 }, + debounceTimer: null, }; }, computed: { @@ -656,9 +657,19 @@ export default { const step = { ...this.steps[nodeId], label: newLabel }; const oldLabel = this.steps[nodeId].label; this.onUpdateStep(step); - const newMarkdown = replaceLabel(this.markdownText, "step", oldLabel, newLabel); + const stepType = this.steps[nodeId].type; + const isInput = ["data_input", "data_collection_input", "parameter_input"].indexOf(stepType) >= 0; + const labelType = isInput ? "input" : "step"; + const newMarkdown = replaceLabel(this.markdownText, labelType, oldLabel, newLabel); + if (newMarkdown !== this.markdownText) { + this.debouncedToast("Label updated in workflow report.", 1500); + } this.onReportUpdate(newMarkdown); }, + debouncedToast(message, delay) { + clearTimeout(this.debounceTimer); + this.debounceTimer = setTimeout(() => Toast.success(message), delay); + }, onScrollTo(stepId) { this.scrollToId = stepId; this.onHighlight(stepId);