# Orch ajax optimized # Remove refresh button # remove RDPListControlPanelGet # AddAutocleaner #Add exception if ControlPanel with error # Restart Orch with old RDP List!!! (need test)

dev-linux
Ivan Maslov 4 years ago
parent 7bc9acf2a5
commit 5333209528

@ -2,6 +2,7 @@ import psutil
import datetime import datetime
import logging import logging
import os import os
import time
#DEFINITIONS #DEFINITIONS
lProcessName = "OpenRPA_RobotScreenActive.exe" lProcessName = "OpenRPA_RobotScreenActive.exe"
lStartFilePath = os.path.join(os.getcwd(), "RobotScreenActive\\pyOpenRPA.Tools.RobotScreenActive_x64.cmd") lStartFilePath = os.path.join(os.getcwd(), "RobotScreenActive\\pyOpenRPA.Tools.RobotScreenActive_x64.cmd")
@ -42,7 +43,8 @@ def RenderRobotScreenActive(inGlobalConfiguration):
if CheckIfProcessRunning("OpenRPA_RobotScreenActive"): if CheckIfProcessRunning("OpenRPA_RobotScreenActive"):
lResultDict["SubheaderText"]=lSubheaderRunTrueText lResultDict["SubheaderText"]=lSubheaderRunTrueText
#Process not running #Process not running
lResultDict["FooterText"]=f'Last update: {datetime.datetime.now().strftime("%H:%M:%S %d.%m.%Y")}' #lResultDict["FooterText"]=f'Last update: {datetime.datetime.now().strftime("%H:%M:%S %d.%m.%Y")}'
lResultDict["FooterText"]=f'Footer text'
return lResultDict return lResultDict
def CheckIfProcessRunning(processName): def CheckIfProcessRunning(processName):

