Commit graph

1711 commits

Author SHA1 Message Date
Jack Baldry
0fc43c5e26
Use organization ISSUE_COMMANDS_TOKEN with reduced scope (#1248)
The new token is set at an organization level so it does not require
repository administrators to rotate the token. It also has the minimal
classic PAT permissions to facilitate the workflow.

It has expiry but that expiry is reported via email to the engineering
organization and the IT Helpdesk have permissions to regenerate the
token when expiration is imminent.

Signed-off-by: Jack Baldry <jack.baldry@grafana.com>

Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-02-02 07:42:53 +01:00
Ildar Iskhakov
df1517573e
Cache web template rendered fields for alert and alertgroup endpoints (#1261)
# What this PR does
This PR adds same approach as introduced
[here](https://github.com/grafana/oncall/pull/1236) to all alert and
alertgroup endpoints

## Which issue(s) this PR fixes

## Checklist

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

---------

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-02-02 11:37:52 +08:00
Vadim Stepanov
b7176888ed
Better FCM error handling / retries (#1267)
# What this PR does
Raise `FirebaseError` in celery tasks contacting FCM instead of just
logging it + add tests

## Checklist

- [x] Tests updated
2023-02-01 14:45:32 +00:00
Matias Bordese
3e15b8cd85
Add default slack channel info to direct paging dialog (#1263) 2023-02-01 10:03:54 -03:00
Joey Orlando
16196822de
Add utility function to get readonly db key if defined (#1264)
# What this PR does

This is a minor refactor before implementing
https://github.com/grafana/oncall-private/issues/1558.

Additionally, it cleans up a few spots where we do this:
```
# Re-take in case we are in the readonly db context.
```
We currently don't read anything from a read-only database, so this
should be not necessary.

## Checklist

- [x] Tests updated
- [ ] Documentation added (N/A)
- [ ] `CHANGELOG.md` updated (N/A)
2023-02-01 12:07:32 +01:00
Joey Orlando
94fe7979cf
add django-dbconn-retry library (#1262) 2023-01-31 20:17:54 +01:00
Maxim Mordasov
f0a34ffd1f
Add cache for working moments (#1048)
# What this PR does

## Which issue(s) this PR fixes

Add cache to avoid heavy calculations to render working hours shades

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2023-01-31 20:00:14 +03:00
Joey Orlando
1a8cff8c6c
update vault secret reference (#1252)
See https://github.com/grafana/oncall-private/pull/1612 for more
context.
2023-01-31 09:40:32 +01:00
Joey Orlando
3ce2173eff
tag @grafana/docs-oncall instead of oncall-backend for docs related changes (#1251)
Adding in reference to #1239.

@grafana/docs-oncall should be tagged as a PR reviewer for changes to
`/docs` rahter than @grafana/grafana-oncall-backend.
2023-01-31 09:34:29 +01:00
Joey Orlando
7420e11b4f
update CHANGELOG for new release 2023-01-30 14:11:42 +01:00
Maxim Mordasov
8ba2a77b53
Add event stop propagation for react router links (#1208)
# What this PR does

Add stopPropagation for PluginLinks, fixes plugin crash if no start and end present in some working days

## Which issue(s) this PR fixes

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

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2023-01-30 15:57:20 +03:00
Matias Bordese
b1fc123d9f
Add a filter by involved users to alert groups page (#1240)
Related to #1119 

It also adds a shortcut to filter current user's related alert groups
(alert groups user was notified by, or in which user participated). Make
the filter visible by default, with a false value.
2023-01-30 14:08:18 +02:00
Alyssa Wada
2b2a837991
Add oncall slack commands to docs (#994)
# What this PR does
Adds instruction for Slack commands and message shortcuts to OnCall
docs.

## Which issue(s) this PR fixes
Issue #190

---------

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
Co-authored-by: Joey Orlando <joseph.t.orlando@gmail.com>
Co-authored-by: Matvey Kukuy <Matvey-Kuk@users.noreply.github.com>
2023-01-30 13:56:30 +02:00
Vadim Stepanov
f80271a1f4
Return alert group ID in direct paging API (#1241)
# What this PR does
Make direct paging internal API endpoint return an alert group ID.

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

## Checklist

- [x] Tests updated
2023-01-30 11:48:25 +00:00
Joey Orlando
8609f415b3
don't tag oncall-backend when CHANGELOG is updated (#1250)
# What this PR does

There is no need to add `@grafana/grafana-oncall-backend` as a PR
reviewer when `CHANGELOG.md` is updated

## Which issue(s) this PR fixes

## Checklist

- [ ] Tests updated (N/A)
- [ ] Documentation added (N/A)
- [ ] `CHANGELOG.md` updated (N/A)
2023-01-30 12:36:21 +01:00
Vadim Stepanov
4aa1feae06
Add Android app link on mobile app connection tab (#1238)
Add the Android app URL to the mobile app connection tab

---------

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-01-30 12:15:17 +01:00
dependabot[bot]
32db4a1b7d
Bump simple-git from 3.15.0 to 3.16.0 in /grafana-plugin (#1233)
Bumps
[simple-git](https://github.com/steveukx/git-js/tree/HEAD/simple-git)
from 3.15.0 to 3.16.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/steveukx/git-js/releases">simple-git's
releases</a>.</em></p>
<blockquote>
<h2>simple-git@3.16.0</h2>
<h3>Minor Changes</h3>
<ul>
<li>97fde2c: Support the use of <code>-B</code> in place of the default
<code>-b</code> in checkout methods</li>
<li>0a623e5: Adds vulnerability detection to prevent use of
<code>--upload-pack</code> and <code>--receive-pack</code> without
explicitly opting in.</li>
</ul>
<h3>Patch Changes</h3>
<ul>
<li>ec97a39: Include restricting the use of git push --exec with other
allowUnsafePack exclusions, thanks to <a
href="https://github.com/stsewd"><code>@​stsewd</code></a> for the
suggestion.</li>
</ul>
<h2>simple-git@3.15.1</h2>
<h3>Patch Changes</h3>
<ul>
<li>de570ac: Resolves an issue whereby non-strings can be passed into
the config switch detector.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/steveukx/git-js/blob/main/simple-git/CHANGELOG.md">simple-git's
changelog</a>.</em></p>
<blockquote>
<h2>3.16.0</h2>
<h3>Minor Changes</h3>
<ul>
<li>97fde2c: Support the use of <code>-B</code> in place of the default
<code>-b</code> in checkout methods</li>
<li>0a623e5: Adds vulnerability detection to prevent use of
<code>--upload-pack</code> and <code>--receive-pack</code> without
explicitly opting in.</li>
</ul>
<h3>Patch Changes</h3>
<ul>
<li>ec97a39: Include restricting the use of git push --exec with other
allowUnsafePack exclusions, thanks to <a
href="https://github.com/stsewd"><code>@​stsewd</code></a> for the
suggestion.</li>
</ul>
<h2>3.15.1</h2>
<h3>Patch Changes</h3>
<ul>
<li>de570ac: Resolves an issue whereby non-strings can be passed into
the config switch detector.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="1a129523ab"><code>1a12952</code></a>
Version Packages</li>
<li><a
href="ec97a39ab6"><code>ec97a39</code></a>
Block unsafe pack (push --exec) (<a
href="https://github.com/steveukx/git-js/tree/HEAD/simple-git/issues/882">#882</a>)</li>
<li><a
href="0a623e53fd"><code>0a623e5</code></a>
Feat/unsafe pack (<a
href="https://github.com/steveukx/git-js/tree/HEAD/simple-git/issues/881">#881</a>)</li>
<li><a
href="97fde2c44f"><code>97fde2c</code></a>
Add support for using the <code>-B</code> modifier instead of the
default <code>-b</code> when usin...</li>
<li><a
href="edfd459519"><code>edfd459</code></a>
Update readme.md</li>
<li><a
href="c9fc61f4ab"><code>c9fc61f</code></a>
Version Packages</li>
<li><a
href="de570acd05"><code>de570ac</code></a>
Fix/non strings (<a
href="https://github.com/steveukx/git-js/tree/HEAD/simple-git/issues/867">#867</a>)</li>
<li>See full diff in <a
href="https://github.com/steveukx/git-js/commits/simple-git@3.16.0/simple-git">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=simple-git&package-manager=npm_and_yarn&previous-version=3.15.0&new-version=3.16.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the
default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as
the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as
the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the
default for future PRs for this repo and language

You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/grafana/oncall/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-01-30 11:51:34 +01:00
Joey Orlando
1eb9658541
fix failing lint github actions job due to issue w/ isort version (#1249)
# What this PR does

## Which issue(s) this PR fixes

`lint` github action jobs on all builds are failing right now
([example](https://github.com/grafana/oncall/actions/runs/4042567074/jobs/6950923821#step:6:16))
because of [this issue](https://github.com/PyCQA/isort/issues/2077) with
`isort`

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2023-01-30 11:43:15 +01:00
Maxim Mordasov
9421ae25be
Add Server URL below QR code for OSS for debugging purposes (#1209)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

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

---------

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
Co-authored-by: Joey Orlando <joseph.t.orlando@gmail.com>
Co-authored-by: teodosii <rares.mardare@grafana.com>
2023-01-30 13:34:35 +03:00
Joey Orlando
63e91f896b
[RBAC] - minor UI bug fixes (#1185)
# What this PR does

- remove hardcoded references to "Admin" and "Editor". Instead, use the
`determineRequiredAuthString` and `generateMissingPermissionMessage`
methods from `utils/authorization` which conditionally show the
permission or role depending on whether RBAC is enabled or not
- fix bug on list users page that always showed "Loading...".
![Screenshot 2023-01-21 at 09 29
35](https://user-images.githubusercontent.com/9406895/213859785-e9852838-5671-4275-aaed-4df75446ab6a.png)
- only show users the user's table if they are allowed, otherwise show
them this
  - RBAC enabled
![Screenshot 2023-01-26 at 09 09
57](https://user-images.githubusercontent.com/9406895/214786723-3389ce9c-7353-4216-9176-6547f2076660.png)
  - RBAC disabled
![Screenshot 2023-01-26 at 09 05
30](https://user-images.githubusercontent.com/9406895/214786739-eb9ee108-e79c-4105-912a-8bb5bf03cb32.png)
- `Schedules Editor` role minor issue
- Viewers are not allowed to list users by default, so granting schedule
edit permission to them won’t allow them to see who rotations are
assigned to or assign a rotation to a user. To make this a more
straightforward user experience, instead of saying "No options found",
we will tell the user that they are missing a particular role/permission
to view these users:
    Before:
![Screenshot 2023-01-23 at 09 52
28](https://user-images.githubusercontent.com/9406895/213999896-d889540e-2835-4133-965a-306923a3e33b.png)
    After:
![Screenshot 2023-01-26 at 12 39
30](https://user-images.githubusercontent.com/9406895/214827179-d127002f-793e-4ab7-ad75-dfab653b7d7d.png)


## Which issue(s) this PR fixes

- closes #971 

## Checklist

- [x] Tests updated
- [ ] Documentation added (N/A)
- [x] `CHANGELOG.md` updated
2023-01-30 11:23:02 +01:00
Ildar Iskhakov
a47fc7048e
Delete release.yml 2023-01-30 11:10:10 +08:00
Ildar Iskhakov
6640a4092b
Create release.yml 2023-01-29 19:25:57 +08:00
Ildar Iskhakov
ae44ee5652
Cache render_for_web field for alertgroups list serializer (#1236)
# What this PR does
This PR caches the field `render_for_web` with lifetime 1 day and cache
becomes invalid if it was created before
* last alert received
* template changed


## Which issue(s) this PR fixes

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2023-01-28 12:50:41 +08:00
Matias Bordese
e0ae9919c7
Add paging for direct paging users in slack dialog (#1232)
Fixes issue when there are more than 100 users to be listed in the
direct pagination responders select. Alternatively we should consider
moving to an `external_select` block later.
2023-01-27 14:10:44 -03:00
Maxim Mordasov
96f9de6299
fix NPE in schedule user details (#1230)
# What this PR does

Fix NPE 

## Which issue(s) this PR fixes

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

## Checklist

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

---------

Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
2023-01-27 14:40:41 +00:00
Alyssa Wada
6456e78ba6
Fix format issues introduced by markdown linter (#1223)
# What this PR does
Restore proper formatting to lists in schedule docs introduced by PR
#1202

## Checklist

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

Co-authored-by: Joey Orlando <joseph.t.orlando@gmail.com>
2023-01-26 13:59:48 +00:00
Ildar Iskhakov
4a8011d236
Add silk setting to store .prof files in the specific folder and share it between uwsgi workers (#1228)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2023-01-26 20:33:04 +08:00
Jack Baldry
1c0144c0b7
Fix typo in snyk workflow file name (#1225)
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>

Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
2023-01-26 11:44:06 +01:00
Ildar Iskhakov
a6a781320d
Set SILKY_PYTHON_PROFILER_BINARY setting to False by default (#1218)
# What this PR does
Here is the example of the visualisation with `snakeviz`
<img width="1126" alt="Screenshot 2023-01-25 at 22 15 49"
src="https://user-images.githubusercontent.com/2262529/214586753-ad49a002-27e1-4e44-82f2-4ad5f4e40101.png">


## Which issue(s) this PR fixes

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2023-01-25 22:17:17 +08:00
Matias Bordese
dd27b3f2c5
Add schedules support for slack direct paging (#1183)
Related to #823
2023-01-25 09:10:50 -03:00
Ildar Iskhakov
d8a0f8330b
Update CHANGELOG.md 2023-01-25 18:34:25 +08:00
Joey Orlando
3cf2fcf660
optimize GET /schedules internal API endpoint (#1169)
# What this PR does

Fixes slow internal`GET /schedules` endpoints. Using the fake-data
generation script in #1128, I generated 65 calendar schedules in my
local setup. This resulted in the following endpoint performance:
![Screenshot 2023-01-24 at 12 03
16](https://user-images.githubusercontent.com/9406895/214276618-1a9848ba-eb84-49ec-a099-fdd96beac93f.png)

The responses which show ~76 queries were run on the latest `dev`
branch. Responses w/ ~26 queries were run on this branch.

Additionally:
- add typing to a few methods in `apps/schedules/ical_utils.py`
- document `apps/api/permissions/__init__.py:user_is_authorized`
function

## Which issue(s) this PR fixes

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

## Checklist

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

Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
2023-01-25 11:08:09 +01:00
Yulya Artyukhina
de5d876d27
Refactor create/update contact points for Alerting integration (#872)
**What this PR does**:
- Keep grafana version on create/update contact points to avoid multiple
requests to alerting
- Add retry limit on create contact point async
- Fix bugs related on create contact point
- Update logs on create/update contact point, make them more clear
- Avoid unnecessary requests to Grafana Alerting
2023-01-25 09:42:42 +01:00
dependabot[bot]
b61a98c5b1
Bump ua-parser-js from 1.0.32 to 1.0.33 in /grafana-plugin (#1210)
Bumps [ua-parser-js](https://github.com/faisalman/ua-parser-js) from
1.0.32 to 1.0.33.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/faisalman/ua-parser-js/blob/master/changelog.md">ua-parser-js's
changelog</a>.</em></p>
<blockquote>
<h2>Version 0.7.32 / 1.0.32</h2>
<ul>
<li>Add new browser : DuckDuckGo, Huawei Browser, LinkedIn</li>
<li>Add new OS : HarmonyOS</li>
<li>Add some Huawei models</li>
<li>Add Sharp Aquos TV</li>
<li>Improve detection Xiaomi Mi CC9</li>
<li>Fix Sony Xperia 1 III misidentified as Acer tablet</li>
<li>Fix Detect Sony BRAVIA as SmartTV</li>
<li>Fix Detect Xiaomi Mi TV as SmartTV</li>
<li>Fix Detect Galaxy Tab S8 as tablet</li>
<li>Fix WeGame mistakenly identified as WeChat</li>
<li>Fix included commas in Safari / Mobile Safari version</li>
<li>Increase UA_MAX_LENGTH to 350</li>
</ul>
<h2>Version 0.7.33 / 1.0.33</h2>
<ul>
<li>Add new browser : Cobalt</li>
<li>Identify Macintosh as an Apple device</li>
<li>Fix ReDoS vulnerability</li>
</ul>
<h1>Version 0.8</h1>
<p>Version 0.8 was created by accident. This version is now deprecated
and no longer maintained, please update to version 0.7 / 1.0.</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="67005e3494"><code>67005e3</code></a>
Update patch version to 1.0.33 as a mirror of 0.7.33</li>
<li><a
href="f2d0db001d"><code>f2d0db0</code></a>
Bump version 0.7.33</li>
<li><a
href="a6140a17dd"><code>a6140a1</code></a>
Remove unsafe regex in trim() function</li>
<li><a
href="a886604935"><code>a886604</code></a>
Fix <a
href="https://github-redirect.dependabot.com/faisalman/ua-parser-js/issues/605">#605</a>
- Identify Macintosh as Apple device</li>
<li><a
href="b814bcd791"><code>b814bcd</code></a>
Merge pull request <a
href="https://github-redirect.dependabot.com/faisalman/ua-parser-js/issues/606">#606</a>
from rileyjshaw/patch-1</li>
<li><a
href="7f71024161"><code>7f71024</code></a>
Fix documentation</li>
<li><a
href="c239ac5167"><code>c239ac5</code></a>
Merge pull request <a
href="https://github-redirect.dependabot.com/faisalman/ua-parser-js/issues/604">#604</a>
from obecerra3/master</li>
<li><a
href="8d3c2d327c"><code>8d3c2d3</code></a>
Add new browser: Cobalt</li>
<li>See full diff in <a
href="https://github.com/faisalman/ua-parser-js/compare/1.0.32...1.0.33">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=ua-parser-js&package-manager=npm_and_yarn&previous-version=1.0.32&new-version=1.0.33)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the
default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as
the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as
the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the
default for future PRs for this repo and language

You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/grafana/oncall/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-01-25 08:37:30 +01:00
Ildar Iskhakov
e5d2d8e727
Update CHANGELOG.md 2023-01-25 12:02:06 +08:00
Ildar Iskhakov
1fc3f6d301
Refactor plugin sync (#1200)
# What this PR does

This PR adds a shortcut in the plugin synchronisation process, so the
existing users will be able login without waiting for the sync task.
Every request still starts the background synchronisation task, to be
able to propagate the organisation changes faster than periodic task. It
means that we don't necessarily need "force reload" button in the
interface.
For all the other cases (user does not exist, organisation token "not
ok", etc) process remains same - plugin will show "Initialising
plugin..." until the background task in successfully completed

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-01-25 09:12:08 +08:00
Vadim Stepanov
cf1a1cd7f3
Remove DynamicSetting usage for mobile app backend on OSS (#1204)
# What this PR does
Make so there's no need to populate `mobile_app_settings` DynamicSetting
when using the OSS license to turn on the mobile app backend.
2023-01-24 13:53:54 +00:00
Joey Orlando
3bc593cdb2
When removing Slack ChatOps integration, warn the user of the implications (#1192)
# What this PR does
- When removing Slack ChatOps integration, warn the user of the
implications of doing so + make them confirm the deletion by having to
type `DELETE`:
![Screenshot 2023-01-23 at 15 01
27](https://user-images.githubusercontent.com/9406895/214060105-1af61170-3141-488c-8977-2809edb04faa.png)
- remove
`grafana-plugin/src/containers/SlackIntegrationButton/SlackIntegrationButton.tsx`
component as it is not referenced anywhere + remove
`grafana-plugin/src/img/slack_workspace_choose_attention.png` as this
was only referenced in `SlackIntegrationButton.tsx`

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

## Checklist

- [ ] Tests updated (N/A)
- [ ] Documentation added (N/A)
- [x] `CHANGELOG.md` updated
2023-01-24 11:21:11 +01:00
Ildar Iskhakov
46b39b2c87
Remove resolved and acknowledged filters as we switched to status (#1201)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2023-01-24 18:13:21 +08:00
Ildar Iskhakov
615a2e8333
Fix markdown formatting in docs (#1202)
# What this PR does

This PR adds `--fix` flag to `markdownlint` pre-commit command and fixes
existing formatting to comply with markdown formatting rules.

## Which issue(s) this PR fixes

## Checklist

- [ ] Tests updated
- [x] Documentation added
- [ ] `CHANGELOG.md` updated
2023-01-24 10:58:38 +01:00
Michael Derynck
e5643fee0a
Add check for MANIFEST.txt after signing (#1198)
Add a check in drone so build fails if plugin is not successfully
signed.

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-01-24 07:51:37 +01:00
Innokentii Konstantinov
cfa7fb816c
Sync users and teams on tf requests (#1180)
# What this PR does
This PR add sync with grafana on requests from terraform 

## Which issue(s) this PR fixes
It's needed to fix case when customers want to create team via grafana
terraform provider and use it in the oncall provider without having to
log into Grafana Cloud.

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-01-24 13:44:07 +08:00
Alyssa Wada
fd75a3e4ad
oncall schedule doc updates v1 (#1197)
This is a first iteration to establish initial on-call schedule doc improvements. Additional docs and content improvements in progress. 

# What this PR does
Updates OnCall docs TOC to provide better on-call schedule documentation
Updates _index.md to describe all on-call schedule options with Grafana
OnCall
Adds web-based schedule guidance to oncall docs
- About web-based schedules
- Create on-call schedule in Grafana OnCall
- Export on-call schedules

## Which issue(s) this PR fixes
Issue #935 
Issue #1078
2023-01-23 14:44:28 -07:00
Vadim Stepanov
ae5949aa7e
Allow viewers fetch cloud connection status (#1181)
# What this PR does
Fixes the issue when users with the viewer role can't fetch the cloud
connection status, which makes the plugin fail to load for viewers. This
PR makes the cloud connection endpoint use `OTHER_SETTINGS_READ` for
fetching the cloud connection status instead of `OTHER_SETTINGS_WRITE`.

## Checklist

- [x] Tests updated
- [x] `CHANGELOG.md` updated
2023-01-23 11:17:57 +00:00
Ildar Iskhakov
37d25b5b31
Optimize alert group filtering queries (#1191)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2023-01-23 16:07:55 +08:00
Dan Cech
639fd81644
Update message when user needs to connect their profile (#1190)
# What this PR does

This just tweaks the message users get when they try to interact via
slack but haven't connected their profile, it fixes a typo and
streamlines the text.
2023-01-23 08:44:33 +01:00
Ildar Iskhakov
b90fe433c9
Optimize alertgroups endpoint (#1189)
# What this PR does

Changing query to retrieve alert group in two completely different
queries instead of one with `join`

new queries
```
SELECT alerts_alertreceivechannel.id
FROM alerts_alertreceivechannel
WHERE (alerts_alertreceivechannel.deleted_at IS NULL
       AND alerts_alertreceivechannel.organization_id = 8
       AND alerts_alertreceivechannel.team_id IS NULL)


SELECT `alerts_alertgroup`.`id`
FROM `alerts_alertgroup`
WHERE (`alerts_alertgroup`.`channel_id` IN (2,33,34,35,36,40,52,59,61,62,63,70,76,89,93,94,03,08,09,10,12,13,16,18,20,22,23,24,26,27,28,30,31,33,34,35,36,40,41,42,43,45,48,53,56,57,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,86,87,88,89,91,93,23,27,29,31,32,33,55,56,57,58,65,69,72,75,81,13,17,20,22,33,34,38,39,41,44,45,46,51,52,55,56,58,59,60,63,68,70,71)
       AND NOT `alerts_alertgroup`.`is_archived`
       AND NOT `alerts_alertgroup`.`is_archived`
       AND `alerts_alertgroup`.`root_alert_group_id` IS NULL
       AND ((NOT `alerts_alertgroup`.`silenced`
             AND NOT `alerts_alertgroup`.`acknowledged`
             AND NOT `alerts_alertgroup`.`resolved`)
            OR (`alerts_alertgroup`.`acknowledged`
                AND NOT `alerts_alertgroup`.`resolved`))
       AND NOT `alerts_alertgroup`.`is_archived`)
ORDER BY `alerts_alertgroup`.`id` DESC
LIMIT 26
```

## Which issue(s) this PR fixes

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2023-01-22 00:53:11 +08:00
Ildar Iskhakov
c9b83906a0
Optimize alertgroups endpoint (#1188)
# What this PR does

Changing query to retrieve alert group in two requests instead of one
with `join`

old query:
```
SELECT `alerts_alertgroup`.`id`
FROM `alerts_alertgroup`
INNER JOIN `alerts_alertreceivechannel` ON (`alerts_alertgroup`.`channel_id` = `alerts_alertreceivechannel`.`id`)
WHERE (`alerts_alertreceivechannel`.`organization_id` = 1
       AND `alerts_alertreceivechannel`.`team_id` IS NULL
       AND NOT `alerts_alertgroup`.`is_archived`
       AND NOT `alerts_alertgroup`.`is_archived`
       AND `alerts_alertgroup`.`root_alert_group_id` IS NULL
       AND ((NOT `alerts_alertgroup`.`silenced`
             AND NOT `alerts_alertgroup`.`acknowledged`
             AND NOT `alerts_alertgroup`.`resolved`)
            OR (`alerts_alertgroup`.`acknowledged`
                AND NOT `alerts_alertgroup`.`resolved`))
       AND NOT `alerts_alertgroup`.`is_archived`)
ORDER BY `alerts_alertgroup`.`id` DESC
LIMIT 26
```

new query:
```
SELECT "alerts_alertgroup"."id"
FROM "alerts_alertgroup"
WHERE ("alerts_alertgroup"."channel_id" IN
         (SELECT U0."id"
          FROM "alerts_alertreceivechannel" U0
          WHERE (NOT (U0."integration" = maintenance)
                 AND U0."deleted_at" IS NULL
                 AND U0."organization_id" = 1
                 AND U0."team_id" IS NULL))
       AND NOT "alerts_alertgroup"."is_archived"
       AND NOT "alerts_alertgroup"."is_archived"
       AND "alerts_alertgroup"."root_alert_group_id" IS NULL
       AND ((NOT "alerts_alertgroup"."silenced"
             AND NOT "alerts_alertgroup"."acknowledged"
             AND NOT "alerts_alertgroup"."resolved")
            OR ("alerts_alertgroup"."acknowledged"
                AND NOT "alerts_alertgroup"."resolved"))
       AND NOT "alerts_alertgroup"."is_archived")
ORDER BY "alerts_alertgroup"."id" DESC
LIMIT 26
```


## Which issue(s) this PR fixes

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2023-01-22 00:14:48 +08:00
Ildar Iskhakov
83b1f069d0
Optimize alertgroups endpoint (#1186)
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2023-01-21 21:59:20 +08:00
Joey Orlando
5ef8b8c345
remove duplicate call in UI to GET /alert_receive_channels (#1179)
# What this PR does

Related to [this PR
comment](https://github.com/grafana/oncall/pull/1164#discussion_r1082337697)
from @maskin25
 
## Which issue(s) this PR fixes

**Before**
![Screenshot 2023-01-20 at 14 24
07](https://user-images.githubusercontent.com/9406895/213706172-1f219346-7e88-4e10-b2f3-c37590ecb43d.png)

**After**
![Screenshot 2023-01-20 at 14 26
05](https://user-images.githubusercontent.com/9406895/213706194-d95fc5f0-1494-4efc-ae92-31f1771ec490.png)


## Checklist

- [ ] Tests updated (N/A)
- [ ] Documentation added (N/A)
- [x] `CHANGELOG.md` updated
2023-01-20 15:23:17 +01:00