Commit graph

55 commits

Author SHA1 Message Date
Michael Derynck
25826690a8 Use common environment for templates 2022-11-05 00:31:51 -06:00
Maxim Mordasov
387b334d2a
Merge pull request #720 from grafana/matiasb/daily-shifts-by-day
Enable daily/by-day shifts option for web schedules
2022-11-04 14:23:09 +00:00
Vadim Stepanov
e2456315af
Allow no-auth SMTP connection for email notifications (#759)
* DEFAULT_FROM_EMAIL -> EMAIL_FROM

* add EMAIL_FROM live setting

* EMAIL_FROM -> EMAIL_FROM_ADDRESS

* merge dev

* add test for get_from_email

* allow live settings to be null on internal API

* remove redundant tests
2022-11-03 16:18:37 +00:00
Matias Bordese
98b187acd9 Add support for daily/by-day and custom interval 2022-11-02 16:12:16 -03:00
Matias Bordese
4bc3ed17a8 Make interval check more explicit 2022-11-02 16:12:16 -03:00
Matias Bordese
241283959a Enable daily/by-day shifts option for web schedules 2022-11-02 16:12:16 -03:00
Matias Bordese
6439752949
Rewrite fallback condition for num escalation chains
Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
2022-10-20 12:57:59 -03:00
Matias Bordese
e4a7a5a23d Rework schedule escalation chains/policies count as a subquery 2022-10-19 17:07:06 -03:00
Vadim Stepanov
e67d3519fe
Restore email notifications (#621)
* remove email verification related code

* remove email verification related code

* remove sendgrid callback

* remove sendgrid related code

* remove sendgrid related code

* rename sendgrid app to email

* remove email from built-in channels

* remove email from built-in channels

* remove email from built-in channels

* add email backend: https://github.com/grafana/oncall/pull/50

* add email templater

* add email templater

* convert md to html

* add email settings to live settings

* use task to send email, handle some exceptions to create logs

* remove ERROR_NOTIFICATION_MAIL_DELIVERY_FAILED usage

* add email limit logic

* fix tests

* add docs

* remove old email templates

* remove old email templates

* add template_fields to messaging backend

* add messaging backends templates to public api

* add comment for deprecated fields

* fix test

* fix tests

* disable email by default

* don't retry on SMTPException and TimeoutError

* add tests

* bring email back to public api docs

* return ERROR_NOTIFICATION_MAIL_LIMIT_EXCEEDED

* make template_fields tuple

* build_subject_and_title -> build_subject_and_message

* add one more comment about template deprecation

* use 8 as backend id

* add comment about gaierror and BadHeaderError

* add comment on importing in notify_user_async

* edit oss docs
2022-10-19 12:32:56 +01:00
Ben Sully
e36757b293
Allow non-JSON custom webhook templates, provided they render as valid JSON (#639)
* Allow non-JSON custom webhook templates, provided they render as valid JSON

Previously, both the provided template _and_ the rendered template had
to be valid JSON in order for validation to pass. This was unnecessarily
restrictive: really, only the rendered template needs to be valid JSON.
It also disallowed using templates such as:

    {
      "labels": {{ alert_payload.labels | tojson }}
    }

even though this would be valid JSON after rendering.

This commit relaxes the validation of custom webhook templates so that
they don't need to be valid JSON, provided that the rendered template
_is_ valid JSON. This is checked using a dummy dictionary of render
params, which use a constant string for the `alert_group_id` field
and a `defaultdict(dict)` for the `alert_payload` field. This should
permit templates like the one above, but still deny templates such as

    {
      "labels": {{ alert_payload.labels }}
    }

which would otherwise fail later if `labels` is not valid JSON.

This should resolve #638.

* Use defaultdict(str) instead of defaultdict(lambda: "")

* Add missing comment to resolution note validation code

* Update validation of resolution notes in public API, too

* Add extra test cases for JSON webhook templates endpoint of public API
2022-10-19 12:32:21 +01:00
Joey Orlando
9f3f691ea4
Feat 549 - add telegram permalink to alert groups http response (#551)
* rename AlertGroup.permalink to slack_permalink

* add telegram key to alert_groups permalinks object in public API response
2022-09-28 16:59:57 +02:00
Innokentii Konstantinov
3e8c7a24c8
Add hiding personal phone numbers (#411)
* Add hiding personal phone numbers

* Fix tests

* phone number toggler

* fixed issue where id was not set

* some improvement changes

* show toggle just for validated phone numbers

* ux changes + refactored PhoneVerification

* minor changes

* linter

* hide banner

* ux changes for phone verification

* make it full width

* linter

* show action only if phone is verified

* linter

* revert isCodeSent once phone is forgotten

* fix UserHiddenFieldsSerializer

* await for loadUser

* missing WithPermissions wrapper

Co-authored-by: Rares Mardare <rares.mardare@grafana.com>
Co-authored-by: Rares Mardare <40542072+teodosii@users.noreply.github.com>
2022-09-09 12:42:40 +05:00
Julia
9f71b5d72f Merge branch 'dev' into on-call-shifts-rotation-index 2022-09-07 18:54:39 +03:00
Matias Bordese
02326d81fa
Merge pull request #485 from grafana/matiasb/schedules-related-escalation-chains
Add related escalation chains details to schedule API
2022-09-07 11:17:05 -03:00
Matias Bordese
b48aadc01c
Merge pull request #473 from grafana/matiasb/fix-update-channel-filter-api-multiple-backends
Fix channel filter updates when there are multiple backends
2022-09-06 17:14:07 -03:00
Vadim Stepanov
afe13550da
Alert group search (#488)
* use web title template to render alert group verbose name

* remove group_verbose_name from tests

* clean up group_verbose_name

* remove verbose_name from API & plugin

* verbose_name migration

* update verbose name on web title template change

* use long queue for updating verbose name

* use first alert for updating verbose name

* improve batch_ids

* fix update_verbose_name

* post-review fixes

* post-review fixes
2022-09-06 11:30:12 +01:00
Julia
5c0d0ace3e Remove user group rotation reordering 2022-09-06 12:59:38 +03:00
Matias Bordese
b41fec5439 Add related escalation chains details to schedule API 2022-09-05 15:00:14 -03:00
Vadim Stepanov
920a863262
Revert "Alert group search by title (#466)" (#479)
This reverts commit f1f4303825.
2022-09-05 11:44:22 +01:00
Vadim Stepanov
f1f4303825
Alert group search by title (#466)
* use web title template to render alert group verbose name

* remove group_verbose_name from tests

* clean up group_verbose_name

* remove verbose_name from API & plugin

* verbose_name migration

* update verbose name on web title template change

* use long queue for updating verbose name

* use first alert for updating verbose name

* improve batch_ids
2022-09-05 10:05:19 +01:00
Matias Bordese
ecbc3ea778 Fix channel filter updates when there are multiple backends 2022-09-02 14:26:47 -03:00
Vadim Stepanov
2fdce0504b
Improve version mismatch warning (#469) 2022-09-02 15:16:00 +01:00
Innokentii Konstantinov
4765c9b07c
Insight logs (#348)
* Entity events insight logs

* Insight logging

* Fix event for updating templates

* Format fixes

* Remove organization_log_type.py

* Simplify signature of chatops_insight_log

* insight logs formatting

* Add possibility to enable all insight logging via DynamicSetting

* Fixes

* Style fixes

* Add migration

* Fix migration
2022-08-24 12:04:44 +05:00
Innokentii Konstantinov
6fb22e0860
Add alert detail view (#385)
* Alert detail view

* Add id to alert serializer
2022-08-19 14:03:07 +05:00
Julia
febe4cc9e0 Add calculation for rotation index 2022-08-18 18:04:38 +03:00
Yulya Artyukhina
fdd369c16b
Merge pull request #288 from grafana/julia-web-schedule-backend-3
Create new oncall shift on update for started shifts
2022-07-28 17:30:35 +03:00
Julia
60ac09b950 Correct until validation 2022-07-28 12:18:14 +03:00
Vadim Stepanov
a1b1b83fd1
Optimize alert group list view (#299)
* Revert "Revert "Alert list view & caching rework (#216)""

This reverts commit 730dccc3

* Revert "fix AlertGroupClassicMarkdownRenderer"

This reverts commit 82e53d8e0c513feb8aaef332fc1d3800e90538fc.

* optimize alert group list view

* optimize alert group list view
2022-07-27 14:14:59 +03:00
Julia
26d3ac6a48 fix serializer, add tests for shifts internal api endpoint 2022-07-27 13:40:07 +03:00
Julia
c3fc514ad4 Update oncall shift serializer 2022-07-26 16:42:30 +03:00
Julia
0406d7a1f3 Add title for shifts, update shift validation for internal api endpoint 2022-07-25 15:37:25 +03:00
Julia
9537e72e4e Add creation oncall shift on update by internal api 2022-07-25 12:52:57 +03:00
Yulya Artyukhina
6b456f9820
Merge pull request #220 from grafana/julia-web-schedule-backend-2
Internal api endpoint for oncall shifts
2022-07-22 11:52:22 +03:00
Vadim Stepanov
0985cb4cb5
Rollback alert group list rework (#269)
* Revert "Alert list view & caching rework (#216)"

This reverts commit 16bbfbbe

* fix AlertGroupClassicMarkdownRenderer
2022-07-21 15:23:02 +01:00
Julia
b7a0411142 Fix oncall shifts serializer, fix migration, update oncall shift log text 2022-07-20 13:11:16 +03:00
Ildar Iskhakov
7e12254d09
Merge pull request #256 from grafana/iskhakov/mobile-app-fixes
Add fixes for the mobile app
2022-07-20 11:04:35 +03:00
Ildar Iskhakov
035d5e99c7 Fix linter 2022-07-20 10:58:54 +03:00
Ildar Iskhakov
ee7a58b5cf Add fixes for the mobile app 2022-07-20 10:26:14 +03:00
Vadim Stepanov
193519abc0
Add version mismatch warning (#241)
* add version mismatch warning

* add link to update docs
2022-07-18 14:24:03 +01:00
Julia
59e88d0c43 fix update shift at internal api endpoint 2022-07-18 15:43:57 +03:00
Julia
f7b3563600 Update serializers for oncall shifts 2022-07-18 15:23:15 +03:00
Julia
a4c481a1ff Add rotation_start field to shifts public api endpoint, fix tests 2022-07-18 12:59:50 +03:00
Vadim Stepanov
16bbfbbe73
Alert list view & caching rework (#216)
* remove cache usage in AlertGroupView

* remove CustomSearchFilter

* remove caching for alerts

* remove readonly db setup

* render templates on alert creation

* serialize only necessary fields on alert groups list

* optimize AlertGroupListSerializer

* return on-demand templating for alerts

* return on-demand templating for alert groups

* use CursorPaginator

* remove templating on alert create

* pass alert to AlertGroupWebRenderer

* alert_count -> alerts_count

* make sql joins after pagination

* add migration

* bring alert.save() back

* fix tests

* fix tests

* fix tests

* add perpage query param

* add cursor pagination to incidents page

* remove cached_render_for_web usage

* post merge fix

* keep cursor

* lint

* remove get_alert_groups_and_days_for_previous_same_period

* fix pagination on navigate

* refine search_fields on AlertGroupView

Co-authored-by: Maxim <hello.makson@gmail.com>
Co-authored-by: Maxim <maxim.mordasov@grafana.com>
2022-07-14 15:19:25 +01:00
Julia
5ebcb39499 fix by_day value, fix getting next event date with respect to rotation end date 2022-07-12 17:13:56 +03:00
Julia
d8a3206130 Add oncall shift endpoint to internal api 2022-07-12 13:59:17 +03:00
Vadim Stepanov
df32f9099f
Add API support for user timezone and working hours (#201)
* add API support for user timezone and working hours

* add tests
2022-07-11 13:16:56 +01:00
Matias Bordese
b5e624e2ed
Merge pull request #196 from grafana/matiasb-web-schedule-backend-1
Initial web schedule model and serializers. Add override shift type.
2022-07-08 14:27:01 -03:00
Matias Bordese
a153d283e4 Initial web schedule model and serializers. Add override shift type. 2022-07-05 12:41:55 -03:00
Julia
5f87f83b2b Update public endpoint for routes
- Add field for telegram
- Add support for messaging backends
2022-06-29 14:05:02 +03:00
Innokentii Konstantinov
174309a531
Optimize schedules select in escalation page (#129)
* Add FastScheduleSerializer

* Linting

* Chnaged Gselect for RemoteSelect for notifySchedules in escalation policies

Co-authored-by: Yulia Shanyrova <yulia.shanyrova@grafana.com>
2022-06-23 13:46:04 +04:00