Modified the alarm row click event to handle the case when alarm comes from the MCM. Now highliting the component is universal and no longer requires params or extra bindings.

This commit is contained in:
guga kakhadze 2025-06-26 17:06:50 +04:00
parent f98724dad6
commit 6ad1847adc
5 changed files with 121 additions and 40 deletions

View File

@ -0,0 +1,19 @@
{
"base": {
"animation": {
"duration": "2.5s",
"timingFunction": "ease-in-out",
"keyframes": {
"0%": {
"boxShadow": "0 0 12px 5px rgba(255, 255, 0, 0.8)"
},
"50%": {
"boxShadow": "0 0 20px 8px rgba(255, 255, 0, 1)"
},
"100%": {
"boxShadow": "0 0 5px 2px rgba(255, 255, 0, 0.3)"
}
}
}
}
}

View File

@ -7,13 +7,18 @@ def handleTagHighlight(view, currentValue):
splitedTag = str(tag).split("/")
deviceName = splitedTag[-1]
system.perspective.print(splitedTag)
tagCopy = tag
Docked_East_Map = {
"VFD" : "Docked-East-VFD",
"MCM" : "Docked-East-MCM"
}
Docked_East_View = Docked_East_Map["VFD"]
if "PE" in deviceName:
tag = "/".join(splitedTag[:2]) + "/Conveyor/" + deviceName[:-3] + "VFD1"
system.perspective.print(tag)
if "MCM" in deviceName:
Docked_East_View = Docked_East_Map["MCM"]
components = view.rootContainer.getChildren()
@ -28,8 +33,8 @@ def handleTagHighlight(view, currentValue):
tagPath = tagsList[0]
if tag == tagPath:
child.props.params["isHighlighted"] = True
system.perspective.openDock('Docked-East-VFD', params={'tagProps': tagProps})
child.props.style["classes"] = "Highlight/Pulse"
system.perspective.openDock(Docked_East_View, params={'tagProps': tagProps})
return True
return False

View File

@ -0,0 +1,18 @@
{
"base": {
"animation": {
"duration": "2.5s",
"keyframes": {
"0%": {
"boxShadow": "0 0 12px 5px rgba(255, 255, 0, 0.8)"
},
"50%": {
"boxShadow": "0 0 20px 8px rgba(255, 255, 0, 1)"
},
"100%": {
"boxShadow": "0 0 5px 2px rgba(255, 255, 0, 0.3)"
}
}
}
}
}

View File

