From 145d8eb9cc40f0c4b33708795fb09fde990cabea Mon Sep 17 00:00:00 2001 From: Ivan Maslov Date: Sun, 13 Oct 2019 11:21:15 +0300 Subject: [PATCH] #OrchestratorControlPanelPreTest --- v1.0.1/Orchestrator/Web/Index.xhtml | 149 ++++++++++++++---- .../orchestratorConfiguration.json | 14 +- .../Orchestrator/orchestratorConfiguration.py | 18 +++ v1.0.1/Orchestrator/orchestratorServer.py | 23 +++ 4 files changed, 172 insertions(+), 32 deletions(-) create mode 100644 v1.0.1/Orchestrator/orchestratorConfiguration.py diff --git a/v1.0.1/Orchestrator/Web/Index.xhtml b/v1.0.1/Orchestrator/Web/Index.xhtml index da14bb22..58e2e3b9 100644 --- a/v1.0.1/Orchestrator/Web/Index.xhtml +++ b/v1.0.1/Orchestrator/Web/Index.xhtml @@ -215,7 +215,47 @@ dataType: "text" }); } - + //////////////////////////////// + ///////Control panel + /////////////////////////////// + ///Refresh control panel + mGlobal.Monitor.fControlPanelRefresh=function() { + ///Загрузка данных + $.ajax({ + type: "GET", + url: 'Monitor/ControlPanelDictGet', + data: '', + success: + function(lData,l2,l3) + { + var lResponseJSON=JSON.parse(lData) + ///Сформировать HTML код новой таблицы + lHTMLCode=mGlobal.GeneralGenerateHTMLCodeHandlebars(".openrpa-hidden-control-panel",lResponseJSON) + ///Очистить дерево + //mGlobal.ElementTree.fClear(); + ///Прогрузить новую таблицу + $(".openrpa-control-panel").html(lHTMLCode) + }, + dataType: "text" + }); + } + /// + mGlobal.Monitor.mControlPanelAutoUpdateSeconds=5; + mGlobal.Monitor.mControlPanelAutoUpdateSecondsCurrent=5; + mGlobal.Monitor.fControlPanelAutoUpdateRun=function(inRefreshSeconds) { + mGlobal.Monitor.mControlPanelAutoUpdateSeconds=inRefreshSeconds; + //Функция обновления текста кнопки обновления + lControlPanelUpdate=function() { + mGlobal.Monitor.mControlPanelAutoUpdateSecondsCurrent=mGlobal.Monitor.mControlPanelAutoUpdateSecondsCurrent-1 + if (mGlobal.Monitor.mControlPanelAutoUpdateSecondsCurrent==-1) { + mGlobal.Monitor.mControlPanelAutoUpdateSecondsCurrent=mGlobal.Monitor.mControlPanelAutoUpdateSecondsCurrent=mGlobal.Monitor.mControlPanelAutoUpdateSeconds; + mGlobal.Monitor.fControlPanelRefresh() + } + $(".openrpa-control-panel-general .openrpa-refresh-button").html("Refresh "+mGlobal.Monitor.mControlPanelAutoUpdateSecondsCurrent); + } + mGlobal.Monitor.mControlPanelAutoUpdateTimerId=setInterval(lControlPanelUpdate,1000) + } + mGlobal.Monitor.fControlPanelAutoUpdateRun(5); ///////////////////////////////////// ///Инициализация страницы //////////////////////////////////// @@ -315,47 +355,98 @@ {{activityType}} {{processPath}} {{activityDateTime}} - {{activityStartDateTime}} + {{activityStartDateTime}} {{/result}} +
+

+ + Plan log +

+
+ +
+
+
+ +
-
+

- Plan log + Robot control panel

-
-
-
-
diff --git a/v1.0.1/Orchestrator/orchestratorConfiguration.json b/v1.0.1/Orchestrator/orchestratorConfiguration.json index bbc684e9..9157e4bd 100644 --- a/v1.0.1/Orchestrator/orchestratorConfiguration.json +++ b/v1.0.1/Orchestrator/orchestratorConfiguration.json @@ -46,7 +46,7 @@ { "description":"Остановка Python консоли", "activityType":"processStop", - "time":"9:20", + "time":"19:20", "timeZone":"4", "processName":"OpenRPARobotDaemon.exe", "_flagCloseForce":"Признак, что процесс нужно принудительно закрыть (если флага нет, то на процесс просто посылается команда terminate)", @@ -66,6 +66,14 @@ "processArgs":"" } - ] - + ], + "ControlPanelDict":{ + "RefreshSeconds": 5, + "RobotList": [ + { + "RenderFunctionName":"RenderRobotR01", + "RenderFunctionModuleName":"orchestratorConfiguration" + } + ] + } } \ No newline at end of file diff --git a/v1.0.1/Orchestrator/orchestratorConfiguration.py b/v1.0.1/Orchestrator/orchestratorConfiguration.py new file mode 100644 index 00000000..115e584e --- /dev/null +++ b/v1.0.1/Orchestrator/orchestratorConfiguration.py @@ -0,0 +1,18 @@ +def RenderRobotR01(inGlobalConfiguration): + lResultDict={ + "HeaderLeftText":"Robot name", + "HeaderRightText":"R01", + "SubheaderText":"Состояние: Работает", + "BodyKeyValueList":[ + {"Key":"Дата запуска","Value":"10:00:09 01.09.2019"}, + {"Key":"Текущий шаг","Value":"Проведение заказа"}, + {"Key":"Время выполнения шага","Value":"20с."}, + {"Key":"Отчет робота","Value":"скачать"} + ], + "FooterText":"Дата изменения: 9:38:00 09.10.2019", + "FooterButtonX2List":[ + {"Text":"Вкл.", "Color":"green", "Link":""}, + {"Text":"Выкл.", "Color":"red", "Link":""} + ] + } + return lResultDict diff --git a/v1.0.1/Orchestrator/orchestratorServer.py b/v1.0.1/Orchestrator/orchestratorServer.py index ddac65ca..af655214 100644 --- a/v1.0.1/Orchestrator/orchestratorServer.py +++ b/v1.0.1/Orchestrator/orchestratorServer.py @@ -9,6 +9,7 @@ import PIL from PIL import ImageGrab from threading import Thread import orchestratorProcessor +import importlib def SaveScreenshot(inFilePath): # grab fullscreen @@ -100,6 +101,28 @@ class testHTTPServer_RequestHandler(BaseHTTPRequestHandler): message = json.dumps(mJSONConfigurationDict) # Write content as utf-8 data self.wfile.write(bytes(message, "utf8")) + if self.path == '/Monitor/ControlPanelDictGet': + # Send response status code + self.send_response(200) + # Send headers + self.send_header('Content-type','application/json') + self.end_headers() + #Create result JSON + lResultJSON={"RenderRobotList":[]} + lRenderFunctionsRobotList=mJSONConfigurationDict["ControlPanelDict"]["RobotList"] + for lItem in lRenderFunctionsRobotList: + #Подключить модуль для вызова + lModule=importlib.import_module(lItem["RenderFunctionModuleName"]) + #Найти функцию + lFunction=getattr(lModule,lItem["RenderFunctionName"]) + #Выполнить вызов и записать результат + lItemResultDict=lFunction(mJSONConfigurationDict) + #RunFunction + lResultJSON["RenderRobotList"].append(lItemResultDict) + # Send message back to client + message = json.dumps(lResultJSON) + # Write content as utf-8 data + self.wfile.write(bytes(message, "utf8")) # POST def do_POST(self): #Централизованная функция получения запросов/отправки