Esempio n. 1
0
    def render(self, row, cell):
        classes = ["perfometer"]
        if is_stale(row):
            classes.append("stale")

        try:
            title, h = Perfometer(row).render()
            if title is None and h is None:
                return "", ""
        except Exception as e:
            logger.exception()
            if config.debug:
                raise
            return " ".join(classes), _("Exception: %s") % e

        content = html.render_div(HTML(h), class_=["content"]) \
                + html.render_div(title, class_=["title"]) \
                + html.render_div("", class_=["glass"])

        # pnpgraph_present: -1 means unknown (path not configured), 0: no, 1: yes
        if display_options.enabled(display_options.X) \
           and row["service_pnpgraph_present"] != 0:
            if metrics.cmk_graphs_possible():
                import cmk.gui.cee.plugins.views.graphs
                url = cmk.gui.cee.plugins.views.graphs.cmk_graph_url(row, "service")
            else:
                url = pnp_url(row, "service")
            disabled = False
        else:
            url = "javascript:void(0)"
            disabled = True

        return " ".join(classes), \
            html.render_a(content=content, href=url, title=html.strip_tags(title),
                          class_=["disabled" if disabled else None])
Esempio n. 2
0
    def _pnp_graph_icon_link(self, row, what):
        if display_options.disabled(display_options.X):
            return ""

        if not metrics.cmk_graphs_possible(row["site"]):
            return pnp_url(row, what)

        import cmk.gui.cee.plugins.views.graphs  # pylint: disable=redefined-outer-name,import-error,no-name-in-module
        return cmk.gui.cee.plugins.views.graphs.cmk_graph_url(row, what)  # pylint: disable=no-member
Esempio n. 3
0
 def _pnp_popup_url(self, row, what):
     return pnp_url(row, what, 'popup')