Skip to content

Commit

Permalink
adding a debounced Toast and step/input differentiation
Browse files Browse the repository at this point in the history
  • Loading branch information
assuntad23 committed Jan 30, 2024
1 parent 7aed45f commit 2875b27
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion client/src/components/Workflow/Editor/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 2875b27

Please sign in to comment.