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")
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)
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))
def get(self, *args, **kwargs): action = self.get_argument("action", default="list") if action == "list": contact_list = AllMachineInfo.get_contact_list() contact_list_handled = DataManage.manage_contact_list(contact_list) self.render("machines/contact_list.html", name=settings.template_variables, contact_list=contact_list_handled) elif action == "delete": cid = self.get_argument("cid") AllMachineInfo.delete_contact(cid) self.write("<script language='javascript'>window.location.href='/contactmanage?action=list';</script>")
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))
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))
def get(self): select_data = AllMachineInfo().add_host_select select_data_handled, status_handled = DataManage.manage_add_host_select(select_data) self.render('machines/add_host.html', name=settings.template_variables, select_data=select_data_handled, select_data_status=status_handled)
def get(self, *args, **kwargs): room_data, room_count = AllMachineInfo.room_list() room_data_handled, room_data_count_handled = DataManage.manage_room_list(room_data, room_count) self.render("machines/room_list.html", name=settings.template_variables, room_data=room_data_handled, room_count=room_data_count_handled)
def get(self, *args, **kwargs): data_distribute, data_nums = AllMachineInfo().distribute_host data_distribute_handled = DataManage.manage_host_distribute(data_distribute) self.render("machines/host_distribute.html", name=settings.template_variables, data_distribute=data_distribute_handled, data_nums=data_nums[0][0])