Esempio n. 1
0
def view_url(url_vars: HTTPVariables) -> str:
    return makeuri_contextless(request, url_vars, filename="view.py")
Esempio n. 2
0
def services_url(site, host_name):
    return makeuri_contextless(
        request,
        [("view_name", "host"), ("site", site), ("host", host_name)],
        filename="view.py",
    )
Esempio n. 3
0
 def _back_url(self) -> str:
     return makeuri_contextless(request, [("mode", "users")],
                                filename="wato.py")
Esempio n. 4
0
    def _handle_report_form(self, crash_info: CrashInfo) -> ReportSubmitDetails:
        details: ReportSubmitDetails
        try:
            vs = self._vs_crash_report()
            details = vs.from_html_vars("_report")
            vs.validate_value(details, "_report")

            # Make the resulting page execute the crash report post request
            url_encoded_params = urlencode_vars(
                [
                    ("name", details["name"]),
                    ("mail", details["mail"]),
                    (
                        "crashdump",
                        base64.b64encode(
                            _pack_crash_report(self._get_serialized_crash_report())
                        ).decode("ascii"),
                    ),
                ]
            )
            html.open_div(id_="pending_msg", style="display:none")
            html.show_message(_("Submitting crash report..."))
            html.close_div()
            html.open_div(id_="success_msg", style="display:none")
            html.show_message(
                _(
                    "Your crash report has been submitted (ID: ###ID###). Thanks for your participation, "
                    "it is very important for the quality of Checkmk.<br><br>"
                    "Please note:"
                    "<ul>"
                    "<li>In general we do <i>not</i> respond to crash reports, "
                    "except we need further information from you.</li>"
                    "<li>We read every feedback thoroughly, but this might happen "
                    "not before a couple of weeks or even months have passed and is "
                    "often aligned with our release cycle.</li>"
                    "<li>If you are in need of a quick solution for your problem, then "
                    "we can help you within the scope of professional support. If you "
                    "already have a support contract, then please use your personal "
                    "support email address to send us a mail refering to your crash "
                    "report.<br>If you are interested in the details about support, "
                    'you find details on <a href="https://checkmk.com/'
                    'checkmk_support_contract.html" target="_blank">our website</a>.'
                )
            )
            html.close_div()
            html.open_div(id_="fail_msg", style="display:none")
            report_url = makeuri_contextless(
                request,
                [
                    ("subject", "Checkmk Crash Report - " + self._get_version()),
                ],
                filename="mailto:" + self._get_crash_report_target(),
            )
            html.show_error(
                _(
                    "Failed to send the crash report. Please download it manually and send it "
                    'to <a href="%s">%s</a>'
                )
                % (report_url, self._get_crash_report_target())
            )
            html.close_div()
            html.javascript(
                "cmk.transfer.submit_crash_report(%s, %s);"
                % (json.dumps(config.crash_report_url), json.dumps(url_encoded_params))
            )
        except MKUserError as e:
            user_errors.add(e)

        return details
Esempio n. 5
0
def render_werk_id(werk, with_link) -> Union[HTML, str]:
    if with_link:
        url = makeuri_contextless(request, [("werk", werk["id"])],
                                  filename="werk.py")
        return html.render_a("#%04d" % werk["id"], href=url)
    return "#%04d" % werk["id"]