@ -482,7 +482,6 @@
],
"custom": {
"priorities": {
"critical": false,
"diagnostic": false,
"high": false,
"low": false,
@ -690,7 +689,7 @@
"component": {
"onRowClick": {
"config": {
"script": "\tdata \u003d self.props.selection.data\n\tif not data or len(data) !\u003d 1:\n\t return\n\t\n\trow \u003d data[0]\n\tclickedTagPath \u003d row.get(\"FullTag\", \"\")\n\tMCM \u003d row.get(\"Location\", \"\")\n\t\n\tMCM_Pages_Map \u003d {\n\t\t\"MCM01\": \"Detailed-Views/MCM01 Fluid Inbound Merges 1-4\",\n\t\t\"MCM02\": \"Detailed-Views/MCM02 Fluid Inbound Merges 5-7\",\n\t\t\"MCM03\": \"Detailed-Views/MCM03 Non Con\",\n\t\t\"MCM04\": \"Detailed-Views/MCM04 North Bulk Inbound, Fluid Outbound and Problem Solve\",\n\t\t\"MCM05\": \"Detailed-Views/MCM05 South Bulk Inbound, Fluid Outbound and Problem Solve\",\n\t\t\"MCM06\": \"Detailed-Views/MCM06 Non Con\",\n\t\t\"MCM07\": \"Detailed-Views/MCM07 Bypass\",\n\t}\n\t\n\n\tpage \u003d MCM_Pages_Map.get(MCM)\n\t\n\tif not page:\n\t return\n\t\t\n\tdevice \u003d row.get(\"Device\", \"\")\n\t\n\tif not device or not clickedTagPath:\n\t\treturn\n\n\tindex \u003d clickedTagPath.find(device)\n\tif index \u003d\u003d -1:\n\t\treturn\n\t\n\tpathToDevice \u003d clickedTagPath[:index + len(device)]\n\t\t\n\t# Navigate to target view, passing the tag to highlight\n\tsystem.perspective.navigate(view \u003d page, params \u003d {\u0027highlightTagPath\u0027:pathToDevice})\n\t\n\t\n"
"script": "\tdata \u003d self.props.selection.data\n\tif not data or len(data) !\u003d 1:\n\t return\n\t\n\trow \u003d data[0]\n\tclickedTagPath \u003d row.get(\"FullTag\", \"\")\n\tMCM \u003d row.get(\"Location\", \"\")\n\t\n\tMCM_Pages_Map \u003d {\n\t\t\"MCM01\": \"Detailed-Views/MCM01 Fluid Inbound Merges 1-4\",\n\t\t\"MCM02\": \"Detailed-Views/MCM02 Fluid Inbound Merges 5-7\",\n\t\t\"MCM03\": \"Detailed-Views/MCM03 Non Con\",\n\t\t\"MCM04\": \"Detailed-Views/MCM04 North Bulk Inbound, Fluid Outbound and Problem Solve\",\n\t\t\"MCM05\": \"Detailed-Views/MCM05 South Bulk Inbound, Fluid Outbound and Problem Solve\",\n\t\t\"MCM06\": \"Detailed-Views/MCM06 Non Con\",\n\t\t\"MCM07\": \"Detailed-Views/MCM07 Bypass\",\n\t}\n\t\n\n\tpage \u003d MCM_Pages_Map.get(MCM)\n\t\n\tif not page:\n\t return\n\t\t\n\tdevice \u003d row.get(\"Device\", \"\")\n\t\n\tif not device or not clickedTagPath:\n\t\treturn\n\n\tpathToDevice \u003d \"\"\n\n#\tcheck for the mcm\n\tif \"MCM\" in device:\n\t\tparts \u003d clickedTagPath.split(\"/\")\n\t\tpathToDevice \u003d \"/\".join(parts[:3])\n\n\telse:\n\t\tindex \u003d clickedTagPath.find(device)\n\t\tif index \u003d\u003d -1:\n\t\t\treturn\n\t\tpathToDevice \u003d clickedTagPath[:index + len(device)]\n\n\t\t\n\t# Navigate to target view, passing the tag to highlight\n\tsystem.perspective.navigate(view \u003d page, params \u003d {\u0027highlightTagPath\u0027:pathToDevice})\n\t\n\t\n"
},
"scope": "G",
"type": "script"
@ -1588,7 +1587,74 @@
}
},
"selection": {
"mode": "multiple interval"
"data": [
{
"Description": {
"style": {
"classes": "Alarms-Styles/High"
},
"value": "MCM01 - Hello world"
},
"Device": {
"style": {
"classes": "Alarms-Styles/High"
},
"value": "MCM01"
},
"Duration": {
"style": {
"classes": "Alarms-Styles/High"
},
"value": "01:05:19"
},
"FullTag": {
"style": {
"classes": "Alarms-Styles/High"
},
"value": "System/MCM01/MCM01/Beacon_Light"
},
"ID": {
"style": {
"classes": "Alarms-Styles/High"
},
"value": 12
},
"Location": {
"style": {
"classes": "Alarms-Styles/High"
},
"value": "MCM01"
},
"Priority": {
"style": {
"classes": "Alarms-Styles/High"
},
"value": "High"
},
"StartTimestamp": {
"style": {
"classes": "Alarms-Styles/High"
},
"value": {
"$": [
"ts",
0,
1750942947091
],
"$ts": 1750939070000
}
},
"Tag": {
"style": {
"classes": "Alarms-Styles/High"
},
"value": "MCM01.HMI.Beacon_Light"
}
}
],
"mode": "multiple interval",
"selectedColumn": "Location",
"selectedRow": 0
}
},
"type": "ia.display.table"
@ -3092,7 +3158,7 @@
"$": [
"ts",
192,
1750866213319
1750938073345
],
"$ts": 1750435156149
},
@ -3100,7 +3166,7 @@
"$": [
"ts",
192,
1750866213319
1750938073345
],
"$ts": 1750436956149
}
@ -4048,7 +4114,7 @@
"$": [
"ts",
192,
1750866213319
1750938073345
],
"$ts": 1750435156149
},
@ -4056,7 +4122,7 @@
"$": [
"ts",
192,
1750866213319
1750938073345
],
"$ts": 1750436956149
},

View File

@ -17,7 +17,6 @@
"directionLeft": false,
"forceFaultStatus": null,
"forceRunningStatus": null,
"isHighlighted": false,
"tagProps": [
"System/MCM01/Conveyor/UL1_3_VFD1",
"value",
@ -302,10 +301,6 @@
"paramDirection": "input",
"persistent": true
},
"params.isHighlighted": {
"paramDirection": "input",
"persistent": true
},
"params.tagProps": {
"paramDirection": "inout",
"persistent": true
@ -508,28 +503,6 @@
],
"type": "property"
}
},
"props.style.classes": {
"binding": {
"config": {
"expression": "{view.params.isHighlighted}"
},
"transforms": [
{
"fallback": "",
"inputType": "scalar",
"mappings": [
{
"input": true,
"output": "State-Styles/State101"
}
],
"outputType": "style-list",
"type": "map"
}
],
"type": "expr"
}
}
},
"props": {