Hit list and historical alarms now have colors based on priority

This commit is contained in:
Salijoghli 2025-06-20 19:01:01 +04:00
parent 88bdae9da4
commit a1203b24da

View File

@ -1507,6 +1507,12 @@
}, },
"queryPath": "GetAlarmsWithCount" "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" "type": "query"
} }
}, },
@ -2269,21 +2275,8 @@
"enabled": true "enabled": true
}, },
"selection": { "selection": {
"data": [ "enableRowSelection": false,
{ "mode": "multiple interval"
"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
} }
}, },
"type": "ia.display.table" "type": "ia.display.table"
@ -2961,6 +2954,12 @@
}, },
"queryPath": "GetAlarms" "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" "type": "query"
} }
} }
@ -4227,19 +4226,7 @@
"bottom": false "bottom": false
}, },
"selection": { "selection": {
"data": [ "enableRowSelection": false
{
"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
}, },
"style": { "style": {
"margin": 20 "margin": 20