fixed the devices not showing when clicking on the alarms. fixed the alarms not showing in the docked views

This commit is contained in:
Salijoghli 2025-10-02 18:52:04 +04:00
parent 59e4bade57
commit cd29995150
17 changed files with 144 additions and 169 deletions

View File

@ -1,86 +0,0 @@
def deviceType(self, path, props):
try:
docked_view = "Docked-East-"
devices = []
tags = []
if "Conveyor" in path:
docked_view += "Conv"
devices = autStand.devices.build_device_table(self)
system.perspective.print(devices)
elif "VFD" in path:
docked_view += "VFD"
else:
docked_view += "Device"
tags = autStand.devices.getAllTags(self, props[0])
return [docked_view, tags, devices]
except Exception as e:
import traceback
msg = "Error in deviceType: {}\n{}".format(str(e), traceback.format_exc())
system.perspective.print(msg)
return None
def handleTagHighlight(view, currentValue):
tag_priority = currentValue.value
# --- CASE 1: Remove all highlights by applying CLEAR class ---
if str(tag_priority).upper() == "CLEAR":
for child in view.rootContainer.getChildren()[0].getChildren():
try:
currentClasses = child.props.style['classes'].split(" ")
filtered = [c for c in currentClasses if not c.startswith("Highlight/")]
child.props.style.classes = " ".join(filtered)
except:
pass
return False
if "||" not in tag_priority:
return
parts = str(tag_priority).split("||")
tag = parts[0]
splitedTag = tag.split("/")
deviceName = splitedTag[-1]
components = view.rootContainer.getChildren()[0].getChildren()
priority = parts[1]
foundMatch = False
# clear all highlights and apply new one when found
for child in components:
params = child.props.get("params", {})
tagProps = params.get("tagProps", {})
tagsList = list(tagProps)
if len(tagsList) == 0:
continue
# child.props.style.classes = ""
currentClasses = child.props.style['classes'].split(" ")
# strip only highlight-related classes
filtered = [c for c in currentClasses if not c.startswith("Highlight/")]
child.props.style["classes"] = " ".join(filtered)
tagPath = tagsList[0]
if tag == tagPath:
child.props.style["classes"] += " Highlight/Pulse-" + priority
path = child.props.get("path")
docked_view = deviceType(view, path, tagProps)
system.perspective.openDock(docked_view[0], params = {'tagProps':tagProps, 'tags': docked_view[1], 'devices':docked_view[2]})
foundMatch = True
return foundMatch

View File

