You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ORPA-pyOpenRPA/Orchestrator/ControlPanel/CP_Test.py

57 lines
1.9 KiB

# !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
# Test JSON generator when page init
def JSONGenerator():
lJSONDict=[1,2,2,4,2,2,2]
return lJSONDict
# Test JS when page init
def JSInitGenerator():
lJSCheckVersion="""
lT = 9;
lY="123";
//console.log(lT+1);
if (lT==9) {
//alert(123)
}
"""
return lJSCheckVersion
def test():
#Orchestrator.WebRequestGet()
Orchestrator.WebRequestResponseSend("Hello my friend!")
#Orchestrator settings
def SettingsUpdate(inGSettings):
# New way to add CP defs in orchestrator - no gSettings..
Orchestrator.WebCPUpdate(inGSettings=inGSettings, inCPKeyStr="TEST", inHTMLRenderDef=CPRender, inJSONGeneratorDef=JSONGenerator, inJSInitGeneratorDef=JSInitGenerator)
Orchestrator.WebURLConnectDef(inMethodStr="GET", inURLStr="/test", inMatchTypeStr="Equal", inDef=test, inUACBool=False)
return inGSettings