# What this PR does - removes unused "custom button" backend code now that we've migrated to outgoing webhooks - adds new e2e test for webhooks asserting that an `ngrok`/`express` webhook handler receives the call as expected + payload is as expected (related to https://github.com/grafana/oncall/issues/2691) - skipped for now, the test passes locally but fails on GitHub Actions CI, seems to be networking related ## Checklist - [x] Unit, integration, and e2e (if applicable) tests updated - [x] Documentation added (or `pr:no public docs` PR label added if not required) --------- Co-authored-by: Michael Derynck <michael.derynck@grafana.com>
14 lines
569 B
Python
14 lines
569 B
Python
def render_relative_timeline(log_created_at, alert_group_started_at):
|
|
time_delta = log_created_at - alert_group_started_at
|
|
seconds = int(time_delta.total_seconds())
|
|
days, seconds = divmod(seconds, 86400)
|
|
hours, seconds = divmod(seconds, 3600)
|
|
minutes, seconds = divmod(seconds, 60)
|
|
if days > 0:
|
|
return "%dd%dh%dm%ds" % (days, hours, minutes, seconds)
|
|
elif hours > 0:
|
|
return "%dh%dm%ds" % (hours, minutes, seconds)
|
|
elif minutes > 0:
|
|
return "%dm%ds" % (minutes, seconds)
|
|
else:
|
|
return "%ds" % (seconds,)
|