oncall-engine/engine/apps/user_management/constants.py
Rares Mardare 455f74560c
Alert group column/label selector (#3281)
# What this PR does

Adds new functionality to enable which columns should show on the alert
group page


![image](https://github.com/grafana/oncall/assets/40542072/952d4004-9cd6-478c-a104-cd5d270cfd58)

---------

Co-authored-by: Julia <ferril.darkdiver@gmail.com>
2023-11-29 12:11:31 +00:00

39 lines
994 B
Python

import typing
from django.db.models import TextChoices
class AlertGroupTableDefaultColumnChoices(TextChoices):
STATUS = "status", "Status"
ID = "id", "ID"
TITLE = "title", "Title"
ALERTS = "alerts", "Alerts"
INTEGRATION = "integration", "Integration"
CREATED = "created", "Created"
LABELS = "labels", "Labels"
TEAM = "team", "Team"
USERS = "users", "Users"
class AlertGroupTableColumnTypeChoices(TextChoices):
DEFAULT = "default"
LABEL = "label"
class AlertGroupTableColumn(typing.TypedDict):
id: str
name: str
type: str
class AlertGroupTableColumns(typing.TypedDict):
visible: typing.List[AlertGroupTableColumn]
hidden: typing.List[AlertGroupTableColumn]
default: bool
def default_columns() -> typing.List[AlertGroupTableColumn]:
return [
{"name": column.label, "id": column.value, "type": AlertGroupTableColumnTypeChoices.DEFAULT.value}
for column in AlertGroupTableDefaultColumnChoices
]