diff --git a/Orchestrator/Settings/ControlPanel_RobotScreenActive.py b/Orchestrator/Settings/ControlPanel_RobotScreenActive.py deleted file mode 100644 index 5facfcfd..00000000 --- a/Orchestrator/Settings/ControlPanel_RobotScreenActive.py +++ /dev/null @@ -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: Turned on" - lSubheaderRunFalseText="State: Turned off" - #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("\"",""") - lActivityOrchestratorUpdateHTMLStr=f'Обновить orchestrator из GIT и перезапустить' - #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 \ No newline at end of file diff --git a/Orchestrator/Template_Settings_AccessUser.py b/Orchestrator/Template_Settings_AccessUser.py index 9c167175..e11679b8 100644 --- a/Orchestrator/Template_Settings_AccessUser.py +++ b/Orchestrator/Template_Settings_AccessUser.py @@ -6,6 +6,8 @@ # }, # "RDPActive": { # Robot RDP active module # "ListRead": {} # Access to read RDP session list +# "RestartPC": {} # Restart PC +# "GITRestartOrchestrator": {} # Update GIT + restart orchestrator # } # } # } diff --git a/Sources/pyOpenRPA/Orchestrator/Web/Index.js b/Sources/pyOpenRPA/Orchestrator/Web/Index.js index 56c80ba0..17d52f94 100644 --- a/Sources/pyOpenRPA/Orchestrator/Web/Index.js +++ b/Sources/pyOpenRPA/Orchestrator/Web/Index.js @@ -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" }); diff --git a/Sources/pyOpenRPA/Orchestrator/Web/Index.xhtml b/Sources/pyOpenRPA/Orchestrator/Web/Index.xhtml index bf4274db..672fda6c 100644 --- a/Sources/pyOpenRPA/Orchestrator/Web/Index.xhtml +++ b/Sources/pyOpenRPA/Orchestrator/Web/Index.xhtml @@ -135,13 +135,13 @@ -