Add silenced_at field to alert group public API (#3992)
# What this PR does ## Which issue(s) this PR fixes Closes #3913 ## 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] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required) Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
This commit is contained in:
parent
53e77e82de
commit
642f8202c8
3 changed files with 9 additions and 1 deletions
|
|
@ -36,7 +36,8 @@ The above command returns JSON structured in the following way:
|
|||
"permalinks": {
|
||||
"slack": "https://ghostbusters.slack.com/archives/C1H9RESGA/p135854651500008",
|
||||
"telegram": "https://t.me/c/5354/1234?thread=1234"
|
||||
}
|
||||
},
|
||||
"silenced_at": "2020-05-19T13:37:01.429805Z",
|
||||
}
|
||||
],
|
||||
"current_page_number": 1,
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ class IncidentSerializer(EagerLoadingMixin, serializers.ModelSerializer):
|
|||
"acknowledged_by",
|
||||
"title",
|
||||
"permalinks",
|
||||
"silenced_at",
|
||||
]
|
||||
|
||||
def get_title(self, obj):
|
||||
|
|
|
|||
|
|
@ -29,6 +29,11 @@ def construct_expected_response_from_alert_groups(alert_groups):
|
|||
acknowledged_at = alert_group.acknowledged_at.isoformat()
|
||||
acknowledged_at = acknowledged_at[:-6] + "Z"
|
||||
|
||||
silenced_at = None
|
||||
if alert_group.silenced_at:
|
||||
silenced_at = alert_group.silenced_at.isoformat()
|
||||
silenced_at = silenced_at[:-6] + "Z"
|
||||
|
||||
def user_pk_or_none(alert_group, user_field):
|
||||
u = getattr(alert_group, user_field)
|
||||
if u is not None:
|
||||
|
|
@ -52,6 +57,7 @@ def construct_expected_response_from_alert_groups(alert_groups):
|
|||
"telegram": None,
|
||||
"web": alert_group.web_link,
|
||||
},
|
||||
"silenced_at": silenced_at,
|
||||
}
|
||||
)
|
||||
return {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue