Open jakubgs opened 3 years ago
I can see that email_alert
field:
https://github.com/arachnys/cabot/blob/4e4ca0a8b6d08b40007e84a9e61160873000f6f5/cabot/cabotapp/models/base.py#L146
Is part of CheckGroupMixin
class:
https://github.com/arachnys/cabot/blob/4e4ca0a8b6d08b40007e84a9e61160873000f6f5/cabot/cabotapp/models/base.py#L94
Which is inherited by the Service
class:
https://github.com/arachnys/cabot/blob/4e4ca0a8b6d08b40007e84a9e61160873000f6f5/cabot/cabotapp/models/base.py#L285
Which contains the is_public
attribute:
https://github.com/arachnys/cabot/blob/4e4ca0a8b6d08b40007e84a9e61160873000f6f5/cabot/cabotapp/models/base.py#L316-L320
So I'm not sure why email_alert
doesn't work. They are both BooleanField
type.
The field overall_status
that is included in the services
API endpoint:
https://github.com/arachnys/cabot/blob/b18b1a0c9f28e7162aacff797ea477b7234c220f/cabot/rest_urls.py#L50-L57
Seems to come from CheckGroupMixin
:
https://github.com/arachnys/cabot/blob/4e4ca0a8b6d08b40007e84a9e61160873000f6f5/cabot/cabotapp/models/base.py#L153
And that one works fine.
Oh, I see, there's a separate alerts
field that is a list of types of alerts enabled:
https://github.com/arachnys/cabot/blob/4e4ca0a8b6d08b40007e84a9e61160873000f6f5/cabot/cabotapp/models/base.py#L140-L144
That's a bit confusing, but I figured that out based on the template. And this field is already exported.
It appears that 1
is the ID of the email alert type:
{
"name": "Websites",
"users_to_notify": [
2
],
"alerts_enabled": true,
"status_checks": [
31,
],
"alerts": [
1
],
"hackpad_id": "",
"url": "https://example.org",
"instances": [],
"overall_status": "PASSING",
"email_alert": true,
"is_public": true,
"id": 1
}
Not sure where that's defined, but I assume it doesn't change.
I've dropped the addition of email_alert
field.
I've attempted to make it possible to enable email alerts by default by addingemail_alert
and it did't work.The addition of
is_public
worked and makes it possible to create public services via API.Resolves: #699