BNA8/.resources/1c9b8b5ab6466f22c7c8871420ce8fc5cc227c168cbb71bd1196ac7530a52847

410 lines
10 KiB
Plaintext

{
"custom": {
"counts": {
"Critical": 0,
"Diagnostic": 0,
"High": 1,
"Low": 1,
"Medium": 0,
"Total": 2
},
"totalAlarms": {
"$": [
"ds",
192,
1752066852881
],
"$columns": [
{
"data": [
null,
"MCM01",
"MCM01"
],
"name": "Location",
"type": "String"
},
{
"data": [
"Low",
"High",
"Low"
],
"name": "Priority",
"type": "String"
},
{
"data": [
1,
1,
1
],
"name": "Count",
"type": "Long"
}
]
}
},
"params": {
"value": {
"tagProps": [
"MCM01",
"value",
"value",
"value",
"value",
"value",
"value",
"value",
"value",
"value"
]
}
},
"propConfig": {
"custom.counts": {
"persistent": true
},
"custom.totalAlarms": {
"binding": {
"config": {
"polling": {
"enabled": true,
"rate": "3"
},
"queryPath": "GetActiveAlarmsByLocationAndPriority"
},
"type": "query"
},
"onChange": {
"enabled": null,
"script": "\tMCM \u003d self.params.value.tagProps[0]\n\tqueryData \u003d currentValue.value\n\t\n\t# Initialize counts\n\tcounts \u003d {\n\t \"Critical\": 0,\n\t \"High\": 0,\n\t \"Medium\": 0,\n\t \"Low\": 0,\n\t \"Diagnostic\": 0,\n\t \"Total\": 0\n\t}\n\t\n\t# Loop through dataset and aggregate\n\tfor row in range(queryData.rowCount):\n\t mcm_val \u003d queryData.getValueAt(row, 0)\n\t severity \u003d queryData.getValueAt(row, 1)\n\t count \u003d queryData.getValueAt(row, 2)\n\t\n\t if mcm_val \u003d\u003d MCM:\n\t key \u003d severity.capitalize()\n\t if key in counts:\n\t counts[key] +\u003d count\n\t counts[\"Total\"] +\u003d count\n\t \n\tself.custom.counts \u003d counts"
},
"persistent": true
},
"params.value": {
"paramDirection": "input",
"persistent": true
},
"params.value.tagProps": {
"onChange": {
"enabled": null,
"script": "\tsystem.perspective.print(currentValue.value[0])"
}
}
},
"props": {
"defaultSize": {
"height": 50,
"width": 300
}
},
"root": {
"children": [
{
"children": [
{
"meta": {
"name": "Label_0"
},
"position": {
"basis": "32px"
},
"props": {
"style": {
"classes": "Text-Styles/Ariel-Bold-12pt",
"textAlign": "center"
},
"text": "High"
},
"type": "ia.display.label"
},
{
"meta": {
"name": "Label_1"
},
"position": {
"basis": "32px"
},
"props": {
"style": {
"classes": "Text-Styles/Ariel-Bold-12pt",
"textAlign": "center"
},
"text": "Med"
},
"type": "ia.display.label"
},
{
"meta": {
"name": "Label_2"
},
"position": {
"basis": "32px"
},
"props": {
"style": {
"classes": "Text-Styles/Ariel-Bold-12pt",
"textAlign": "center"
},
"text": "Low"
},
"type": "ia.display.label"
},
{
"meta": {
"name": "Label_3"
},
"position": {
"basis": "32px"
},
"props": {
"style": {
"classes": "Text-Styles/Ariel-Bold-12pt",
"textAlign": "center"
},
"text": "Diag"
},
"type": "ia.display.label"
},
{
"meta": {
"name": "Label_4"
},
"position": {
"basis": "32px"
},
"props": {
"style": {
"classes": "Text-Styles/Ariel-Bold-12pt",
"textAlign": "center"
},
"text": "Total"
},
"type": "ia.display.label"
}
],
"meta": {
"name": "FlexContainer"
},
"position": {
"basis": "25px"
},
"props": {
"justify": "space-between"
},
"type": "ia.container.flex"
},
{
"children": [
{
"meta": {
"name": "Label_0"
},
"position": {
"basis": "32px"
},
"propConfig": {
"props.text": {
"binding": {
"config": {
"path": "view.custom.counts.High"
},
"type": "property"
}
}
},
"props": {
"style": {
"classes": "Text-Styles/Ariel-Bold-12pt",
"textAlign": "center"
}
},
"type": "ia.display.label"
},
{
"meta": {
"name": "Label_1"
},
"position": {
"basis": "32px"
},
"propConfig": {
"props.text": {
"binding": {
"config": {
"path": "view.custom.counts.Medium"
},
"type": "property"
}
}
},
"props": {
"style": {
"classes": "Text-Styles/Ariel-Bold-12pt",
"textAlign": "center"
}
},
"type": "ia.display.label"
},
{
"meta": {
"name": "Label_2"
},
"position": {
"basis": "32px"
},
"propConfig": {
"props.text": {
"binding": {
"config": {
"path": "view.custom.counts.Low"
},
"type": "property"
}
}
},
"props": {
"style": {
"classes": "Text-Styles/Ariel-Bold-12pt",
"textAlign": "center"
}
},
"type": "ia.display.label"
},
{
"meta": {
"name": "Label_3"
},
"position": {
"basis": "32px"
},
"propConfig": {
"props.text": {
"binding": {
"config": {
"path": "view.custom.counts.Diagnostic"
},
"type": "property"
}
}
},
"props": {
"style": {
"classes": "Text-Styles/Ariel-Bold-12pt",
"textAlign": "center"
}
},
"type": "ia.display.label"
},
{
"meta": {
"name": "Label_4"
},
"position": {
"basis": "32px"
},
"propConfig": {
"props.text": {
"binding": {
"config": {
"path": "view.custom.counts.Total"
},
"type": "property"
}
}
},
"props": {
"style": {
"classes": "Text-Styles/Ariel-Bold-12pt",
"textAlign": "center"
}
},
"type": "ia.display.label"
}
],
"meta": {
"name": "FlexContainer_1"
},
"position": {
"basis": "25px"
},
"props": {
"justify": "space-between"
},
"type": "ia.container.flex"
}
],
"meta": {
"name": "root"
},
"propConfig": {
"custom.has_role": {
"binding": {
"config": {
"expression": "{session.custom.fc}"
},
"transforms": [
{
"code": "\trme_role \u003d value +\"-rme-all\"\n\troles \u003d (self.session.props.auth.user.roles)\n\tif (rme_role.lower() in roles \n\tor rme_role.upper() in roles):\n\t\treturn True\n\telse:\n\t\treturn False",
"type": "script"
}
],
"type": "expr"
}
},
"custom.status": {
"binding": {
"config": {
"fallbackDelay": 2.5,
"mode": "indirect",
"references": {
"0": "{view.params.tagProps[0]}",
"fc": "{session.custom.fc}"
},
"tagPath": "[{fc}_SCADA_TAG_PROVIDER]{0}/ALARMST"
},
"transforms": [
{
"expression": "if(isNull({value}), 0, {value})",
"type": "expression"
},
{
"fallback": null,
"inputType": "scalar",
"mappings": [
{
"input": 4,
"output": 1
},
{
"input": 3,
"output": 2
},
{
"input": 2,
"output": 3
},
{
"input": 1,
"output": 4
},
{
"input": 0,
"output": 5
}
],
"outputType": "scalar",
"type": "map"
}
],
"type": "tag"
}
}
},
"props": {
"direction": "column"
},
"type": "ia.container.flex"
}
}