diff --git a/Sources/pyOpenRPA/Orchestrator/ServerSettings.py b/Sources/pyOpenRPA/Orchestrator/ServerSettings.py index b5bb7601..eaf44acf 100644 --- a/Sources/pyOpenRPA/Orchestrator/ServerSettings.py +++ b/Sources/pyOpenRPA/Orchestrator/ServerSettings.py @@ -10,6 +10,17 @@ import time # sleep functions import datetime # datetime functions import threading # Multi-threading +#v1.2.0 Send data container to the client from the server +# /pyOpenRPA/ServerData return {"HashStr" , "ServerDataDict"} +# Client: mGlobal.pyOpenRPA.ServerDataHashStr +# Client: mGlobal.pyOpenRPA.ServerDataDict +def pyOpenRPA_ServerData(inRequest,inGSettings): + lResult = {"HashStr": "", "ServerDataDict": {}} + + + return lResult + + # /Orchestrator/RobotRDPActive/ControlPanelDictGet def RobotRDPActive_ControlPanelDictGet(inRequest,inGlobalDict): inResponseDict = inRequest.OpenRPAResponseDict @@ -213,7 +224,8 @@ def SettingsUpdate(inGlobalConfiguration): {"Method": "GET", "URL": "/Monitor/ControlPanelDictGet", "MatchType": "Equal", "ResponseDefRequestGlobal": Monitor_ControlPanelDictGet_SessionCheckInit, "ResponseContentType": "application/json"}, {"Method": "GET", "URL": "/GetScreenshot", "MatchType": "BeginWith", "ResponseDefRequestGlobal": GetScreenshot, "ResponseContentType": "image/png"}, {"Method": "GET", "URL": "/pyOpenRPA_logo.png", "MatchType": "Equal", "ResponseFilePath": os.path.join(lOrchestratorFolder, "..\\Resources\\Web\\pyOpenRPA_logo.png"), "ResponseContentType": "image/png"}, - {"Method": "POST", "URL": "/Orchestrator/UserRoleHierarchyGet", "MatchType": "Equal","ResponseDefRequestGlobal": UserRoleHierarchyGet, "ResponseContentType": "application/json"} + {"Method": "POST", "URL": "/Orchestrator/UserRoleHierarchyGet", "MatchType": "Equal","ResponseDefRequestGlobal": UserRoleHierarchyGet, "ResponseContentType": "application/json"}, + {"Method": "POST", "URL": "/pyOpenRPA/ServerData", "MatchType": "Equal","ResponseDefRequestGlobal": pyOpenRPA_ServerData, "ResponseContentType": "application/json"} ] inGlobalConfiguration["Server"]["URLList"]=inGlobalConfiguration["Server"]["URLList"]+lURLList return inGlobalConfiguration \ No newline at end of file diff --git a/Sources/pyOpenRPA/Orchestrator/Web/Index.js b/Sources/pyOpenRPA/Orchestrator/Web/Index.js index b90cd74d..9424361e 100644 --- a/Sources/pyOpenRPA/Orchestrator/Web/Index.js +++ b/Sources/pyOpenRPA/Orchestrator/Web/Index.js @@ -276,59 +276,75 @@ $(document).ready(function() { mGlobal.Monitor.fControlPanelRefresh_TechnicalRender = function() { lResponseJSON = mGlobal.Monitor.mDatasetLast + if (lResponseJSON!= null) { - ///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; + /// New version of control panels + for (var lKeyStr in lResponseJSON){ + if (lKeyStr != "RenderRobotList") { /// Check if not "RenderRobotList" + lCPDict = lResponseJSON[lKeyStr] + /// Render HTML + if ("HTMLStr" in lCPDict) { + + } + } + } + + + /// v1.2.0 Backward compatibility - support old control panels + if ("RenderRobotList" in lResponseJSON) { + ///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; + ); + /// 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 - mGlobal.Monitor.mResponseList = lResponseJSON - ///Set result in mGlobal.DataStorage - lResponseJSON["RenderRobotList"].forEach( - function(lItem){ - if ('DataStorageKey' in lItem) { - mGlobal["DataStorage"][lItem['DataStorageKey']]=lItem + ); + ////////////////////////////////////////////////////////// + ///Сформировать HTML код новой таблицы - контрольная панель + lHTMLCode+=mGlobal.GeneralGenerateHTMLCodeHandlebars(".openrpa-hidden-control-panel",lResponseJSON) + //Присвоить ответ в mGlobal.Monitor.mResponseList + mGlobal.Monitor.mResponseList = lResponseJSON + ///Set result in mGlobal.DataStorage + lResponseJSON["RenderRobotList"].forEach( + function(lItem){ + if ('DataStorageKey' in lItem) { + mGlobal["DataStorage"][lItem['DataStorageKey']]=lItem + } } - } - ) - ///Прогрузить новую таблицу - $(".openrpa-control-panel").html(lHTMLCode) - //////////////////////////////////////////////////// - ///Сформировать HTML код новой таблицы - список RDP - lHTMLCode=mGlobal.GeneralGenerateHTMLCodeHandlebars(".openrpa-hidden-robotrdpactive-control-panel",lResponseJSON) - //Присвоить ответ в mGlobal.RobotRDPActive.mResponseList - mGlobal.RobotRDPActive.mResponseList = lResponseJSON - ///Прогрузить новую таблицу - $(".openrpa-robotrdpactive-control-panel").html(lHTMLCode) - ///Очистить дерево - //mGlobal.ElementTree.fClear(); + ) + ///Прогрузить новую таблицу + $(".openrpa-control-panel").html(lHTMLCode) + //////////////////////////////////////////////////// + ///Сформировать HTML код новой таблицы - список RDP + lHTMLCode=mGlobal.GeneralGenerateHTMLCodeHandlebars(".openrpa-hidden-robotrdpactive-control-panel",lResponseJSON) + //Присвоить ответ в mGlobal.RobotRDPActive.mResponseList + mGlobal.RobotRDPActive.mResponseList = lResponseJSON + ///Прогрузить новую таблицу + $(".openrpa-robotrdpactive-control-panel").html(lHTMLCode) + ///Очистить дерево + //mGlobal.ElementTree.fClear(); + } } } mGlobal.Monitor.mDatasetLast = null diff --git a/changelog.md b/changelog.md index bcd6092d..d2b12c24 100644 --- a/changelog.md +++ b/changelog.md @@ -33,7 +33,7 @@ - - def JSEscapeForHTMLInline(inJSStr): # Escape JS to the safe JS for the inline JS in HTML tags ATTENTION! Use it only if want to paste JS into HTML tag - not in