Commit graph

113 commits

Author SHA1 Message Date
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
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
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
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
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
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
Matias Bordese
693b5a41c4
Add slack command to trigger direct paging (#1154)
Slash command needs to be added to slack app manifest:

```
  slash_commands:
    - command: /escalate
      url: https://<oncall-public-url>/slack/interactive_api_endpoint/
      description: Create a new alert group escalation
      should_escape: false
```
2023-01-20 09:06:27 -03:00
Vadim Stepanov
8e0438ddc8
Update CHANGELOG.md 2023-01-18 17:37:33 +00:00
Vadim Stepanov
c93ee5c554
Send a Slack DM when user is not in channel (#1144)
# What this PR does

Currently, when a user gets mentioned in an alert group thread and the
user is not in the Slack channel, the Slack bot sends the following to
the channel:

> ⚠️ Tried to ask USER to look at incident. Unfortunately USER is
not in this channel. Please, invite.

This PR changes this behaviour to instead send a direct message to the
user. The message contains a link to the main alert group message in
Slack.

<img width="806" alt="Screenshot 2023-01-17 at 19 25 36"
src="https://user-images.githubusercontent.com/20116910/212996457-02db183f-2041-4998-b743-bd5b6c84b7b5.png">


## Checklist

- [ ] Tests updated (N/A)
- [ ] Documentation added (N/A)
- [x] `CHANGELOG.md` updated
2023-01-18 16:08:15 +00:00
Vadim Stepanov
b8d78fd6bb
Allow messaging backends to be enabled/disabled per organization (#1151)
# What this PR does
Allows messaging backends to be enabled/disabled per organization when
getting a list of available personal notification channels.

## Checklist

- [x] Tests updated
- [ ] Documentation added (N/A)
- [x] `CHANGELOG.md` updated
2023-01-18 15:52:25 +00:00
Yulya Artyukhina
1c799f7265
Update CHANGELOG.md (#1150)
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-01-18 15:50:23 +01:00
Tommy
5bd8fbdef8
Add alert groups state filter (#1133)
# What this PR does
This PR added a new parameter (state) into the alert_group public API to
filter the state of the alert groups

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

## Checklist

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

Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
2023-01-17 10:28:29 +00:00
Innokentii Konstantinov
1b0ad667d2 Update changelog.md 2023-01-12 17:49:56 +08:00
Tom Mitchell
ccbe8259c9
correct values file stub for slack commandName (#1093)
# What this PR does

The templates actually generate the SLACK_SLASH_COMMAND_NAME envvar from
`.Values.oncall.slack.commandName`, not `command`. This commit changes
the default values file to reflect this.

## Which issue(s) this PR fixes

#1092 

## Checklist

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

^ Are these applicable with regards to updating the helm chart, not the
core application? I did take the time to test both the default and
changed value after this change in a kubernetes deployment.

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-01-12 08:03:33 +01:00
Joey Orlando
babacf4da8
refactor the is_rbac_permissions_enabled check to be more robust (#1099)
# What this PR does
Checks the `is_rbac_permissions_enabled` flag differently based on
whether we are dealing with an open-source, or cloud installation:
- for open-source installations, simply continue making a `HEAD` request
to the list RBAC permissions Grafana API endpoint.
- for cloud installations, use the `config` object returned from `GET
/instances/{instance_id}?config=true` and check whether
`instance_info["config"]["feature_toggles"]["accessControlOnCall"] ==
"true"`

## Which issue(s) this PR fixes
Resolves the issue in hosted grafana where when a stack is inactive, the
hosted grafana gateway, returns 200 to the `HEAD` request (which
erroneously sets the `is_rbac_permissions_enabled` flag to `true`)

## Checklist

- [x] Tests updated (N/A)
- [ ] Documentation added
- [x] `CHANGELOG.md` updated
2023-01-11 12:48:30 +01:00
Rares Mardare
2ac4d88e88
v1.1.15 CHANGELOG (#1116)
# What this PR does

`v1.1.15`
2023-01-10 10:37:52 +02:00
Joey Orlando
923bee1f8f
update changelog (#1091) 2023-01-05 17:58:40 +01:00
Innokentii Konstantinov
bf9e5c0ad7 Update Changelog 2023-01-05 13:39:23 +08:00
Vadim Stepanov
0d4701bd81
Change wording from "incident" to "alert group" in the Telegram app (#1052)
# What this PR does
Makes Telegram integration consistent with the rest of the system so it
uses the word "alert group" instead of "incident" when referring to
alert groups.

## Checklist

- [x] Tests updated
- [ ] Documentation added (N/A)
- [x] `CHANGELOG.md` updated
2023-01-04 17:44:01 +00:00
Ildar Iskhakov
01f3e19e02
Update CHANGELOG.md 2023-01-04 10:11:33 +08:00
Ildar Iskhakov
0e54a9f253
Update CHANGELOG.md 2023-01-04 10:02:29 +08:00
Ildar Iskhakov
89144692d3
Update CHANGELOG.md 2023-01-04 09:09:51 +08:00
Michael Derynck
cc31af20dc
Update CHANGELOG.md 2023-01-03 14:07:32 -07:00
Ildar Iskhakov
da51edefcc
Update CHANGELOG.md 2023-01-03 21:50:53 +08:00
Ildar Iskhakov
4a32b21c46
Update CHANGELOG.md 2023-01-03 21:09:00 +08:00
Ildar Iskhakov
d778710469
Update CHANGELOG.md 2023-01-03 21:07:36 +08:00
Ildar Iskhakov
100a18ab1c
Update CHANGELOG.md 2023-01-03 19:46:12 +08:00
Juris Pavļučenkovs
327b7121ac
Helm: define engine update strategy in values.yaml (#985)
# What this PR does

Now it is possible to change engine deployment update strategy in
values.yaml.
## Which issue(s) this PR fixes

This is due to #334 and #316, as with rolling update, race conditions
might happen when there is still an old engine pod running.

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2022-12-20 13:59:19 +01:00
Joey Orlando
ed4be171f6
add make command to configure mobile app feature (#988)
Adds a make command, `enable-mobile-app-feature-flags`, which sets the
backend feature flag in `./dev/.env.dev`, and updates a record in the
`base_dynamicsetting` database table, which are needed to enable the
mobile app backend features.
2022-12-14 09:36:35 +01:00
Matias Bordese
2b763f376e
Update CHANGELOG.md 2022-12-13 10:18:18 -03:00
Matias Bordese
684375a3eb
Update CHANGELOG.md 2022-12-13 10:16:59 -03:00
Joey Orlando
5967d5af63
remove apns + fix django-push-notifications migrations (#984)
- removes APNS support
- changes the `django-push-notification` library from the `iskhakov`
fork to the [`grafana`
fork](https://github.com/grafana/django-push-notifications). This new
fork basically just patches an issue which affected the database
migrations of this django app (previously the library would not respect
the `USER_MODEL` setting when creating its tables and would instead
reference the `auth_user` table.. which we don't want)
- add `--no-cache` flag to the `make build` command

**NOTE**
A migration should be applied as follows:
```bash
# remove the four push_notifications tables, which have improper foreign key references
python manage.py migrate push_notifications zero

# recreate the tables with the proper foreign key references
python manage.py migrate
```
2022-12-13 13:00:59 +01:00
Matias Bordese
5036d719d7
Update CHANGELOG.md 2022-12-09 15:16:33 -03:00
Joey Orlando
635168afb9
hide mobile app verification tab in the user settings modal for unauthed users (#970) 2022-12-09 12:53:20 +01:00
Erikas Truskauskas
c1307a44d7
Make job-migrate ttlSecondsAfterFinished customizable (#957)
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2022-12-07 09:10:10 +01:00
Joey Orlando
ffda80ae34
add permalinks.web attribute to alert group internal/public api response (#953) 2022-12-06 11:06:05 +01:00
Joey Orlando
427dd4b5f7
helm chart v1.0.13 - update appVersion to v1.1.5 + change image.pullPolicy to "Always" (#937) 2022-12-02 13:27:37 +01:00
Joey Orlando
c08eeb72a3
add precommit rules for markdown/json files (#915)
* add markdownlint precommit steps + fix existing errors

* prettier json linting
2022-12-01 14:26:54 +01:00
Joey Orlando
9a7b8acd5a
centralize timezone validation + add serializer validation for on call shifts and schedules (#924)
* Centralize timezone validation into one spot + add serializer validation
for schedules and oncall shifts (both public and internal API)

* add engine-manage make command
2022-12-01 14:13:39 +01:00
Joey Orlando
9e598385f4
Add RBAC Support (#777)
* Modify plugin.json to support RBAC role registration

* defines 26 new custom roles in plugin.json. The main roles are:

- Admin: read/write access to everything in OnCall
- Reader: read access to everything in OnCall
- OnCaller : read access to everything in OnCall + edit access to Alert Groups and Schedules
- <object-type> Editor: read/write access to everything related to <object-type>
- <object-type> Reader: read access for <object-type>
- User Settings Admin: read/write access to all user's settings, not just own settings. This is in comparison to User Settings Editor which can only read/write own settings

* update changelog and documentation (#686)

* implement RBAC for OnCall backend

This commit refactors backend authorization. It trys to use RBAC authorization if the org's grafana instance supports it, otherwise it falls back to basic role authorization.

* update RBAC backend tests

* add tests for RBAC changes
- run backend tests as matrix where RBAC is enabled/disabled. When RBAC is enabled, the permissions granted are read from the role grants in the frontend's plugin.json file (instead of relying what we specify in RBACPermission.Permissions)
- remove --reuse-db --nomigrations flags from engine/tox.ini
- minor autoformatting changes to docker-compose-developer.yml

* remove --ds=settings.ci-test from pytest CI command

DJANGO_SETTINGS_MODULE is already specified as an env var so this is just unecessary duplication

* update gitignore

* update github action job name for "test"

* RBAC frontend changes

* refactors the use of basic roles (ex. Viewer, Editor, Admin) use RBAC permissions (when supported), or falling back to basic roles when RBAC is not supported.

- updates the UserAction enum in grafana-plugin/src/state/userAction.ts. Previously this was hardcoded to a list of strings that were being returned by the OnCall API. Now the values here correspond to the permissions in plugin.json (plus a fallback role)

* changes per Gabriel's comments:
- get rid of group attribute in rbac roles
- remove displayName role attribute
- remove hidden role attribute
- add back role to includes section

* don't try to update user timezone if they don't have permission
2022-11-29 09:41:56 +01:00
Joey Orlando
eb97797d43
Merge pull request #880 from grafana/jorlando/mobile-app-qr-code
Fetch/Display Mobile App QR Code
2022-11-28 18:54:05 +01:00
Joey Orlando
5a4fc90fa4
fetch/render mobile app QR code in user settings modal 2022-11-28 18:47:59 +01:00
Michael Derynck
3582f9b08f
Improve Jinja Template feedback and error handling (#884)
* Improve feedback so template errors are given to user

* Add security error logging

* Add limits for templates, payloads, results

* Show popup error notification for webhook errors and template errors that don't have a result

* Update tests

* Split exceptions into warnings/errors to give more control when previewing, rendering, saving templates

* Limit title lengths

* Make TypeError a warning

* Adjust title length limit

* Remove length limiting on urlize since it is being done on template render

* Fix tests

* Add KeyError and ValueError to warnings

* No longer enforcing json result when saving webhook in case it is dependent on payload

* Add tests for expected exceptions coming from apply_jinja_template

* Update changelog

* Send raw post if template result is not JSON
2022-11-28 09:46:51 -07:00
Vadim Stepanov
c23de808cb
Update CHANGELOG.md 2022-11-24 14:03:14 +00:00
Joey Orlando
d50db0dd80
[Hotfix] UI not handling invalid grafana tokens properly (#892)
* bug-fix

fix issue where frontend would not properly handle
scenario where Grafana API token was not yet available/valid
2022-11-23 13:29:58 +01:00
Michael Derynck
2edd88cbe3 Update changelog 2022-11-22 11:27:41 -07:00
Yulya Artyukhina
381520ee13
Get rid of installation token + add a bunch of tests (#624)
* Get rid of installation token (for OSS installations)

This is done by being required to supply the grafana API URL as an
environment variable on the backend. Additionally, optionally an OnCall
API URL environment variable can be passed in to the frontend (this basically
allows completely skipping the need to configure anything).
- deduplicated a lot of the sync logic on the frontend + made
error message more useful and consistent
- Split PluginConfigPage component into several subcomponents
(making it easier to test each individual component)
- Moved RootWithLoader (from plugin/GrafanaPluginRootPage) into its own
subcomponent (making it easier to test)
- Added tests for pre-existing components that were touched:
  - PluginConfigPage component (and its new subcomponents)
  - state/plugin and state/rootBaseStore functions
  - apps.grafana_plugin django app

Helm changes:
- add GRAFANA_API_URL to oncall.env
- some yaml autoformatting changes
- remove reference to python manage.py issue_invite_for_the_frontend --override

Co-authored-by: Joey Orlando <joseph.t.orlando@gmail.com>
2022-11-21 16:26:00 +01:00
Innokentii Konstantinov
671c3a74b9 Update Changelod 2022-11-18 17:39:23 +08:00