Commit graph

159 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
5da5b8d430
Allow use of dynamic payloads in alert receive channels preview templ… (#1756)
…ate in private api

# 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 03:57:40 +00:00
Ildar Iskhakov
7dd726622a
Add endpoints to start and stop maintenance in alert receive channel … (#1755)
…private api

# 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 03:31:49 +00:00
Ildar Iskhakov
9d19493561
Added preview and migration API endpoints for route migration from regex into jinja2 (#1715)
# What this PR does
This PR adds new API endpoints for migrating routes from regex format to
jinja2 format. The changes include the following:

* `filtering_term_as_jinja2` field to GET `channels_filters` endpoint
* A POST endpoint
`channel_filters/ABCDEF123/convert_from_regex_to_jinja2/` for migrating
routes to jinja2 format.

These new endpoints will allow users to preview and migrate their
existing regex routes to the more flexible and maintainable jinja2
format.

Check the screenshot where this endpoints will be used
<img width="407" alt="Screenshot 2023-04-14 at 09 50 23"
src="https://user-images.githubusercontent.com/2262529/231920771-20792c7e-d6ef-4681-80e1-c82bb4aa4b8e.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-04-18 02:53:53 +00:00
Ildar Iskhakov
f825fdf1a3
Send demo alert with dynamic payload and get demo payload example on private api (#1700)
# 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 02:48:11 +00:00
Innokentii Konstantinov
c68fdf5681
Fix insight_logs exceptions (#1757)
Most of the PR is just renaming ChatOpsType to ChatOpsPlug, core changes
are linked below:

- Fix insight_logs error writing unlink_backend error
https://github.com/grafana/oncall/pull/1757/files#diff-7ae187be84e55ebac962bad0984f7569186cdc83c896132b2ebcbcbb31bbf5dd
- Fix insight_logs error writing updated schedule with installed slack
integration
(https://github.com/grafana/oncall/pull/1757/files#diff-4037b7bbef9fc16d9b541beb3ed46f760916d7cd720847c3123adf7afb5ab4b4L690)
2023-04-17 07:16:18 +00:00
Yulya Artyukhina
f61af74411
Add mobile app auth for notification_policies endpoint (#1725)
Add mobile app authentication for `notification_policies` endpoint
2023-04-11 16:36:46 +00:00
Matias Bordese
bc1ca0f376
Add user endpoint to get upcoming shifts details (#1705)
Add internal API endpoint to get users' upcoming shifts:
`GET /api/internal/v1/users/<USER PK>/upcoming_shifts`

Related to https://github.com/grafana/oncall-private/issues/1602.
2023-04-05 20:19:02 +00:00
Matias Bordese
2a89374adf
Add escalation chain support for new webhooks (#1654)
Allow setting a webhook as escalation chain policy step.
2023-04-05 12:03:55 +00:00
Vadim Stepanov
ac57c8ee9f
Fix team search (#1680)
# What this PR does

Team search doesn't work when filtering by team:

<img width="331" alt="Screenshot 2023-03-30 at 15 48 50"
src="https://user-images.githubusercontent.com/20116910/228875971-0f55bdf8-6aa7-4759-9882-cdf7d11bb0c7.png">

This PR fixes it + adds backend unit 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-03-30 15:34:55 +00:00
Maxim Mordasov
061123e124
Allow changing team for escalation chains (#1658)
# What this PR does

Allows changing team for escalation chains

## 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: Ildar Iskhakov <ildar.iskhakov@grafana.com>
Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
2023-03-30 10:43:00 +01:00
Vadim Stepanov
a936c8c7fe
Improve schedule quality feature (#1602)
# What this PR does

Before:

<img width="281" alt="Screenshot 2023-03-23 at 16 56 42"
src="https://user-images.githubusercontent.com/20116910/227279464-c883ec05-a964-4360-bda2-3443409ca90a.png">

After:

<img width="338" alt="Screenshot 2023-03-23 at 16 57 41"
src="https://user-images.githubusercontent.com/20116910/227279476-468bffba-922a-45ea-b400-5f34d6bf0534.png">


- Add scores for overloaded users, e.g. `(+25% avg)` which means the
user is scheduled to be on-call 25% more than average for given
schedule.
- Add score for gaps, e.g. `Schedule has gaps (29% not covered)` which
means 29% of time no one is scheduled to be on-call.
- Make things easier to understand when there are gaps in the schedule,
add `(see overloaded users)` text.
- Consider events for next 52 weeks (~1 year) instead of 90 days (~3
months), so the quality report is more accurate. Also treat any balance
quality >95% as perfectly balanced. These two changes (period change and
adding 95% threshold) should help eliminate false positives for _most_
schedules.
- Modify backend & frontend so the backend returns all necessary user
information to render without using the user store.
- Move quality report generation to `OnCallSchedule` model, add more
tests.

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

## Checklist

- [x] Tests updated
- [x] `CHANGELOG.md` updated
(public docs will be added in a separate PR)
2023-03-27 11:03:16 +00:00
Ildar Iskhakov
cfcfa0336e
Add filters to outgoing webhooks 2 (#1598)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2023-03-23 09:52:59 +08:00
Ildar Iskhakov
cc2b4eeae2
Fix resource duplication caused by available_teams_lookup_args (#1593)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2023-03-22 15:43:32 +08:00
Ildar Iskhakov
d5079d9ffc
Add rbac to teams endpoint (#1592)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2023-03-22 15:25:30 +08:00
Ildar Iskhakov
d3c6621dae
Teams redesign (#1528)
# What this PR does

* api returns all the resources available to the user by default 
* substitutes `team switcher` with `multi-select team filter`
* allow referencing between integrations - escalations chains -
[schedules, outgoing webhooks] across teams



https://user-images.githubusercontent.com/2262529/225634581-2d2e8af2-15ce-4c01-a90e-8267d98f5a23.mov



## Which issue(s) this PR fixes

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated

---------

Co-authored-by: Maxim <maxim.mordasov@grafana.com>
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-03-22 00:57:20 +08:00
Matias Bordese
d40d3a62b8
Keep webhook responses data (#1580)
Track all webhook responses data, and allow using this between
alertgroup-related webhooks (e.g. use firing webhook response data when
templating the acknowledge webhook request data).

NOTE: dropping the table is not backwards compatible but the feature is
not enabled (and in any case it would drop log entries only used for
status display)
2023-03-21 13:43:37 +00:00
Innokentii Konstantinov
bfe06ac888
Add SLACK_INTEGRATION_MAINTENANCE env var (#1582)
# What this PR does
Add SLACK_INTEGRATION_MAINTENANCE env var to be able to disable slack
install/uninstall
2023-03-21 08:15:35 +00:00
Joey Orlando
7ea5b07704
change escalation chains searching to allow for partial searching (#1578)
# Which issue(s) this PR fixes

Previously if you had an Escalation Chain named "Something Critical" and
tried searching for "Critical", it would return no results. This was
because the backend was using a "starts-with" search on the `name`
attribute.

This PR changes that to use "partial searching" + adds a few e2e test
cases.

## Checklist

- [x] Tests updated
- [ ] Documentation added (N/A)
- [x] `CHANGELOG.md` updated
2023-03-20 15:51:39 +01:00
Vadim Stepanov
61b7c2ec48
Add alert group filter by escalation chain (#1535)
# What this PR does
Adds a new filter on alert groups page that allows to filter alert
groups by escalation chain.

<img width="1204" alt="Screenshot 2023-03-13 at 22 42 00"
src="https://user-images.githubusercontent.com/20116910/224848730-ef753856-a050-4acb-ba36-498d2bca2b4f.png">


## Which issue(s) this PR fixes
This should be useful on it's own as it's giving more filtering
capabilities, but it also could be useful for
https://github.com/grafana/oncall/issues/1300, if PD rulesets are
migrated to a single integration with multiple escalation chains.

## Checklist

- [x] Tests updated
- [x] `CHANGELOG.md` updated
2023-03-14 14:38:18 +00:00
Michael Derynck
e089e29b86
Enable new webhooks preview per org (#1534) 2023-03-14 14:31:47 +00:00
Matias Bordese
2db1a5a883
Add initial webhooks internal plugin API (#1524) 2023-03-10 17:00:06 +00:00
Matias Bordese
9709cfbc73
Add force option to delete web schedule shifts (#1519)
Related to #1505
Add force param to shift delete endpoint in plugin internal API.
2023-03-09 18:39:25 +00:00
Matias Bordese
ef66cab597
Fix involved users filter, add missing test (#1500)
Fixes https://github.com/grafana/oncall-private/issues/1673
2023-03-08 15:27:03 +00:00
Joey Orlando
7c8722e714
remove mobile app feature flag (#1484)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [x] Tests updated
- [ ] Documentation added (N/A)
- [x] `CHANGELOG.md` updated
2023-03-08 11:22:44 +01:00
Matias Bordese
f5fb5d34dc
Rework alert group mine filter query (#1466)
Rework query to make it more efficient.
2023-03-07 11:38:50 +00:00
Innokentii Konstantinov
7bad073626
Remove OSS_INSTALATION env var (#881)
It's a duplicate of LICENSE env var

**What this PR does**:
Remove OSS_INSTALLATION env var in favour of LICENSE env var. Also, I
refactored features tests a little. From my point of view it makes
little sense to test if all features are disabled or enabled. Better to
test specific use-case (e.g. oss installation).
Also to test that all features are disabled it is needed to set LICENSE
equals cloud license, which makes test confusing.

**Checklist**
- [x] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2023-03-07 11:07:42 +00:00
Innokentii Konstantinov
4b91203eca
Add validation of hostname for recapctha (#1445)
# What this PR does

- Implement recapthca v3 check. DRF_RECAPTCHA didn't support hostname
validation and it's too complicated to add it.
- Add validation of verification code on oncall side to not to call
twilio with obviously invalid codes

## Checklist

- [x] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2023-03-06 08:59:48 +00:00
Vadim Stepanov
8170ca491c
Fix pagination issue when searching schedules (#1437)
# What this PR does
Fixes a bug with inconsistent schedule count when searching by name.

Example (2 schedules returned, but count is incorrectly set to 12):

![image](https://user-images.githubusercontent.com/20116910/222198919-2f2124bc-52b2-4e5f-a949-79bbf89a5a26.png)

## Checklist

- [x] Tests updated
- [x] `CHANGELOG.md` updated
2023-03-01 16:28:40 +00:00
Vadim Stepanov
4c31ede558
Add "used in escalation" filter for schedules internal API (#1425)
# What this PR does
Adds a `used` filter on schedules endpoint for internal API.

Usage:
- `?used=true` returns schedules that are referenced by at least one
escalation policy
- `?used=false` returns schedules that are NOT referenced
- `?used=null` or not providing the query param at all will return all
schedules
## Which issue(s) this PR fixes
https://github.com/grafana/oncall/issues/1423

## Checklist

- [x] Tests updated
2023-03-01 10:09:07 +00:00
Innokentii Konstantinov
6a5e75e083
Fix of templates api behaviour for public and private api (#1408)
# What this PR does

This PR fixes templates behaviour for public and private api. It fix
"reset to default" for templates from messaging backends and some minor
bugs. Also added acknowledge signal and source link templates

## Checklist

- [x] Tests updated
- [x] Documentation added
- [x] `CHANGELOG.md` updated
2023-03-01 16:32:15 +08:00
Matias Bordese
98b3b918a5
Add schedule pagination to plugin API (#1309)
Related to #1289

---------

Co-authored-by: Yulia Shanyrova <yulia.shanyrova@grafana.com>
2023-02-24 14:59:03 +00:00
Joey Orlando
c55a9010f7
Add Google reCAPTCHA for mobile app phone verification (#1373)
# What this PR does

Adds reCAPTCHA validation to the get mobile verification code endpoint

## Which issue(s) this PR fixes

## Checklist

- [x] Tests updated
- [ ] Documentation added (N/A)
- [x] `CHANGELOG.md` updated

---------

Co-authored-by: Maxim <maxim.mordasov@grafana.com>
2023-02-21 20:17:06 +01:00
Innokentii Konstantinov
61fdcfdc72
Add ratelimit for phone number verification (#1354)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [x] Tests updated
- [x] `CHANGELOG.md` updated

---------

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-02-21 16:47:52 +08:00
Vadim Stepanov
507c9a5b92
Show direct paging integrations in list filter options (#1329)
# What this PR does
Changes the internal API to show direct paging integrations in list
filter options.

<img width="1203" alt="Screenshot 2023-02-15 at 16 27 31"
src="https://user-images.githubusercontent.com/20116910/219090234-d40d471c-ffcc-48e9-8799-e48f03681b72.png">

## Checklist

- [x] Tests updated
2023-02-16 11:38:45 +00:00
Matias Bordese
a121f84a89
Rework slack login to check backend before redirecting (#1306)
Also:
- Remove unused slack login views in `social_auth` app
- Disable unlink actions in the profile if user is not owner (otherwise
it will disconnect the logged in user, not the one being shown on
screen)
2023-02-08 09:08:18 -03:00