@ -78,6 +78,30 @@ def Settings():
import pyOpenRPA.Orchestrator import pyOpenRPA.Orchestrator
lOrchestratorFolder = "\\".join(pyOpenRPA.Orchestrator.__file__.split("\\")[:-1]) lOrchestratorFolder = "\\".join(pyOpenRPA.Orchestrator.__file__.split("\\")[:-1])
mDict = { mDict = {
"Autocleaner": { # Some gurbage is collecting in g settings. So you can configure autocleaner to periodically clear gSettings
"IntervalSecFloat": 10, # Sec float to periodically clear gsettings
},
"Client":{ # Settings about client web orchestrator
"Session":{ # Settings about web session. Session algorythms works only for special requests (URL in ServerSettings)
"LifetimeSecFloat": 10.0, # Client Session lifetime in seconds. after this time server will forget about this client session
"LifetimeRequestSecFloat": 15.0, # 1 client request lifetime in server in seconds
"ControlPanelRefreshIntervalSecFloat": 1.5, # Interval to refresh control panels for session,
"TechnicalSessionGUIDCache": { # TEchnical cache. Fills when web browser is requesting
#"SessionGUIDStr":{ # Session with some GUID str. On client session guid stored in cookie "SessionGUIDStr"
# "InitDatetime": None, # Datetime when session GUID was created
# "DatasetLast": {
# "ControlPanel": {
# "Data": None, # Struct to check with new iterations. None if starts
# "ReturnBool": False # flag to return, close request and return data as json
# }
# },
# "ClientRequestHandler": None, # Last client request handler
# "UserADStr": None, # User, who connect. None if user is not exists
# "DomainADStr": None, # Domain of the user who connect. None if user is not exists
#}
}
}
},
"Server": { "Server": {
"ListenPort_": "Порт, по которому можно подключиться к демону", "ListenPort_": "Порт, по которому можно подключиться к демону",
"ListenPort": 80, "ListenPort": 80,
@ -245,25 +269,25 @@ def Settings():
# # # # # # # # # # # # # # # # # # # # # # # # # # # #
"RobotRDPActive":{ "RobotRDPActive":{
"RDPList": { "RDPList": {
"RDPSessionKey":{ #"RDPSessionKey":{
"Host": "77.77.22.22", # Host address # "Host": "77.77.22.22", # Host address
"Port": "3389", # RDP Port # "Port": "3389", # RDP Port
"Login": "test", # Login # "Login": "test", # Login
"Password": "test", # Password # "Password": "test", # Password
"Screen": { # "Screen": {
"Width": 1680, # Width of the remote desktop in pixels # "Width": 1680, # Width of the remote desktop in pixels
"Height": 1050, # Height of the remote desktop in pixels # "Height": 1050, # Height of the remote desktop in pixels
# "640x480" or "1680x1050" or "FullScreen". If Resolution not exists set full screen # # "640x480" or "1680x1050" or "FullScreen". If Resolution not exists set full screen
"FlagUseAllMonitors": False, # True or False # "FlagUseAllMonitors": False, # True or False
"DepthBit": "32" # "32" or "24" or "16" or "15" # "DepthBit": "32" # "32" or "24" or "16" or "15"
}, # },
"SharedDriveList": ["c"], # List of the Root sesion hard drives # "SharedDriveList": ["c"], # List of the Root sesion hard drives
###### Will updated in program ############ # ###### Will updated in program ############
"SessionHex": "", # Hex is created when robot runs # "SessionHex": "", # Hex is created when robot runs
"SessionIsWindowExistBool": False, # Flag if the RDP window is exist, old name "FlagSessionIsActive". Check every n seconds # "SessionIsWindowExistBool": False, # Flag if the RDP window is exist, old name "FlagSessionIsActive". Check every n seconds
"SessionIsWindowResponsibleBool": False, # Flag if RDP window is responsible (recieve commands). Check every nn seconds. If window is Responsible - window is Exist too # "SessionIsWindowResponsibleBool": False, # Flag if RDP window is responsible (recieve commands). Check every nn seconds. If window is Responsible - window is Exist too
"SessionIsIgnoredBool": False # Flag to ignore RDP window False - dont ignore, True - ignore # "SessionIsIgnoredBool": False # Flag to ignore RDP window False - dont ignore, True - ignore
} #}
}, },
"ResponsibilityCheckIntervalSec": None, "ResponsibilityCheckIntervalSec": None,
# Seconds interval when Robot check the RDP responsibility. if None - dont check # Seconds interval when Robot check the RDP responsibility. if None - dont check

@ -18,9 +18,28 @@ import threading # Multi-threading for RobotRDPActive
from .RobotRDPActive import RobotRDPActive #Start robot rdp active from .RobotRDPActive import RobotRDPActive #Start robot rdp active
from .RobotScreenActive import Monitor #Start robot screen active from .RobotScreenActive import Monitor #Start robot screen active
import uuid # Generate uuid import uuid # Generate uuid
import datetime # datetime
#Единый глобальный словарь (За основу взять из Settings.py) #Единый глобальный словарь (За основу взять из Settings.py)
global gSettingsDict global gSettingsDict
# Interval gsettings auto cleaner
def GSettingsAutocleaner(inGSettings):
while True:
time.sleep(inGSettings["Autocleaner"]["IntervalSecFloat"]) # Wait for the next iteration
lL = inGSettings["Logger"]
if lL: lL.info(f"Autocleaner is running") # Info
lNowDatetime = datetime.datetime.now() # Get now time
# Clean old items in Client > Session > TechnicalSessionGUIDCache
lTechnicalSessionGUIDCacheNew = {}
for lItemKeyStr in inGSettings["Client"]["Session"]["TechnicalSessionGUIDCache"]:
lItemValue = inGSettings["Client"]["Session"]["TechnicalSessionGUIDCache"][lItemKeyStr]
if (lNowDatetime - lItemValue["InitDatetime"]).total_seconds() < inGSettings["Client"]["Session"]["LifetimeSecFloat"]: # Add if lifetime is ok
lTechnicalSessionGUIDCacheNew[lItemKeyStr]=lItemValue # Lifetime is ok - set
else:
if lL: lL.debug(f"Client > Session > TechnicalSessionGUIDCache > lItemKeyStr: Lifetime is expired. Remove from gSettings") # Info
inGSettings["Client"]["Session"]["TechnicalSessionGUIDCache"] = lTechnicalSessionGUIDCacheNew # Set updated Cache
# # # # # # # # # # # # # # # # # # # # # # # # # #
#Call Settings function from argv[1] file #Call Settings function from argv[1] file
################################################ ################################################
lSubmoduleFunctionName = "Settings" lSubmoduleFunctionName = "Settings"
@ -53,6 +72,7 @@ if os.path.exists("_SessionLast_RDPList.json"):
lFile = open("_SessionLast_RDPList.json", "r", encoding="utf-8") lFile = open("_SessionLast_RDPList.json", "r", encoding="utf-8")
lSessionLastRDPList = json.loads(lFile.read()) lSessionLastRDPList = json.loads(lFile.read())
lFile.close() # Close the file lFile.close() # Close the file
os.remove("_SessionLast_RDPList.json") # remove the temp file
gSettingsDict["RobotRDPActive"]["RDPList"]=lSessionLastRDPList # Set the last session dict gSettingsDict["RobotRDPActive"]["RDPList"]=lSessionLastRDPList # Set the last session dict
#Инициализация настроечных параметров #Инициализация настроечных параметров
@ -77,6 +97,12 @@ lRobotRDPActiveThread.daemon = True # Run the thread in daemon mode.
lRobotRDPActiveThread.start() # Start the thread execution. lRobotRDPActiveThread.start() # Start the thread execution.
if lL: lL.info("Robot RDP active has been started") #Logging if lL: lL.info("Robot RDP active has been started") #Logging
# Init autocleaner in another thread
lAutocleanerThread = threading.Thread(target= GSettingsAutocleaner, kwargs={"inGSettings":gSettingsDict})
lAutocleanerThread.daemon = True # Run the thread in daemon mode.
lAutocleanerThread.start() # Start the thread execution.
if lL: lL.info("Autocleaner thread has been started") #Logging
# Orchestrator start activity # Orchestrator start activity
if lL: lL.info("Orchestrator start activity run") #Logging if lL: lL.info("Orchestrator start activity run") #Logging
for lActivityItem in gSettingsDict["OrchestratorStart"]["ActivityList"]: for lActivityItem in gSettingsDict["OrchestratorStart"]["ActivityList"]:
@ -96,7 +122,7 @@ while True:
if lItem["ActivityEndDateTime"] and lCurrentDateTime<=lItem["ActivityEndDateTime"]: if lItem["ActivityEndDateTime"] and lCurrentDateTime<=lItem["ActivityEndDateTime"]:
pass pass
# Activity is actual - do not delete now # Activity is actual - do not delete now
else: else:
# remove the activity - not actual # remove the activity - not actual
lDaemonActivityLogDict.pop(lIndex,None) lDaemonActivityLogDict.pop(lIndex,None)
lIterationLastDateTime = lDaemonLastDateTime # Get current datetime before iterator (need for iterate all activities in loop) lIterationLastDateTime = lDaemonLastDateTime # Get current datetime before iterator (need for iterate all activities in loop)
@ -109,7 +135,7 @@ while True:
else: else:
lGUID = str(uuid.uuid4()) lGUID = str(uuid.uuid4())
lItem["GUID"]=lGUID lItem["GUID"]=lGUID
#Проверка дней недели, в рамках которых можно запускать активность #Проверка дней недели, в рамках которых можно запускать активность
lItemWeekdayList=lItem.get("WeekdayList", [0, 1, 2, 3, 4, 5, 6]) lItemWeekdayList=lItem.get("WeekdayList", [0, 1, 2, 3, 4, 5, 6])
if lCurrentDateTime.weekday() in lItemWeekdayList: if lCurrentDateTime.weekday() in lItemWeekdayList:

@ -83,6 +83,7 @@ gSettingsDict = None
def Activity(inActivity): def Activity(inActivity):
#Глобальная переменная - глобальный словарь унаследованный от Settings.py #Глобальная переменная - глобальный словарь унаследованный от Settings.py
global gSettingsDict global gSettingsDict
lL = gSettingsDict["Logger"] # Alias for logger
#Alias (compatibility) #Alias (compatibility)
lItem = inActivity lItem = inActivity
lCurrentDateTime = datetime.datetime.now() lCurrentDateTime = datetime.datetime.now()
@ -112,6 +113,12 @@ def Activity(inActivity):
#Обработка команды OrchestratorRestart #Обработка команды OrchestratorRestart
########################################################### ###########################################################
if lItem["Type"]=="OrchestratorRestart": if lItem["Type"]=="OrchestratorRestart":
# Dump RDP List in file json
lFile = open("_SessionLast_RDPList.json", "w", encoding="utf-8")
lFile.write(json.dumps(gSettingsDict["RobotRDPActive"]["RDPList"])) # dump json to file
lFile.close() # Close the file
if lL: lL.info(f"Orchestrator has dump the RDP list before the restart. The RDP List is {gSettingsDict['RobotRDPActive']['RDPList']}")
# Restart session
os.execl(sys.executable, os.path.abspath(__file__), *sys.argv) os.execl(sys.executable, os.path.abspath(__file__), *sys.argv)
lItem["Result"] = True lItem["Result"] = True
sys.exit(0) sys.exit(0)
@ -231,7 +238,7 @@ def Activity(inActivity):
lFunction=getattr(lModule,lItem["FunctionName"]) lFunction=getattr(lModule,lItem["FunctionName"])
lItem["Result"]=lFunction(*lItem.get("ArgList",[]),**lItem.get("ArgDict",{})) lItem["Result"]=lFunction(*lItem.get("ArgList",[]),**lItem.get("ArgDict",{}))
except Exception as e: except Exception as e:
logging.exception("Loop activity error: module/function not founded") if lL: lL.exception("Loop activity error: module/function not founded")
################################# #################################
# Windows logon # Windows logon
################################# #################################

@ -4,6 +4,11 @@ from inspect import signature # For detect count of def args
from desktopmagic.screengrab_win32 import ( from desktopmagic.screengrab_win32 import (
getDisplayRects, saveScreenToBmp, saveRectToBmp, getScreenAsImage, getDisplayRects, saveScreenToBmp, saveRectToBmp, getScreenAsImage,
getRectAsImage, getDisplaysAsImages) getRectAsImage, getDisplaysAsImages)
from http import cookies
import uuid # generate UUID4
import time # sleep functions
import datetime # datetime functions
import threading # Multi-threading
# /Orchestrator/RobotRDPActive/ControlPanelDictGet # /Orchestrator/RobotRDPActive/ControlPanelDictGet
def RobotRDPActive_ControlPanelDictGet(inRequest,inGlobalDict): def RobotRDPActive_ControlPanelDictGet(inRequest,inGlobalDict):
@ -27,10 +32,86 @@ def RobotRDPActive_ControlPanelDictGet(inRequest,inGlobalDict):
# Write content as utf-8 data # Write content as utf-8 data
inResponseDict["Body"] = bytes(message, "utf8") inResponseDict["Body"] = bytes(message, "utf8")
# def to check control panels for selected session
def Monitor_ControlPanelDictGet_SessionCheckInit(inRequest,inGlobalDict):
lL = inGlobalDict["Logger"] # Alias for logger
lLifetimeSecFloat = inGlobalDict["Client"]["Session"]["LifetimeSecFloat"]
lLifetimeRequestSecFloat = inGlobalDict["Client"]["Session"]["LifetimeRequestSecFloat"]
lControlPanelRefreshIntervalSecFloat = inGlobalDict["Client"]["Session"]["ControlPanelRefreshIntervalSecFloat"]
lCookieSessionGUIDStr = None # generate the new GUID
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Technicaldef - interval check control panels + check actuality of the session by the datetime
def TechnicalCheck():
lItemValue = inGlobalDict["Client"]["Session"]["TechnicalSessionGUIDCache"][lCookieSessionGUIDStr]
# Lifetime is ok - check control panel
lDatasetCurrentBytes = Monitor_ControlPanelDictGet(inRequest,inGlobalDict) # Call the control panel
if lDatasetCurrentBytes != lItemValue["DatasetLast"]["ControlPanel"]["Data"]: # Check if dataset is changed
lItemValue["DatasetLast"]["ControlPanel"]["Data"] = lDatasetCurrentBytes # Set new datset
lItemValue["DatasetLast"]["ControlPanel"]["ReturnBool"] = True # Set flag to return the data
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Technicaldef - Create new session struct
def TechnicalSessionNew():
lCookieSessionGUIDStr = str(uuid.uuid4()) # Generate the new GUID
lSessionNew = { # Session with some GUID str. On client session guid stored in cookie "SessionGUIDStr"
"InitDatetime": datetime.datetime.now(), # Datetime when session GUID was created
"DatasetLast": {
"ControlPanel": {
"Data": None, # Struct to check with new iterations. None if starts
"ReturnBool": False # flag to return, close request and return data as json
}
},
"ClientRequestHandler": inRequest, # Last client request handler
"UserADStr": inRequest.OpenRPA["User"], # User, who connect. None if user is not exists
"DomainADStr": inRequest.OpenRPA["Domain"], # Domain of the user who connect. None if user is not exists
}
inGlobalDict["Client"]["Session"]["TechnicalSessionGUIDCache"][lCookieSessionGUIDStr] = lSessionNew # Set new session in dict
inRequest.OpenRPAResponseDict["SetCookies"]["SessionGUIDStr"] = lCookieSessionGUIDStr # Set SessionGUIDStr in cookies
if lL: lL.info(f"New session GUID is created. GUID {lCookieSessionGUIDStr}")
return lCookieSessionGUIDStr
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
lCreateNewSessionBool = False # Flag to create new session structure
# step 1 - get cookie SessionGUIDStr
lCookies = cookies.SimpleCookie(inRequest.headers.get("Cookie", ""))
if "SessionGUIDStr" in lCookies:
lCookieSessionGUIDStr = lCookies.get("SessionGUIDStr", None).value # Get the cookie
if lCookieSessionGUIDStr not in inGlobalDict["Client"]["Session"]["TechnicalSessionGUIDCache"]:
lCookieSessionGUIDStr= TechnicalSessionNew() # Create new session
else:
lCookieSessionGUIDStr = TechnicalSessionNew() # Create new session
# Init the RobotRDPActive in another thread
#lThreadCheckCPInterval = threading.Thread(target=TechnicalIntervalCheck)
#lThreadCheckCPInterval.daemon = True # Run the thread in daemon mode.
#lThreadCheckCPInterval.start() # Start the thread execution.
# Step 2 - interval check if data is exist
lTimeStartSecFloat = time.time()
lDoWhileBool = True # Flag to iterate throught the lifetime of the request
while lDoWhileBool:
#print(lTechnicalSessionGUIDCache)
#print(lCookieSessionGUIDStr)
if lCookieSessionGUIDStr in inGlobalDict["Client"]["Session"]["TechnicalSessionGUIDCache"]:
lItemValue = inGlobalDict["Client"]["Session"]["TechnicalSessionGUIDCache"][lCookieSessionGUIDStr]
if (time.time() - lTimeStartSecFloat) >= lLifetimeRequestSecFloat: # Check if lifetime client request is over or has no key
if lL: lL.debug(f"Client request lifetime is over")
lDoWhileBool = False # Stop the iterations
if lDoWhileBool:
TechnicalCheck() # Calculate the CP
if lItemValue["DatasetLast"]["ControlPanel"]["ReturnBool"] == True: # Return data if data flag it True
lDatasetCurrentBytes = lItemValue["DatasetLast"]["ControlPanel"]["Data"] # Set new dataset
inResponseDict = inRequest.OpenRPAResponseDict
inResponseDict["Body"] = lDatasetCurrentBytes
lItemValue["DatasetLast"]["ControlPanel"]["ReturnBool"] = False # Set flag that data was returned
lDoWhileBool = False # Stop the iterations
else:
lCookieSessionGUIDStr = TechnicalSessionNew() # Create new session
if lDoWhileBool: # Sleep if we wait hte next iteration
time.sleep(lControlPanelRefreshIntervalSecFloat) # Sleep to the next iteration
def Monitor_ControlPanelDictGet(inRequest,inGlobalDict): def Monitor_ControlPanelDictGet(inRequest,inGlobalDict):
inResponseDict = inRequest.OpenRPAResponseDict inResponseDict = inRequest.OpenRPAResponseDict
lL = inGlobalDict["Logger"] # Alias for logger
# Create result JSON # Create result JSON
lResultJSON = {"RenderRobotList": []} lResultJSON = {"RenderRobotList": [], "RenderRDPList": []}
lRenderFunctionsRobotList = inGlobalDict["ControlPanelDict"]["RobotList"] lRenderFunctionsRobotList = inGlobalDict["ControlPanelDict"]["RobotList"]
for lItem in lRenderFunctionsRobotList: for lItem in lRenderFunctionsRobotList:
lUACBool = True # Check if render function is applicable User Access Rights (UAC) lUACBool = True # Check if render function is applicable User Access Rights (UAC)
@ -44,19 +125,34 @@ def Monitor_ControlPanelDictGet(inRequest,inGlobalDict):
lItemResultDict = None lItemResultDict = None
lDEFSignature = signature(lItem["RenderFunction"]) # Get signature of the def lDEFSignature = signature(lItem["RenderFunction"]) # Get signature of the def
lDEFARGLen = len(lDEFSignature.parameters.keys()) # get count of the def args lDEFARGLen = len(lDEFSignature.parameters.keys()) # get count of the def args
if lDEFARGLen == 1: # def (inGSettings) try:
lItemResultDict = lItem["RenderFunction"](inGlobalDict) if lDEFARGLen == 1: # def (inGSettings)
elif lDEFARGLen == 2: # def (inRequest, inGSettings) lItemResultDict = lItem["RenderFunction"](inGlobalDict)
lItemResultDict = lItem["RenderFunction"](inRequest, inGlobalDict) elif lDEFARGLen == 2: # def (inRequest, inGSettings)
elif lDEFARGLen == 0: # def () lItemResultDict = lItem["RenderFunction"](inRequest, inGlobalDict)
lItemResultDict = lItem["RenderFunction"]() elif lDEFARGLen == 0: # def ()
# RunFunction lItemResultDict = lItem["RenderFunction"]()
lResultJSON["RenderRobotList"].append(lItemResultDict) # RunFunction
lResultJSON["RenderRobotList"].append(lItemResultDict)
except Exception as e:
if lL: lL.exception(f"Error in control panel. CP item {lItem}. Exception is below")
# Iterate throught the RDP list
for lRDPSessionKeyStrItem in inGlobalDict["RobotRDPActive"]["RDPList"]:
lRDPConfiguration = inGlobalDict["RobotRDPActive"]["RDPList"][
lRDPSessionKeyStrItem] # Get the configuration dict
lDataItemDict = {"SessionKeyStr": "", "SessionHexStr": "", "IsFullScreenBool": False,
"IsIgnoredBool": False} # Template
lDataItemDict["SessionKeyStr"] = lRDPSessionKeyStrItem # Session key str
lDataItemDict["SessionHexStr"] = lRDPConfiguration["SessionHex"] # Session Hex
lDataItemDict["IsFullScreenBool"] = True if lRDPSessionKeyStrItem == inGlobalDict["RobotRDPActive"][
"FullScreenRDPSessionKeyStr"] else False # Check the full screen for rdp window
lDataItemDict["IsIgnoredBool"] = lRDPConfiguration["SessionIsIgnoredBool"] # Is ignored
lResultJSON["RenderRDPList"].append(lDataItemDict)
# Send message back to client # Send message back to client
message = json.dumps(lResultJSON) message = json.dumps(lResultJSON)
# Write content as utf-8 data # Write content as utf-8 data
inResponseDict["Body"] = bytes(message, "utf8") #inResponseDict["Body"] = bytes(message, "utf8")
return bytes(message, "utf8")
# UserAccess get rights hierarchy dict in json # UserAccess get rights hierarchy dict in json
def UserRoleHierarchyGet(inRequest,inGlobalDict): def UserRoleHierarchyGet(inRequest,inGlobalDict):
inResponseDict = inRequest.OpenRPAResponseDict inResponseDict = inRequest.OpenRPAResponseDict
@ -109,10 +205,9 @@ def SettingsUpdate(inGlobalConfiguration):
{"Method":"GET", "URL": "/3rdParty/Semantic-UI-CSS-master/themes/default/assets/fonts/icons.woff2", "MatchType": "EqualCase", "ResponseFilePath": os.path.join(lOrchestratorFolder, "..\\Resources\\Web\\Semantic-UI-CSS-master\\themes\\default\\assets\\fonts\\icons.woff2"), "ResponseContentType": "font/woff2"}, {"Method":"GET", "URL": "/3rdParty/Semantic-UI-CSS-master/themes/default/assets/fonts/icons.woff2", "MatchType": "EqualCase", "ResponseFilePath": os.path.join(lOrchestratorFolder, "..\\Resources\\Web\\Semantic-UI-CSS-master\\themes\\default\\assets\\fonts\\icons.woff2"), "ResponseContentType": "font/woff2"},
{"Method":"GET", "URL": "/favicon.ico", "MatchType": "EqualCase", "ResponseFilePath": os.path.join(lOrchestratorFolder, "Web\\favicon.ico"), "ResponseContentType": "image/x-icon"}, {"Method":"GET", "URL": "/favicon.ico", "MatchType": "EqualCase", "ResponseFilePath": os.path.join(lOrchestratorFolder, "Web\\favicon.ico"), "ResponseContentType": "image/x-icon"},
{"Method":"GET", "URL": "/3rdParty/Handlebars/handlebars-v4.1.2.js", "MatchType": "EqualCase", "ResponseFilePath": os.path.join(lOrchestratorFolder, "..\\Resources\\Web\\Handlebars\\handlebars-v4.1.2.js"), "ResponseContentType": "application/javascript"}, {"Method":"GET", "URL": "/3rdParty/Handlebars/handlebars-v4.1.2.js", "MatchType": "EqualCase", "ResponseFilePath": os.path.join(lOrchestratorFolder, "..\\Resources\\Web\\Handlebars\\handlebars-v4.1.2.js"), "ResponseContentType": "application/javascript"},
{"Method": "GET", "URL": "/Monitor/ControlPanelDictGet", "MatchType": "Equal", "ResponseDefRequestGlobal": Monitor_ControlPanelDictGet, "ResponseContentType": "application/json"}, {"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": "/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": "GET", "URL": "/pyOpenRPA_logo.png", "MatchType": "Equal", "ResponseFilePath": os.path.join(lOrchestratorFolder, "..\\Resources\\Web\\pyOpenRPA_logo.png"), "ResponseContentType": "image/png"},
{"Method": "GET", "URL": "/Orchestrator/RobotRDPActive/ControlPanelDictGet", "MatchType": "Equal","ResponseDefRequestGlobal": RobotRDPActive_ControlPanelDictGet, "ResponseContentType": "application/json"},
{"Method": "POST", "URL": "/Orchestrator/UserRoleHierarchyGet", "MatchType": "Equal","ResponseDefRequestGlobal": UserRoleHierarchyGet, "ResponseContentType": "application/json"} {"Method": "POST", "URL": "/Orchestrator/UserRoleHierarchyGet", "MatchType": "Equal","ResponseDefRequestGlobal": UserRoleHierarchyGet, "ResponseContentType": "application/json"}
] ]
inGlobalConfiguration["Server"]["URLList"]=inGlobalConfiguration["Server"]["URLList"]+lURLList inGlobalConfiguration["Server"]["URLList"]=inGlobalConfiguration["Server"]["URLList"]+lURLList

@ -54,7 +54,8 @@ $(document).ready(function() {
} }
//For data storage key //For data storage key
mGlobal["DataStorage"] = {} mGlobal["DataStorage"] = {}
// Clear the session cookie
document.cookie = "SessionGUIDStr=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
String.prototype.replaceAll = function(search, replace){ String.prototype.replaceAll = function(search, replace){
return this.split(search).join(replace); return this.split(search).join(replace);
} }
@ -225,125 +226,96 @@ $(document).ready(function() {
///////Control panel ///////Control panel
/////////////////////////////// ///////////////////////////////
///Refresh control panel ///Refresh control panel
function sleep(ms) {
ms += new Date().getTime();
while (new Date() < ms){}
}
mGlobal.Monitor.fControlPanelRefresh=function() { mGlobal.Monitor.fControlPanelRefresh=function() {
///Загрузка данных try {
$.ajax({ ///Загрузка данных
type: "GET", $.ajax({
url: 'Monitor/ControlPanelDictGet', type: "GET",
data: '', url: 'Monitor/ControlPanelDictGet',
success: data: '',
function(lData,l2,l3) xhrFields: {
{ withCredentials: true
var lResponseJSON=JSON.parse(lData) },
///Escape onclick success: function(lData,l2,l3)
/// RenderRobotList {
lResponseJSON["RenderRobotList"].forEach( try {
function(lItem){ var lResponseJSON=JSON.parse(lData)
if ('FooterButtonX2List' in lItem) { ///Escape onclick
/// FooterButtonX2List /// RenderRobotList
lItem["FooterButtonX2List"].forEach( lResponseJSON["RenderRobotList"].forEach(
function(lItem2){ function(lItem){
if ('OnClick' in lItem) { if ('FooterButtonX2List' in lItem) {
lOnClickEscaped = lItem["OnClick"]; /// FooterButtonX2List
lOnClickEscaped = lOnClickEscaped.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;"); lItem["FooterButtonX2List"].forEach(
lItem["OnClick"] = lOnClickEscaped; function(lItem2){
} if ('OnClick' in lItem) {
lOnClickEscaped = lItem["OnClick"];
lOnClickEscaped = lOnClickEscaped.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
lItem["OnClick"] = lOnClickEscaped;
}
}
);
/// FooterButtonX1List
lItem["FooterButtonX1List"].forEach(
function(lItem2){
if ('OnClick' in lItem) {
lOnClickEscaped = lItem["OnClick"];
lOnClickEscaped = lOnClickEscaped.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
lItem["OnClick"] = lOnClickEscaped;
}
}
);
} }
); }
/// FooterButtonX1List );
lItem["FooterButtonX1List"].forEach( //////////////////////////////////////////////////////////
function(lItem2){ ///Сформировать HTML код новой таблицы - контрольная панель
if ('OnClick' in lItem) { lHTMLCode=mGlobal.GeneralGenerateHTMLCodeHandlebars(".openrpa-hidden-control-panel",lResponseJSON)
lOnClickEscaped = lItem["OnClick"]; //Присвоить ответ в mGlobal.Monitor.mResponseList
lOnClickEscaped = lOnClickEscaped.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;"); mGlobal.Monitor.mResponseList = lResponseJSON
lItem["OnClick"] = lOnClickEscaped; ///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();
} }
); catch(error) {
///Сформировать 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
}
} }
) mGlobal.Monitor.fControlPanelRefresh() // recursive
///Очистить дерево },
//mGlobal.ElementTree.fClear(); dataType: "text",
///Прогрузить новую таблицу error: function(jqXHR, textStatus, errorThrown ) {
$(".openrpa-control-panel").html(lHTMLCode) sleep(3000)
}, mGlobal.Monitor.fControlPanelRefresh() // recursive
dataType: "text" }
}); });
}
///
mGlobal.Monitor.mControlPanelAutoUpdateSeconds=3;
mGlobal.Monitor.mControlPanelAutoUpdateSecondsCurrent=3;
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) catch(error) {
} sleep(3000)
mGlobal.Monitor.fControlPanelRefresh() mGlobal.Monitor.fControlPanelRefresh() // recursive
mGlobal.Monitor.fControlPanelAutoUpdateRun(3);
////////////////////////////////
/////// /Orchestrator/RobotRDPActive/ControlPanelDictGet
///////////////////////////////
mGlobal.RobotRDPActive = {}
///Refresh control panel
mGlobal.RobotRDPActive.fControlPanelRefresh=function() {
///Загрузка данных
$.ajax({
type: "GET",
url: 'Orchestrator/RobotRDPActive/ControlPanelDictGet',
data: '',
success:
function(lData,l2,l3)
{
var lResponseJSON=JSON.parse(lData)
///Сформировать HTML код новой таблицы
lHTMLCode=mGlobal.GeneralGenerateHTMLCodeHandlebars(".openrpa-hidden-robotrdpactive-control-panel",lResponseJSON)
//Присвоить ответ в mGlobal.RobotRDPActive.mResponseList
mGlobal.RobotRDPActive.mResponseList = lResponseJSON
///Прогрузить новую таблицу
$(".openrpa-robotrdpactive-control-panel").html(lHTMLCode)
},
dataType: "text"
});
}
///
mGlobal.RobotRDPActive.mControlPanelAutoUpdateSeconds=3;
mGlobal.RobotRDPActive.mControlPanelAutoUpdateSecondsCurrent=3;
mGlobal.RobotRDPActive.fControlPanelAutoUpdateRun=function(inRefreshSeconds) {
mGlobal.RobotRDPActive.mControlPanelAutoUpdateSeconds=inRefreshSeconds;
//Функция обновления текста кнопки обновления
lControlPanelUpdate=function() {
mGlobal.RobotRDPActive.mControlPanelAutoUpdateSecondsCurrent=mGlobal.RobotRDPActive.mControlPanelAutoUpdateSecondsCurrent-1
if (mGlobal.RobotRDPActive.mControlPanelAutoUpdateSecondsCurrent==-1) {
mGlobal.RobotRDPActive.mControlPanelAutoUpdateSecondsCurrent=mGlobal.RobotRDPActive.mControlPanelAutoUpdateSecondsCurrent=mGlobal.RobotRDPActive.mControlPanelAutoUpdateSeconds;
mGlobal.RobotRDPActive.fControlPanelRefresh()
}
$(".openrpa-robotrdpactive-control-panel-general .openrpa-refresh-button").html("Refresh "+mGlobal.RobotRDPActive.mControlPanelAutoUpdateSecondsCurrent);
} }
mGlobal.RobotRDPActive.mControlPanelAutoUpdateTimerId=setInterval(lControlPanelUpdate,1000) //mGlobal.Monitor.fControlPanelRefresh() // recursive
} }
mGlobal.RobotRDPActive.fControlPanelRefresh() mGlobal.Monitor.fControlPanelRefresh()
mGlobal.RobotRDPActive.fControlPanelAutoUpdateRun(3);
mGlobal.Test=function() { mGlobal.Test=function() {
///Обнулить таблицу ///Обнулить таблицу
lData = [ lData = [

@ -68,12 +68,6 @@
<i class="clipboard list icon"></i> <i class="clipboard list icon"></i>
Dashboard (Robot control panel) Dashboard (Robot control panel)
</h4> </h4>
<div class="ui info message">
<button class="ui icon button labeled" onclick="mGlobal.Monitor.fControlPanelRefresh();">
<i class="sync alternate icon"></i>
<div class="openrpa-refresh-button">Refresh</div>
</button>
</div>
<div class="openrpa-control-panel"></div> <div class="openrpa-control-panel"></div>
<script class="openrpa-hidden-control-panel" style="display:none" type="text/x-handlebars-template"> <script class="openrpa-hidden-control-panel" style="display:none" type="text/x-handlebars-template">
<div class="ui cards"> <div class="ui cards">
@ -236,17 +230,11 @@
RDP active list RDP active list
</div> </div>
</h2> </h2>
<div class="ui info message">
<button class="ui icon button labeled " onclick="mGlobal.RobotRDPActive.fControlPanelRefresh();">
<i class="sync alternate icon"></i>
<div class="openrpa-refresh-button">Refresh</div>
</button>
</div>
<div class="openrpa-robotrdpactive-control-panel"></div> <div class="openrpa-robotrdpactive-control-panel"></div>
<script class="openrpa-hidden-robotrdpactive-control-panel" style="display:none" type="text/x-handlebars-template"> <script class="openrpa-hidden-robotrdpactive-control-panel" style="display:none" type="text/x-handlebars-template">
<div class="ui inverted segment"> <div class="ui inverted segment">
<div class="ui inverted relaxed divided list"> <div class="ui inverted relaxed divided list">
{{#DataList}} {{#RenderRDPList}}
<div class="item"> <div class="item">
<div class="right floated content"> <div class="right floated content">
<div class="ui button" onclick="mGlobal.Processor.ServerValueAppend(['RobotRDPActive','ActivityList'],{'DefNameStr': 'RDPSessionReconnect', 'ArgList': [], 'ArgDict': {'inRDPSessionKeyStr': '{{{SessionKeyStr}}}'} })" >Reconnect</div> <div class="ui button" onclick="mGlobal.Processor.ServerValueAppend(['RobotRDPActive','ActivityList'],{'DefNameStr': 'RDPSessionReconnect', 'ArgList': [], 'ArgDict': {'inRDPSessionKeyStr': '{{{SessionKeyStr}}}'} })" >Reconnect</div>

Loading…
Cancel
Save