BNA8/.resources/03b59282e77e1c9f22d81fcf44fd0769f0b58f80ad2cd422908b773eee24826f
2025-09-29 14:30:47 +04:00

237 lines
7.5 KiB
Plaintext

{
"custom": {
"alarm_message": null,
"color": "#FFFFFF",
"priority": "No Active Alarms",
"state": "TagError"
},
"params": {
"tagProps": [
"Status/Chutes/Chute_0",
"value",
"value",
"value",
"value",
"value",
"value",
"value",
"value",
"value"
]
},
"propConfig": {
"custom.color": {
"binding": {
"config": {
"fallbackDelay": 2.5,
"mode": "indirect",
"references": {
"0": "{view.params.tagProps[0]}",
"fc": "{session.custom.fc}"
},
"tagPath": "[{fc}_SCADA_TAG_PROVIDER]{0}/"
},
"transforms": [
{
"code": "\tdata \u003d dict(value) if value else {}\n\t\n\tif data.get(\"bBeacon_Yellow\"):\n\t return \"#FF8C00\"\n\telif data.get(\"No_Container\"):\n\t return \"#FF0000\"\n\telif data.get(\"bBeacon_Green\"):\n\t return \"#008000\"\n\telif data.get(\"bBeacon_Blue\"):\n\t return \"#0000FF\"\n\t\n\treturn \"#FFFFFF\"",
"type": "script"
}
],
"type": "tag"
},
"persistent": true
},
"custom.priority": {
"binding": {
"config": {
"fallbackDelay": 2.5,
"mode": "indirect",
"references": {
"0": "{view.params.tagProps[0]}",
"fc": "{session.custom.fc}"
},
"tagPath": "[{fc}_SCADA_TAG_PROVIDER]{0}/"
},
"transforms": [
{
"code": "\tdata \u003d dict(value) if value else {}\n\t\n\tif data.get(\"bBeacon_Yellow\"):\n\t return \"High\"\n\telif data.get(\"No_Container\"):\n\t return \"Low\"\n\telif data.get(\"bBeacon_Green\"):\n\t return \"No Active Alarms\"\n\telif data.get(\"bBeacon_Blue\"):\n\t return \"Low\"\n\t\n\treturn \"No Active Alarms\"",
"type": "script"
}
],
"type": "tag"
},
"persistent": true
},
"custom.state": {
"binding": {
"config": {
"fallbackDelay": 2.5,
"mode": "indirect",
"references": {
"0": "{view.params.tagProps[0]}",
"fc": "{session.custom.fc}"
},
"tagPath": "[{fc}_SCADA_TAG_PROVIDER]{0}/"
},
"transforms": [
{
"code": "\tdata \u003d dict(value) if value else {}\n\t\n\tif value is None or data.get(\"_quality\") \u003d\u003d \"Bad\" or data.get(\"error\"):\n\t return \"TagError\"\n\t\n\tif data.get(\"bBeacon_Yellow\"):\n\t return \"Jammed\"\n\telif data.get(\"No_Container\"):\n\t return \"No Container\"\n\telif data.get(\"bBeacon_Green\"):\n\t return \"Enabled\"\n\telif data.get(\"bBeacon_Blue\"):\n\t return \"Full/Half Full\"\n\t\n\treturn \"Inactive\"\n",
"type": "script"
}
],
"type": "tag"
},
"persistent": true
},
"params.tagProps": {
"paramDirection": "inout",
"persistent": true
}
},
"props": {
"defaultSize": {
"height": 20,
"width": 29
}
},
"root": {
"children": [
{
"meta": {
"name": "RunningStatus"
},
"position": {
"grow": 1
},
"propConfig": {
"position.rotate.angle": {
"binding": {
"config": {
"path": "view.params.directionLeft"
},
"transforms": [
{
"expression": "if({value}, \u0027180deg\u0027, \u00270deg\u0027)",
"type": "expression"
}
],
"type": "property"
}
},
"props.elements[0].fill.paint": {
"binding": {
"config": {
"path": "view.custom.color"
},
"type": "property"
}
}
},
"props": {
"elements": [
{
"d": "M 0 0 L 40 0 L 40 0 L 70 30 L 40 60 L 40 60 L 0 60 L 0 0 Z",
"fill": {},
"name": "path",
"stroke": {
"paint": "#4c4c4c",
"width": 3
},
"type": "path"
}
],
"style": {
"overflow": "hidden"
},
"viewBox": "-1.5 -1.5 73 63"
},
"type": "ia.shapes.svg"
}
],
"events": {
"dom": {
"onClick": {
"config": {
"script": "\tsystem.perspective.openDock(\u0027Docked-East-CH\u0027,params\u003d{\u0027tagProps\u0027:self.view.params.tagProps})"
},
"scope": "G",
"type": "script"
},
"onMouseEnter": {
"config": {
"script": "\tself.props.style.transform \u003d \"scale(2)\"\n\tfrom time import sleep\n\t\n\talarm \u003d []\n\tmessage \u003d None\n\t\n#\tsleep(0.5)\n\t\n\tif system.tag.exists(\"System/aws_data\"):\n\t\tif self.view.params.tagProps[0] !\u003d \"\":\n\t\t\ttags_to_read \u003d system.tag.readBlocking(\"System/aws_data\")\n\t\t\tdecode_alarm_data \u003d system.util.jsonDecode(tags_to_read[0].value)\n\t\t\talarm \u003d [decode_alarm_data[i] for i in decode_alarm_data\n\t\t\t\t\tif decode_alarm_data[i][\u0027sourceId\u0027].startswith(self.view.params.tagProps[0])]\n\t\tif alarm:\n\t\t\talarm \u003d sorted(alarm, key \u003d lambda t:t[\u0027timestamp\u0027], reverse\u003dTrue)\n\t\t\tmessage \u003d max(alarm, key \u003d lambda p:p[\u0027priority\u0027]).get(\u0027message\u0027)\n\t\t\tif len(alarm) \u003e 1:\n\t\t\t\tmessage +\u003d \" (+\" + str(len(alarm)-1) + \")\"\n\tself.view.custom.alarm_message \u003d message"
},
"scope": "G",
"type": "script"
},
"onMouseLeave": {
"config": {
"script": "\tself.props.style.transform \u003d \"scale(1)\""
},
"scope": "G",
"type": "script"
}
}
},
"meta": {
"name": "root",
"tooltip": {
"enabled": true,
"location": "top-left",
"style": {}
}
},
"propConfig": {
"meta.tooltip.style.classes": {
"binding": {
"config": {
"expression": "{view.custom.priority}"
},
"transforms": [
{
"fallback": "Alarms-Styles/NoAlarm",
"inputType": "scalar",
"mappings": [
{
"input": "High",
"output": "Alarms-Styles/High"
},
{
"input": "Medium",
"output": "Alarms-Styles/Medium"
},
{
"input": "Low",
"output": "Alarms-Styles/Low"
},
{
"input": "Diagnostic",
"output": "Alarms-Styles/Diagnostic"
}
],
"outputType": "style-list",
"type": "map"
}
],
"type": "expr"
}
},
"meta.tooltip.text": {
"binding": {
"config": {
"expression": "if(\n {view.custom.state} !\u003d \"TagError\",\n \"Source Id: \" + {view.params.tagProps[1]} + \", Priority: \" + {view.custom.priority} + \", State: \" + {view.custom.state},\n \"Device Disconnected\"\n)\n"
},
"type": "expr"
}
}
},
"props": {
"justify": "center",
"style": {
"transform": "scale(1)",
"transition": "transform 100ms linear"
}
},
"type": "ia.container.flex"
}
}