From 9980e64313c50933d48fdb2bb71eab128c09c7f2 Mon Sep 17 00:00:00 2001 From: Ildar Iskhakov Date: Thu, 23 Mar 2023 11:49:38 +0800 Subject: [PATCH 01/17] Update CHANGELOG.md --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 628fd815..f0ba5ee8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## v1.2.1 (2023-03-23) + +### Changed + +- Mobile app settings backend by @vadimkerr in ([1571](https://github.com/grafana/oncall/pull/1571)) +- Fix integrations and escalations autoselect, improve GList by @maskin25 in ([1601](https://github.com/grafana/oncall/pull/1601)) +- Add filters to outgoing webhooks 2 by @iskhakov in ([1598](https://github.com/grafana/oncall/pull/1598)) + ## v1.2.0 (2023-03-21) ### Changed From 79deaec281e9c62a1740c4c31c19f1ca72dbff72 Mon Sep 17 00:00:00 2001 From: Matvey Kukuy Date: Thu, 23 Mar 2023 08:49:42 +0200 Subject: [PATCH 02/17] Update issue-template.md --- .github/ISSUE_TEMPLATE/issue-template.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/issue-template.md b/.github/ISSUE_TEMPLATE/issue-template.md index c6fc0f94..28d35bff 100644 --- a/.github/ISSUE_TEMPLATE/issue-template.md +++ b/.github/ISSUE_TEMPLATE/issue-template.md @@ -6,13 +6,18 @@ labels: '' assignees: '' --- +`` + +Hi 👋, thank you for opening an issue! -Hi, thank you for opening an issue! +Please make sure to add such an info to the issue description: -Here is a quick checklist: - -- [ ] Is it about Cloud or Open Source OnCall? +- [ ] Mention is it's about Cloud or Open Source OnCall. - [ ] Add OnCall backend & frontend versions. -- [ ] Include labels starting with "part:". Like `part:alertflow` or `part:schedules`. +- [ ] Include labels starting with "part:". Like `part:alertflow` or `part:schedules`. Search for all `part:` labels and choose the closest one. - [ ] Include labels like `bug` or `feature request`. -- [ ] If it's a bug, include logs. +- [ ] If it's a bug, include logs, scheenshots, videos. As much specific info as possible. + +Issues mising those items will be closed. + +`` From e18c1a5f568e570566bdb9dd66df21193e7c7764 Mon Sep 17 00:00:00 2001 From: Vadim Stepanov Date: Thu, 23 Mar 2023 06:53:24 +0000 Subject: [PATCH 03/17] Inbound email OSS docs minor improvements (#1567) # What this PR does Updates the [OSS docs](https://grafana.com/docs/oncall/latest/open-source/#email-setup) for configuring inbound email setup: - Separate inbound & outbound email sections so it's easier to reference - Add info on configuring ESPs to forward emails to OnCall - Minor formatting changes ## Which issue(s) this PR fixes Related to https://github.com/grafana/oncall/issues/575 ## Checklist - [x] Documentation added --- docs/sources/open-source/_index.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/sources/open-source/_index.md b/docs/sources/open-source/_index.md index 5d3f981d..870e1201 100644 --- a/docs/sources/open-source/_index.md +++ b/docs/sources/open-source/_index.md @@ -224,15 +224,19 @@ the following env variables with your SMTP server credentials: After enabling the email integration, it will be possible to use the `Notify by email` notification step in user settings. -Grafana OnCall is also capable of creating alert groups from +## Inbound Email Setup + +Grafana OnCall is capable of creating alert groups from [Inbound Email integration]({{< relref "../integrations/available-integrations/configure-inbound-email" >}}). To configure Inbound Email integration for Grafana OnCall OSS populate env variables with your Email Service Provider data: -- `INBOUND_EMAIL_ESP` - Inbound email ESP name. Available options: amazon_ses, mailgun, mailjet, mandrill, postal, postmark, sendgrid, sparkpost +- `INBOUND_EMAIL_ESP` - Inbound email ESP name. Available options: `amazon_ses`, `mailgun`, `mailjet`, `mandrill`, `postal`, `postmark`, `sendgrid`, `sparkpost` - `INBOUND_EMAIL_DOMAIN` - Inbound email domain - `INBOUND_EMAIL_WEBHOOK_SECRET` - Inbound email webhook secret +You will also need to configure your ESP to forward messages to the following URL: `/integrations/v1/inbound_email_webhook`. + ## Limits By default, Grafana OnCall limits email and phone notifications (calls, SMS) to 200 per user per day. From 10fa332dd1c3a5d4339daede803a207e2865815b Mon Sep 17 00:00:00 2001 From: Joey Orlando Date: Thu, 23 Mar 2023 11:17:18 +0100 Subject: [PATCH 04/17] fix failing markdownlint (#1609) --- .github/ISSUE_TEMPLATE/issue-template.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/issue-template.md b/.github/ISSUE_TEMPLATE/issue-template.md index 28d35bff..f65de799 100644 --- a/.github/ISSUE_TEMPLATE/issue-template.md +++ b/.github/ISSUE_TEMPLATE/issue-template.md @@ -2,22 +2,23 @@ name: General Issue about: General requirements to all issues. title: Specific issue name -labels: '' -assignees: '' - +labels: "" +assignees: "" --- + `` - + Hi 👋, thank you for opening an issue! Please make sure to add such an info to the issue description: - [ ] Mention is it's about Cloud or Open Source OnCall. - [ ] Add OnCall backend & frontend versions. -- [ ] Include labels starting with "part:". Like `part:alertflow` or `part:schedules`. Search for all `part:` labels and choose the closest one. +- [ ] Include labels starting with "part:". Like `part:alertflow` or `part:schedules`. Search for all `part:` labels and + choose the closest one. - [ ] Include labels like `bug` or `feature request`. - [ ] If it's a bug, include logs, scheenshots, videos. As much specific info as possible. - + Issues mising those items will be closed. `` From b65daa165d0c1afbd104ad5147ba10c17b6990b6 Mon Sep 17 00:00:00 2001 From: Joey Orlando Date: Thu, 23 Mar 2023 11:48:33 +0100 Subject: [PATCH 05/17] update pr template (#1610) --- .github/pull_request_template.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 0fab1e81..0c858069 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -4,6 +4,6 @@ ## Checklist -- [ ] Tests updated -- [ ] Documentation added -- [ ] `CHANGELOG.md` updated +- [ ] Unit, integration, and e2e (if applicable) tests updated +- [ ] Documentation added (or `pr:no public docs` PR label added if not required) +- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required) From 7e0f40219d402610e5daa0e3149ab67d402542ce Mon Sep 17 00:00:00 2001 From: Zach Day Date: Thu, 23 Mar 2023 06:30:52 -0500 Subject: [PATCH 06/17] Update wording when creating an integration (#1572) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hello everyone 👋 This is my first PR to the OnCall repo so please let me know if I'm not doing something right. I'm also not sure if the items in the Checklist are for me to complete or someone else. If those are for me, please let me know and I'll be happy to do them (with some guidance as a first-timer)! # What this PR does This PR is a really small suggestion to the wording in this file. I believe it will help improve the way this line of text is read by users. ## Which issue(s) this PR fixes ## Checklist - [ ] Tests updated - [ ] Documentation added - [ ] `CHANGELOG.md` updated --------- Co-authored-by: Joey Orlando Co-authored-by: Joey Orlando --- CHANGELOG.md | 6 ++++++ grafana-plugin/src/containers/AlertRules/AlertRules.tsx | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0ba5ee8..8f4a9ddb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Changed + +- Updated wording when creating an integration ([1572](https://github.com/grafana/oncall/pull/1572)) + ## v1.2.1 (2023-03-23) ### Changed diff --git a/grafana-plugin/src/containers/AlertRules/AlertRules.tsx b/grafana-plugin/src/containers/AlertRules/AlertRules.tsx index 67d9dec6..01ce927d 100644 --- a/grafana-plugin/src/containers/AlertRules/AlertRules.tsx +++ b/grafana-plugin/src/containers/AlertRules/AlertRules.tsx @@ -578,7 +578,7 @@ class AlertRules extends React.Component { ) : ( - Select Escalation Chain first please ↑ or + Select Escalation Chain ↑ or {' '} )} From 9b70b79c78d372ee3a42b292b3d4c36421342fad Mon Sep 17 00:00:00 2001 From: Hamed Karbasi Date: Thu, 23 Mar 2023 15:51:17 +0330 Subject: [PATCH 07/17] use CustomURLValidator in custom_button (#1398) # What this PR does This PR, overrides Django URLValidator with a CustomURLValidator. It just removes tld_re part from the regex, and the other behaviour remains the same. The CustomURLValidator is defined in common.api_helpers.utils.py file and is utilized in custom_button.py. Please inform me if it needs to be defined somewhere else or be implemented with some other methods. ## Which issue(s) this PR fixes Currently, URLValidator raises exception for URLs that don't have TLD. This leads to not being able to use containers URL for outgoing webhooks as they usually don't have TLD. ## Checklist - [x] Tests updated - [ ] Documentation added - [x] `CHANGELOG.md` updated --------- Co-authored-by: Joey Orlando Co-authored-by: Innokentii Konstantinov Co-authored-by: Joey Orlando --- CHANGELOG.md | 2 ++ engine/apps/api/serializers/custom_button.py | 8 +++-- engine/apps/api/tests/test_custom_button.py | 35 +++++++++++++++++++ engine/common/api_helpers/utils.py | 31 ++++++++++++++++ .../tests/test_urlvalidator_without_tld.py | 20 +++++++++++ 5 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 engine/common/tests/test_urlvalidator_without_tld.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f4a9ddb..a8ca4702 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- When the `DANGEROUS_WEBHOOKS_ENABLED` environment variable is set to true, it's possible now to create Outgoing Webhooks + using URLs without a top-level domain ([1266](https://github.com/grafana/oncall/pull/1266)) - Updated wording when creating an integration ([1572](https://github.com/grafana/oncall/pull/1572)) ## v1.2.1 (2023-03-23) diff --git a/engine/apps/api/serializers/custom_button.py b/engine/apps/api/serializers/custom_button.py index d0026b9f..853fe28e 100644 --- a/engine/apps/api/serializers/custom_button.py +++ b/engine/apps/api/serializers/custom_button.py @@ -5,8 +5,9 @@ from rest_framework import serializers from rest_framework.validators import UniqueTogetherValidator from apps.alerts.models import CustomButton +from apps.base.utils import live_settings from common.api_helpers.custom_fields import TeamPrimaryKeyRelatedField -from common.api_helpers.utils import CurrentOrganizationDefault, CurrentTeamDefault +from common.api_helpers.utils import CurrentOrganizationDefault, CurrentTeamDefault, URLValidatorWithoutTLD from common.jinja_templater import apply_jinja_template from common.jinja_templater.apply_jinja_template import JinjaTemplateError, JinjaTemplateWarning @@ -41,7 +42,10 @@ class CustomButtonSerializer(serializers.ModelSerializer): def validate_webhook(self, webhook): if webhook: try: - URLValidator()(webhook) + if live_settings.DANGEROUS_WEBHOOKS_ENABLED: + URLValidatorWithoutTLD()(webhook) + else: + URLValidator()(webhook) except ValidationError: raise serializers.ValidationError("Webhook is incorrect") return webhook diff --git a/engine/apps/api/tests/test_custom_button.py b/engine/apps/api/tests/test_custom_button.py index cc6ae317..0c3660eb 100644 --- a/engine/apps/api/tests/test_custom_button.py +++ b/engine/apps/api/tests/test_custom_button.py @@ -11,6 +11,8 @@ from apps.alerts.models import CustomButton from apps.api.permissions import LegacyAccessControlRole TEST_URL = "https://amixr.io" +URL_WITH_TLD = "http://www.google.com" +URL_WITHOUT_TLD = "http://container:8080" @pytest.fixture() @@ -457,3 +459,36 @@ def test_get_custom_button_from_other_team_with_flag( response = client.get(url, format="json", **make_user_auth_headers(user, token)) assert response.status_code == status.HTTP_200_OK + + +@pytest.mark.django_db +@pytest.mark.parametrize( + "dangerous_webhooks,webhook_url,expected_status", + [ + (True, URL_WITH_TLD, status.HTTP_201_CREATED), + (True, URL_WITHOUT_TLD, status.HTTP_201_CREATED), + (False, URL_WITH_TLD, status.HTTP_201_CREATED), + (False, URL_WITHOUT_TLD, status.HTTP_400_BAD_REQUEST), + ], +) +def test_url_without_tld_custom_button( + custom_button_internal_api_setup, + make_user_auth_headers, + settings, + dangerous_webhooks, + webhook_url, + expected_status, +): + settings.DANGEROUS_WEBHOOKS_ENABLED = dangerous_webhooks + + user, token, _ = custom_button_internal_api_setup + client = APIClient() + url = reverse("api-internal:custom_button-list") + + data = { + "name": "amixr_button", + "webhook": webhook_url, + "team": None, + } + response = client.post(url, data, format="json", **make_user_auth_headers(user, token)) + assert response.status_code == expected_status diff --git a/engine/common/api_helpers/utils.py b/engine/common/api_helpers/utils.py index c82f64af..cc805ccc 100644 --- a/engine/common/api_helpers/utils.py +++ b/engine/common/api_helpers/utils.py @@ -1,9 +1,12 @@ import datetime +import re from urllib.parse import urljoin import requests from django.conf import settings +from django.core.validators import URLValidator from django.utils import dateparse, timezone +from django.utils.regex_helper import _lazy_re_compile from icalendar import Calendar from rest_framework import serializers @@ -45,6 +48,34 @@ class CurrentTeamDefault: return "%s()" % self.__class__.__name__ +class URLValidatorWithoutTLD(URLValidator): + """ + Overrides Django URLValidator Regex. It removes the tld part because + most of the time, containers don't have any TLD in their urls and such outgoing webhooks + can't be registered. + """ + + host_re = ( + "(" + + URLValidator.hostname_re + + URLValidator.domain_re + + URLValidator.tld_re + + "|" + + URLValidator.hostname_re + + "|localhost)" + ) + + regex = _lazy_re_compile( + r"^(?:[a-z0-9.+-]*)://" # scheme is validated separately + r"(?:[^\s:@/]+(?::[^\s:@/]*)?@)?" # user:pass authentication + r"(?:" + URLValidator.ipv4_re + "|" + URLValidator.ipv6_re + "|" + host_re + ")" + r"(?::[0-9]{1,5})?" # port + r"(?:[/?#][^\s]*)?" # resource path + r"\Z", + re.IGNORECASE, + ) + + class CurrentUserDefault: """ Utility class to get the current user right from the serializer field. diff --git a/engine/common/tests/test_urlvalidator_without_tld.py b/engine/common/tests/test_urlvalidator_without_tld.py new file mode 100644 index 00000000..7df900cd --- /dev/null +++ b/engine/common/tests/test_urlvalidator_without_tld.py @@ -0,0 +1,20 @@ +import pytest +from django.core.validators import ValidationError + +from common.api_helpers.utils import URLValidatorWithoutTLD + +valid_urls = ["https://www.google.com", "https://www.google", "http://conatainer1"] +invalid_urls = ["https:/www.google.com", "htt://www.google.com/"] + + +@pytest.mark.parametrize("url", valid_urls) +def test_urlvalidator_without_tld_valid_urls(url): + # Test valid URLs + URLValidatorWithoutTLD()(url) + + +@pytest.mark.parametrize("url", invalid_urls) +def test_urlvalidator_without_tld_invalid_urls(url): + # Test an invalid URL + with pytest.raises(ValidationError): + URLValidatorWithoutTLD()(url) From ceed76aadad2473844a47d57f62849739b5f2998 Mon Sep 17 00:00:00 2001 From: Joey Orlando Date: Thu, 23 Mar 2023 13:55:32 +0100 Subject: [PATCH 08/17] for mobile app push notifications set FCM android priority to high (#1612) # What this PR does ## Which issue(s) this PR fixes ## Checklist - [ ] Unit, integration, and e2e (if applicable) tests updated (N/A) - [ ] Documentation added (or `pr:no public docs` PR label added if not required) (N/A) - [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required) --- CHANGELOG.md | 1 + engine/apps/mobile_app/tasks.py | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8ca4702..b130e307 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - When the `DANGEROUS_WEBHOOKS_ENABLED` environment variable is set to true, it's possible now to create Outgoing Webhooks using URLs without a top-level domain ([1266](https://github.com/grafana/oncall/pull/1266)) - Updated wording when creating an integration ([1572](https://github.com/grafana/oncall/pull/1572)) +- Set FCM iOS/Android "message priority" to "high priority" for mobile app push notifications ([1612](https://github.com/grafana/oncall/pull/1612)) ## v1.2.1 (2023-03-23) diff --git a/engine/apps/mobile_app/tasks.py b/engine/apps/mobile_app/tasks.py index dec51193..24658ea4 100644 --- a/engine/apps/mobile_app/tasks.py +++ b/engine/apps/mobile_app/tasks.py @@ -6,7 +6,7 @@ from celery.utils.log import get_task_logger from django.conf import settings from fcm_django.models import FCMDevice from firebase_admin.exceptions import FirebaseError -from firebase_admin.messaging import APNSConfig, APNSPayload, Aps, ApsAlert, CriticalSound, Message +from firebase_admin.messaging import AndroidConfig, APNSConfig, APNSPayload, Aps, ApsAlert, CriticalSound, Message from requests import HTTPError from rest_framework import status @@ -185,6 +185,21 @@ def _get_fcm_message(alert_group, user, registration_id, critical): mobile_app_user_settings.important_notification_override_dnd ), }, + android=AndroidConfig( + # from the docs + # https://firebase.google.com/docs/cloud-messaging/concept-options#setting-the-priority-of-a-message + # + # Normal priority. + # Normal priority messages are delivered immediately when the app is in the foreground. + # For backgrounded apps, delivery may be delayed. For less time-sensitive messages, such as notifications + # of new email, keeping your UI in sync, or syncing app data in the background, choose normal delivery + # priority. + # + # High priority. + # FCM attempts to deliver high priority messages immediately even if the device is in Doze mode. + # High priority messages are for time-sensitive, user visible content. + priority="high", + ), apns=APNSConfig( payload=APNSPayload( aps=Aps( @@ -201,6 +216,11 @@ def _get_fcm_message(alert_group, user, registration_id, critical): "interruption-level": "critical" if critical else "time-sensitive", }, ), + headers={ + # From the docs + # https://firebase.google.com/docs/cloud-messaging/concept-options#setting-the-priority-of-a-message + "apns-priority": "10", + }, ), ), ) From cad8223a58707c6b2f7f03d946f30e92fdee095c Mon Sep 17 00:00:00 2001 From: Ildar Iskhakov Date: Thu, 23 Mar 2023 21:15:55 +0800 Subject: [PATCH 09/17] Update team management docs (#1606) # What this PR does ## Which issue(s) this PR fixes ## Checklist - [ ] Tests updated - [ ] Documentation added - [ ] `CHANGELOG.md` updated --- .../sources/configure-user-settings/_index.md | 31 ++++++++++++++++--- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/docs/sources/configure-user-settings/_index.md b/docs/sources/configure-user-settings/_index.md index 99f11f23..5b2ea1e4 100644 --- a/docs/sources/configure-user-settings/_index.md +++ b/docs/sources/configure-user-settings/_index.md @@ -46,12 +46,33 @@ To learn more about RBAC for Grafana OnCall, refer to the following documentatio ## Manage Teams in Grafana OnCall -Teams in Grafana OnCall are based on the teams created at the organization level of your Grafana instance, -in **Configuration > Teams**. Administrators can create a different configuration for each team, and can navigate -between team configurations in the **Select Team** dropdown menu in the **Alert Group** section of Grafana OnCall. +Teams in Grafana OnCall enable the configuration of visibility and filtering of resources, such as alert groups, +integrations, escalation chains, and schedules. OnCall teams are automatically synced with +[Grafana teams](https://grafana.com/docs/grafana/latest/administration/team-management/) created at the organization +level of your Grafana instance. To modify global settings like team name or team members, navigate to +**Configuration > Teams**. For OnCall-specific team settings, +go to **Alerts and Incidents > OnCall > Settings > Teams and Access Settings**. -Users, including admins, can only view and manage teams in OnCall if they are a member of that team. -An admin user may need to temporarily add themselves to a team to manage it. +This section displays a list of teams, allowing you to configure team visibility and access to team resources for all +Grafana users, or only admins and team members. You can also set a default team, which is a user-specific setting; +the default team will be pre-selected each time a user creates a new resource. The team list includes a `No team` tag, +signifying that the resource has no team and is accessible to everyone. + +Admins can view the list of all teams, while editors and viewers can only see teams (and their resources) +they are members of or if the team setting "who can see the team name and access the team resources" is set to +"all users of Grafana". + +> ⚠️ In the main Grafana teams section, users can set team-specific user permissions, such as Admin, Editor, or Viewer, +> but only for resources within that team. Currently, Grafana OnCall ignores this setting and uses global roles instead. + +Teams help filter resources on their respective pages, improving organization. You can assign a resource to a team when +creating it. Alert groups created via the Integration API inherit the team from the integration. + +Resources from different teams can be connected with one another. For instance, you can create an integration in one +team, set up multiple routes for the integration, and utilize escalation chains from other teams. Users, schedules, +and outgoing webhooks from other teams can also be included in the escalation chain. If a user only has access to the +first team and not others, they will be unable to view the resource, which will display as `🔒 Private resource`. +This feature enables the distribution of escalations across various teams. ## Configure user notification policies From 1580138a8073cef82cfd784202dadc0a905cb421 Mon Sep 17 00:00:00 2001 From: Joey Orlando Date: Thu, 23 Mar 2023 15:48:52 +0100 Subject: [PATCH 10/17] minor bugfix for ios push notifications config (#1614) In the "apns" key of the message sent to FCM, "headers" should not be nested under "payload", it should instead be at the same level. See Firebase docs for the `FirebaseAdmin.Messaging.ApnsConfig` class [here](https://firebase.google.com/docs/reference/admin/dotnet/class/firebase-admin/messaging/apns-config#class_firebase_admin_1_1_messaging_1_1_apns_config_1a7a9858f0b30ef7c437205ca01d6e62f6) --- engine/apps/mobile_app/tasks.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engine/apps/mobile_app/tasks.py b/engine/apps/mobile_app/tasks.py index 24658ea4..76d3d32b 100644 --- a/engine/apps/mobile_app/tasks.py +++ b/engine/apps/mobile_app/tasks.py @@ -216,11 +216,11 @@ def _get_fcm_message(alert_group, user, registration_id, critical): "interruption-level": "critical" if critical else "time-sensitive", }, ), - headers={ - # From the docs - # https://firebase.google.com/docs/cloud-messaging/concept-options#setting-the-priority-of-a-message - "apns-priority": "10", - }, ), + headers={ + # From the docs + # https://firebase.google.com/docs/cloud-messaging/concept-options#setting-the-priority-of-a-message + "apns-priority": "10", + }, ), ) From 199f234a6a4fc675815581172a257e7b24fd15ef Mon Sep 17 00:00:00 2001 From: Rares Mardare Date: Thu, 23 Mar 2023 17:34:16 +0200 Subject: [PATCH 11/17] Rares/2 webhooks (#1585) # What this PR does Webhooks ^_^ --- grafana-plugin/src/components/GForm/GForm.tsx | 144 ++++++++++++------ .../src/components/GForm/GForm.types.ts | 2 + .../SourceCode/SourceCode.module.scss | 12 +- .../src/components/SourceCode/SourceCode.tsx | 6 +- .../src/containers/GSelect/GSelect.tsx | 4 +- ...fig.ts => OutgoingWebhook2Form.config.tsx} | 64 ++++++-- .../OutgoingWebhook2Status.tsx | 16 +- grafana-plugin/src/pages/index.tsx | 11 +- .../OutgoingWebhooks2.module.css | 10 ++ .../outgoing_webhooks_2/OutgoingWebhooks2.tsx | 96 ++++++++---- grafana-plugin/src/utils/index.ts | 6 +- 11 files changed, 254 insertions(+), 117 deletions(-) rename grafana-plugin/src/containers/OutgoingWebhook2Form/{OutgoingWebhook2Form.config.ts => OutgoingWebhook2Form.config.tsx} (59%) diff --git a/grafana-plugin/src/components/GForm/GForm.tsx b/grafana-plugin/src/components/GForm/GForm.tsx index a6d65392..5e2c404a 100644 --- a/grafana-plugin/src/components/GForm/GForm.tsx +++ b/grafana-plugin/src/components/GForm/GForm.tsx @@ -1,4 +1,4 @@ -import React, { useCallback } from 'react'; +import React from 'react'; import { Field, Form, Input, InputControl, Select, Switch, TextArea } from '@grafana/ui'; import { capitalCase } from 'change-case'; @@ -17,22 +17,57 @@ const nullNormalizer = (value: string) => { return value || null; }; -function renderFormControl(formItem: FormItem, register: any, control: any) { +function renderFormControl(formItem: FormItem, register: any, control: any, onChangeFn: () => void) { switch (formItem.type) { case FormItemType.Input: - return ; + return ; case FormItemType.TextArea: - return