Commit graph

287 commits

Author SHA1 Message Date
Matias Bordese
6e5d417967
Update shift week_start when translating to UTC (#2124)
This fixes scenario described
[here](https://github.com/grafana/oncall/issues/2118#issuecomment-1580499754).

When a rotation is setup in UTC+1, and the shift starts at 00:00 with
Monday as active day and a weekly frequency, the values are translated
to UTC when submitting to the backend, so the shift data becomes
something like: shift starting at 23:00 on Sunday, but since week_start
is on Monday, the "first event" in the week belongs to the "previous
week". This can be addressed by moving the week_start, so a weekly shift
that was starting on a Monday but in UTC tz starts on Sunday,
"translates" to a UTC week_start on Sunday:


![rotation-example](https://github.com/grafana/oncall/assets/260710/5222d3ce-52b7-41d5-8ecb-d01c7a0139cb)


(this is with the proposed changes; otherwise you get the same issue
linked above where the first event in the week is assigned to the other
user group).

About selected week days changed when editing a rotation, see inline
comment (related to
[this](https://github.com/grafana/oncall/issues/1322#issuecomment-1521787786))
2023-06-13 14:31:50 +00:00
Joey Orlando
9dde1805aa
add mypy static type checker to backend codebase (#2151)
# What this PR does

- Adds [`mypy` static type checking](https://mypy-lang.org/) to our CI
pipeline. Currently there is still a **ton** of errors being returned by
the tool, as we'll need to fix pre-existing errors. I think we can
slowly chip away at these errors in small PRs, doing them all in one
large PR is likely very risky.
- Also, this PR starts chipping away at one of the main type errors that
we have which is accessing the `datetime` class (from the `datetime`
library) or `timedelta` function on the `django.utils.timezone` module.
Basically we should be instead accessing these two objects from the
native `datetime` module. This makes sense because the [`__all__`
attribute](https://github.com/django/django/blob/main/django/utils/timezone.py#L14-L30)
in `django.utils.timezone` does not re-export `datetime` or `timedelta`.
- splits `engine` dependencies out into `requirements.txt` and
`requirements-dev.txt`

## 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)
- [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required) (N/A)
2023-06-12 12:50:33 -04:00
Matias Bordese
c1935ef46c
Update alert group view receive channel filter (#2140)
We were noticing some discrepancies in alert groups counts.

From a real example:

```
# queryset is the alert groups initial queryset
>>> qs = queryset.filter(channel_filter__alert_receive_channel=arc)
>>> qs.filter(resolved_at__isnull=False).count()
1318
>>> qs = queryset.filter(channel=arc)
>>> qs.filter(resolved_at__isnull=False).count()
1356
>>> qs.filter(resolved_at__isnull=False, channel_filter__isnull=True).count()
38
```
2023-06-08 19:49:48 +00:00
Ildar Iskhakov
f14179b9b0
Fix demo-payload (#2139)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] 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)
2023-06-08 23:31:18 +08:00
Innokentii Konstantinov
c7f8ac3559
Add BaseFailed exceptions for phone_notificator (#2074)
# What this PR does
Introduces BaseFailed exception for phone_notificator.

# Why
We need to somehow distinguish errors we want to be notified - like
network errors or invalid twilio credentials (I will call them "real"
errors) and errors we want to share with user, but don't want to be
paged ( I will call them "fake" errors).
To do that I added "graceful_msg" to all Failed... exceptions. If
details field is present - it mean we can return 400 code with the
message, if not - 500 code. So, "real" errors will raise Failed...
exception, while "fake" will add "graceful_msg".

# TODO
handle exceptions handled here
https://github.com/grafana/oncall/pull/2065
## Checklist

- [ ] 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: Michael Derynck <michael.derynck@grafana.com>
2023-06-08 05:55:41 +00:00
Innokentii Konstantinov
a865ae1378
Fix backend for resolution notes via mobile app (#2117)
# What this PR does
Add first internal api error code and add "resolution_note" param to
resolve endpoint

## Which issue(s) this PR fixes
It fixes resolving alert groups via mobile app when resolution note is
required

## Checklist

- [x] 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)
2023-06-07 12:19:16 +00:00
Vadim Stepanov
68605029e4
Make viewset actions more consistent (#2120)
# What this PR does

Makes sure that all viewset actions with `detail=True` use
`self.get_object()` to retrieve an instance that's being acted upon.

## 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)
2023-06-07 12:10:53 +00:00
Joey Orlando
357adfbc21
make make test command much more robust + address several more backend test warnings (#2115)
# What this PR does

see more detailed comments under the "Files changed" tab

---------

Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
2023-06-07 10:51:58 +00:00
Matvey Kukuy
971ef576ae
Main to dev (#2108)
Co-authored-by: Innokentii Konstantinov <innokenty.konstantinov@grafana.com>
Co-authored-by: GitHub Actions <actions@github.com>
Co-authored-by: Michael Derynck <michael.derynck@grafana.com>
Co-authored-by: eldin <33036213+nikoalch@users.noreply.github.com>
Co-authored-by: Matias Bordese <mbordese@gmail.com>
Co-authored-by: chrisharbro <102977229+chrisharbro@users.noreply.github.com>
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
Co-authored-by: Ildar Iskhakov <Ildar.iskhakov@grafana.com>
2023-06-07 04:14:21 +00:00
Joey Orlando
ea9b7a6331
Fix warnings when running backend tests (#2079)
# What this PR does

- update `make test` to always use `settings.ci-test`. Right now it will
use whatever the value of `DJANGO_SETTINGS_MODULE` is in
`./dev/.env.dev`, which causes ~45 tests to fail
- Fix several Python warnings that we see when running the tests
```bash
RemovedInDjango40Warning: The providing_args argument is deprecated. As it is purely documentational, it has no replacement. If you rely on this argument as documentation, you can move the text to a code comment or docstring.
    alert_create_signal = django.dispatch.Signal(
```

```bash
PytestCollectionWarning: cannot collect test class 'TestOnlyBackend' because it has a __init__ constructor (from: apps/api/tests/test_alert_receive_channel_template.py)
    class TestOnlyBackend(BaseMessagingBackend):
```

```bash
DeprecationWarning: The parameter 'use_aliases' in emoji.emojize() is deprecated and will be removed in version 2.0.0. Use language='alias' instead.
  To hide this warning, pin/downgrade the package to 'emoji~=1.6.3'
    return emoji.emojize(self.verbal_name, use_aliases=True)
```

```bash
DateTimeField CustomOnCallShift.start received a naive datetime (2023-06-01 12:53:12) while time zone support is active.
    warnings.warn("DateTimeField %s received a naive datetime (%s)"
```

```bash
apps/twilioapp/tests/test_phone_calls.py::test_resolve_by_phone
  /etc/app/apps/twilioapp/tests/test_phone_calls.py:173: DeprecationWarning: The 'text' argument to find()-type methods is deprecated. Use 'string' instead.
    content = BeautifulSoup(content, features="html.parser").findAll(text=True)
```

```bash
apps/twilioapp/tests/test_phone_calls.py::test_resolve_by_phone
apps/twilioapp/tests/test_phone_calls.py::test_wrong_pressed_digit
  /usr/local/lib/python3.11/site-packages/bs4/builder/__init__.py:545: XMLParsedAsHTMLWarning: It looks like you're parsing an XML document using an HTML parser. If this really is an HTML document (maybe it's XHTML?), you can ignore or filter this warning. If it's XML, you should know that using an XML parser will be more reliable. To parse this document as XML, make sure you have the lxml package installed, and pass the keyword argument `features="xml"` into the BeautifulSoup constructor.
```

```bash
apps/twilioapp/tests/test_phone_calls.py::test_forbidden_requests
  /usr/local/lib/python3.11/site-packages/social_django/urls.py:15: RemovedInDjango40Warning: django.conf.urls.url() is deprecated in favor of django.urls.re_path().
    url(r'^login/(?P<backend>[^/]+){0}$'.format(extra), views.auth,
```

```bash
apps/twilioapp/tests/test_phone_calls.py: 66 warnings
  /usr/local/lib/python3.11/site-packages/debug_toolbar/utils.py:255: DeprecationWarning: currentThread() is deprecated, use current_thread() instead
    thread = threading.currentThread()
```


## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] 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)
2023-06-06 18:38:00 +00:00
Vadim Stepanov
3d7c044193
Fix Telegram ratelimit on live setting change (#2100)
# What this PR does

Fixes https://github.com/grafana/oncall/issues/1103, inspired by
https://github.com/grafana/oncall/pull/1934.

Makes sure that:
1. `LiveSettings.validate_settings` is only called once per update
request and not called for any individual LiveSetting instance save.
2. `telegram.Bot.set_webhook` is only called once per request when
changing `TELEGRAM_WEBHOOK_HOST`.


## Which issue(s) this PR fixes

https://github.com/grafana/oncall/issues/1103

## 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)
2023-06-06 15:18:12 +00:00
Joey Orlando
0a78b99fd8
allow mobile app to consume internal schedules api endpoints (#2109)
# What this PR does

allow mobile app to consume internal schedules api endpoints

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] 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)
2023-06-06 08:46:17 +00:00
Michael Derynck
bc535ac5df
Webhooks 2 hide secrets (#2104)
Replace password and authorization header fields with placeholders when
returning data to the UI. Mask the authorization header field when
editing and in the status logs.
2023-06-06 07:59:12 +00:00
Matias Bordese
021cf095a2
Add support to update web schedule rotations in-place (#2102) 2023-06-05 17:24:59 +00:00
Joey Orlando
7ed6290d42
public API endpoint to export schedule final shifts (#2047)
# What this PR does

Closes https://github.com/grafana/oncall-private/issues/1632

## 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)
2023-06-05 14:06:10 +00:00
Vadim Stepanov
8c8b5e0f2d
Fix demo alert for inbound email (#2081)
# What this PR does
Fix HTTP 500 when sending demo alert for inbound integration email. 

- Make all integration configs have consistent `is_demo_alert_enabled`
and `example_payload` values
- Add tests

## 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)
2023-06-02 09:44:32 +00:00
Dieter Plaetinck
44b105343a
Better english (#1959)
Not sure if this breaks anything. it probably breaks backwards compat.

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-06-01 12:37:37 +00:00
Ildar Iskhakov
5975b9dd8c
Change integrations page wording and add more guidance (#1986)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] 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)

---------

Co-authored-by: Yulia Shanyrova <yulia.shanyrova@grafana.com>
2023-05-31 11:26:36 +00:00
Innokentii Konstantinov
528529de23
Fix 500 on templates when slack or tg integration is disabled (#2064)
# What this PR does
Continue the work, started in
https://github.com/grafana/oncall/pull/2061.
Check if slack or telegram integration is enabled to include related
templates in the response
## Which issue(s) this PR fixes
https://github.com/grafana/oncall/issues/1889

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
2023-05-31 08:22:58 +00:00
Matias Bordese
e8c9d08301
Enable selecting active days for every shift freq (#2037)
Make it possible to select "by day" active periods for every shift
frequency (ie. enable it for hourly and monthly recurrent rotations).
2023-05-29 13:33:45 +00:00
Innokentii Konstantinov
1f786e8d2a
Phone provider refactoring (#1713)
# What this PR does
This PR moves phone notification logic into separate object PhoneBackend
and introduces PhoneProvider interface to hide actual implementation of
external phone services provider. It should allow add new phone
providers just by implementing one class (See SimplePhoneProvider for
example).
# Why 
[Asterisk PR](https://github.com/grafana/oncall/pull/1282) showed that
our phone notification system is not flexible. However this is one of
the most frequent community questions - how to add "X" phone provider.
Also, this refactoring move us one step closer to unifying all
notification backends, since with PhoneBackend all phone notification
logic is collected in one place and independent from concrete
realisation.
# Highligts
1. PhoneBackend object - contains all phone notifications business
logic.
2. PhoneProvider - interface to  external phone services provider.
3. TwilioPhoneProvider and SimplePhoneProvider - two examples of
PhoneProvider implementation.
4. PhoneCallRecord and SMSRecord models. I introduced these models to
keep phone notification limits logic decoupled from external providers.
Existing TwilioPhoneCall and TwilioSMS objects will be migrated to the
new table to not to reset limits counter. To be able to receive status
callbacks and gather from Twilio TwilioPhoneCall and TwilioSMS still
exists, but they are linked to PhoneCallRecord and SMSRecord via fk, to
not to leat twilio logic into core code.

---------

Co-authored-by: Yulia Shanyrova <yulia.shanyrova@grafana.com>
2023-05-24 06:27:48 +00:00
Vadim Stepanov
06bd0454f6
Fix MultipleObjectsReturned error on webhook endpoints (#1996)
# What this PR does
Sometimes `CustomButtonView` returns HTTP 500 with the following error:

```
apps.alerts.models.custom_button.CustomButton.MultipleObjectsReturned: get() returned more than one CustomButton -- it returned 3!
```

This PR fixes it by adding `.distinct()` to the `CustomButton` queryset
when retrieving an instance + does the same for `WebhooksView`.

## Which issue(s) this PR fixes
Related to https://github.com/grafana/oncall-private/issues/1828

## 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)
2023-05-23 16:23:06 +00:00
Innokentii Konstantinov
ac2f6edd9b
Mobile push dynamic setting (#1967) 2023-05-18 19:45:31 +08:00
Innokentii Konstantinov
f51e6fff5e
Test mobile push (#1933)
# What this PR does
Adds ability to send test push notification

---------

Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
Co-authored-by: Rares Mardare <rares.mardare@grafana.com>
2023-05-18 15:52:42 +08:00
Ildar Iskhakov
e97826df94
Allow null for short description in integrations api (#1952)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] 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)
2023-05-17 18:43:01 +08:00
Matias Bordese
79c7313cc5
Refactor upcoming shifts to use cached final schedule data (#1891) 2023-05-08 19:01:24 +00:00
Matias Bordese
b62687295d
Fix teams filter related issue setting maintenance mode (#1885)
Related to https://github.com/grafana/support-escalations/issues/5862
2023-05-05 18:09:25 +00:00
Joey Orlando
bb3521b879
upgrade to python 3.11.3 (#1849)
# What this PR does

Upgrades the backend to Python 3.11.3 (latest stable release) + update
linting step on Drone builds to run **all** the linting steps, not just
the Python ones.

## 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)
2023-05-05 15:32:40 +00:00
Ildar Iskhakov
0a02b21886
Add pagination to integrations page (#1872)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] 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)
2023-05-04 13:48:46 +08:00
Ildar Iskhakov
c7c26cb693
Clean commented code (#1875)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] 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)
2023-05-04 13:36:51 +08:00
Ildar Iskhakov
be35e579ed
Add routes_count and connected_escalations_chains_count to alert_rece… (#1874)
…ive_channels endpoint

# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] 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)
2023-05-04 13:31:48 +08:00
Yulia Shanyrova
b10b589f72
Main Grouping&Templating PR fro all frontend changes (#1731)
# What this PR does
Main Grouping&Templating PR fro all frontend changes:
Includes:

1. Integration table view
2. Integration form using Drawer component
3. Integration landing page with routes/escalation chains
4. Templates
5. Groupong

## Which issue(s) this PR fixes
https://github.com/grafana/oncall/issues/1620
https://github.com/grafana/oncall/issues/1621

---------

Co-authored-by: Rares Mardare <rares.mardare@grafana.com>
Co-authored-by: Ildar Iskhakov <ildar.iskhakov@grafana.com>
2023-05-03 17:51:45 +03:00
Joey Orlando
0d4db59137
Add "Notifications Receiver" RBAC role (#1853)
# What this PR does

Closes #1651 

Plus, add developer instructions on how to run `grafana-enterprise` with
RBAC for OnCall, enabled locally.

## Todo

- [x] add API integration test for new `permission` query param filter

## 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)
2023-05-02 12:19:34 +00:00
Ildar Iskhakov
bb34ba485b
Add filter descriptions (#1845)
# What this PR does
<img width="954" alt="Screenshot 2023-04-28 at 9 33 16 AM"
src="https://user-images.githubusercontent.com/2262529/235033175-6a94ffb2-3a39-4730-b855-5b1c5dff8fda.png">


## Which issue(s) this PR fixes

## Checklist

- [ ] 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)
2023-05-02 13:50:03 +08:00
Ildar Iskhakov
07e3a78949
Use subquery for mine alert groups (#1803)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] 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)
2023-04-27 11:20:45 +08:00
Michael Derynck
3d74cbf3f5
Webhook 2 improvements and fixes (#1829)
- Rename Firing to Alert Group Created to reduce confusion as to why the
event only first once and not when unresolve or unacknowledge returns
the alert group to the firing state.
- Increase password field length
- Do not filter webhook execution by team, team is just for filtering
ownership now
- Do not log webhook triggers in alert group escalation log if the
webhook does not trigger (Status/response will still be stored)
- Fix formatting for response content and data fields on the Status page
- Add a content length limit for responses being stored (50000
characters)
2023-04-26 15:55:08 -06:00
Matias Bordese
06b6c856d7
Rework schedule related users, add endpoint (#1828)
Related to https://github.com/grafana/oncall/issues/1820.
2023-04-26 20:46:51 +00:00
Joey Orlando
52ff041066
Optimize duplicate queries occurring in AlertGroupFilter (#1809)
# What this PR does

In `AlertGroupFilter` we currently have 11 duplicate queries which add
~1-2secs of unecessary request latency to `GET
/api/internal/v1/alertgroups` calls.
![Screenshot 2023-04-20 at 17 57
49](https://user-images.githubusercontent.com/9406895/233589341-de5e53ca-f10b-4038-ad68-a857d1643bf2.png)



The queries originate from the `queryset` callable arguments on several
of the fields of the `AlertGroupFilter` class. These callables basically
filter down their respective querysets to include only objects that
belong to the currently authenticated user's organization.

The duplicate queries are
- 2 queries to fetch integrations
- 2 queries to fetch escalation chains
- 10 queries to fetch users

At the moment, this PR is still a draft and doesn't work as intended.
It's based off of [a suggestion from this
discussion](https://github.com/carltongibson/django-filter/discussions/1572#discussioncomment-5676042)
in the `django-filter` repo. See [this DjangoCon
talk](https://youtu.be/e52S1SjuUeM?t=841) for more context.

---------

Co-authored-by: Ildar Iskhakov <Ildar.iskhakov@grafana.com>
2023-04-26 06:16:29 +00:00
Matias Bordese
20ec6f52bc
Add is_legacy column to handle webhook migration (#1813)
Legacy webhooks won't be editable at first. Keep data templates
compatibility.

Possible migration code:
```python
from apps.webhooks.models import Webhook
from apps.alerts.models import CustomButton, EscalationPolicy

custom_buttons = CustomButton.objects.all()
for cb in custom_buttons:
    webhook, _ = Webhook.objects.get_or_create(
        organization=cb.organization,
        team=cb.team,
        name=cb.name,
        is_legacy=True,
        defaults=dict(
            created_at=cb.created_at,
            url=cb.webhook,
            username=cb.user,
            password=cb.password,
            authorization_header=cb.authorization_header,
            trigger_type=Webhook.TRIGGER_ESCALATION_STEP,
            forward_all=cb.forward_whole_payload,
            data=cb.data,
        )
    )
    # migrate related escalation policies
    policies = EscalationPolicy.objects.filter(
        step=EscalationPolicy.STEP_TRIGGER_CUSTOM_BUTTON,
        custom_button_trigger=cb,
    ).update(
        step=EscalationPolicy.STEP_TRIGGER_CUSTOM_WEBHOOK,
        custom_webhook=webhook,
    )

```
2023-04-25 11:22:56 -03:00
Matias Bordese
e404d2f4b6
Update shift API to use a default for interval when missing (#1810)
Fixes #1527.
2023-04-21 19:13:09 +00:00
Joey Orlando
16502205be
add channel__team to internal api serializer select_related (#1805)
Locally I reproduced a slow `GET /api/internal/v1/alertgroups` query
(took 9s - 10s). After adding this line to the alert group serializer
for the internal api it:
- cut the response time in half
- cut the number of executed SQL queries from 52 to 30
2023-04-20 18:30:49 +02:00
Ildar Iskhakov
13e7aaba01
Optimise alert groups private api endpoint (#1802)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] 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)
2023-04-20 21:01:41 +08:00
Ildar Iskhakov
21aaa14076
Return is_based_on_alertmanager for alert_receive_channel in private api (#1782)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] 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)
2023-04-20 05:49:25 +00:00
Vadim Stepanov
eee9dcfcfa
Fix team update (#1794)
# What this PR does
Fixes team update endpoint for internal API + adds a unit test for this
scenario.

## Which issue(s) this PR fixes
https://github.com/grafana/oncall/issues/1774

## 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)
2023-04-19 15:22:14 +00:00
Matias Bordese
0895cdbb8f
Use shift tz for web-created events (#1785)
Fix issue when creating web overrides for TF schedules using a non-UTC
timezone (web UI assumes editable events are UTC-based).
2023-04-19 01:11:07 +00:00
Michael Derynck
2af4398e01
Webhooks 2 - Add copy ID to clipboard buttons (#1753)
Add copy to clipboard buttons for integration, route, webhook IDs if
webhooks 2 is enabled.

![Screenshot from 2023-04-14
11-31-13](https://user-images.githubusercontent.com/28077050/232116596-98cef7e1-0727-4fdd-a6e4-ad1fab4c0e4f.png)

![Screenshot from 2023-04-14
11-20-13](https://user-images.githubusercontent.com/28077050/232116613-5b964ae6-ccf8-4cf0-9a39-faa8a92360fe.png)

Updated tooltip:

![Screenshot from 2023-04-14
12-00-08](https://user-images.githubusercontent.com/28077050/232122222-80c58837-f213-421f-85e0-3ff40e193dda.png)
2023-04-18 13:03:13 -06:00
Matias Bordese
017d98efad
Rework schedule ical export (#1783)
Related to #1501. Behind a feature flag, will migrate existing exports
to use the new ical export transparently.
2023-04-18 17:07:11 +00:00
Matias Bordese
6cff9729d8
Update upcoming shift endpoint to return a list (#1784) 2023-04-18 16:42:04 +00:00
Matias Bordese
4149c266bb
Add mine filter to schedules listing (#1743)
Related to #1741 .
2023-04-18 13:16:36 +00:00
Ildar Iskhakov
16d64485f3
Fix templates bug (#1776)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] 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)
2023-04-18 18:55:53 +08:00