50 lines
1.8 KiB
Plaintext
50 lines
1.8 KiB
Plaintext
def detailed_view(self, tag_name, device_id, area):
|
|
"""
|
|
This function is used to naviagte to a detailed view
|
|
For example an on click event of a component.
|
|
The input paramter array to the component contains a reference to the PLC.
|
|
Detail view display all devices and equipement connected to a particular PLC.
|
|
The PLC ID is looked up in the "Configuration/DetailedViews" dictionary.
|
|
if found it navigates to the detailed view of the page_name {/<PLCid>}.
|
|
|
|
Args:
|
|
self: This is a reference to the object that is clicked on the screen.
|
|
tag_name: Hold information on the particular event that call this function.
|
|
area : The area within the FC
|
|
Returns:
|
|
None.
|
|
|
|
Raises:
|
|
None.
|
|
"""
|
|
device = tag_name.split("_")
|
|
device = device[0]
|
|
# Example: page_name = /F01
|
|
pages = system.tag.readBlocking(["Configuration/DetailedViews"])
|
|
pages_value = pages[0].value
|
|
pages_decoded = system.util.jsonDecode(pages_value)
|
|
for view , devices in pages_decoded.items():
|
|
if device in devices:
|
|
self.session.custom.searchId = tag_name
|
|
self.session.custom.deviceSearchId = device_id
|
|
system.perspective.sendMessage("plc-to-display", payload = {"device":view,"show_controls":True,"area":area}, scope = "page")
|
|
url_to_navigate = "/DetailedView/%s/%s" % (view, view)
|
|
system.perspective.navigate(page = url_to_navigate)
|
|
return
|
|
|
|
def navigate_to_deatiled_view(source):
|
|
page_id = config.project_config.get_project_config.global_project_page_ids.get(source)
|
|
if page_id:
|
|
url_to_navigate = "/DetailedView/%s/%s" % (page_id, page_id)
|
|
navigation.amzl_navigation.set_session_variables(self, page_id, False)
|
|
system.perspective.navigate(page = url_to_navigate)
|
|
elif not page_id:
|
|
data = source.split("/")
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|