def page(self) -> cmk.gui.pages.PageResult: breadcrumb = make_simple_page_breadcrumb( mega_menu_registry["help_links"], _("Info")) make_header( html, self._title(), breadcrumb=breadcrumb, ) html.open_div(id_="info_title") html.h1(_("Your monitoring machine")) html.a( HTMLWriter.render_img(theme.url("images/tribe29.svg")), "https://tribe29.com", target="_blank", ) html.close_div() html.div(None, id_="info_underline") html.open_div(id_="info_intro_text") html.span(_("Open. Effective. Awesome.")) html.span( _("May we present? Monitoring as it's supposed to be: " "incredibly quick to install, infinetely scalable, highly customizable and " "designed for admins.")) html.span( _("Visit our %s to learn more about Checkmk and about the %s.") % ( HTMLWriter.render_a( _("website"), "https://checkmk.com", target="_blank"), HTMLWriter.render_a( _("latest version"), "https://checkmk.com/product/latest-version", target="_blank", ), )) html.close_div() version_major_minor = re.sub(r".\d+$", "", Version(__version__).version_base) if version_major_minor: current_version_link = "https://checkmk.com/product/checkmk-%s" % version_major_minor else: current_version_link = "https://checkmk.com/product/latest-version" html.open_div(id="info_image") html.open_a(href=current_version_link, target="_blank") html.img(theme.url("images/monitoring-machine.png")) html.close_a() html.close_div() html.close_div() html.open_div(id_="info_footer") html.span( _("© %s tribe29 GmbH. All Rights Reserved.") % time.strftime("%Y")) html.a(_("License agreement"), href="https://checkmk.com/legal.html", target="_blank") html.close_div()
def _show_link( self, url: str, onclick: Optional[str], target: Optional[str], icon: Icon, title: str ) -> None: html.open_a(href=url, onclick=onclick, target=target) html.icon(icon or "trans") html.span(title) html.close_a()
def _show_add_snapin_button(self) -> None: html.open_div(id_="add_snapin") html.open_a(href=makeuri_contextless(request, [], filename="sidebar_add_snapin.py"), target="main") html.icon("add", title=_("Add elements to your sidebar")) html.close_a() html.close_div()
def show(self, page_state: PageState) -> None: html.open_div(class_=self._get_css_classes(page_state), title=page_state.tooltip_text) if page_state.url: html.open_a(page_state.url) self._show_content(page_state) html.close_a() else: self._show_content(page_state) html.close_div()
def _show_item(self, item: TopicMenuItem) -> None: html.open_li(class_="show_more_mode" if item.is_show_more else None) html.open_a( href=item.url, target=item.target, onclick="cmk.popup_menu.close_popup()", ) if user.get_attribute("icons_per_item"): html.icon(item.icon or "dash") self._show_item_title(item) html.close_a() html.close_li()
def _show_diagnose_output(self): if not request.var("_save"): html.show_message( _( "You can diagnose the connection to a specific host using this dialog. " "You can either test whether your current configuration is still working " "or investigate in which ways a host can be reached. Simply configure the " "connection options you like to try on the right side of the screen and " 'press the "Test" button. The results will be displayed here.' ) ) return if user_errors: html.show_user_errors() return # TODO: Insert any vs_host valuespec validation # These tests can be called with invalid valuespec settings... # TODO: Replace hard coded icon paths with dynamic ones to old or new theme for ident, title in ModeDiagHost.diag_host_tests(): html.h3(title) html.open_table(class_=["data", "test"]) html.open_tr(class_=["data", "odd0"]) html.open_td(class_="icons") html.open_div() html.icon("reload", id_="%s_img" % ident) html.open_a(href="") html.icon( "reload", title=_("Retry this test"), cssclass="retry", id_="%s_retry" % ident ) html.close_a() html.close_div() html.close_td() html.open_td() html.div("", class_="log", id="%s_log" % ident) html.close_td() html.close_tr() html.close_table() html.javascript( "cmk.host_diagnose.start_test(%s, %s, %s)" % ( json.dumps(ident), json.dumps(self._hostname), json.dumps(transactions.fresh_transid()), ) )
def _show_items(self, topic_id: str, topic: TopicMenuTopic) -> None: html.open_ul() for item in sorted(topic.items, key=lambda g: g.sort_index): self._show_item(item) html.open_li(class_="show_all_items") html.open_a(href="", onclick="cmk.popup_menu.mega_menu_show_all_items('%s')" % topic_id) if user.get_attribute("icons_per_item"): html.icon("trans") html.write_text(_("Show all")) html.close_a() html.close_li() html.close_ul()
def show(self): html.open_div(class_="mainmenu") for item in self._items: if not item.may_see(): continue html.open_a(href=item.get_url(), onfocus="if (this.blur) this.blur();") html.icon(item.icon, item.title) html.div(item.title, class_="title") html.div(item.description, class_="subtitle") html.close_a() html.close_div()
def jqm_page_index_topic_renderer(topic: str, items: Items) -> None: has_items_for_topic = any(i for i in items if i[0] == topic) if not has_items_for_topic: return html.p(topic) html.open_ul(**{"data-role": "listview", "data-inset": "true"}) for top, href, title in items: if top == topic: html.open_li() html.open_a(href=href, **{"data-ajax": "false", "data-transition": "flip"}) html.write_html(HTML(title)) html.close_a() html.close_li() html.close_ul()
def _show_topic_title(self, menu_id: str, topic_id: str, topic: TopicMenuTopic) -> None: html.open_h2() html.open_a( class_="show_all_topics", href="", onclick="cmk.popup_menu.mega_menu_show_all_topics('%s')" % topic_id, ) html.icon(icon="collapse_arrow", title=_("Show all %s topics") % menu_id) html.close_a() if not user.get_attribute("icons_per_item") and topic.icon: html.icon(topic.icon) html.span(topic.title) html.close_h2()
def _show_link( self, entry: PageMenuEntry, url: Optional[str], onclick: Optional[str], target: Optional[str], ) -> None: html.open_a( href=url, onclick=onclick, target=target, id_=("menu_suggestion_%s" % entry.name if entry.name else None), ) html.icon(entry.icon_name or "trans") html.write_text(entry.shortcut_title or entry.title) html.close_a()
def show(self): html.open_table(class_="dashlet_overview") html.open_tr() html.open_td(valign="top") html.open_a(href="https://checkmk.com/") html.img(theme.url("images/check_mk.trans.120.png"), style="margin-right: 30px;") html.close_a() html.close_td() html.open_td() html.h2("CheckMK") html.write_text( _("Welcome to Checkmk. If you want to learn more about Checkmk, please visit " 'our <a href="https://checkmk.com/" target="_blank">user manual</a>.' )) html.close_td() html.close_tr() html.close_table()
def _show_sidebar_head(self): html.open_div(id_="side_header") html.open_a( href=user.start_url or active_config.start_url, target="main", title=_("Go to main page"), ) _render_header_icon() html.close_a() html.close_div() MainMenuRenderer().show() html.open_div(id_="side_fold", title=_("Toggle the sidebar"), onclick="cmk.sidebar.toggle_sidebar()") html.icon("sidebar_folded", class_=["folded"]) html.icon("sidebar") if not user.get_attribute("nav_hide_icons_title"): html.div(_("Sidebar")) html.close_div()
def page(self) -> None: assert user.id is not None html.render_headfoot = False html.add_body_css_class("login") html.add_body_css_class("two_factor") make_header(html, _("Two-factor authentication"), Breadcrumb(), javascripts=[]) html.open_div(id_="login") html.open_div(id_="login_window") html.open_a(href="https://checkmk.com") html.img( src=theme.detect_icon_path(icon_name="logo", prefix="mk-"), id_="logo", class_="custom" if theme.has_custom_logo() else None, ) html.close_a() if not is_two_factor_login_enabled(user.id): raise MKGeneralException( _("Two-factor authentication not enabled")) html.begin_form("two_factor_login", method="POST", add_transid=False, action="user_login_two_factor.py") html.prevent_password_auto_completion() html.hidden_field( "_origtarget", origtarget := request.get_url_input("_origtarget", "index.py")) if backup_code := request.get_ascii_input("_backup_code"): if is_two_factor_backup_code_valid(user.id, backup_code): set_two_factor_completed() raise HTTPRedirect(origtarget)
def iconlink(text: str, url: str, icon: Icon) -> None: html.open_a(class_=["iconlink", "link"], target="main", href=url) html.icon(icon, cssclass="inline") html.write_text(text) html.close_a() html.br()
def _iconlink(self, text, url, icon): html.open_a(class_=["iconlink", "link"], target="main", href=url) html.icon("/webconf/images/icon_%s.png" % icon, cssclass="inline") html.write_text(text) html.close_a() html.br()
def show(self): html.open_a(href="https://checkmk.com/", target="_blank") html.img(theme.url("images/check_mk.trans.120.png"), style="margin-right: 30px;") html.close_a()