|
|
|
# !ATTENTION - Current Control panel works only from pyOpenRPA v1.2.0!
|
|
|
|
from pyOpenRPA import Orchestrator
|
|
|
|
def ControlPanelRenderDict(inGSettings):
|
|
|
|
# Example of the JS code in Python code
|
|
|
|
lJSCheckVersion = f"""
|
|
|
|
if (!('VersionStr' in mGlobal)) {{
|
|
|
|
window.location.reload(true);
|
|
|
|
}} else {{
|
|
|
|
if (mGlobal.VersionStr != "{inGSettings["VersionStr"]}") {{
|
|
|
|
window.location.reload(true);
|
|
|
|
}} else {{
|
|
|
|
$('div.orchestrator-version').html(mGlobal['VersionStr']);
|
|
|
|
}}
|
|
|
|
}}
|
|
|
|
"""
|
|
|
|
lResultDict={
|
|
|
|
"HeaderLeftText":"Version check",
|
|
|
|
"HeaderRightText":"Orchestrator",
|
|
|
|
"DataStorageKey":"", #Use key for set current dict in mGlobal.DataStorage["DataStorageKey"] on client side
|
|
|
|
"SubheaderText":f"<script>{lJSCheckVersion}</script>",
|
|
|
|
"BodyKeyValueList":[
|
|
|
|
{"Key": "Client", "Value": '<div class="orchestrator-version" style="display:inline;"></div>'},
|
|
|
|
{"Key": "Server", "Value": inGSettings["VersionStr"]},
|
|
|
|
],
|
|
|
|
"FooterText":"",
|
|
|
|
"FooterButtonX2List":[],
|
|
|
|
"FooterButtonX1List":[],
|
|
|
|
"GlobalStorage": "" # UNCOMMENT FOR DEBUG PURPOSE TO WATCH inGSettings on client side
|
|
|
|
}
|
|
|
|
return lResultDict
|
|
|
|
# Check in control panel, that process is runnning
|
|
|
|
|
|
|
|
#Orchestrator settings
|
|
|
|
def SettingsUpdate(inGSettings):
|
|
|
|
#Add RobotRDPActive in control panel
|
|
|
|
inGSettings["ControlPanelDict"]["RobotList"].append({"RenderFunction": ControlPanelRenderDict, "KeyStr": "VersionCheck"})
|
|
|
|
|
|
|
|
return inGSettings
|