30 lines
718 B
Plaintext
30 lines
718 B
Plaintext
# Filter first
|
|
.
|
|
| debug("Filtering...")
|
|
| .tags[]
|
|
|= select(.typeId == $typeId)
|
|
# Sort first
|
|
| debug("Sorting...")
|
|
| walk( if type == "object" and has("tags") then .tags |= sort_by(.name) end )
|
|
# so object positions are predictable
|
|
# | 2 as $pos
|
|
| .tags[0].tags[$pos].tags as $baseData
|
|
| debug("Modifying tags...")
|
|
| .tags
|
|
|= map(
|
|
.
|
|
| if .parameters.plcName.value then
|
|
.parameters.plcName.value |= rtrimstr(".Tags.Controller Tags")
|
|
elif .parameters.plcname.value then
|
|
.parameters.plcname.value |= rtrimstr(".Tags.Controller Tags")
|
|
end
|
|
| if .tags
|
|
and .tags[$pos].name == "Data"
|
|
and .tags[$pos].tagType == "Folder"
|
|
then
|
|
.tags[$pos].tags |= $baseData
|
|
else
|
|
.
|
|
| debug("Data folder not found")
|
|
end
|
|
) |