I’m trying to create a function to back a node coloring style in Vertex. The function works when testing in the Typescript repo, I published it, but I’m not seeing it as an option for the Node’s Layer “Fill Option”.
Btw I’ve created an identical node-coloring function for a different object that works. This one’s almost identical but the input object type is different. In the Vertex Template I’m making, I made sure the input type matches my new one. Any ideas to go about debugging?
Here’s the fn that works:
@Function()
public async NodeColorBasedOnStatus(nodes: Node[]): Promise<FunctionsMap<Node, string>> {
const map = new FunctionsMap<Node, string>()
const getStatus = ...;
nodes.forEach(async (node) => {
const statuses = await getStatus.status(node)
const mostRecentStatus: string = statuses[0].statusCategory;
switch (mostRecentStatus){
case "Active": {
map.set(node, 'active')
break;
}
case "pending": {
map.set(node, 'pending')
break;
}
case "Category Unknown": {
map.set(node, 'unknown')
break;
}
default: {
map.set(node, 'other')
break;
}
}
})
return map
}
Here’s the new one that doesnt appear in Vertex Templates:
@Function()
public async NodeColorBasedOnStatus_2(nodes: Node2[]): Promise<FunctionsMap<Node2, string>> {
const map = new FunctionsMap<Node2, string>()
const getStatus = ...;
nodes.forEach(async (node) => {
const statuses = await getStatus.status(node)
const mostRecentStatus = statuses[0].statusCategory;
switch (mostRecentStatus){
case "Active": {
map.set(node, 'active')
break;
}
case "pending": {
map.set(node, 'pending')
break;
}
case "Category Unknown": {
map.set(node, 'unknown')
break;
}
case "Pending change": {
map.set(node, 'pending change')
break;
}
case "Pending add": {
map.set(node, 'pending add')
break;
}
case "Pending 2": {
map.set(node, 'pending')
break;
}
default: {
map.set(node, 'other')
break;
}
}
})
return map
}