BNA8/.resources/7a65169a1093814b34d3d20d02a25919c17c3cb9157a260b943c106f248e0b89

803 lines
24 KiB
Plaintext

{
"custom": {},
"params": {
"Status": "",
"tagProps": [
"MCM01",
"value",
"value",
"value",
"value",
"value",
"value",
"value",
"value",
"value"
]
},
"propConfig": {
"params.Status": {
"paramDirection": "input",
"persistent": true
},
"params.tagProps": {
"paramDirection": "input",
"persistent": true
},
"params.tagProps[0]": {
"onChange": {
"enabled": null,
"script": "\tsystem.perspective.print(currentValue.value)"
}
}
},
"props": {
"defaultSize": {
"height": 212,
"width": 336
}
},
"root": {
"children": [
{
"children": [
{
"meta": {
"name": "Label"
},
"position": {
"basis": "400px"
},
"propConfig": {
"props.text": {
"binding": {
"config": {
"path": "/root.custom.MCM"
},
"type": "property"
}
}
},
"props": {
"style": {
"textIndent": "10px"
},
"textStyle": {
"textIndent": "10px"
}
},
"type": "ia.display.label"
},
{
"meta": {
"name": "JAM",
"tooltip": {
"enabled": true,
"text": "Jams"
}
},
"position": {
"basis": "24px",
"shrink": 0
},
"props": {
"path": "autStand/Equipment/JAM",
"style": {
"marginRight": "5px"
}
},
"type": "ia.display.view"
},
{
"meta": {
"name": "Label_0"
},
"position": {
"basis": "10px",
"grow": 1
},
"propConfig": {
"props.text": {
"binding": {
"config": {
"path": "/root.custom.totalJams"
},
"type": "property"
}
}
},
"props": {
"style": {
"marginRight": "20px",
"overflow": "visible",
"textAlign": "end"
},
"textStyle": {
"textAlign": "end"
}
},
"type": "ia.display.label"
}
],
"meta": {
"name": "FlexContainer"
},
"position": {
"basis": "60px"
},
"props": {
"style": {
"backgroundColor": "#555555"
}
},
"type": "ia.container.flex"
},
{
"children": [
{
"meta": {
"name": "Label_0"
},
"position": {
"basis": "50px"
},
"props": {
"style": {
"fontFamily": "Roboto",
"fontSize": 12,
"marginLeft": 10
},
"text": "AREA",
"textStyle": {
"fontFamily": "Roboto",
"fontSize": 12
}
},
"type": "ia.display.label"
},
{
"meta": {
"name": "Label"
},
"position": {
"basis": "195px"
},
"propConfig": {
"props.text": {
"binding": {
"config": {
"path": "/root.custom.area_display"
},
"type": "property"
}
}
},
"props": {
"style": {
"fontSize": 12,
"marginLeft": 50
},
"textStyle": {
"fontSize": 12
}
},
"type": "ia.display.label"
}
],
"meta": {
"name": "FlexContainer_0"
},
"position": {
"basis": "80px"
},
"props": {
"style": {
"borderBottomColor": "#555555",
"borderBottomStyle": "solid",
"borderBottomWidth": 0.5,
"borderLeftColor": "#555555",
"borderLeftStyle": "none",
"borderLeftWidth": 0.5,
"borderRightColor": "#555555",
"borderRightStyle": "none",
"borderRightWidth": 0.5,
"borderTopColor": "#555555",
"borderTopStyle": "solid",
"borderTopWidth": 0.5
}
},
"type": "ia.container.flex"
},
{
"children": [
{
"meta": {
"name": "Label_0"
},
"position": {
"basis": "50px"
},
"props": {
"style": {
"fontFamily": "Roboto",
"fontSize": 12,
"marginLeft": 10
},
"text": "STATUS",
"textStyle": {
"fontFamily": "Roboto",
"fontSize": 12
}
},
"type": "ia.display.label"
},
{
"meta": {
"name": "EmbeddedView"
},
"position": {
"basis": "200px"
},
"propConfig": {
"props.params.value.tagProps[0]": {
"binding": {
"config": {
"expression": "{view.params.tagProps[0]}"
},
"type": "expr"
}
}
},
"props": {
"params": {
"value": {
"tagProps": [
null,
"value",
"value",
"value",
"value",
"value",
"value",
"value",
"value",
"value"
]
}
},
"path": "autStand/Equipment/Controller-Views/CommandControlStatus"
},
"type": "ia.display.view"
}
],
"meta": {
"name": "FlexContainer_1"
},
"position": {
"basis": "80px"
},
"props": {
"justify": "space-around",
"style": {
"borderBottomColor": "#555555",
"borderBottomStyle": "solid",
"borderBottomWidth": 0.5
}
},
"type": "ia.container.flex"
},
{
"children": [
{
"meta": {
"name": "Icon"
},
"position": {
"basis": "25px"
},
"propConfig": {
"props.color": {
"binding": {
"config": {
"path": "/root.custom.counts"
},
"transforms": [
{
"code": "\tfor v in value.values():\n\t\tif v \u003e 0:\n\t\t\treturn \"red\"\n\treturn \"\"",
"type": "script"
}
],
"type": "property"
}
}
},
"props": {
"path": "material/notifications_active",
"style": {
"classes": "",
"marginLeft": 10
}
},
"type": "ia.display.icon"
},
{
"meta": {
"name": "Label"
},
"position": {
"basis": "100px"
},
"props": {
"style": {
"fontFamily": "Roboto",
"fontSize": 12,
"marginLeft": 10
},
"text": "ACTIVE ALARMS",
"textStyle": {
"fontFamily": "Roboto",
"fontSize": 12
}
},
"type": "ia.display.label"
}
],
"meta": {
"name": "FlexContainer_3"
},
"position": {
"basis": "80px"
},
"type": "ia.container.flex"
},
{
"children": [
{
"children": [
{
"children": [
{
"meta": {
"name": "Label_0"
},
"position": {
"basis": "32px"
},
"props": {
"style": {
"fontSize": 10
},
"text": "High",
"textStyle": {
"fontSize": 10
}
},
"type": "ia.display.label"
},
{
"meta": {
"name": "Label_1"
},
"position": {
"basis": "32px"
},
"props": {
"style": {
"fontSize": 10
},
"text": "Medium",
"textStyle": {
"fontSize": 10
}
},
"type": "ia.display.label"
},
{
"meta": {
"name": "Label_2"
},
"position": {
"basis": "32px"
},
"props": {
"style": {
"fontSize": 10
},
"text": "Low",
"textStyle": {
"fontSize": 10
}
},
"type": "ia.display.label"
},
{
"meta": {
"name": "Label_3"
},
"position": {
"basis": "32px"
},
"props": {
"style": {
"fontSize": 10
},
"text": "Diag",
"textStyle": {
"fontSize": 10
}
},
"type": "ia.display.label"
},
{
"meta": {
"name": "Label_4"
},
"position": {
"basis": "32px"
},
"props": {
"style": {
"fontSize": 10
},
"text": "Total",
"textStyle": {
"fontSize": 10
}
},
"type": "ia.display.label"
}
],
"meta": {
"name": "FlexContainer"
},
"position": {
"basis": "200px"
},
"props": {
"justify": "space-between"
},
"type": "ia.container.flex"
},
{
"children": [
{
"meta": {
"name": "Label_0"
},
"position": {
"basis": "32px"
},
"props": {
"style": {
"fontSize": 10,
"textAlign": "center"
},
"text": 23
},
"scripts": {
"customMethods": [],
"extensionFunctions": null,
"messageHandlers": [
{
"messageType": "update-alarm-count",
"pageScope": false,
"script": "\thigh \u003d payload.get(\"High\",0)\n\tself.props.text \u003d high",
"sessionScope": false,
"viewScope": true
}
]
},
"type": "ia.display.label"
},
{
"meta": {
"name": "Label_1"
},
"position": {
"basis": "32px"
},
"props": {
"style": {
"fontSize": 10,
"textAlign": "center"
},
"text": 2,
"textStyle": {
"fontSize": 10,
"textAlign": "center"
}
},
"scripts": {
"customMethods": [],
"extensionFunctions": null,
"messageHandlers": [
{
"messageType": "update-alarm-count",
"pageScope": false,
"script": "\tmedium \u003d payload.get(\"Medium\",0)\n\tself.props.text \u003d medium",
"sessionScope": false,
"viewScope": true
}
]
},
"type": "ia.display.label"
},
{
"meta": {
"name": "Label_2"
},
"position": {
"basis": "32px"
},
"props": {
"style": {
"fontSize": 10,
"textAlign": "center"
},
"text": 10,
"textStyle": {
"fontSize": 10,
"textAlign": "center"
}
},
"scripts": {
"customMethods": [],
"extensionFunctions": null,
"messageHandlers": [
{
"messageType": "update-alarm-count",
"pageScope": false,
"script": "\tlow \u003d payload.get(\"Low\",0)\n\tself.props.text \u003d low",
"sessionScope": false,
"viewScope": true
}
]
},
"type": "ia.display.label"
},
{
"meta": {
"name": "Label_3"
},
"position": {
"basis": "32px"
},
"props": {
"style": {
"fontSize": 10,
"textAlign": "center"
},
"text": 0,
"textStyle": {
"fontSize": 10,
"textAlign": "center"
}
},
"scripts": {
"customMethods": [],
"extensionFunctions": null,
"messageHandlers": [
{
"messageType": "update-alarm-count",
"pageScope": false,
"script": "\tdiag \u003d payload.get(\"Diagnostic\",0)\n\tself.props.text \u003d diag",
"sessionScope": false,
"viewScope": true
}
]
},
"type": "ia.display.label"
},
{
"meta": {
"name": "Label_4"
},
"position": {
"basis": "32px"
},
"props": {
"style": {
"fontSize": 10,
"textAlign": "center"
},
"text": 35,
"textStyle": {
"fontSize": 10,
"textAlign": "center"
}
},
"scripts": {
"customMethods": [],
"extensionFunctions": null,
"messageHandlers": [
{
"messageType": "update-alarm-count",
"pageScope": false,
"script": "\tcritical \u003d payload.get(\"Critical\",0)\n\thigh \u003d payload.get(\"High\",0)\n\tmed \u003d payload.get(\"Medium\",0)\n\tlow \u003d payload.get(\"Low\",0)\n\tdiag \u003d payload.get(\"Diagnostic\",0)\n\t\n\ttotal \u003d critical + high + med + low + diag\n\tself.props.text \u003d total\n\t",
"sessionScope": false,
"viewScope": true
}
]
},
"type": "ia.display.label"
}
],
"meta": {
"name": "FlexContainer_1"
},
"position": {
"basis": "200px"
},
"props": {
"justify": "space-between"
},
"type": "ia.container.flex"
}
],
"meta": {
"name": "FlexContainer"
},
"position": {
"basis": "334px"
},
"props": {
"direction": "column"
},
"type": "ia.container.flex"
}
],
"meta": {
"name": "FlexContainer_2"
},
"position": {
"basis": "80px"
},
"props": {
"style": {
"marginBottom": 5,
"marginLeft": 10,
"marginRight": 10
}
},
"type": "ia.container.flex"
}
],
"custom": {
"counts": {
"Critical": 0,
"Diagnostic": 0,
"High": 23,
"Low": 10,
"Medium": 2
}
},
"events": {
"dom": {
"onClick": {
"config": {
"script": "\n\tpage \u003d self.view.params.tagProps[0]\n\t\n\tsystem.perspective.navigate(\"/\"+ page)"
},
"scope": "G",
"type": "script"
}
}
},
"meta": {
"name": "root"
},
"propConfig": {
"custom.MCM": {
"binding": {
"config": {
"path": "view.params.tagProps[0]"
},
"type": "property"
}
},
"custom.Total": {
"binding": {
"config": {
"expression": "{this.custom.counts.Critical} + {this.custom.counts.Diagnostic} + {this.custom.counts.High} + {this.custom.counts.Low} + {this.custom.counts.Medium}"
},
"type": "expr"
}
},
"custom.area_display": {
"binding": {
"config": {
"expression": "jsonGet({this.custom.plc_dict}, \"Area\")"
},
"type": "expr"
}
},
"custom.counts": {
"onChange": {
"enabled": null,
"script": "\tsystem.perspective.sendMessage(\"update-alarm-count\", self.custom.counts, \"view\")"
}
},
"custom.plc_dict": {
"binding": {
"config": {
"fallbackDelay": 2.5,
"mode": "indirect",
"references": {
"fc": "{session.custom.fc}"
},
"tagPath": "[{fc}_SCADA_TAG_PROVIDER]Configuration/PLC"
},
"transforms": [
{
"expression": "jsonGet({value}, {view.params.tagProps[0]})",
"type": "expression"
}
],
"type": "tag"
}
},
"custom.table": {
"binding": {
"config": {
"polling": {
"enabled": true,
"rate": "3"
},
"queryPath": "autStand/Alarms/GetActiveAlarmsByLocationAndPriority"
},
"type": "query"
},
"onChange": {
"enabled": null,
"script": "\ttry:\n\t\tMCM \u003d self.view.params.tagProps[0]\n\t\tdata \u003d currentValue.value\n\t\t\n\t\t# Convert dataset to PyDataSet\n\t\trows \u003d system.dataset.toPyDataSet(data)\n\t\t\n\t\t# Initialize counts dictionary with first-letter uppercase keys\n\t\tcounts \u003d {\n\t\t\t\"Low\": 0,\n\t\t\t\"Medium\": 0,\n\t\t\t\"High\": 0,\n\t\t\t\"Critical\": 0,\n\t\t\t\"Diagnostic\": 0\n\t\t}\n\t\t\n\t\t# Loop through rows and filter for current MCM\n\t\tfor row in rows:\n\t\t\tif row[\"Location\"] \u003d\u003d MCM:\n\n\t\t\t\tpriority \u003d row[\"Priority\"].capitalize()\n\t\t\t\tif priority in counts:\n\t\t\t\t\tcounts[priority] \u003d row[\"Count\"]\n\t\t\n\t\tself.custom.counts \u003d counts\n\t\n\texcept Exception as e:\n\t\tsystem.perspective.print(\"Errors: \" + str(e))"
}
},
"custom.totalJams": {
"binding": {
"config": {
"parameters": {
"location": "{this.custom.MCM}",
"priority": "3"
},
"polling": {
"enabled": true,
"rate": "3"
},
"queryPath": "autStand/Alarms/Active"
},
"transforms": [
{
"code": "\t# value is a dataset returned from your SQL query\n\tfrom java.util import HashSet\n\t\n\tunique_devices \u003d HashSet()\n\t\n\t# iterate rows\n\tfor rowIndex in range(value.getRowCount()):\n\t device \u003d value.getValueAt(rowIndex, \"Description\")\n\t tag \u003d value.getValueAt(rowIndex, \"Tag\")\n\t location \u003d value.getValueAt(rowIndex, \"Location\")\n\t\n\t # match for TPE devices that are jammed and match MCM area\n\t if (\n\t device\n\t and tag\n\t and \"TPE\" in str(device)\n\t and \"Jammed\" in str(tag)\n\t and str(location) \u003d\u003d str(self.custom.MCM)\n\t ):\n\t unique_devices.add(device)\n\t\n\t# return total unique jammed device count\n\treturn unique_devices.size()",
"type": "script"
}
],
"type": "query"
}
},
"meta.visible": {
"binding": {
"config": {
"expression": "if({session.custom.covert} \u003d False \u0026\u0026 {this.custom.status} \u003d 5, False, True)"
},
"type": "expr"
}
}
},
"props": {
"direction": "column",
"style": {
"animationFillMode": "both",
"borderBottomLeftRadius": 10,
"borderBottomRightRadius": 10,
"borderColor": "#555555",
"borderStyle": "solid",
"borderTopLeftRadius": 10,
"borderTopRightRadius": 10,
"borderWidth": 1,
"box-shadow": "5px 5px 5px grey",
"classes": "Background-Styles/Controller",
"cursor": "pointer"
}
},
"type": "ia.container.flex"
}
}