Esempio n. 1
0
    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
Esempio n. 2
0
 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
Esempio n. 3
0
 def dm_createautoagent(request):
     ''' create new  db model autoagent
     '''
     message = "successful"
     try:
         autoagent = AutoAgent()
         autoagent = AutoAgentService.initlize_dm_instance(
             request, autoagent)
         DAL_AutoAgent.add_autoagent(autoagent)
     except Exception as ex:
         message = str(ex)
         SimpleLogger.error(message)
     return message
Esempio n. 4
0
 def search_autoagent_byid(autoagentid):
     autoagent = None
     try:
         autoagent = DAL_AutoAgent.get_all().filter(id=autoagentid)
     except Exception as ex:
         SimpleLogger.error(ex.message)
     return autoagent
Esempio n. 5
0
 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
Esempio n. 6
0
 def search_autoagent_byname(autoagentname):
     result = None
     try:
         result = DAL_AutoAgent.get_all().filter(
             AName__icontains=autoagentname)
     except Exception as ex:
         print(ex)
     return result
Esempio n. 7
0
 def search_autoagent(searchkeyword):
     if searchkeyword == "ALL":
         result = DAL_AutoAgent.get_all().filter(AIsActive=1)
     else:
         result = AutoAgentService.search_autoagent_byid(searchkeyword)
         if result == None or len(result) == 0:
             result = AutoAgentService.search_autoagent_byname(
                 searchkeyword.strip())
     return result.order_by("-id")
Esempio n. 8
0
 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 get_autotask_agent(autotaskid):
     all_agents=DAL_AutoAgent.get_all()
     result=list()
     for agent in all_agents:
         temp=dict()
         temp["text"]=agent.AName
         temp["memberid"]=agent.id
         if autotaskid!=0:
             autotask=DAL_AutomationTask.get_automation_task(autotaskid)
             if agent.id==autotask.TaskAgentID:
                 temp["selected"]=1
             else:
                 temp["selected"]=0
         else:
             temp["selected"]=0
         result.append(temp)
     return str(result).replace("u'","'")
Esempio n. 10
0
 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'", "'")
Esempio n. 11
0
 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'", "'")
Esempio n. 12
0
 def get_autoagent_namelist():
     autoagentlist = DAL_AutoAgent.get_all()
     return str([item.TaskName
                 for item in autoagentlist]).replace("u'", "'")
Esempio n. 13
0
 def get_autoagent_name(autoagentid):
     result = ""
     if autoagentid != 0:
         autoagent = DAL_AutoAgent.get_autoagent(autoagentid)
         result = autoagent.AName
     return result
Esempio n. 14
0
 def check_ip_exits(agentip):
     return DAL_AutoAgent.get_autoagent_byip(agentip)
Esempio n. 15
0
 def check_name_exits(agentname):
     return DAL_AutoAgent.get_autoagent_byname(agentname)
Esempio n. 16
0
 def get_autoagent_workspace(autoagentid):
     result = ""
     if autoagentid != 0:
         autoagent = DAL_AutoAgent.get_autoagent(autoagentid)
         result = autoagent.AAgentWorkSpace
     return result
Esempio n. 17
0
 def get_autoagent_reserved(autoagentid):
     result = 1
     if autoagentid != 0:
         autoagent = DAL_AutoAgent.get_autoagent(autoagentid)
         result = autoagent.AIsReserved
     return result
Esempio n. 18
0
 def get_autoagent_ip(autoagentid):
     result = ""
     if autoagentid != 0:
         autoagent = DAL_AutoAgent.get_autoagent(autoagentid)
         result = autoagent.AIP
     return result
Esempio n. 19
0
 def get_hostmachine(self):
     machine_name="--"
     if self.automobiledevice.MDeviceAgent:
         agent=DAL_AutoAgent.get_autoagent(id)
         machine_name=agent.AName
     return machine_name