From 050616561b90fe9431acd0f3835aea08b8ad5842 Mon Sep 17 00:00:00 2001 From: Ivan Maslov Date: Wed, 6 May 2020 16:33:19 +0300 Subject: [PATCH 1/2] # Add GIT CMD, Add OnClick escape in HTML render control panel --- .../pyOpenRPA/Orchestrator/Web/Index.xhtml | 28 +++++++++++++++++++ Utils/GITBranch_devIvan_master.cmd | 9 ++++++ Utils/GITRevisionLastUpdate.cmd | 4 +++ 3 files changed, 41 insertions(+) create mode 100644 Utils/GITBranch_devIvan_master.cmd create mode 100644 Utils/GITRevisionLastUpdate.cmd diff --git a/Sources/pyOpenRPA/Orchestrator/Web/Index.xhtml b/Sources/pyOpenRPA/Orchestrator/Web/Index.xhtml index 0ae0cfc2..db422ff4 100644 --- a/Sources/pyOpenRPA/Orchestrator/Web/Index.xhtml +++ b/Sources/pyOpenRPA/Orchestrator/Web/Index.xhtml @@ -254,6 +254,34 @@ function(lData,l2,l3) { var lResponseJSON=JSON.parse(lData) + ///Escape onclick + /// RenderRobotList + lResponseJSON["RenderRobotList"].forEach( + function(lItem){ + if ('FooterButtonX2List' in lItem) { + /// FooterButtonX2List + lItem["FooterButtonX2List"].forEach( + function(lItem2){ + if ('OnClick' in lItem) { + lOnClickEscaped = lItem["OnClick"]; + lOnClickEscaped = lOnClickEscaped.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """).replace(/'/g, "'"); + lItem["OnClick"] = lOnClickEscaped; + } + } + ); + /// FooterButtonX1List + lItem["FooterButtonX1List"].forEach( + function(lItem2){ + if ('OnClick' in lItem) { + lOnClickEscaped = lItem["OnClick"]; + lOnClickEscaped = lOnClickEscaped.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """).replace(/'/g, "'"); + lItem["OnClick"] = lOnClickEscaped; + } + } + ); + } + } + ); ///Сформировать HTML код новой таблицы lHTMLCode=mGlobal.GeneralGenerateHTMLCodeHandlebars(".openrpa-hidden-control-panel",lResponseJSON) //Присвоить ответ в mGlobal.Monitor.mResponseList diff --git a/Utils/GITBranch_devIvan_master.cmd b/Utils/GITBranch_devIvan_master.cmd new file mode 100644 index 00000000..500d1ad2 --- /dev/null +++ b/Utils/GITBranch_devIvan_master.cmd @@ -0,0 +1,9 @@ +cd %~dp0 +git push origin devIvan +git checkout master +git reset --hard +git pull +git merge devIvan +git push origin master +git checkout devIvan +pause >nul \ No newline at end of file diff --git a/Utils/GITRevisionLastUpdate.cmd b/Utils/GITRevisionLastUpdate.cmd new file mode 100644 index 00000000..378c325e --- /dev/null +++ b/Utils/GITRevisionLastUpdate.cmd @@ -0,0 +1,4 @@ +cd %~dp0 +git reset --hard +git pull +pause >nul \ No newline at end of file From 6b0eff175ec9512d30d4e9507dc4ce941f8cd441 Mon Sep 17 00:00:00 2001 From: Ivan Maslov Date: Wed, 6 May 2020 19:37:21 +0300 Subject: [PATCH 2/2] # Update control panel --- .../Settings/ControlPanel_RobotScreenActive.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Orchestrator/Settings/ControlPanel_RobotScreenActive.py b/Orchestrator/Settings/ControlPanel_RobotScreenActive.py index 64dc7e64..10c88af4 100644 --- a/Orchestrator/Settings/ControlPanel_RobotScreenActive.py +++ b/Orchestrator/Settings/ControlPanel_RobotScreenActive.py @@ -4,7 +4,7 @@ import logging import os #DEFINITIONS lProcessName = "OpenRPA_RobotScreenActive.exe" -lStartFilePath = os.path.join(os.getcwd(), "..\\Utils\\RobotScreenActive\\pyOpenRPA.Tools.RobotScreenActive_x64.cmd") +lStartFilePath = os.path.join(os.getcwd(), "RobotScreenActive\\pyOpenRPA.Tools.RobotScreenActive_x64.cmd") def RenderRobotScreenActive(inGlobalConfiguration): #Subheader Variants lSubheaderRunTrueText="State: Turned on" @@ -14,6 +14,11 @@ def RenderRobotScreenActive(inGlobalConfiguration): 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 @@ -23,6 +28,7 @@ def RenderRobotScreenActive(inGlobalConfiguration): "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":[ @@ -56,5 +62,5 @@ def CheckIfProcessRunning(processName): #Orchestrator settings def SettingsUpdate(inDict): #Add RobotRDPActive in control panel - inDict["ControlPanelDict"]["RobotList"].append({"RenderFunction": RenderRobotScreenActive , "KeyStr": "RobotScreenActive"}) + inDict["ControlPanelDict"]["RobotList"].append({"RenderFunction": RenderRobotScreenActive,"KeyStr":"RobotScreenActive"}) return inDict \ No newline at end of file