Skip to content

Commit

Permalink
Refactor linking values
Browse files Browse the repository at this point in the history
  • Loading branch information
electrikmilk committed Nov 23, 2023
1 parent 4e5ef9f commit f4dbb67
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,31 +88,28 @@ let lastAction: ActionData;

function renderActionConnection(card: HTMLElement, action: ActionData) {
if (lastAction && lastAction.WFWorkflowActionParameters) {
let outputUUID = null;
for (let i in action.WFWorkflowActionParameters) {
// @ts-ignore
const paramValue = action.WFWorkflowActionParameters[i];
if (!paramValue.hasOwnProperty("Value")) {
let outputUUIDs = [];
for (const i in action.WFWorkflowActionParameters) {
if (i !== "WFInput") {
continue;
}
if (!paramValue.Value.hasOwnProperty("OutputUUID")) {
continue;
// @ts-ignore
const paramValue = action.WFWorkflowActionParameters[i];
if (paramValue.Value && paramValue.Value.OutputUUID) {
outputUUIDs.push(paramValue.Value.OutputUUID);
}
outputUUID = paramValue.Value.OutputUUID;
}
if (outputUUID !== null) {
if (outputUUIDs.length !== 0) {
// @ts-ignore
for (let j in lastAction.WFWorkflowActionParameters) {
if (j !== "UUID") {
continue;
}
// @ts-ignore
const UUID = lastAction.WFWorkflowActionParameters[j];
if (outputUUID !== UUID) {
if (!outputUUIDs.includes(UUID)) {
continue;
}

console.log('link actions', [action, lastAction]);
card.classList.add('sp-linked-action');
}
}
Expand Down

0 comments on commit f4dbb67

Please sign in to comment.