def get_perfometer(self, elt): if elt.perf_data != '': r = get_perfometer_table_values(elt) # If the perfmeter are not good, bail out if r is None: return '\n' lnk = r['lnk'] metrics = r['metrics'] title = r['title'] s = '<a href="%s">' % lnk s += '''<div class="graph"> <table> <tbody> <tr>\n''' for (color, pct) in metrics: s += ' <td style="background-color: %s; width: %s%%;"></td>\n' % ( color, pct) s += ''' </tr> </tbody> </table> </div> <div class="text">%s</div> <img class="glow" src="/static/images/glow.png"/> </a>\n''' % title return s return '\n'
def get_perfometer(self, elt): if elt.perf_data != '': r = get_perfometer_table_values(elt) # If the perfmeter are not good, bail out if r is None: return '\n' lnk = r['lnk'] metrics = r['metrics'] title = r['title'] s = '<a href="%s">' % lnk s += '''<div class="graph"> <table> <tbody> <tr>\n''' for (color, pct) in metrics: s += ' <td style="background-color: %s; width: %s%%;"></td>\n' % (color, pct) s += ''' </tr> </tbody> </table> </div> <div class="text">%s</div> <img class="glow" src="/static/images/glow.png"/> </a>\n''' % title return s return '\n'
def get_perfometer(self, elt, metric=None): if elt.perf_data: r = get_perfometer_table_values(elt, metric=metric) if r is None: return '' #lnk = r['lnk'] metrics = r['metrics'] title = r['title'] s = '' if r['lnk'] != '#': s += '<a href="%s">' % lnk if metrics: # metrics[0][0] is the color associated to the current state # metrics[0][1] is a percentage: # - real percentage between min and max (if defined) # - else 100 logger.debug("[WebUI] get_perfometer: %s, %s / %s", elt.get_name(), metrics[0][0], metrics[0][1]) s += '''<div class="progress" style="min-width:100px;"> <div title="%s" class="ellipsis progress-bar progress-bar-%s" role="progressbar" aria-valuenow="%s" aria-valuemin="0" aria-valuemax="100" style="min-width: 50px; width:%s%%"> %s </div> </div>''' % (title, metrics[0][0], metrics[0][1], metrics[0][1], title) if r['lnk'] != '#': s += '</a>' return s return ''
def get_perfometer(self, elt, metric=None): if elt.perf_data: r = get_perfometer_table_values(elt, metric=metric) if r is None: return '' #lnk = r['lnk'] metrics = r['metrics'] title = r['title'] s = '' if r['lnk'] != '#': s += '<a href="%s">' % lnk if metrics: # metrics[0][0] is the color associated to the current state # metrics[0][1] is a percentage: # - real percentage between min and max (if defined) # - else 100 logger.debug("[WebUI] get_perfometer: %s, %s / %s", elt.get_name(), metrics[0][0], metrics[0][1]) s += '''<div class="progress" style="min-width:100px;"> <div title="%s" class="ellipsis progress-bar progress-bar-%s" role="progressbar" aria-valuenow="%s" aria-valuemin="0" aria-valuemax="100" style="min-width: 50px; width:%s%%"> %s </div> </div>''' % (title, metrics[0][0], metrics[0][1], metrics[0][1], title) if r['lnk'] != '#': s += '</a>' return s return ''
def get_perfometer(self, elt, metric=None): if elt.perf_data: r = get_perfometer_table_values(elt, metric=metric) if r is None: return '' #lnk = r['lnk'] metrics = r['metrics'] title = r['title'] s = '' if r['lnk'] != '#': s += '<a href="%s">' % lnk if metrics: # metrics[0][0] is the color associated to the current state # metrics[0][1] is a percentage: # - real percentage between min and max (if defined) # - else 100 # Thanks to @medismail base = { 'success': 'green', 'warning': 'orange', 'danger': 'red', 'info': 'blue' } color = base.get(metrics[0][0], 'blue') logger.debug("[WebUI] get_perfometer: %s, %s / %s", elt.get_name(), metrics[0][0], metrics[0][1]) if metrics[0][1] > 9: s += '''<div class="progress" style="min-width:100px;"> <div title="%s" class="ellipsis progress-bar progress-bar-%s" role="progressbar" aria-valuenow="%s" aria-valuemin="0" aria-valuemax="100" style="min-width: 40px; width:%s%%"> %s </div> </div>''' % (title, metrics[0][0], metrics[0][1], metrics[0][1], title) else: s += '''<div class="progress" style="min-width:100px;"> <div title="%s" class="ellipsis progress-bar progress-bar-%s" role="progressbar" aria-valuenow="%s" aria-valuemin="0" aria-valuemax="100" style="width:%s%%"> </div> <font size="2" color="%s"> %s </div>''' % (title, metrics[0][0], metrics[0][1], metrics[0][1], color, title) if r['lnk'] != '#': s += '</a>' return s return ''