Exemple #1
0
    def execute(self):
        action = self._get_str_parameter("action")
        if action == "delcache":
            caKey = self._get_str_parameter("caKey")
            cache.delete(caKey)

        cl = cache.populate()
        html = "<table>"
        for ca in cl:
            tr = "<tr>"
            tr += "<td><p>%s</p></td>" % ca["key"]
            value = strutil.replce_html_entities(ca["value"])
            tr += "<td><p>%s</p></td>" % (value if len(value) < 50 else value[0:50] + "...")
            tr += "<td><p>%d</p></td>" % ca["hits"]
            tr += "<td><span onclick='sysman.delcache(\"%s\")' title='Delete'>X</span></td>" % (ca["key"])
            tr += "</tr>"
            html += tr

        html += "</table>"
        return html
Exemple #2
0
 def execute(self):
     level = self._get_str_parameter("level", "ERROR")
     offset = self._get_int_parameter("offset", 0)
     levels = ["ERROR", "WARNING", "INFO", "DEBUG"]
     level = "ERROR" if level not in levels else level
     pager = log.fetch_logs(level, limit=1000, offset=offset)
     html = "<select id='logLevelSelt' name='level' onchange='sysman.fetchlogs()'>"
     for l in levels:
         selected = "selected" if l == level else ""
         html += "<option value='%s' %s>%s</option>" % (l, selected, l)
     html += "</select>"
     html += "<br/><table>"
     for result in pager.records:
         tr = "<tr>"
         tr += "<td><p>%s</p></td>" % result.l_level
         tr += "<td><p>%s</p></td>" % strutil.replce_html_entities(result.l_message)
         tr += "<td><p>%r</p></td>" % result.logged_time
         tr += "</tr>"
         html += tr
     html += "</table>"
     return html