diff --git a/Orchestrator/ControlPanel/CP_Test.py b/Orchestrator/ControlPanel/CP_Test.py new file mode 100644 index 00000000..c0b30172 --- /dev/null +++ b/Orchestrator/ControlPanel/CP_Test.py @@ -0,0 +1,34 @@ +# !ATTENTION - Current Control panel works only from pyOpenRPA v1.2.0! +from pyOpenRPA import Orchestrator +def CPRender(inGSettings): + + lJSCheckVersion=""" + lT = 9; + lY="123"; + console.log(lT+1); + if (lT==9) { + alert(123) + } + """ + + lResultDict={ + "HeaderLeftText":"CP_TEST", + "HeaderRightText":"NAME", + "DataStorageKey":"", #Use key for set current dict in mGlobal.DataStorage["DataStorageKey"] on client side + "SubheaderText":"", + "BodyKeyValueList":[ + {"Key": "HTMLLinkURL", "Value": Orchestrator.Web.Basic.HTMLLinkURL(inURLStr="test",inColorStr="orange")}, + {"Key": "HTMLLinkJSOnClick", "Value": Orchestrator.Web.Basic.HTMLLinkJSOnClick(inJSOnClickStr=lJSCheckVersion, inTitleStr="!Click me!",inColorStr="green")}, + ], + "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): + inGSettings["ControlPanelDict"]["RobotList"].append({"RenderFunction": CPRender, "KeyStr": "TEST"}) + return inGSettings \ No newline at end of file diff --git a/Orchestrator/ControlPanel/CP_VersionCheck.py b/Orchestrator/ControlPanel/CP_VersionCheck.py index 72998c7b..6b05a7fd 100644 --- a/Orchestrator/ControlPanel/CP_VersionCheck.py +++ b/Orchestrator/ControlPanel/CP_VersionCheck.py @@ -1,14 +1,23 @@ -import psutil, datetime, logging, os, json - # !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":"", + "SubheaderText":f"", "BodyKeyValueList":[ {"Key": "Client", "Value": '
'}, {"Key": "Server", "Value": inGSettings["VersionStr"]}, diff --git a/Orchestrator/OrchestratorSettings.py b/Orchestrator/OrchestratorSettings.py index c7e3d7b9..f5ccf58d 100644 --- a/Orchestrator/OrchestratorSettings.py +++ b/Orchestrator/OrchestratorSettings.py @@ -39,6 +39,9 @@ if __name__ == "__main__": # New init way - allow run as module -m PyOpenRPA.Orc from ControlPanel import CP_VersionCheck CP_VersionCheck.SettingsUpdate(inGSettings=gSettings) + from ControlPanel import CP_Test + CP_Test.SettingsUpdate(inGSettings=gSettings) + # Call the orchestrator def Orchestrator.Orchestrator(inGSettings=gSettings) diff --git a/Sources/pyOpenRPA/Orchestrator/Web/Basic.py b/Sources/pyOpenRPA/Orchestrator/Web/Basic.py new file mode 100644 index 00000000..96e5992c --- /dev/null +++ b/Sources/pyOpenRPA/Orchestrator/Web/Basic.py @@ -0,0 +1,26 @@ + +# Escape JS to the safe JS for the inline JS in HTML tags ATTENTION! Use it only if want to paste JS into HTML tag - not in