def response(self): '''index ''' zk_clusters = ZdZookeeper.select().where( ZdZookeeper.deleted == "0") self.render('config/zookeeper/stat.html', zk_clusters=zk_clusters)
def response(self): '''add ''' clusters = ZdZookeeper.select().where(ZdZookeeper.deleted == "0") return self.render('config/agent/add.html', action='config/agent/save', clusters=clusters)
def response(self): """watch """ clusters = ZdZookeeper.select().where( (ZdZookeeper.deleted == "0") & (ZdZookeeper.cluster_name.startswith("qconf")) ) self.render("config/agent/watch.html", clusters=clusters, agent_register_prefix=self.agent_register_prefix)
def response(self): '''edit ''' if self.info_ids: id_li = self.info_ids.split(',') if len(id_li) != 1: return self.ajax_popup(close_current=False, code=300, msg="请选择单条记录进行修改") else: user = ZdUser.one(id=id_li[0], deleted='0') result = dict() zookeepers = ZdZookeeper.select().where( ZdZookeeper.deleted == '0') for zookeeper in zookeepers: services = ZdService.select().where( (ZdService.zookeeper == zookeeper.id) & (ZdService.deleted == '0')) result[zookeeper] = services return self.render('config/user/edit.html', action='config/user/save', user=user, result=result) else: return self.ajax_popup(close_current=False, code=300, msg="请选择某条记录进行修改")
def response(self): """add """ clusters = ZdZookeeper.select().where( (ZdZookeeper.deleted == "0") & (ZdZookeeper.cluster_name.startswith("qconf")) ) return self.render("config/agent/add.html", action="config/agent/save", clusters=clusters)
def response(self): '''导出选中数据到excel中 ''' id_li = self.info_ids.split(',') sheet_text = ZdZookeeper.select().where(ZdZookeeper.id << id_li) sheet_title = [ { 'name': '集群名称' }, { 'name': '集群配置' }, { 'name': '集群业务' }, ] bind_attr = ( 'cluster_name', 'hosts', 'business', ) ewb = ExcelWorkBook() sheet_name = ZdZookeeper._meta.db_table ewb.add_sheet(sheet_name) ewb.add_title(sheet_name, sheet_title) ewb.add_text(sheet_name, sheet_text, bind=bind_attr) filename = '{}.xls'.format(sheet_name) filename = urllib.urlencode({'filename': filename}) self.set_header('Content-Disposition', 'attachment;{}'.format(filename)) self.finish(ewb.get_stream())
def response(self): '''watch ''' clusters = ZdZookeeper.select().where(ZdZookeeper.deleted == "0") self.render('config/agent/watch.html', clusters=clusters, agent_register_prefix=self.agent_register_prefix)
def response(self): '''index ''' # zookeeper clusters clusters = ZdZookeeper.select().where(ZdZookeeper.deleted == "0") if clusters.count() < 1: return self.ajax_popup(code=300, msg="请先到zookeeper管理菜单下设置集群信息!") return self.render('config/znode/index.html', clusters=clusters)
def response(self): """index """ # zookeeper clusters clusters = ZdZookeeper.select().where(ZdZookeeper.deleted == "0") if clusters.count() < 1: return self.ajax_popup(code=300, msg="请先到zookeeper管理菜单下设置集群信息!") return self.render("config/znode/index.html", clusters=clusters)
def response(self): '''watch ''' clusters = ZdZookeeper.select().where( (ZdZookeeper.deleted == "0") & (ZdZookeeper.cluster_name.startswith('qconf')) ) self.render('config/agent/watch.html', clusters=clusters, agent_register_prefix=self.agent_register_prefix)
def response(self): '''add ''' result = dict() zookeepers = ZdZookeeper.select().where(ZdZookeeper.deleted == '0') for zookeeper in zookeepers: services = ZdService.select().where((ZdService.zookeeper == zookeeper.id) & (ZdService.deleted == '0')) result[zookeeper] = services return self.render('config/user/add.html', action='config/user/save', result=result)
def response(self): '''search ''' clauses = self.parse_query(ZdZookeeper) order = getattr(ZdZookeeper, self.order_field) records = ZdZookeeper.select().order_by( getattr(order, self.order_direction)() ).where(reduce(operator.and_, clauses)) self.render('config/zookeeper/datagrid.html', total=records.count(), current_page=self.current_page, page_size=self.page_size, records=records.paginate(self.current_page, self.page_size))
def response(self): """edit """ if self.info_ids: id_li = self.info_ids.split(",") if len(id_li) != 1: return self.ajax_popup(close_current=False, code=300, msg="请选择单条记录进行修改") clusters = ZdZookeeper.select().where( (ZdZookeeper.deleted == "0") & (ZdZookeeper.cluster_name.startswith("qconf")) ) record = ZdQconfAgent.one(id=id_li[0]) return self.render("config/agent/edit.html", action="/config/agent/save", clusters=clusters, record=record) else: return self.ajax_popup(close_current=False, code=300, msg="请选择某条记录进行修改")
def response(self): '''edit ''' if self.info_ids: id_li = self.info_ids.split(',') if len(id_li) != 1: return self.ajax_popup(close_current=False, code=300, msg="请选择单条记录进行修改") clusters = ZdZookeeper.select().where(ZdZookeeper.deleted == "0") record = ZdQconfAgent.one(id=id_li[0]) return self.render('config/agent/edit.html', action='/config/agent/save', clusters=clusters, record=record) else: return self.ajax_popup(close_current=False, code=300, msg="请选择某条记录进行修改")
def response(self): '''index ''' # zookeeper clusters clusters = ZdZookeeper.select().where(ZdZookeeper.deleted == "0") if clusters.count() < 1: return self.ajax_popup(code=300, msg="请先到zookeeper管理菜单下设置集群信息!") clauses = self.parse_query(ZdService) order = getattr(ZdService, self.order_field) records = ZdService.select().order_by( getattr(order, self.order_direction)() ).where(reduce(operator.and_, clauses) & (ZdService.deleted == "0")) self.render('config/service/index.html', action='/config/service/index', total=records.count(), current_page=self.current_page, page_size=self.page_size, records=records.paginate(self.current_page, self.page_size))
def response(self): '''导出选中数据到excel中 ''' id_li = self.info_ids.split(',') sheet_text = ZdZookeeper.select().where(ZdZookeeper.id << id_li) sheet_title = [ {'name': '集群名称'}, {'name': '集群配置'}, {'name': '集群业务'}, ] bind_attr = ( 'cluster_name', 'hosts', 'business', ) ewb = ExcelWorkBook() sheet_name = ZdZookeeper._meta.db_table ewb.add_sheet(sheet_name) ewb.add_title(sheet_name, sheet_title) ewb.add_text(sheet_name, sheet_text, bind=bind_attr) filename = '{}.xls'.format(sheet_name) filename = urllib.urlencode({'filename': filename}) self.set_header('Content-Disposition', 'attachment;{}'.format(filename)) self.finish(ewb.get_stream())