results.html 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. {% extends "base.html" %}
  2. {% block content %}
  3. <h2>Latency to {{ target }}</h2>
  4. <p>Job submitted at {{ target.submitted.strftime('%Y-%m-%d %H:%M') }}</p>
  5. <table>
  6. <tr>
  7. <th>Latency</th>
  8. <th>Jitter</th>
  9. <th>Packet loss</th>
  10. <th>Source</th>
  11. <th>Comment</th>
  12. <th>Contact</th>
  13. <th>Date</th>
  14. </tr>
  15. {% macro color(packetloss) -%}
  16. {% if packetloss >= 50 %}
  17. "red"
  18. {% elif packetloss > 0 %}
  19. "orange"
  20. {% else %}
  21. "green"
  22. {% endif %}
  23. {%- endmacro %}
  24. {% for r in results %}
  25. {% set packetloss = (100 * (r.probes_sent - r.probes_received) / r.probes_sent) %}
  26. <tr>
  27. <td>{% if r.avgrtt is not none() %}{{ r.avgrtt }} ms{% endif %}</td>
  28. <td>{% if r.jitter is not none() %}{{ r.jitter }} ms{% endif %}</td>
  29. <td><span class={{ color(packetloss) }}>
  30. {{ packetloss|round(2) }}%
  31. </span>
  32. (<span class={{ color(packetloss) }}>{{ r.probes_sent - r.probes_received }}</span>/{{ r.probes_sent }})
  33. </td>
  34. <td>{{ r.participant.name }}
  35. {% if r.participant.country is not none() %}
  36. ({{ r.participant.country }})
  37. {% endif %}
  38. </td>
  39. <td>{{ r.participant.comment|default("", True) }}</td>
  40. <td>{{ r.participant.contact }}</td>
  41. <td>{{ r.date.strftime('%Y-%m-%d %H:%M') }}</td>
  42. </tr>
  43. {% endfor %}
  44. </table>
  45. {% endblock %}