Skip to content

Commit b28a659

Browse files
authored
Merge pull request #139 from SaaShup/registries_index_sync
✨ Synchronize registries index with Netbox changes
2 parents d2cf5f1 + f51f08c commit b28a659

File tree

3 files changed

+60
-8
lines changed

3 files changed

+60
-8
lines changed

flows.json

Lines changed: 57 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,7 @@
923923
"t": "set",
924924
"p": "registries",
925925
"pt": "global",
926-
"to": "[msg.payload.results.{\t \"id\": id,\t \"name\": name,\t \"serveraddress\": serveraddress,\t \"images\": images.display\t}]",
926+
"to": "[$filter(msg.payload.results.{\t \"id\": id,\t \"name\": name,\t \"serveraddress\": serveraddress,\t \"images\": [images.display]\t}, function($v) { $v.images != [] })]",
927927
"tot": "jsonata"
928928
}
929929
],
@@ -3702,7 +3702,8 @@
37023702
"y": 520,
37033703
"wires": [
37043704
[
3705-
"829323373ce00e9e"
3705+
"829323373ce00e9e",
3706+
"34ea063b4d53a0a0"
37063707
]
37073708
]
37083709
},
@@ -4230,8 +4231,8 @@
42304231
"links": [
42314232
"36f439d2ba0ac71a"
42324233
],
4233-
"x": 3025,
4234-
"y": 520,
4234+
"x": 3045,
4235+
"y": 480,
42354236
"wires": []
42364237
},
42374238
{
@@ -4788,6 +4789,31 @@
47884789
"y": 760,
47894790
"wires": []
47904791
},
4792+
{
4793+
"id": "34ea063b4d53a0a0",
4794+
"type": "change",
4795+
"z": "3ea1a4b04d852f38",
4796+
"name": "",
4797+
"rules": [
4798+
{
4799+
"t": "set",
4800+
"p": "registries",
4801+
"pt": "global",
4802+
"to": "(\t $registry := {\t \"id\": msg.input.data.registry.id,\t \"name\": msg.input.data.registry.name,\t \"serveraddress\": msg.input.data.registry.serveraddress,\t \"images\": [msg.input.data.display]\t };\t $globalContext(\"registries\")[id=$registry.id] ? $globalContext(\"registries\") ~> |$[id=$registry.id]|{\"images\":$distinct([$append(images, $registry.images[0])])}| : $append($globalContext(\"registries\"), $registry)\t)",
4803+
"tot": "jsonata"
4804+
}
4805+
],
4806+
"action": "",
4807+
"property": "",
4808+
"from": "",
4809+
"to": "",
4810+
"reg": false,
4811+
"x": 3120,
4812+
"y": 540,
4813+
"wires": [
4814+
[]
4815+
]
4816+
},
47914817
{
47924818
"id": "dcf35b57666a30f9",
47934819
"type": "http in",
@@ -6556,7 +6582,8 @@
65566582
"y": 300,
65576583
"wires": [
65586584
[
6559-
"b87eba8ac3329ce3"
6585+
"b87eba8ac3329ce3",
6586+
"06d9e416e24ea04b"
65606587
],
65616588
[],
65626589
[]
@@ -7071,6 +7098,31 @@
70717098
"y": 440,
70727099
"wires": []
70737100
},
7101+
{
7102+
"id": "06d9e416e24ea04b",
7103+
"type": "change",
7104+
"z": "177047e3d7a351be",
7105+
"name": "",
7106+
"rules": [
7107+
{
7108+
"t": "set",
7109+
"p": "registries",
7110+
"pt": "global",
7111+
"to": "(\t $id := msg.input.data.registry.id;\t $image := msg.input.data.display;\t [$globalContext(\"registries\") ~> | $[id=$id] | {\"images\": [$filter(images, function($v) { $v != $image })]} | ~> $filter(function($v) { $v.images != [] })]\t)",
7112+
"tot": "jsonata"
7113+
}
7114+
],
7115+
"action": "",
7116+
"property": "",
7117+
"from": "",
7118+
"to": "",
7119+
"reg": false,
7120+
"x": 1580,
7121+
"y": 300,
7122+
"wires": [
7123+
[]
7124+
]
7125+
},
70747126
{
70757127
"id": "305f23764ca23090",
70767128
"type": "change",

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "netbox-docker-agent",
3-
"version": "0.37.0",
3+
"version": "0.38.0",
44
"description": "Saashup agent for netbox manager",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)