def search(self, device=None): user = self.get_auth() html = WebViews.load_base( user, WebViews.load_bc_settings(), WebViews.load_basic_page('Search Results', WebSearch.search_devices(device))) return html
def notify(self): user = self.get_auth() html = WebViews.load_base( user, WebViews.load_bc_settings(), WebViews.load_basic_page('Notification Rules', WebNotify.notify_rules())) return html
def user_add(self, username=None, password=None, role=None): user = self.get_auth() if not username is None and not password is None and not role is None: WebUsers.user_add(username, password, role) self.redirect('/users') else: html = WebViews.load_base( user, WebViews.load_bc_settings(), WebViews.load_basic_page('Users', WebViews.load_user_add())) return html
def user_edit_role(self, id, role=None): user = self.get_auth() if role == None: roleid = WebData.web_code_select_user(id) print(roleid) html = WebViews.load_base( user, WebViews.load_bc_settings(), WebViews.load_basic_page( 'Users', WebViews.load_user_edit_role(roleid['role']))) return html else: WebData.web_code_edit_user_role(id, role) self.redirect('/users')
def password(self, pass1=None, pass2=None): user = self.get_auth() if pass1 is None and pass2 is None: html = WebViews.load_base( user, WebViews.load_bc_settings(), WebViews.load_basic_page('Change Password', WebViews.load_change_password())) return html else: changepw = WebAuth.change_password(user, pass1, pass2) if changepw is True: self.redirect('/settings') else: self.redirect('/error')
def user_edit_pass(self, id, pass1=None, pass2=None): user = self.get_auth() if pass1 is None and pass2 is None: html = WebViews.load_base( user, WebViews.load_bc_settings(), WebViews.load_basic_page('Users', WebViews.load_user_edit_password())) return html else: encryptpw = WebAuth.set_password(pass1, pass2) if not encryptpw is None: WebData.web_code_edit_user_password(str(id), encryptpw) self.redirect('/users') else: self.redirect('/error')
def index_content(qstring="page=1"): html = "" pstring = str(qstring) page = int(pstring.replace("page=", "")) html += WebViews.load_index_content(WebIndex.index_block_1(), WebIndex.index_block_2(), WebIndex.index_block_3(), WebIndex.index_block_4(page), WebIndex.index_block_pager(page)) return html
def devices(self, name=None, monitor=None): user = self.get_auth() if name is None and monitor is None: html = WebViews.load_base( user, WebViews.load_bc_devices(), WebViews.load_basic_page('Devices', WebDevices.device_index())) elif not name is None and monitor is None: html = WebViews.load_base( user, WebViews.load_bc_device(name), WebViews.load_refresh('/device_content/' + name)) elif not name is None and not monitor is None: html = WebViews.load_base( user, WebViews.load_bc_device_graph(name, monitor), WebViews.load_refresh('/device_graph_content/' + name + '/' + monitor)) return html
def notify_add(self, notify_name=None, notify_email=None, agent_name=None, agent_monitor=None, agent_status=None, agent_severity=None, notify_enabled=None): user = self.get_auth() html = '' if notify_name is None and notify_email is None and agent_name is None and agent_monitor is None and agent_status is None and agent_severity is None and notify_enabled is None: html = WebViews.load_base( user, WebViews.load_bc_settings(), WebViews.load_basic_page('Add Notification Rule', WebNotify.notify_add())) return html else: WebData.web_code_insert_notifyrules(notify_name, notify_email, agent_name, agent_monitor, agent_status, agent_severity, notify_enabled) self.redirect('/notify')
def settings(self): user = self.get_auth() html = WebViews.load_base( user, WebViews.load_bc_settings(), WebViews.load_basic_page('Settings', WebSettings.settings())) return html
def reports(self): user = self.get_auth() html = WebViews.load_base(user, WebViews.load_bc_reports(), 'reports') return html
def events(self, status=1): user = self.get_auth() html = WebViews.load_base( user, WebViews.load_bc_events(), WebViews.load_refresh('/events_content/' + str(status))) return html
def index(self, page=1): user = self.get_auth() html = WebViews.load_base( user, WebViews.load_bc_home(), WebViews.load_refresh('/index_content/' + str(page))) return html
def error(self): user = self.get_auth() html = WebViews.load_base(user, WebViews.load_bc_settings(), WebViews.load_basic_page('Error', 'Error')) return html
def device_graph_content(name, monitor): html = WebViews.load_basic_page("System Performance", WebDevice.device_graph(name, monitor)) return html
def device_content(name): html = "" html = WebViews.load_device_content( WebDevice.device_content_system(name), WebDevice.device_content_data(name)) return html
def login(self): html = WebViews.load_login() return html
def events_content(status): html = WebViews.load_events_content(WebEvents.event_summary(status), WebEvents.event_list(status)) return html
def users(self): user = self.get_auth() html = WebViews.load_base( user, WebViews.load_bc_settings(), WebViews.load_basic_page('Users', WebUsers.users_list())) return html