@ -10,8 +10,8 @@
"attributes": {
"lastModification": {
"actor": "admin",
"timestamp": "2025-10-01T12:11:45Z"
"timestamp": "2025-10-02T14:49:19Z"
},
"lastModificationSignature": "8b3250bd65d1c5c62d6992352ca872434f34f6524bfce631ffa4446eb751adaa"
"lastModificationSignature": "fff221cd30604cabadf0c342e011706873f6b0aea7d804bc3c54c6451e20a63f"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View File

@ -658,7 +658,7 @@
"component": {
"onRowDoubleClick": {
"config": {
"script": "\n\tmyData \u003d self.props.selection.data\n\n\talarms.alarm_click.handleClick(myData)\n\t\n\t"
"script": "\n\tmyData \u003d self.props.selection.data\n\n\tautStand.Alarms.handleClick(myData)"
},
"scope": "G",
"type": "script"
@ -1559,46 +1559,28 @@
"filter": {
"enabled": true,
"results": {
"data": [
{
"Description": "S03-CH101 Full 1",
"Device": "S03_CH101",
"Duration": "21:03:27",
"FullTag": "System/MCM02/Chute/S03_CH101/Alarm/Full 1",
"ID": 16,
"Location": "MCM02",
"Priority": "Low",
"StartTimestamp": "Tue Sep 30 2025 18:19:44 GMT+0400 (Georgia Standard Time)",
"Tag": "S03_CH101.HMI.Alarm.Full 1"
},
{
"Description": "NCS1-1-SOL1 TEST",
"Device": "NCS1_1_SOL1",
"Duration": "21:03:27",
"FullTag": "System/MCM02/SOL/NCS1_1_SOL1/TEST",
"ID": 17,
"Location": "MCM02",
"Priority": "High",
"StartTimestamp": "Tue Sep 30 2025 18:19:44 GMT+0400 (Georgia Standard Time)",
"Tag": "NCS1_1_SOL1.HMI.Alarm.TEST"
},
{
"Description": "S03-CH101 Full 1",
"Device": "S03_CH101",
"Duration": "47:28:32",
"FullTag": "System/MCM02/Chute/S03_CH101/Alarm/Full 1",
"ID": 14,
"Location": "MCM02",
"Priority": "Low",
"StartTimestamp": "Mon Sep 29 2025 15:54:39 GMT+0400 (Georgia Standard Time)",
"Tag": "S03_CH101.HMI.Alarm.Full 1"
}
],
"enabled": true
}
},
"pager": {
"activeOption": 100
},
"selection": {
"data": [
{
"Description": "PS3-14 Jammed",
"Device": "PS3_14",
"Duration": "00:46:08",
"FullTag": "System/MCM02/Conveyor/PS3_14/Alarm/Jammed",
"ID": 24,
"Location": "MCM02",
"Priority": "High",
"StartTimestamp": "Thu Oct 02 2025 17:31:20 GMT+0400 (Georgia Standard Time)",
"Tag": "PS3_14.HMI.Alarm.Jammed"
}
],
"selectedColumn": "StartTimestamp",
"selectedRow": 0
}
},
"type": "ia.display.table"
@ -1656,17 +1638,17 @@
"$": [
"ts",
192,
1759319697855
1759411326186
],
"$ts": 1759319697855
"$ts": 1759411326185
},
"startDate": {
"$": [
"ts",
192,
1759319697855
1759411326185
],
"$ts": 1759317897855
"$ts": 1759409526185
}
},
"meta": {
@ -1932,9 +1914,9 @@
"$": [
"ts",
192,
1759319697855
1759411326186
],
"$ts": 1759319697855
"$ts": 1759411326185
}
},
"scripts": {
@ -2124,7 +2106,7 @@
"component": {
"onRowDoubleClick": {
"config": {
"script": "\t\n\tmyData \u003d self.props.selection.data\n\n\talarms.alarm_click.handleClick(myData)"
"script": "\n\tmyData \u003d self.props.selection.data\n\n\tautStand.Alarms.handleClick(myData)"
},
"scope": "G",
"type": "script"
@ -3267,22 +3249,22 @@
},
{
"custom": {
"customTime": true,
"customTime": false,
"endDate": {
"$": [
"ts",
192,
1759319940518
1759414649745
],
"$ts": 1759319940517
"$ts": 1759414649745
},
"startDate": {
"$": [
"ts",
192,
1759319940517
1759414649745
],
"$ts": 1759305540517
"$ts": 1759412849745
}
},
"meta": {
@ -3455,7 +3437,7 @@
}
},
"props": {
"formattedValue": "Sep 16, 2025 11:59 AM",
"formattedValue": "Oct 2, 2025 5:47 PM",
"style": {
"margin": 15
}
@ -3539,7 +3521,7 @@
}
},
"props": {
"formattedValue": "Oct 1, 2025 3:59 PM",
"formattedValue": "Oct 2, 2025 6:17 PM",
"style": {
"margin": 15
},
@ -3547,9 +3529,9 @@
"$": [
"ts",
192,
1759319940518
1759414649745
],
"$ts": 1759319940517
"$ts": 1759414649745
}
},
"scripts": {
@ -3833,6 +3815,8 @@
"children": [
{
"custom": {
"device_filters": null,
"duration_filter": null,
"hasNext": false,
"loading": false,
"max_duration": {
@ -3844,29 +3828,31 @@
"$ts": 1747562336635
},
"page_size": 100,
"priority_filters": "",
"priority_filters": null,
"source_id_filters": null,
"time_from_filter": {
"$": [
"ts",
192,
1759320109195
1759414649748
],
"$ts": 1758009540000
"$ts": 1759412849745
},
"time_to_filter": {
"$": [
"ts",
192,
1759319940518
1759414649748
],
"$ts": 1759319940517
}
"$ts": 1759414649745
},
"type_filters": null
},
"events": {
"component": {
"onRowDoubleClick": {
"config": {
"script": "\t\n\tmyData \u003d self.props.selection.data\n\n\talarms.alarm_click.handleClick(myData)"
"script": "\n\tmyData \u003d self.props.selection.data\n\n\tautStand.Alarms.handleClick(myData)"
},
"scope": "G",
"type": "script"
@ -4890,6 +4876,81 @@
"pager": {
"bottom": false
},
"selection": {
"data": [
{
"Description": {
"style": {
"classes": "Alarms-Styles/High"
},
"value": "PS3-14 Jammed"
},
"Device": {
"style": {
"classes": "Alarms-Styles/High"
},
"value": "PS3_14"
},
"Duration": {
"style": {
"classes": "Alarms-Styles/High"
},
"value": "01:17:58"
},
"EndTimestamp": {
"style": {
"classes": "Alarms-Styles/High"
},
"value": null
},
"FullTag": {
"style": {
"classes": "Alarms-Styles/High"
},
"value": "System/MCM02/Conveyor/PS3_14/Alarm/Jammed"
},
"ID": {
"style": {
"classes": "Alarms-Styles/High"
},
"value": 24
},
"Location": {
"style": {
"classes": "Alarms-Styles/High"
},
"value": "MCM02"
},
"Priority": {
"style": {
"classes": "Alarms-Styles/High"
},
"value": "High"
},
"StartTimestamp": {
"style": {
"classes": "Alarms-Styles/High"
},
"value": {
"$": [
"ts",
0,
1759414650062
],
"$ts": 1759411880000
}
},
"Tag": {
"style": {
"classes": "Alarms-Styles/High"
},
"value": "PS3_14.HMI.Alarm.Jammed"
}
}
],
"selectedColumn": "ID",
"selectedRow": 0
},
"style": {
"margin": 20
},

View File

@ -10,8 +10,8 @@
"attributes": {
"lastModification": {
"actor": "admin",
"timestamp": "2025-09-23T10:58:05Z"
"timestamp": "2025-10-02T14:45:00Z"
},
"lastModificationSignature": "4e60143624e4b229c8dabc6c01f6a372e1f521fdb7e9b41afd9182b546fd13ad"
"lastModificationSignature": "c69c88fd8c9f0205f07762e332fce7d77e7079d8dbe4c4f372dc25c3a15c1a1e"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -527,7 +527,7 @@
},
"transforms": [
{
"code": "\tparts \u003d value.split(\"/\")\n\tname \u003d parts[-1]\n\t\n\t# Split on \"_\" and remove the last part\n\tname_parts \u003d name.split(\"_\")\n\tnew_name \u003d \"_\".join(name_parts[:-1])\n\t\n\treturn new_name + \"_PE*,\" + new_name + \"_VFD*\"",
"code": "\treturn value.split(\"/\")[-1]",
"type": "script"
}
],
@ -1119,7 +1119,8 @@
},
"props": {
"alignItems": "flex-start",
"justify": "space-evenly"
"justify": "space-evenly",
"style": {}
},
"type": "ia.container.flex"
},
@ -1461,7 +1462,6 @@
"grow": 1
},
"props": {
"currentTabIndex": 3,
"menuType": "modern",
"tabSize": {
"width": 1000

View File

@ -10,8 +10,8 @@
"attributes": {
"lastModification": {
"actor": "admin",
"timestamp": "2025-09-23T10:58:06Z"
"timestamp": "2025-10-02T14:41:46Z"
},
"lastModificationSignature": "7ef3505384480030aba2f2feb68aef4ecc4e8f90ae3e12683bbe4d7de796e463"
"lastModificationSignature": "21af14631a98b96f000a434201ee503de37c1ff7f01be9a15662bae86998d2c8"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -1064,7 +1064,6 @@
"grow": 1
},
"props": {
"currentTabIndex": 2,
"menuType": "modern",
"tabSize": {
"width": 1000

View File

@ -10,8 +10,8 @@
"attributes": {
"lastModification": {
"actor": "admin",
"timestamp": "2025-09-23T08:56:27Z"
"timestamp": "2025-10-02T14:49:19Z"
},
"lastModificationSignature": "7d47667073e4bdf8c7eb038060fcf952008470c5759e707e340033ff5b54b3f8"
"lastModificationSignature": "55fa7ff476c82b73d207ceb99545a2fd8b2e09df1a3a7a1f598dcdc037b579ee"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -262,7 +262,7 @@
},
"transforms": [
{
"code": "\tparts \u003d value.split(\"/\")\n\tname \u003d parts[-1]\n\t\n\t# Split on \"_\" and remove the last part\n\tname_parts \u003d name.split(\"_\")\n\tnew_name \u003d \"_\".join(name_parts[:-1])\n\t\n\treturn new_name + \"_PE*,\" + new_name + \"_VFD*\"",
"code": "\treturn value.split(\"/\")[-1]",
"type": "script"
}
],
@ -1470,7 +1470,6 @@
"grow": 1
},
"props": {
"currentTabIndex": 2,
"menuType": "modern",
"tabSize": {
"width": 1000

View File

@ -8,7 +8,7 @@ def handleClick(data):
MCM_Pages_Map = {
"MCM01": "autStand/Detailed_Views/MCM01-FLUID INBOUND",
"MCM02": "autStand/Detailed_Views/MCM02-NC SORTER",
"MCM02": "autStand/Detailed_Views/MCM02-NON CON SORTER",
}

View File

@ -9,9 +9,9 @@
"attributes": {
"lastModification": {
"actor": "admin",
"timestamp": "2025-09-19T12:09:01Z"
"timestamp": "2025-10-02T13:24:28Z"
},
"hintScope": 2,
"lastModificationSignature": "c261f074467f77939e981711dd4ed7ed2bc0a823f4d265fe7acfcc55148cdc18"
"lastModificationSignature": "2b735064b583816593d39f70b86a3b234ced19aa19d90c4068ffc9e99b5d72c2"
}
}

View File

@ -4,17 +4,20 @@ def deviceType(self, path, props):
devices = []
tags = []
prop = props[0]
if "Conveyor" in path:
docked_view += "Conv"
devices = autStand.devices.build_device_table(self)
system.perspective.print(devices)
docked_view += "Conv"
system.perspective.print(path)
autStand.devices.build_device_mapping(prop)
devices = autStand.devices.build_device_table(self)
elif "VFD" in path:
docked_view += "VFD"
else:
docked_view += "Device"
tags = autStand.devices.getAllTags(self, props[0])
tags = autStand.devices.getAllTags(self, prop)
return [docked_view, tags, devices]
@ -64,7 +67,6 @@ def handleTagHighlight(view, currentValue):
if len(tagsList) == 0:
continue
# child.props.style.classes = ""
currentClasses = child.props.style['classes'].split(" ")

View File

@ -9,9 +9,9 @@
"attributes": {
"lastModification": {
"actor": "admin",
"timestamp": "2025-09-29T15:20:27Z"
"timestamp": "2025-10-02T14:24:19Z"
},
"hintScope": 2,
"lastModificationSignature": "fed5ae3429475fb225180ebea84965ceeeba3a0080a3775ef28f195a8b1c126d"
"lastModificationSignature": "bcb8d8e7a9940f99c75876afd34a4fe807da4f611bfddc4e62d13f0acf9f8dff"
}
}