Exemplo n.º 1
0
 def get(self):
     server_data = AllMachineInfo().machine_list
     server_data_handled = DataManage.manage_machine_list(server_data)
     server_length = len(server_data_handled)
     page = self.get_argument("page", default="1")
     self.render('machines/main.html', name=settings.template_variables, server_data=server_data_handled,
                 server_length=server_length, page=int(page))
Exemplo n.º 2
0
 def get(self, *args, **kwargs):
     server_data = AllMachineInfo().machine_list
     server_data_handled = DataManage.manage_machine_list(server_data)
     DataManage.manage_host_export(server_data_handled)
     self.add_header("Content-Type", "application/vnd.ms-excel")
     self.add_header("Content-Disposition", "attachment;filename=machine.xls")
     self.render("../download/machine.xls")
     os.system("rm -rf download/machine.xls")
Exemplo n.º 3
0
 def post(self, *args, **kwargs):
     data_dic = dict()
     data_list = settings.ADD_HOST_LIST
     for name in data_list:
         data_dic[name] = self.get_argument(name)
     server_data = AllMachineInfo.search_hosts(data_dic)
     server_data_handled = DataManage.manage_machine_list(server_data)
     server_length = len(server_data_handled)
     page = self.get_argument("page", default="1")
     self.render('machines/main.html', name=settings.template_variables, server_data=server_data_handled,
                 server_length=server_length, page=int(page))
Exemplo n.º 4
0
 def get(self, *args, **kwargs):
     if self.get_argument('search') == 'server_ip':
         search_word = self.get_argument('search_word')
         server_data = AllMachineInfo.search_hosts_quick(search_word.strip())
         server_data_handled = DataManage.manage_machine_list(server_data)
         server_length = len(server_data_handled)
         page = self.get_argument("page", default="1")
         self.render('machines/main.html', name=settings.template_variables, server_data=server_data_handled,
                     server_length=server_length, page=int(page))
     elif self.get_argument('search') == 'high':
         select_data = AllMachineInfo().add_host_select
         select_data_handled, status_handled = DataManage.manage_add_host_select(select_data)
         self.render('machines/search_hosts.html', name=settings.template_variables, select_data=select_data_handled,
                     select_data_status=status_handled)
     elif self.get_argument('search') == 'distribute':
         project_name = self.get_argument('project_name')
         server_data = AllMachineInfo.distribute_host_search(project_name)
         server_data_handled = DataManage.manage_machine_list(server_data)
         server_length = len(server_data_handled)
         page = self.get_argument("page", default="1")
         self.render('machines/main.html', name=settings.template_variables, server_data=server_data_handled,
                     server_length=server_length, page=int(page))
Exemplo n.º 5
0
 def get(self, *args, **kwargs):
     action = self.get_argument('action')
     ModifyHost.machine_id = self.get_argument('mid')
     if action == 'modify':
         host_data = AllMachineInfo.modify_host(ModifyHost.machine_id)
         host_data_handled = DataManage.manage_machine_list(host_data)
         select_data = AllMachineInfo().add_host_select
         select_data_handled, status_handled = DataManage.manage_add_host_select(select_data)
         self.render('machines/modify_host.html', name=settings.template_variables, select_data=select_data_handled,
                     select_data_status=status_handled, host_data=host_data_handled)
     elif action == 'delete':
         AllMachineInfo.delete_host(ModifyHost.machine_id)
         page = self.get_argument("page")
         js_str = "<script language='javascript'>window.location.href='/?page=%s';</script>" % page
         self.write(js_str)