66 lines
2.3 KiB
Plaintext
66 lines
2.3 KiB
Plaintext
def set_session_variables(self, search_id, covert):
|
|
"""
|
|
chnaged from:(self, search_id, device_search_id, plc_tag_path, display_cc, detailed_view)
|
|
This function is used to set the custom session variables in the perspective session.
|
|
|
|
Args:
|
|
self: This is a reference to the object that is calling this function.
|
|
search_id: Type string, this should be a UDT name.
|
|
device_search_id: Type string, display path of the alarm.
|
|
Returns:
|
|
None.
|
|
|
|
Raises:
|
|
None.
|
|
"""
|
|
self.session.custom.searchId = search_id
|
|
self.session.custom.covert = covert
|
|
|
|
|
|
def navigate_to_alarm(self, mhe_id):
|
|
"""
|
|
This function is used to navigate to the location of an alarm within SCADA
|
|
|
|
Args:
|
|
self: This is a reference to the object that is clicked on the screen.
|
|
event: This is a reference to the event that is clicked on the screen.
|
|
Returns:
|
|
None.
|
|
|
|
Raises:
|
|
Logs and error to the gateway if the Config/cfg tag is not found
|
|
or the LinkToPage field is empty.
|
|
"""
|
|
|
|
config = "%s/Config/cfg" % (mhe_id)
|
|
tags_to_read = system.tag.readBlocking(["Configuration/FC", "Configuration/DetailedViews"])
|
|
tag_provider = "[%s_SCADA_TAG_PROVIDER]" % (tags_to_read[0].value)
|
|
tags_config = system.tag.readBlocking([tag_provider + config])
|
|
tag_config_value = system.util.jsonDecode(tags_config[0].value)
|
|
if tag_config_value:
|
|
link_to_page = tag_config_value.get("LinkToPage")
|
|
if link_to_page == None or len(link_to_page) == 0:
|
|
error_message = "No page id found in Cfg tag"
|
|
system.perspective.openPopup("ErrorPopUP", "PopUp-Views/Error",
|
|
params ={"Error_message":error_message},
|
|
showCloseIcon = False, modal = True,
|
|
viewportBound = True,
|
|
draggable = False,
|
|
overlayDismiss = True
|
|
)
|
|
else:
|
|
url_to_navigate = "/DetailedView/%s/%s" % (link_to_page, link_to_page)
|
|
#Update the session variables to flash the pointers.
|
|
set_session_variables(self, mhe_id, False)
|
|
system.perspective.navigate(page = url_to_navigate)
|
|
else:
|
|
error_message = "No cfg tag found"
|
|
system.perspective.openPopup("ErrorPopUP", "PopUp-Views/Error",
|
|
params ={"Error_message":error_message},
|
|
showCloseIcon = False, modal = True,
|
|
viewportBound = True,
|
|
draggable = False,
|
|
overlayDismiss = True
|
|
)
|
|
|