From 383fc9b57528c56ce4e958bad82e024aed9dccc7 Mon Sep 17 00:00:00 2001 From: Ivan Maslov Date: Sun, 6 Dec 2020 09:32:50 +0300 Subject: [PATCH] - Orch: /pyOpenRPA/ServerData - add sub dict "AgentDict" - Orch WEB: Create Agent render !NEED TEST! --- .../pyOpenRPA/Orchestrator/ServerSettings.py | 24 ++++++++++++-- Sources/pyOpenRPA/Orchestrator/Web/Index.js | 27 ++++++++++++++- .../pyOpenRPA/Orchestrator/Web/Index.xhtml | 33 ++++++++++++++++++- changelog.md | 2 ++ 4 files changed, 82 insertions(+), 4 deletions(-) diff --git a/Sources/pyOpenRPA/Orchestrator/ServerSettings.py b/Sources/pyOpenRPA/Orchestrator/ServerSettings.py index d57c0cd9..7532822e 100644 --- a/Sources/pyOpenRPA/Orchestrator/ServerSettings.py +++ b/Sources/pyOpenRPA/Orchestrator/ServerSettings.py @@ -1,4 +1,5 @@ import json +import copy from inspect import signature # For detect count of def args #ControlPanelDict from desktopmagic.screengrab_win32 import ( @@ -55,7 +56,7 @@ def HiddenCPDictGenerate(inRequest, inGSettings): # Return {"Key":{"",""}} def HiddenRDPDictGenerate(inRequest, inGSettings): - lRDPDict = {} + lRDPDict = {"HandlebarsList":[]} # Iterate throught the RDP list for lRDPSessionKeyStrItem in inGSettings["RobotRDPActive"]["RDPList"]: lRDPConfiguration = inGSettings["RobotRDPActive"]["RDPList"][ @@ -68,8 +69,26 @@ def HiddenRDPDictGenerate(inRequest, inGSettings): "FullScreenRDPSessionKeyStr"] else False # Check the full screen for rdp window lDataItemDict["IsIgnoredBool"] = lRDPConfiguration["SessionIsIgnoredBool"] # Is ignored lRDPDict[lDataItemDict["SessionKeyStr"]].append(lDataItemDict) + lHandlebarsDataItemDict = copy.deepcopy(lDataItemDict) + lHandlebarsDataItemDict["SessionKeyStr"]=lDataItemDict["SessionKeyStr"] + lRDPDict["HandlebarsList"].append(lHandlebarsDataItemDict) return lRDPDict +# Return {"HostNameUpperStr;UserUpperStr":{"IsListenBool":True}, "HandlebarsList":[{"HostnameUpperStr":"","UserUpperStr":"","IsListenBool":True}]} +def HiddenAgentDictGenerate(inRequest, inGSettings): + lAgentDict = {"HandlebarsList":[]} + # Iterate throught the RDP list + for lAgentItemKeyStrItem in inGSettings["AgentDict"]: + lKeyStr = f"{lAgentItemKeyStrItem[0]};{lAgentItemKeyStrItem[1]}" # turple ("HostNameUpperStr","UserUpperStr") > Str "HostNameUpperStr;UserUpperStr" + lDataItemDict = inGSettings["AgentDict"][lAgentItemKeyStrItem] + lAgentDict[lKeyStr]=lDataItemDict + lHandlebarsDataItemDict = copy.deepcopy(lDataItemDict) + lHandlebarsDataItemDict["HostnameUpperStr"]=lAgentItemKeyStrItem[0] + lHandlebarsDataItemDict["UserUpperStr"]=lAgentItemKeyStrItem[1] + lAgentDict["HandlebarsList"].append(lHandlebarsDataItemDict) + return lAgentDict + + #v1.2.0 Send data container to the client from the server # /pyOpenRPA/ServerData return {"HashStr" , "ServerDataDict": {"CPKeyStr":{"HTMLStr":"", DataDict:{}}}} @@ -90,7 +109,8 @@ def pyOpenRPA_ServerData(inRequest,inGSettings): lServerDataDict = { "CPDict": HiddenCPDictGenerate(inRequest=inRequest, inGSettings=inGSettings), "RDPDict": HiddenRDPDictGenerate(inRequest=inRequest, inGSettings=inGSettings), - "UserDict": {"UACClientDict": inRequest.OpenRPA["DefUserRoleHierarchyGet"]()} + "AgentDict": HiddenAgentDictGenerate(inRequest=inRequest, inGSettings=inGSettings), + "UserDict": {"UACClientDict": inRequest.OpenRPA["DefUserRoleHierarchyGet"]()}, } # Create JSON lServerDataDictJSONStr = json.dumps(lServerDataDict) diff --git a/Sources/pyOpenRPA/Orchestrator/Web/Index.js b/Sources/pyOpenRPA/Orchestrator/Web/Index.js index b56e87c1..7680a0ed 100644 --- a/Sources/pyOpenRPA/Orchestrator/Web/Index.js +++ b/Sources/pyOpenRPA/Orchestrator/Web/Index.js @@ -343,7 +343,7 @@ $(document).ready(function() { ///Прогрузить новую таблицу $(".openrpa-control-panel").html(lHTMLCode) //////////////////////////////////////////////////// - ///Сформировать HTML код новой таблицы - список RDP + /// !RDP List ! Сформировать HTML код новой таблицы - список RDP lHTMLCode=mGlobal.GeneralGenerateHTMLCodeHandlebars(".openrpa-hidden-robotrdpactive-control-panel",lResponseJSON) //Присвоить ответ в mGlobal.RobotRDPActive.mResponseList mGlobal.RobotRDPActive.mResponseList = lResponseJSON @@ -351,6 +351,15 @@ $(document).ready(function() { $(".openrpa-robotrdpactive-control-panel").html(lHTMLCode) ///Очистить дерево //mGlobal.ElementTree.fClear(); + //////////////////////////////////////////////////// + /// !UserAgent List ! Сформировать HTML код новой таблицы - список RDP + lHTMLCode=mGlobal.GeneralGenerateHTMLCodeHandlebars(".pyOpenRPA-Agent-ListTemplate",lResponseJSON) + //Присвоить ответ в mGlobal.RobotRDPActive.mResponseList + mGlobal.RobotRDPActive.mResponseList = lResponseJSON + ///Прогрузить новую таблицу + $(".pyOpenRPA-Agent-List").html(lHTMLCode) + ///Очистить дерево + //mGlobal.ElementTree.fClear(); } } } @@ -374,6 +383,22 @@ $(document).ready(function() { lHTMLCode += '' ///Прогрузить новую таблицу $(".openrpa-control-panel").html(lHTMLCode) + //////////////////////////////////////////////////// + /// !RDP List ! Сформировать HTML код новой таблицы - список RDP + lHTMLCode=mGlobal.GeneralGenerateHTMLCodeHandlebars(".openrpa-hidden-robotrdpactive-control-panel",lResponseJSON["RDPDict"]) + //Присвоить ответ в mGlobal.RobotRDPActive.mResponseList + mGlobal.RobotRDPActive.mResponseList = lResponseJSON["RDPDict"] + ///Прогрузить новую таблицу + $(".openrpa-robotrdpactive-control-panel").html(lHTMLCode) + ///Очистить дерево + //mGlobal.ElementTree.fClear(); + //////////////////////////////////////////////////// + /// !UserAgent List ! Сформировать HTML код новой таблицы - список RDP + lHTMLCode=mGlobal.GeneralGenerateHTMLCodeHandlebars(".pyOpenRPA-Agent-ListTemplate",lResponseJSON["AgentDict"]) + ///Прогрузить новую таблицу + $(".pyOpenRPA-Agent-List").html(lHTMLCode) + ///Очистить дерево + //mGlobal.ElementTree.fClear(); } } mGlobal.pyOpenRPA.ServerDataRefreshDef=function() { diff --git a/Sources/pyOpenRPA/Orchestrator/Web/Index.xhtml b/Sources/pyOpenRPA/Orchestrator/Web/Index.xhtml index 6adce89d..1ac191c9 100644 --- a/Sources/pyOpenRPA/Orchestrator/Web/Index.xhtml +++ b/Sources/pyOpenRPA/Orchestrator/Web/Index.xhtml @@ -201,7 +201,7 @@ diff --git a/changelog.md b/changelog.md index a2febb9b..919672b8 100644 --- a/changelog.md +++ b/changelog.md @@ -51,6 +51,8 @@ - Orchestrator WEB: Update WEB to the new UACClient - Create pyOpenRPA.Agent - just prototype, need test - Create Agent support in Orchestrator (/pyOpenRPA/Agent/O2A and /pyOpenRPA/Agent/A2O) +- Orch: /pyOpenRPA/ServerData - add sub dict "AgentDict" +- Orch WEB: Create Agent render [1.1.0] After 2 month test prefinal with new improovements (+RobotRDPActive in Orchestrator + Easy ControlPanelTemplate) Beta before 1.1.0 (new way of OpenRPA with improvements. Sorry, but no backward compatibility)/ Backward compatibility will start from 1.0.1