示例#1
0
 def buttons(self):
     changelog_button()
     home_button()
     if self._log_exists() and config.user.may("wato.clear_auditlog") \
        and config.user.may("wato.auditlog") and config.user.may("wato.edit"):
         html.context_button(_("Download"), html.makeactionuri([("_action", "csv")]), "download")
         if config.user.may("wato.edit"):
             html.context_button(_("Clear Log"), html.makeactionuri([("_action", "clear")]),
                                 "trash")
示例#2
0
    def action(self):
        if html.request.var("_action") != "discard":
            return

        if not html.check_transaction():
            return

        if not self._may_discard_changes():
            return

        # TODO: Remove once new changes mechanism has been implemented
        # Now remove all currently pending changes by simply restoring the last automatically
        # taken snapshot. Then activate the configuration. This should revert all pending changes.
        file_to_restore = self._get_last_wato_snapshot_file()

        if not file_to_restore:
            raise MKUserError(None,
                              _('There is no WATO snapshot to be restored.'))

        msg = _("Discarded pending changes (Restored %s)") % file_to_restore

        # All sites and domains can be affected by a restore: Better restart everything.
        watolib.add_change("changes-discarded",
                           msg,
                           domains=watolib.ABCConfigDomain.enabled_domains(),
                           need_restart=True)

        self._extract_snapshot(file_to_restore)
        cmk.gui.watolib.activate_changes.execute_activate_changes(
            [d.ident for d in watolib.ABCConfigDomain.enabled_domains()])

        for site_id in cmk.gui.watolib.changes.activation_sites():
            self.confirm_site_changes(site_id)

        html.header(self.title(),
                    show_body_start=display_options.enabled(display_options.H),
                    show_top_heading=display_options.enabled(
                        display_options.T))
        html.open_div(class_="wato")

        html.begin_context_buttons()
        home_button()
        html.end_context_buttons()

        html.show_message(_("Successfully discarded all pending changes."))
        html.javascript("hide_changes_buttons();")
        html.footer()

        return False
示例#3
0
    def buttons(self):
        home_button()

        # TODO: Remove once new changes mechanism has been implemented
        if self._may_discard_changes():
            html.context_button(_("Discard Changes!"),
                                html.makeactionuri([("_action", "discard")]),
                                "discard",
                                id_="discard_changes_button")

        if config.user.may("wato.sites"):
            html.context_button(_("Site Configuration"),
                                watolib.folder_preserving_link([("mode", "sites")]), "sites")

        if config.user.may("wato.auditlog"):
            html.context_button(_("Audit Log"),
                                watolib.folder_preserving_link([("mode", "auditlog")]), "auditlog")
示例#4
0
 def buttons(self):
     # type: () -> None
     home_button()
示例#5
0
 def buttons(self) -> None:
     home_button()
示例#6
0
 def home_button(self):
     home_button()
示例#7
0
 def buttons(self):
     home_button()