From a1203b24daf95b1db2ef20e58d6d263e1c985ffb Mon Sep 17 00:00:00 2001 From: Salijoghli <107577102+Salijoghli@users.noreply.github.com> Date: Fri, 20 Jun 2025 19:01:01 +0400 Subject: [PATCH] Hit list and historical alarms now have colors based on priority --- .../views/Alarm-Views/RealTime/view.json | 43 +++++++------------ 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/SCADA_PERSPECTIVE_PARENT_PROJECT/com.inductiveautomation.perspective/views/Alarm-Views/RealTime/view.json b/SCADA_PERSPECTIVE_PARENT_PROJECT/com.inductiveautomation.perspective/views/Alarm-Views/RealTime/view.json index 3f2dc32..e40b20b 100644 --- a/SCADA_PERSPECTIVE_PARENT_PROJECT/com.inductiveautomation.perspective/views/Alarm-Views/RealTime/view.json +++ b/SCADA_PERSPECTIVE_PARENT_PROJECT/com.inductiveautomation.perspective/views/Alarm-Views/RealTime/view.json @@ -1507,6 +1507,12 @@ }, "queryPath": "GetAlarmsWithCount" }, + "transforms": [ + { + "code": "\n\tfrom system.dataset import toPyDataSet\n\n\tds \u003d toPyDataSet(value)\n\tdata \u003d []\n\n\tcolumn_names \u003d list(ds.columnNames)\n\n\tfor row in ds:\n\t\tpriority \u003d row[\"Priority\"] \n\n\t\t# Determine style based on priority\n\t\tif priority \u003d\u003d \"High\":\n\t\t\tstyle \u003d {\"backgroundColor\": \"#fd6059\"}\n\t\telif priority \u003d\u003d \"Low\":\n\t\t\tstyle \u003d {\"backgroundColor\": \"#fafa6c\"}\n\t\telif priority \u003d\u003d \"Diagnostic\":\n\t\t\tstyle \u003d {\"backgroundColor\": \"#5da0f9\"}\n\t\telif priority \u003d\u003d \"Medium\":\n\t\t\tstyle \u003d {\"backgroundColor\": \"#fca25f\"}\n\t\telif priority \u003d\u003d \"Critical\":\n\t\t\tstyle \u003d {\"backgroundColor\": \"#c86462\"}\n\t\telse:\n\t\t\tstyle \u003d {\"backgroundColor\": \"\"}\n\n\t\t# Apply style to all columns in this row\n\t\trow_dict \u003d {col: {\"value\": row[col], \"style\": style} for col in column_names}\n\t\tdata.append(row_dict)\n\n\treturn data\n", + "type": "script" + } + ], "type": "query" } }, @@ -2269,21 +2275,8 @@ "enabled": true }, "selection": { - "data": [ - { - "Count": 8, - "Description": "FL2078_2_VFD1 - Alarm", - "Duration": "00:02:08", - "FirstTimestamp": 1750417519000, - "LastTimestamp": 1750417548000, - "Location": "MCM01", - "Priority": "High", - "Tag": "FL2078_2_VFD1.HMI.Voltage" - } - ], - "mode": "multiple interval", - "selectedColumn": "Duration", - "selectedRow": 1 + "enableRowSelection": false, + "mode": "multiple interval" } }, "type": "ia.display.table" @@ -2961,6 +2954,12 @@ }, "queryPath": "GetAlarms" }, + "transforms": [ + { + "code": "\n\tfrom system.dataset import toPyDataSet\n\n\tds \u003d toPyDataSet(value)\n\tdata \u003d []\n\n\tcolumn_names \u003d list(ds.columnNames)\n\n\tfor row in ds:\n\t\tpriority \u003d row[\"Priority\"] \n\n\t\t# Determine style based on priority\n\t\tif priority \u003d\u003d \"High\":\n\t\t\tstyle \u003d {\"backgroundColor\": \"#fd6059\"}\n\t\telif priority \u003d\u003d \"Low\":\n\t\t\tstyle \u003d {\"backgroundColor\": \"#fafa6c\"}\n\t\telif priority \u003d\u003d \"Diagnostic\":\n\t\t\tstyle \u003d {\"backgroundColor\": \"#5da0f9\"}\n\t\telif priority \u003d\u003d \"Medium\":\n\t\t\tstyle \u003d {\"backgroundColor\": \"#fca25f\"}\n\t\telif priority \u003d\u003d \"Critical\":\n\t\t\tstyle \u003d {\"backgroundColor\": \"#c86462\"}\n\t\telse:\n\t\t\tstyle \u003d {\"backgroundColor\": \"\"}\n\n\t\t# Apply style to all columns in this row\n\t\trow_dict \u003d {col: {\"value\": row[col], \"style\": style} for col in column_names}\n\t\tdata.append(row_dict)\n\n\treturn data", + "type": "script" + } + ], "type": "query" } } @@ -4227,19 +4226,7 @@ "bottom": false }, "selection": { - "data": [ - { - "Description": "MCM01 - Hello world", - "Duration": "00:00:32", - "EndTimestamp": 1750427866000, - "ID": 39, - "Location": "MCM01", - "Priority": "Low", - "StartTimestamp": 1750427834000, - "Tag": "MCM01.HMI.Beacon_Light" - } - ], - "selectedRow": 0 + "enableRowSelection": false }, "style": { "margin": 20