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

52 lines
1.7 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
#Orchestrator settings
def SettingsUpdate(inGSettings):
# New way to add CP defs in orchestrator - no gSettings..
Orchestrator.OrchestratorWebCPUpdate(inGSettings=inGSettings,inCPKeyStr="TEST",inHTMLRenderDef=CPRender, inJSONGeneratorDef=JSONGenerator, inJSInitGeneratorDef=JSInitGenerator)
return inGSettings