# minor fixes in basic UAC (because of add 2 buttons in front)

dev-linux
Ivan Maslov 4 years ago
parent c5de069966
commit c7cfa66a62

@ -1,68 +0,0 @@
import psutil
import datetime
import logging
import os
import time
#DEFINITIONS
lProcessName = "OpenRPA_RobotScreenActive.exe"
lStartFilePath = os.path.join(os.getcwd(), "RobotScreenActive\\pyOpenRPA.Tools.RobotScreenActive_x64.cmd")
def RenderRobotScreenActive(inGlobalConfiguration):
#Subheader Variants
lSubheaderRunTrueText="State: <span style=\"color:green\">Turned on</span>"
lSubheaderRunFalseText="State: <span style=\"color:red\">Turned off</span>"
#Run button
#Такое большое количество слэшей связано с тем, что этот текст отправляется сначала в браузер, рендерится там, а потом отправляется на процессор оркестратора
import os
lRobotScreenActivePath = lStartFilePath
lOnClickRunButton=f"mGlobal.Controller.CMDRunText('start cmd /K {lRobotScreenActivePath}');"
# Activity update orchestrator
lActivityOrchestratorBuildPath = os.getcwd()
lActivityOrchestratorBuildPathEscaped = lActivityOrchestratorBuildPath.replace("\\","\\\\")
lActivityOrchestratorUpdateStr = f"mGlobal.Controller.CMDRunText(\"taskkill /f /im OpenRPA_Orchestrator.exe & timeout 2 & cd {lActivityOrchestratorBuildPathEscaped} & git reset --hard & git pull origin master & pyOpenRPA.Orchestrator_x64_administrator_startup.cmd\");".replace("\"","&quot;")
lActivityOrchestratorUpdateHTMLStr=f'<a onclick=\"{lActivityOrchestratorUpdateStr}\" style=\"color:orange\">Обновить orchestrator из GIT и перезапустить</a>'
#Force close button
lOnClickForceCloseButton=f"mGlobal.Controller.CMDRunText('taskkill /F /im {lProcessName}');"
#Result template
lResultDict={
"HeaderLeftText":"Keep active screen session",
"HeaderRightText":"Tech",
"DataStorageKey":"RobotScreenActive", #Use key for set current dict in mGlobal.DataStorage["DtaaStorageKey"] on client side
"SubheaderText":lSubheaderRunFalseText,
"BodyKeyValueList":[
{"Key":"Репозиторий","Value":lActivityOrchestratorUpdateHTMLStr}
],
"FooterText":"Last update: 9:38:00 09.10.2019",
"FooterButtonX2List":[
{"Text":"Turn on", "Color":"green", "Link":"", "OnClick": lOnClickRunButton.replace("\\","\\\\")}
],
"FooterButtonX1List":[
{"Text":"Kill", "Color":"red", "Link":"", "OnClick": lOnClickForceCloseButton.replace("\\","\\\\")}
]
}
#Check if process running
if CheckIfProcessRunning("OpenRPA_RobotScreenActive"):
lResultDict["SubheaderText"]=lSubheaderRunTrueText
#Process not running
#lResultDict["FooterText"]=f'Last update: {datetime.datetime.now().strftime("%H:%M:%S %d.%m.%Y")}'
lResultDict["FooterText"]=f'Footer text'
return lResultDict
def CheckIfProcessRunning(processName):
'''
Check if there is any running process that contains the given name processName.
'''
#Iterate over the all the running process
for proc in psutil.process_iter():
try:
# Check if process name contains the given name string.
if processName.lower() in proc.name().lower():
return True
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
pass
return False;
#Orchestrator settings
def SettingsUpdate(inDict):
#Add RobotRDPActive in control panel
inDict["ControlPanelDict"]["RobotList"].append({"RenderFunction": RenderRobotScreenActive,"KeyStr":"RobotScreenActive"})
return inDict

@ -6,6 +6,8 @@
# },
# "RDPActive": { # Robot RDP active module
# "ListRead": {} # Access to read RDP session list
# "RestartPC": {} # Restart PC
# "GITRestartOrchestrator": {} # Update GIT + restart orchestrator
# }
# }
# }

@ -664,6 +664,14 @@ $(document).ready(function() {
$(".openrpa-rdpactive-title").show() //Show section
$(".openrpa-robotrdpactive-control-panel-general").show() //Show section
}
//Turn on the restart PC button
if (lUACAsk(["Orchestrator","Controls","RestartPC"])) {
$(".openrpa-control-restartpc").show() //Show button
}
//Turn on the git update + restart orchestrator
if (lUACAsk(["Orchestrator","Controls","GITRestartOrchestrator"])) {
$(".openrpa-control-gitrestartorchestrator").show() //Show button
}
},
dataType: "text"
});

@ -135,13 +135,13 @@
<i class="right arrow icon"></i>
</div>
</div>
<div class="ui animated button openrpa-control-restartorchestrator" onclick="mGlobal.Controller.OrchestratorGITPullRestart();" style="display: none; margin-top: 5px;">
<div class="ui animated button openrpa-control-gitrestartorchestrator" onclick="mGlobal.Controller.OrchestratorGITPullRestart();" style="display: none; margin-top: 5px;">
<div class="visible content">Git pull + restart Orchestrator</div>
<div class="hidden content">
<i class="right arrow icon"></i>
</div>
</div>
<div class="ui animated button openrpa-control-restartorchestrator red" onclick="mGlobal.Controller.PCRestart();" style="display: none; margin-top: 5px;">
<div class="ui animated button openrpa-control-restartpc red" onclick="mGlobal.Controller.PCRestart();" style="display: none; margin-top: 5px;">
<div class="visible content">Restart PC</div>
<div class="hidden content">
<i class="right arrow icon"></i>

Loading…
Cancel
Save