oncall-engine/grafana-plugin/src
Nick Moore cf589d45c6
feat: add timedeltaparse function to the jinja template (#5142)
# What this PR does
If an OnCall template needs to contain a date relative to a date in the
alert response, currently there is no way for the template to add or
subtract time from a parsed date.

This PR adds a function that allows a time-window (e.g., 1s, 5m, 6h, 7d,
2w) to be converted into a Python timedelta, which can then be added or
subtracted from a datetime. An example usage might be:

```
{% set delta = alert.timeWindow | timedeltaparse %}
{% set time = alert.startsAt | iso8601_to_time - delta | datetimeformat('%s') %}
```

## Checklist

- [X] Unit, integration, and e2e (if applicable) tests updated
- [X] Documentation added (or `pr:no public docs` PR label added if not
required)
- [X] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will show up in the
autogenerated release notes.
2024-10-09 18:27:48 +00:00
..
assets Migrate remaining stylesheets to Emotion (#5022) 2024-09-18 14:20:46 +00:00
components feat: add timedeltaparse function to the jinja template (#5142) 2024-10-09 18:27:48 +00:00
containers chore: back merge irm (#5111) 2024-10-02 10:34:21 +00:00
dashboards Revert using backticks in insights queries (#4488) 2024-06-07 13:58:07 +00:00
helpers Back merge irm (#5098) 2024-10-01 12:59:24 +00:00
icons Google OAuth2 flow + fetch Google Calendar OOO events (#4067) 2024-04-02 14:59:03 -04:00
jest generate types, create http client and add exemplary usage (#3384) 2023-11-29 05:16:13 +00:00
models chore: back merge irm (#5111) 2024-10-02 10:34:21 +00:00
navbar Chore: Remove topnav references (#5092) 2024-09-30 16:22:04 +00:00
network Add manual trigger support for webhooks (#4934) 2024-09-09 12:17:23 +00:00
pages chore: back merge irm (#5111) 2024-10-02 10:34:21 +00:00
plugin Back merge irm (#5098) 2024-10-01 12:59:24 +00:00
state ci: update oss plugin release process (#5051) 2024-09-23 11:56:16 -04:00
styles Migrate remaining stylesheets to Emotion (#5022) 2024-09-18 14:20:46 +00:00
app-types.ts chore: adjust dir names to irm (#4989) 2024-09-05 14:51:29 +00:00
index.d.ts Change functions for access control (#3184) 2023-10-23 15:58:45 -06:00
module.ts Back merge irm (#5098) 2024-10-01 12:59:24 +00:00
plugin.json fix: address RBAC Admin issue (#5087) 2024-09-26 12:40:07 -04:00
PluginPage.tsx Chore: Remove topnav references (#5092) 2024-09-30 16:22:04 +00:00
version.ts chore: back merge irm (#5111) 2024-10-02 10:34:21 +00:00