47 lines
1.1 KiB
Plaintext
47 lines
1.1 KiB
Plaintext
def handleClick(data):
|
|
if not data or len(data) != 1:
|
|
return
|
|
|
|
row = data[0]
|
|
clickedTagPath = row.get("FullTag", "")
|
|
MCM = row.get("Location", "")
|
|
|
|
MCM_Pages_Map = {
|
|
"MCM01": "Detailed-Views/MCM01 Bulk Inbound",
|
|
"MCM02": "Detailed-Views/MCM02 Fluid Inbound",
|
|
"MCM03": "Detailed-Views/MCM03 Fluid Inbound",
|
|
"MCM04": "Detailed-Views/MCM04 Sorter Destination, Chutes and Bypass",
|
|
"MCM05": "Detailed-Views/MCM05 Sorter Destination and Chutes",
|
|
}
|
|
|
|
|
|
page = MCM_Pages_Map.get(MCM)
|
|
|
|
if not page:
|
|
return
|
|
|
|
device = row.get("Device", "")
|
|
|
|
if not device or not clickedTagPath:
|
|
return
|
|
|
|
pathToDevice = ""
|
|
|
|
# check for the mcm
|
|
if "MCM" in device:
|
|
parts = clickedTagPath.split("/")
|
|
pathToDevice = "/".join(parts[:3])
|
|
|
|
else:
|
|
index = clickedTagPath.find(device)
|
|
if index == -1:
|
|
return
|
|
pathToDevice = clickedTagPath[:index + len(device)]
|
|
|
|
priority = row.get("Priority", "")
|
|
|
|
#combining with priority
|
|
combined = pathToDevice + "||" + priority
|
|
|
|
# Navigate to target view, passing the tag to highlight
|
|
system.perspective.navigate(view = page, params = {'highlightTagPath': str(combined)}) |