fix(editor): Color node connections correctly in execution preview for nodes that have pinned data (#9669)

This commit is contained in:
Tomi Turtiainen
2024-06-07 16:12:59 +03:00
committed by GitHub
parent 6ae6a5ebdf
commit ebba7c87cd
9 changed files with 170 additions and 27 deletions

View File

@@ -915,7 +915,7 @@ export default defineComponent({
setTimeout(() => {
void this.usersStore.showPersonalizationSurvey();
this.addPinDataConnections(this.workflowsStore.pinnedWorkflowData || ({} as IPinData));
this.addPinDataConnections(this.workflowsStore.pinnedWorkflowData);
}, 0);
});
@@ -2332,7 +2332,7 @@ export default defineComponent({
this.workflowsStore.addWorkflowTagIds(tagIds);
setTimeout(() => {
this.addPinDataConnections(this.workflowsStore.pinnedWorkflowData || ({} as IPinData));
this.addPinDataConnections(this.workflowsStore.pinnedWorkflowData);
});
}
} catch (error) {
@@ -3892,7 +3892,7 @@ export default defineComponent({
});
setTimeout(() => {
this.addPinDataConnections(this.workflowsStore.pinnedWorkflowData ?? ({} as IPinData));
this.addPinDataConnections(this.workflowsStore.pinnedWorkflowData);
});
},
__removeConnection(connection: [IConnection, IConnection], removeVisualConnection = false) {
@@ -4904,23 +4904,31 @@ export default defineComponent({
await this.importWorkflowData(workflowData, 'url');
}
},
addPinDataConnections(pinData: IPinData) {
addPinDataConnections(pinData?: IPinData) {
if (!pinData) {
return;
}
Object.keys(pinData).forEach((nodeName) => {
const node = this.workflowsStore.getNodeByName(nodeName);
if (!node) {
return;
}
const hasRun = this.workflowsStore.getWorkflowResultDataByNodeName(nodeName) !== null;
const classNames = ['pinned'];
if (hasRun) {
classNames.push('has-run');
}
const nodeElement = document.getElementById(node.id);
if (!nodeElement) {
return;
}
const hasRun = this.workflowsStore.getWorkflowResultDataByNodeName(nodeName) !== null;
// In case we are showing a production execution preview we want
// to show pinned data connections as they wouldn't have been pinned
const classNames = this.isProductionExecutionPreview ? [] : ['pinned'];
if (hasRun) {
classNames.push('has-run');
}
const connections = this.instance?.getConnections({
source: nodeElement,
});
@@ -5055,7 +5063,7 @@ export default defineComponent({
});
}
this.addPinDataConnections(this.workflowsStore.pinnedWorkflowData || ({} as IPinData));
this.addPinDataConnections(this.workflowsStore.pinnedWorkflowData);
},
async saveCurrentWorkflowExternal(callback: () => void) {