Skip to content

Commit

Permalink
Implement connections between actions
Browse files Browse the repository at this point in the history
  • Loading branch information
electrikmilk committed Nov 20, 2023
1 parent f249f0f commit 36c9354
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ function renderAction(identifier: string, action: ActionData): Node {

const ul = document.createElement('ul');

renderActionConnection(card, action);

let actionData = null;
if (actions[identifier]) {
console.log('Found definition.');
Expand Down Expand Up @@ -82,6 +84,42 @@ function renderAction(identifier: string, action: ActionData): Node {
return card;
}

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")) {
continue;
}
if (!paramValue.Value.hasOwnProperty("OutputUUID")) {
continue;
}
outputUUID = paramValue.Value.OutputUUID;
}
if (outputUUID !== null) {
// @ts-ignore
for (let j in lastAction.WFWorkflowActionParameters) {
if (j !== "UUID") {
continue;
}
// @ts-ignore
const UUID = lastAction.WFWorkflowActionParameters[j];
if (outputUUID !== UUID) {
continue;
}

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

export function renderActionIcon(icon: string = 'gear', color?: string, background?: string): string {
const actionIcon = document.createElement('div');
actionIcon.className = 'sp-action-icon';
Expand Down
9 changes: 9 additions & 0 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,15 @@
color: #ffbf00;
}

.sp-container .card.sp-linked-action:before {
content: " ";
background: #6f7178;
width: 0.2rem;
height: 0.9rem;
top: -1rem;
position: absolute;
}

.sp-container .sp-action-icon {
display: flex;
place-content: center;
Expand Down

0 comments on commit 36c9354

Please sign in to comment.