Commit graph

1040 commits

Author SHA1 Message Date
Yulya Artyukhina
d7d5c3aa28
Fix acknowledge reminder (#3345)
# What this PR does
Fix acknowledge reminder:
- check if organization was deleted
- improve logging

## Which issue(s) this PR fixes

## 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-11-14 13:39:27 +00:00
Matias Bordese
e8bd71bbab
Enable filtering users by public primary key (#3339)
Related to https://github.com/grafana/oncall/issues/3164

This will allow the following request to check if a user is currently
on-call:
`GET
/api/internal/v1/users/?search=UCGEIXI1MR1NZ&is_currently_oncall=true`
2023-11-14 12:56:58 +00:00
Joey Orlando
dcf08425eb
Fix few minor Slack connection issues (#3327)
# What this PR does

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

- Fix issue where if you try connecting your Slack user to your OnCall
user and the first time around you encounter an error (ex. connecting to
the wrong Slack workspace), you will see the same error banner message
despite a successful connection. Now we clear the session upon
successful connection to ensure that you will not see any previously
encountered errors.
- Fix some alignment issues on the Slack connection buttons
  **Before**

<img width="564" alt="Screenshot 2023-11-10 at 15 07 48"
src="https://github.com/grafana/oncall/assets/9406895/1a256ae9-668c-4a76-b101-cb4e0af29c43">
<img width="789" alt="Screenshot 2023-11-10 at 15 16 22"
src="https://github.com/grafana/oncall/assets/9406895/61649d9d-2f11-497a-9f2d-274c6dbe90eb">

  **After**

<img width="470" alt="Screenshot 2023-11-10 at 15 10 28"
src="https://github.com/grafana/oncall/assets/9406895/92c0f1d3-75eb-4de2-a3d3-4e014489f970">
<img width="738" alt="Screenshot 2023-11-10 at 15 16 42"
src="https://github.com/grafana/oncall/assets/9406895/dc825266-c45e-4c48-af78-0cd5c3c5b64e">

- On the "User Info" user settings modal tab, render `display_name`
instead of `slack_login`. Currently we prefix `@` before `slack_login`,
which is a bit confusing as it makes you think that this is the handle
you would use to `@` your user in Slack. `display_name` corresponds to
the handle that would be used to `@` your user

## 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)
2023-11-13 12:44:54 +00:00
Michael Derynck
6fa4df0afe
Forward headers for Amazon SNS (#3326)
# What this PR does
Forward headers for Amazon SNS when forwarding requests for moved
organizations. Previous
[PR](https://github.com/grafana/oncall/pull/3315) missed this since the
test did not check mocked make_request for headers.

## Which issue(s) this PR fixes

## 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-11-11 11:11:51 -07:00
Matias Bordese
8ddea0576e
Add test ensuring ingestion works without db access (#3322)
Handling alert payloads should work without db access (but still
requires cached integrations information)
2023-11-10 17:44:37 +00:00
Joey Orlando
37160806ca
Direct paging integrations table (#3290)
# What this PR does

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

## Which issue(s) this PR fixes

## 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)

---------

Co-authored-by: Dominik <dominik.broj@grafana.com>
2023-11-10 16:54:22 +00:00
Ravishankar
152b1b1c58
fix(3093) Return timezone field of the user via public API (#3311)
# What this PR does
Return the `timezone` field for the users GET API call
## Which issue(s) this PR fixes

Closes #3093 

## 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)

---------

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-11-10 11:47:11 -05:00
Michael Derynck
ad1f63dbe9
AmazonSNS integration exception handling (#3315)
# What this PR does
Handle OrganizationMoved, OrganizationDeleted and PermissionDenied
exceptions same as other integration API views instead of converting to
BadRequest.

## Which issue(s) this PR fixes

## 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-11-10 13:45:12 +00:00
Ildar Iskhakov
784c5ee7c1
Add notifications success ratio log to auditor (#3312)
# What this PR does

This PR adds alert groups success ratio over last 48 hours

## 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-11-10 16:39:13 +08:00
Matias Bordese
e41ccb9d9b
Make usernames unique in tests (#3310)
Some tests (particularly when there are schedules and shifts involved)
depend on generated usernames being unique (we randomly get [CI
errors](https://github.com/grafana/oncall/actions/runs/6812435056/job/18524768961#step:5:676)
because of this). Although username field is not required to be unique,
I think it makes sense for testing purposes to enable this (and when a
duplicated username is needed in a test, make that explicit).
2023-11-09 14:30:28 +00:00
Vadim Stepanov
456829f768
Pass all integration labels down to alert groups (#3302)
Reverts grafana/oncall#3301
2023-11-08 14:04:58 +00:00
Vadim Stepanov
53aae00f7c
Revert "Pass all integration labels down to alert groups" (#3301)
Reverts grafana/oncall#3299
2023-11-08 13:32:10 +00:00
Vadim Stepanov
367e3c9c1d
Pass all integration labels down to alert groups (#3299)
# What this PR does

Passes ALL integration labels down to alert groups, so it's easier to
create labels for alert groups locally.

## Which issue(s) this PR fixes

Related to https://github.com/grafana/oncall-private/issues/2179

## 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-11-08 13:17:05 +00:00
Vadim Stepanov
1997d41e5b
Add labels to alert group API responses (#3292)
# What this PR does

Adds a field to the internal API alert group serializer to display
labels.

## Which issue(s) this PR fixes

Related to https://github.com/grafana/oncall-private/issues/2179

## 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-11-08 09:18:15 +00:00
Joey Orlando
00b8d1b821
remove AlertGroup.is_restricted column (#3287)
# What this PR does

Second part of https://github.com/grafana/oncall/pull/3256 to remove the
deprecated `AlertGroup.is_restricted` column. That change was released
in v1.3.54.

## 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-11-07 16:58:53 +00:00
Matias Bordese
ac01dd173d
Improve user permissions query (#3291)
The query for checking a user permission (used to get users from a Slack
usergroup, for example) is timing out (and generating retries, besides
affecting some use cases:
[logs](https://ops.grafana-ops.net/explore?panes=%7B%22FCQ%22:%7B%22datasource%22:%22c-R8UWvVk%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%7Bnamespace%3D%5C%22amixr-prod%5C%22,%20cluster%3D%5C%22prod-us-central-0%5C%22%7D%20%7C%3D%20%5C%22Timeout%20exceeded%20in%20regular%20expression%20match.%5C%22%22,%22queryType%22:%22range%22,%22datasource%22:%7B%22type%22:%22loki%22,%22uid%22:%22c-R8UWvVk%22%7D,%22editorMode%22:%22code%22%7D%5D,%22range%22:%7B%22from%22:%22now-6h%22,%22to%22:%22now%22%7D%7D%7D&schemaVersion=1&orgId=1)):

`django.db.utils.OperationalError: (3699, 'Timeout exceeded in regular
expression match.')`

Change to a `contains` query except for SQLite (not supported), where a
simplified version of the original regex query is used.
2023-11-07 16:58:16 +00:00
Yulya Artyukhina
7552de13e5
Add a command to continue escalations for alert groups (#3283)
# What this PR does
Add an ability to continue escalations for alert groups from the point
it was in case if it was stopped

## 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-11-07 13:44:23 +00:00
Matias Bordese
99a7d8aced
Update test to avoid failure depending on when it is run (#3289) 2023-11-07 13:29:46 +00:00
Joey Orlando
eb0f465970
add get_cached_oncall_users_for_multiple_schedules method + add DELETE /alertgroups/<id> internal API endpoint (#3280)
# What this PR does

This PR:
- adds a new method
`apps.schedules.ical_utils.get_cached_oncall_users_for_multiple_schedules`.
In short this method basically adds a layer of caching on top of
`apps.schedules.ical_utils.get_oncall_users_for_multiple_schedules`. We
store one cache value for each schedule. Cache results are stored for 15
minutes. To me this feels like a good balance between improving
performance + returning stale results. Cache values are stored as:
  - key = `f"schedule_{schedule.public_primary_key}_oncall_users"`
- value = `[user.public_primary_key for user in
schedule.currently_oncall_users]`
- adds a `DELETE /alertgroups/<id>` internal API endpoint (needed by
Grafana Incident for the Add Responders integration)
- updates the `is_currently_oncall` query parameter for the `GET /users`
internal API endpoint to return ALL users when the query param value `==
"all"`

## Which issue(s) this PR fixes

https://github.com/grafana/oncall-private/issues/2264

## 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-11-06 15:30:32 -05:00
Matias Bordese
cc9dc66437
Move cache clear to fixtures, fix some deprecation notices (#3269) 2023-11-06 16:52:50 +00:00
Joey Orlando
eef27b35d1
remove AlertGroup.is_restricted column (#3256)
# What this PR does

Removes deprecated/not-referenced `AlertGroup.is_restricted` column. Per
our dev docs on "[Removing a nullable field from a
model](https://github.com/grafana/oncall/blob/dev/dev/README.md#removing-a-nullable-field-from-a-model)"
this is the 1st of two migration files. The [second migration
file](https://github.com/grafana/oncall/files/13255276/0038_remove_alertgroup_is_restricted_db.py.zip)
will be added in a PR in a subsequent PR/release.
2023-11-06 12:48:06 +00:00
Vadim Stepanov
94e2a8472d
Alert group labels filter (#3238)
# What this PR does

Adds a model for alert group labels and adds filtering functionality for
labels on the alert groups page.

## Which issue(s) this PR fixes

https://github.com/grafana/oncall-private/issues/2178

## 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)

---------

Co-authored-by: Maxim <maxim.mordasov@grafana.com>
2023-11-06 10:31:12 +00:00
Innokentii Konstantinov
a09a6426cb
Update grafana-labels-url (#3275) 2023-11-06 17:08:55 +08:00
Yulya Artyukhina
66219b15f0
Check if organization was deleted for heartbeat integration (#3270)
# What this PR does
Exclude deleted organizations before sending heartbeat alerts

## Which issue(s) this PR fixes

## 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-11-03 17:05:37 +00:00
Joey Orlando
2cbb20601e
Improve performance of GET /users and GET /teams endpoints used by add responders popup (#3241)
# What this PR does

- Improve performance of the specific `GET /users` and `GET /teams`
calls that're made by the Add Responders dropdown in the UI
- Add `GET /team/{teamId}` internal API route (needed by Grafana
Incident team for their Add Responders changes)
- Some UI improvements to the Add Responders popup (loading state +
pre-fetch users and teams when the drawer is opened)
- Re-enable django-admin only if `settings.SILK_PROFILER_ENABLED ==
True` (need to be able to log into django admin to auth to silk routes)

Closes #3231 
Closes https://github.com/grafana/oncall-private/issues/2252

## 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-11-03 12:40:54 -04:00
Yulya Artyukhina
68c1b2efba
Fix getting alert group from telegram action (#3262)
# What this PR does
Fix getting alert group from telegram action: try to get alert group
from telegram message first instead of getting it from action data

## 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-11-03 10:22:38 +00:00
Michael Derynck
f23a0572a1
Limit number of times webhooks retry (#3244)
# What this PR does
Set limit on number of times webhooks retry to 3

## 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-11-02 17:56:12 +00:00
Yulya Artyukhina
c9ce61efd7
Fix db migration for mobile app (#3260)
# What this PR does
Fixes bd migration

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

## 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)
2023-11-02 16:40:26 +00:00
Yulya Artyukhina
2edae70b04
Update wording for mobile push notifications timing choices (#3253)
# What this PR does
Update wording for mobile push notifications timing choices

## Which issue(s) this PR fixes

## 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)
2023-11-02 11:37:28 +00:00
Yulya Artyukhina
66a898df7d
Add labels feature flag for list of organizations (#3246)
# What this PR does
Adds a flag that allows to enable labels feature for the list of
organizations

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

## 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-11-02 09:52:32 +00:00
Ildar Iskhakov
a9364307c8
Return alert groups for deleted integrations on private api (#3223)
# What this PR does

This PR adds alert groups from deleted integrations to the api response.
More details in this [slack
thread](https://raintank-corp.slack.com/archives/C0229FD3CE9/p1698742008962209)

## 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: Matvey Kukuy <Matvey-Kuk@users.noreply.github.com>
2023-11-02 08:45:30 +00:00
Joey Orlando
f905ac5246
Updates to POST /direct_paging internal API endpoint to support Grafana Incident use-cases (#3232)
# What this PR does

- Add a new column, `grafana_incident_id`, to the `AlertGroup` model.
For now this is really just needed to determine if the Alert Group was
created, via a Direct Page, that originated from Grafana Incident.
- I understand that these IDs may be cluster specific. For now we will
not need to make OnCall backend -> Incident API calls. Should we need to
start doing this we will likely need to start syncing the Incident
plugin's provisioned API url into the `organization` in OnCall, such
that we make the API call to the right Incident backend.
- Add two new optional request body parameters to `POST /direct_paging`,
`source_url` and `grafana_incident_id`
- `source_url` - will easily allow Grafana Incident to specify the URL
to the Incident and have this populate the "Source" button
- `grafana_incident_id` - Grafana Incident can specify this such that we
have a link back to Incident (+ we know that the Alert Group was
generated from Incident)
- Hide the "Declare Incident" button in the UI if the Alert Group was
generated from Grafana Incident

## 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-11-01 17:19:44 -04:00
Michael Derynck
3b02c587f5
Order alert groups by -started_at in internal API (#3240)
# What this PR does
Order alert groups in API by -started_at instead of -pk. This should
result in no visible change for most installations. In the case where
alert groups are being moved/restored between installations this allows
for the display order to be as expected without relying on insertion
order.

Note: Public API is already using -started_at instead of pk and it is
already indexed.

## Which issue(s) this PR fixes

## 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-11-01 13:19:21 -06:00
Joey Orlando
b8ad7bf99b
remove all references to deprecated AlertGroup.is_restricted field (#3228)
# What this PR does

remove all references to deprecated `AlertGroup.is_restricted` field +
leave a note to remove the column in a future release
2023-10-31 20:10:45 +00:00
Joey Orlando
1b05b60738
add missing db migrations + add additional backend db migration check to CI (#3234)
# What this PR does

- add missing db migration files generated via `python manage.py
makemigrations`
- fail the `lint-migrations-backend-mysql-rabbitmq` GitHub Actions CI
job if there are missing Django database migration files
2023-10-31 16:00:55 -04:00
Joey Orlando
d568ad6707
few add responders patches (#3220)
# Which issue(s) this PR fixes

Closes https://github.com/grafana/support-escalations/issues/8143

Fix a few minor issues introduced in #3128:

- Fix slow `GET /users` internal API endpoint related to [this
change](https://github.com/grafana/oncall/blob/dev/engine/apps/api/views/user.py#L239)
- Fix slow `GET /teams` internal API endpoint. Introduced a `short`
query parameter that only invokes
`apps.schedules.ical_utils.get_oncall_users_for_multiple_schedules` when
`short=false`.
- Order results from `GET /teams` internal API endpoint by name
(ascending)
- Fix search issue when searching for teams in the add responders popup
window (this was strictly a frontend issue)
- CSS changes to add responders dropdown to fix lonnnggg results list:
  **Before**
<img width="377" alt="Screenshot 2023-10-31 at 10 06 20"
src="https://github.com/grafana/oncall/assets/9406895/246c7c3b-7bea-44a1-afec-a38144c2c2d1">
  **After**
<img width="444" alt="Screenshot 2023-10-31 at 10 48 12"
src="https://github.com/grafana/oncall/assets/9406895/b5602a22-c691-4dc7-bd3d-e4d6b76d04a0">



## Still todo

The `apps.schedules.ical_utils.get_oncall_users_for_multiple_schedules`
method is still very slow when an instance has a lot of users (ex.
`ops`). Ideally we should refactor this method to be more efficient
because we still need to call this method under some circumstances. Ex.
to populate this dropdown when Direct Paging a user (note that it didn't
finish loading here on `ops`):
<img width="1037" alt="Screenshot 2023-10-30 at 18 14 59"
src="https://github.com/grafana/oncall/assets/9406895/9d91a57c-5db8-4ff9-862a-cd3755f52690">



## 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-10-31 11:18:33 -04:00
Matias Bordese
5996141133
Disable updates for API/terraform shifts in internal API (#3224)
Related to https://github.com/grafana/oncall-private/issues/2246
2023-10-31 15:08:07 +00:00
Yulya Artyukhina
76a0643bc5
"Going oncall" notification settings (#3187)
# What this PR does

## Which issue(s) this PR fixes

## 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)

---------

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-10-30 13:44:18 +00:00
Joey Orlando
6a78ee6983
fix RBAC authz issue for Slack Alert Group actions (#3213)
Was able to reproduce locally with OnCall RBAC enabled and as a user
with Viewer role:
<img width="701" alt="Screenshot 2023-10-30 at 09 30 52"
src="https://github.com/grafana/oncall/assets/9406895/0050c2b1-2765-4aba-a73e-985f364691ad">

Fixed with the changes introduced in this PR:
<img width="963" alt="Screenshot 2023-10-30 at 09 30 16"
src="https://github.com/grafana/oncall/assets/9406895/02b62f39-01e5-4a13-baaf-db30181eb16a">
<img width="967" alt="Screenshot 2023-10-30 at 09 30 11"
src="https://github.com/grafana/oncall/assets/9406895/c606f6db-8e99-4df4-a3e9-5c9da8feb051">



## Which issue(s) this PR fixes

Closes #3212 

## 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-10-30 09:48:54 -04:00
Nelson
c281484f67
add support for datetime on final_shifts API parameters (#3103)
# What this PR does
- Changes the data type from `DateField` to `DateTimeField` on the
`final_shifts` API endpoint
- Accepts either a date or a datetime for the `start_date` and
`end_date` parameters (e.g. 2021-01-01 or 2021-01-01T01:00)
- Datetime granularity is in line with what is configurable on the
schedule i.e. `YYYY-MM-DD hh:mm`
- removes the rounding logic that modifies the query sent on the
database

## Which issue(s) this PR fixes
#3086 

## 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)

---------

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-10-30 12:00:39 +00:00
Joey Orlando
d49ccef8cb
address some minor direct paging backend issues (#3208)
# Which issue(s) this PR fixes

- Fixes an issue where if the user does not appear in the
`UserHasNotification` query, we don't actually unpage the user and
therefore they still show up in the `paged_users` array. (unpaging ==
creating a `AlertGroupLogRecord.TYPE_UNPAGE_USER` log record)
- Fixes an issue where if a user is paged multiple times, they would
currently show up in `paged_users` > 1

## 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-10-27 20:47:00 +00:00
Matias Bordese
c4fb620328
Upgrade to django 4.2.6 and other deps updates (#3176) 2023-10-27 18:45:00 +00:00
Joey Orlando
697248dc75
Add responders improvements (#3128)
# What this PR does

https://www.loom.com/share/c5e10b5ec51343d0954c6f41cfd6a5fb

## Summary of backend changes
- Add `AlertReceiveChannel.get_orgs_direct_paging_integrations` method
and `AlertReceiveChannel.is_contactable` property. These are needed to
be able to (optionally) filter down teams, in the `GET /teams` internal
API endpoint
([here](https://github.com/grafana/oncall/pull/3128/files#diff-a4bd76e557f7e11dafb28a52c1034c075028c693b3c12d702d53c07fc6f24c05R55-R63)),
to just teams that have a "contactable" Direct Paging integration
- `engine/apps/alerts/paging.py`
- update these functions to support new UX. In short `direct_paging` no
longer takes a list of `ScheduleNotifications` or an `EscalationChain`
object
  - add `user_is_oncall` helper function
- add `_construct_title` helper function. In short if no `title` is
provided, which is the case for Direct Pages originating from OnCall
(either UI or Slack), then the format is `f"{from_user.username} is
paging <team.name (if team is specified> <comma separated list of
user.usernames> to join escalation"`
- `engine/apps/api/serializers/team.py` - add
`number_of_users_currently_oncall` attribute to response schema
([code](https://github.com/grafana/oncall/pull/3128/files#diff-26af48f796c9e987a76447586dd0f92349783d6ea6a0b6039a2f0f28bd58c2ebR45-R52))
- `engine/apps/api/serializers/user.py` - add `is_currently_oncall`
attribute to response schema
([code](https://github.com/grafana/oncall/pull/3128/files#diff-6744b5544ebb120437af98a996da5ad7d48ee1139a6112c7e3904010ab98f232R157-R162))
- `engine/apps/api/views/team.py` - add support for two new optional
query params `only_include_notifiable_teams` and `include_no_team`
([code](https://github.com/grafana/oncall/pull/3128/files#diff-a4bd76e557f7e11dafb28a52c1034c075028c693b3c12d702d53c07fc6f24c05R55-R70))
- `engine/apps/api/views/user.py`
- in the `GET /users` internal API endpoint, when specifying the
`search` query param now also search on `teams__name`
([code](https://github.com/grafana/oncall/pull/3128/files#diff-30309629484ad28e6fe09816e1bd226226d652ea977b6f3b6775976c729bf4b5R223);
this is a new UX requirement)
- add support for a new optional query param, `is_currently_oncall`, to
allow filtering users based on.. whether they are currently on call or
not
([code](https://github.com/grafana/oncall/pull/3128/files#diff-30309629484ad28e6fe09816e1bd226226d652ea977b6f3b6775976c729bf4b5R272-R282))
- remove `check_availability` endpoint (no longer used with new UX; also
removed references in frontend code)
- `engine/apps/slack/scenarios/paging.py` and
`engine/apps/slack/scenarios/manage_responders.py` - update Slack
workflows to support new UX. Schedules are no longer a concept here.
When creating a new alert group via `/escalate` the user either
specifies a team and/or user(s) (they must specify at least one of the
two and validation is done here to check this). When adding responders
to an existing alert group it's simply a list of users that they can
add, no more schedules.
- add `Organization.slack_is_configured` and
`Organization.telegram_is_configured` properties. These are needed to
support [this new functionality
](https://github.com/grafana/oncall/pull/3128/files#diff-9d96504027309f2bd1e95352bac1433b09b60eb4fafb611b52a6c15ed16cbc48R271-R272)
in the `AlertReceiveChannel` model.

## Summary of frontend changes
- Refactor/rename `EscalationVariants` component to `AddResponders` +
remove `grafana-plugin/src/containers/UserWarningModal` (no longer
needed with new UX)
- Remove `grafana-plugin/src/models/user.ts` as it seemed to be a
duplicate of `grafana-plugin/src/models/user/user.types.ts`

Related to https://github.com/grafana/incident/issues/4278

- Closes #3115
- Closes #3116
- Closes #3117
- Closes #3118 
- Closes #3177 

## TODO
- [x] make frontend changes
- [x] update Slack backend functionality
- [x] update public documentation
- [x] add/update e2e tests

## Post-deploy To-dos
- [ ] update dev/ops/production Slack bots to update `/escalate` command
description (should now say "Direct page a team or user(s)")

## 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-10-27 12:12:07 -04:00
Yulya Artyukhina
f239fd7798
Quickfix for getting alert group from slack message payload (#3195)
# What this PR does

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

## 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-10-25 16:32:55 +00:00
Yulya Artyukhina
a3aeb0ecb5
Fix channel filter endpoint (#3192)
# What this PR does
Add filtering term length check for channel filter endpoints

## Which issue(s) this PR fixes

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

## 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-10-25 12:33:05 +00:00
Matias Bordese
d546d0b7ff
Fix iCal imported schedules related users and next shifts per user (#3178)
Fixes https://github.com/grafana/oncall-private/issues/2212
2023-10-23 22:15:02 +00:00
Yulya Artyukhina
c0318b55c0
Permissions for labels (#3173)
# What this PR does
Adds check for basic role permissions on get/create/update labels

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

## 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-10-23 11:03:51 +00:00
Vadim Stepanov
2179e7a1c9
Resolution note source mobile app (#3174)
# What this PR does

Fixes https://github.com/grafana/oncall/issues/2320

## 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-10-20 15:22:45 +01:00
Yulya Artyukhina
24f4969f61
Add labels implementation for integration (#3014)
# What this PR does
Adds labels implementation for integrations:
- ability to create/update labels on creating/updating integration
- ability to associate labels to integrations
- cache for label reprs on OnCall side
- feature flag to enable/disable labels

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

## 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)

---------

Co-authored-by: Maxim <maxim.mordasov@grafana.com>
Co-authored-by: Rares Mardare <rares.mardare@grafana.com>
2023-10-20 07:30:11 +00:00
Matias Bordese
848bd1277f
Handle None role when syncing users from Grafana (#3147)
Fixes https://github.com/grafana/oncall-private/issues/2201
2023-10-19 17:39:08 +00:00