Пример #1
0
def page_handler() -> None:
    initialize_wato_html_head()

    if not config.wato_enabled:
        raise MKGeneralException(
            _("WATO is disabled. Please set <tt>wato_enabled = True</tt>"
              " in your <tt>multisite.mk</tt> if you want to use WATO."))

    # config.current_customer can not be checked with CRE repos
    if cmk_version.is_managed_edition() and not managed.is_provider(
            config.current_customer):  # type: ignore[attr-defined]
        raise MKGeneralException(
            _("Check_MK can only be configured on "
              "the managers central site."))

    current_mode = html.request.var("mode") or "main"
    mode_permissions, mode_class = _get_mode_permission_and_class(current_mode)

    display_options.load_from_html()

    if display_options.disabled(display_options.N):
        html.add_body_css_class("inline")

    # If we do an action, we aquire an exclusive lock on the complete WATO.
    if html.is_transaction():
        with store.lock_checkmk_configuration():
            _wato_page_handler(current_mode, mode_permissions, mode_class)
    else:
        _wato_page_handler(current_mode, mode_permissions, mode_class)
Пример #2
0
    def _display_audit_log_options(self):
        if display_options.disabled(display_options.C):
            return

        valuespec = self._vs_audit_log_options()

        html.begin_form("options", method="GET")
        valuespec.render_input_as_form("options", {})

        html.button("options", _("Apply"))
        html.hidden_fields()
        html.end_form()
Пример #3
0
    def _display_audit_log_options(self):
        if display_options.disabled(display_options.C):
            return

        html.begin_form("options", method="GET")

        self._show_audit_log_options_controls()

        html.open_div(class_="side_popup_content")
        if html.has_user_errors():
            html.show_user_errors()

        for name, vs in self._audit_log_options():
            html.render_floating_option(name, "single", "options_", vs,
                                        self._options[name])

        html.close_div()

        html.hidden_fields()
        html.end_form()
Пример #4
0
    def _display_audit_log_options(self):
        if display_options.disabled(display_options.C):
            return

        html.begin_form("options", method="GET")

        self._show_audit_log_options_controls()

        html.open_div(class_="side_popup_content")
        html.show_user_errors()

        for name, vs in self._audit_log_options():

            def renderer(name=name, vs=vs) -> None:
                vs.render_input("options_" + name, self._options[name])

            html.render_floating_option(name, "single", vs.title(), renderer)

        html.close_div()

        html.hidden_fields()
        html.end_form()