{ "custom": { "state": { "$": [ "ds", 192, 1766054596663 ], "$columns": [ { "data": [ "MCM01", "MCM01" ], "name": "Location", "type": "String" }, { "data": [ "High", "Medium" ], "name": "Priority", "type": "String" }, { "data": [ 2, 1 ], "name": "Count", "type": "Integer" } ] }, "status": "" }, "params": { "value": { "tagProps": [ "value", "value", "value", "value", "value", "value", "value", "value", "value", "value" ] } }, "propConfig": { "custom.state": { "binding": { "config": { "fallbackDelay": 2.5, "mode": "direct", "tagPath": "[BNA8_SCADA_TAG_PROVIDER]System/Queries/Alarms/ActiveAlarmsByLocationAndPriority" }, "type": "tag" }, "onChange": { "enabled": null, "script": "\tMCM \u003d self.params.value.tagProps[0]\n\tqueryData \u003d currentValue.value\n\t\n\tif not queryData:\n\t self.custom.status \u003d \"\"\n\t\n\t# Define priority order from highest to lowest\n\tpriority_order \u003d [\"Critical\", \"High\", \"Medium\", \"Low\", \"Diagnostic\"]\n\texisting_priorities \u003d set()\n\tmyPriority \u003d \"\"\n\t\n\t# Populate the set\n\tfor row in range(queryData.rowCount):\n\t mcm_val \u003d queryData.getValueAt(row, 0)\n\t severity \u003d queryData.getValueAt(row, 1).capitalize()\n\t count \u003d queryData.getValueAt(row, 2)\n\t\n\t if mcm_val \u003d\u003d MCM and count \u003e 0:\n\t existing_priorities.add(severity)\n\t\n\t# Find the highest one that exists\n\tfor priority in priority_order:\n\t if priority in existing_priorities:\n\t myPriority \u003d priority\n\t break\n\t\n\tself.custom.status \u003d myPriority" }, "persistent": true }, "custom.status": { "persistent": true }, "params.value": { "paramDirection": "input", "persistent": true } }, "props": { "defaultSize": { "height": 50, "width": 300 } }, "root": { "children": [ { "events": { "dom": { "onClick": { "config": { "script": "\tsystem.perspective.navigate(self.view.params.value.tagProps[0])" }, "scope": "G", "type": "script" } } }, "meta": { "name": "Label" }, "position": { "grow": 1 }, "propConfig": { "props.style.classes": { "binding": { "config": { "path": "view.custom.status" }, "transforms": [ { "fallback": "State-Styles/Background-Fill/State5", "inputType": "scalar", "mappings": [ { "input": "High", "output": "State-Styles/Background-Fill/State1" }, { "input": "Medium", "output": "State-Styles/Background-Fill/State2" }, { "input": "Low", "output": "State-Styles/Background-Fill/State3" }, { "input": "Diagnostic", "output": "State-Styles/Background-Fill/State4" } ], "outputType": "style-list", "type": "map" } ], "type": "property" } }, "props.text": { "binding": { "config": { "path": "view.custom.status" }, "transforms": [ { "fallback": "HEALTHY", "inputType": "scalar", "mappings": [ { "input": "Diagnostic", "output": "DIAGNOSTIC" }, { "input": "Low", "output": "HALF WORKFLOW" }, { "input": "Medium", "output": "CONTROLLED STOP" }, { "input": "High", "output": "UNCONTROLLED STOP" } ], "outputType": "scalar", "type": "map" } ], "type": "property" } } }, "props": { "style": { "borderColor": "#555555", "borderStyle": "none", "cursor": "pointer", "fontSize": 12, "marginBottom": 8, "marginTop": 8, "textAlign": "center" }, "textStyle": { "fontSize": 12, "textAlign": "center" } }, "type": "ia.display.label" } ], "meta": { "name": "root" }, "props": { "direction": "column" }, "type": "ia.container.flex" } }