def dm_updateautoagent(request): message = "successful" try: autoagent = DAL_AutoAgent.get_autoagent( request.POST["autoagentid"]) autoagent = AutoAgentService.initlize_dm_instance( request, autoagent) DAL_AutoAgent.add_autoagent(autoagent) except Exception as ex: message = str(ex) SimpleLogger.error(message) return message
def disable_autoagent(request): message = "successful" try: autoagent = DAL_AutoAgent.get_autoagent( request.POST["autoagentid"]) autoagent.TaskIsActive = 0 DAL_AutoAgent.add_autoagent(autoagent) except Exception as ex: message = str(ex) SimpleLogger.error(message) return message
def get_autoagent_types(autoagentid): tasktypes = DAL_DictValue.getdatavaluebytype("AutoTaskType") result = list() for tasktype in tasktypes: temp = dict() temp["text"] = tasktype.DicDataName temp["memberid"] = tasktype.DicDataValue if autoagentid != 0: autoagent = DAL_AutoAgent.get_autoagent(autoagentid) if tasktype.DicDataValue == autoagent.TaskTpye: temp["selected"] = 1 else: temp["selected"] = 0 else: temp["selected"] = 0 result.append(temp) return str(result).replace("u'", "'")
def copy_autoagent(request): message = "successful" try: from_autoagent = DAL_AutoAgent.get_autoagent( request.POST["autoagentid"]) to_autoagent = AutoAgent() to_autoagent.AName = from_autoagent.AName to_autoagent.AOS = from_autoagent.AOS to_autoagent.AIP = from_autoagent.AIP to_autoagent.AStatus = AutoAgentStatusEnum.AgentStatus_Offline to_autoagent.AAgentBrowser = from_autoagent.AAgentBrowser to_autoagent.AIsReserved = from_autoagent.AIsReserved DAL_AutoAgent.add_autoagent(to_autoagent) except Exception as ex: message = str(ex) SimpleLogger.error(message) return message
def get_autoagent_os(autoagentid): all_os = DAL_DictValue.getdatavaluebytype("AgentOSType") result = list() if autoagentid != 0: autoagent = DAL_AutoAgent.get_autoagent(autoagentid) for os in all_os: temp = dict() temp["text"] = os.DicDataName temp["memberid"] = os.DicDataValue if autoagentid != 0: if os.DicDataValue == autoagent.AOS: temp["selected"] = 1 else: temp["selected"] = 0 else: temp["selected"] = 0 result.append(temp) return str(result).replace("u'", "'")
def get_autoagent_browsers(autoagentid): all_browsers = DAL_DictValue.getdatavaluebytype( "AutoTaskRuntime").filter(DicDataDesc='WEB') result = list() if autoagentid != 0: autoagent = DAL_AutoAgent.get_autoagent(autoagentid) for browser in all_browsers: temp = dict() temp["text"] = browser.DicDataName temp["memberid"] = browser.DicDataValue if autoagentid != 0: if browser.DicDataValue in eval(autoagent.AAgentBrowser): temp["selected"] = 1 else: temp["selected"] = 0 else: temp["selected"] = 0 result.append(temp) return str(result).replace("u'", "'")
def get_autoagent_workspace(autoagentid): result = "" if autoagentid != 0: autoagent = DAL_AutoAgent.get_autoagent(autoagentid) result = autoagent.AAgentWorkSpace return result
def get_autoagent_reserved(autoagentid): result = 1 if autoagentid != 0: autoagent = DAL_AutoAgent.get_autoagent(autoagentid) result = autoagent.AIsReserved return result
def get_autoagent_ip(autoagentid): result = "" if autoagentid != 0: autoagent = DAL_AutoAgent.get_autoagent(autoagentid) result = autoagent.AIP return result
def get_autoagent_name(autoagentid): result = "" if autoagentid != 0: autoagent = DAL_AutoAgent.get_autoagent(autoagentid) result = autoagent.AName return result
def get_hostmachine(self): machine_name="--" if self.automobiledevice.MDeviceAgent: agent=DAL_AutoAgent.get_autoagent(id) machine_name=agent.AName return machine_name