From 09ae47ac8578456bd9e5521ca34f30b384002283 Mon Sep 17 00:00:00 2001 From: Ivan Maslov Date: Sat, 12 Dec 2020 01:26:27 +0300 Subject: [PATCH] - Add Working Dir (CWD) + Orchestrator Version Str in ServerData > UserDict - Orc Web JS - lite refactoring --- .../pyOpenRPA/Orchestrator/ServerSettings.py | 4 +- Sources/pyOpenRPA/Orchestrator/Web/Index.js | 97 +------------------ changelog.md | 3 +- 3 files changed, 5 insertions(+), 99 deletions(-) diff --git a/Sources/pyOpenRPA/Orchestrator/ServerSettings.py b/Sources/pyOpenRPA/Orchestrator/ServerSettings.py index 71e192ef..e6c1b4ed 100644 --- a/Sources/pyOpenRPA/Orchestrator/ServerSettings.py +++ b/Sources/pyOpenRPA/Orchestrator/ServerSettings.py @@ -1,4 +1,4 @@ -import json +import json, os import copy from inspect import signature # For detect count of def args #ControlPanelDict @@ -179,7 +179,7 @@ def pyOpenRPA_ServerData(inRequest,inGSettings): "CPDict": HiddenCPDictGenerate(inRequest=inRequest, inGSettings=inGSettings), "RDPDict": HiddenRDPDictGenerate(inRequest=inRequest, inGSettings=inGSettings), "AgentDict": HiddenAgentDictGenerate(inRequest=inRequest, inGSettings=inGSettings), - "UserDict": {"UACClientDict": inRequest.OpenRPA["DefUserRoleHierarchyGet"]()}, + "UserDict": {"UACClientDict": inRequest.OpenRPA["DefUserRoleHierarchyGet"](), "CWDPathStr": os.getcwd(), "VersionStr": inGSettings["VersionStr"]}, } # Create JSON lServerDataDictJSONStr = json.dumps(lServerDataDict) diff --git a/Sources/pyOpenRPA/Orchestrator/Web/Index.js b/Sources/pyOpenRPA/Orchestrator/Web/Index.js index 0b374983..4a3242a6 100644 --- a/Sources/pyOpenRPA/Orchestrator/Web/Index.js +++ b/Sources/pyOpenRPA/Orchestrator/Web/Index.js @@ -466,6 +466,7 @@ $(document).ready(function() { success: function(lData,l2,l3) { try { var lResponseJSON=JSON.parse(lData) + mGlobal.VersionStr = lResponseJSON["ServerDataDict"]["UserDict"]["VersionStr"] mGlobal.pyOpenRPA.ServerDataDict = lResponseJSON["ServerDataDict"] mGlobal.pyOpenRPA.ServerDataHashStr = lResponseJSON["HashStr"] mGlobal.pyOpenRPA.ServerDataRefreshDef_TechnicalRender() @@ -544,71 +545,8 @@ $(document).ready(function() { ///////////////////////////////////////////////////////////// - mGlobal.Monitor.mDatasetLast = null - mGlobal.fControlPanelRefresh=function() { - try { - //var XHR = new XMLHttpRequest(); - //XHR.setRequestHeader("Cookies",document.cookie) - ///Загрузка данных - //console.log("Request is sent") - //console.log(document.cookie) - $.ajax({ - type: "GET", - headers: {"SessionGUIDStr":mGlobal.SessionGUIDStr}, - url: 'Monitor/ControlPanelDictGet', - data: '', - //cache: false, - //xhr: XHR, - success: function(lData,l2,l3) { - try { - var lResponseJSON=JSON.parse(lData) - mGlobal.Monitor.mDatasetLast = lResponseJSON - mGlobal.Monitor.fControlPanelRefresh_TechnicalRender() - } - catch(error) { - } - mGlobal.Monitor.fControlPanelRefresh() // recursive - }, - dataType: "text", - error: function(jqXHR, textStatus, errorThrown ) { - sleep(3000) - mGlobal.Monitor.fControlPanelRefresh() // recursive - } - }); - } - catch(error) { - sleep(3000) - mGlobal.Monitor.fControlPanelRefresh() // recursive - } - //mGlobal.Monitor.fControlPanelRefresh() // recursive - } - mGlobal.Test=function() { - ///Обнулить таблицу - lData = [ - { - "Type":"GlobalDictKeyListValueSet", - "key_list":["Storage","Robot_R01"], - "value":{ - "RunDateTimeString":"Test1", - "StepCurrentName":"Test2", - "StepCurrentDuration":"Test3" - } - } - ] - $.ajax({ - type: "POST", - url: 'Utils/Processor', - data: JSON.stringify(lData), - success: - function(lData,l2,l3) - { - //console.log(lData) - }, - dataType: "text" - }); - } /////////////////////////////// ///Processor functions /////////////////////////////// @@ -874,39 +812,6 @@ $(document).ready(function() { if (lUACAsk(["pyOpenRPADict","AdminDict","RestartPCBool"])) { $(".UACClient-pyOpenRPADict-AdminDict-RestartPCBool").show(); } } - // Orchestrator model - mGlobal.WorkingDirectoryPathStr = null - mGlobal.OrchestratorModelUpdate=function() { - lData = [ - { - "Type": "GlobalDictKeyListValueGet", - "KeyList": ["Server","WorkingDirectoryPathStr"] - }, - { - "Type": "GlobalDictKeyListValueGet", - "KeyList": ["VersionStr"] - }, - ] - $.ajax({ - type: "POST", - url: 'Utils/Processor', - data: JSON.stringify(lData), - success: - function(lData,l2,l3) - { - var lUACAsk = mGlobal.UserRoleAsk // Alias - var lResponseList=JSON.parse(lData) - mGlobal.WorkingDirectoryPathStr = lResponseList[0]["Result"] - mGlobal.VersionStr = lResponseList[1]["Result"] - }, - dataType: "text" - }); - } - - //Main sub - mGlobal.OrchestratorModelUpdate() // Cal the update orchestrator model - //mGlobal.Monitor.fControlPanelRefresh() - /// v1.2.0 pyOpenRPA Init defs mGlobal.pyOpenRPA.ServerJSInitDef() // Recieve JS from server (if exist) and then call anothe url ServerData diff --git a/changelog.md b/changelog.md index 483b8520..a57b1cab 100644 --- a/changelog.md +++ b/changelog.md @@ -81,7 +81,8 @@ Orc connect JSONGenerators to WEB Front (mGlobal.) - Orc back: add new block: OrchestratorWeb - - def OrchestratorWebCPUpdate(inGSettings, inCPKeyStr, inHTMLRenderDef=None, inJSONGeneratorDef=None, inJSInitGeneratorDef=None): # Add control panel HTML, JSON generator or JS when page init - +- Add Working Dir (CWD) + Orchestrator Version Str in ServerData > UserDict +- Orc Web JS - lite refactoring [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