Commit Graph

6962 Commits

Author SHA1 Message Date
Alexander Emelin
4cd2575ad0
Live: generate ts definitions for pipeline configs (#41544)
Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
2021-11-15 22:45:35 +03:00
Levente Balogh
4219e4f107
Plugins Catalog: hide plugins based on the Grafana config (#41679)
* refactor(pkg/api/frontendsettings): group plugin catalog settings

* feat(plugins/admin): add a default config value for `pluginCatalogHiddenPlugins`

* chore(grafana/config): add type for `pluginCatalogHiddenPlugins`

* feat(plugins/admin): hide plugins from the catalog based on the grafana config

* fix(plugins/admin): fix a rebase typo

* fix(plugins/admin): remove unnecessary filtering
2021-11-15 15:51:16 +01:00
Dimitris Sotirakis
2c8ac1f58f
Security Fix: Fine-grained access control enables organization admins to create/modify/delete user roles in other organization (#41694)
* 8.2.4: Fine-grained access control enables organization admins to create/modify/delete user roles in other organization

* Revert back calls with ScopeOrgID

Co-authored-by: gamab <gabi.mabs@gmail.com>
2021-11-15 15:35:09 +01:00
Will Browne
8ea75c9401
Plugins: Add SDK stream handler support to plugin.Client (#41650)
* add stream handler support to plugin.Client

* nil instead of empty resp

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>

* nil instead of empty resp #2

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
2021-11-15 14:25:13 +01:00
Alexander Emelin
d5ffff21ac
Live: comments for pipeline channel rule (#41639) 2021-11-15 15:02:27 +03:00
Marcus Efraimsson
b88d21a6cb
PluginsCatalog: Add backend support for hiding plugins in plugins catalog (#41563)
Add backend support for hiding plugins in plugins catalog. 

Ref #41074
2021-11-15 10:53:35 +01:00
Alexander Emelin
1700b2c2f3
live: add ws endpoint to push into pipeline (#41534) 2021-11-15 12:43:18 +03:00
Alexander Emelin
e0b59fe8ce
live: move back to ojg (#41642) 2021-11-13 15:14:13 +03:00
Peter Holmberg
b2d7162168
Alerting: Add external Alertmanagers (#39183)
* building ui

* saving alertmanager urls

* add actions and api call to get external ams

* add list to add modal

* add validation and edit/delete

* work on merging results

* merging results

* get color for status heart

* adding tests

* tests added

* rename

* add pollin and status

* fix list sync

* fix polling

* add info icon with actual tooltip

* fix test

* Accessibility things

* fix strict error

* delete public/dist files

* Add API tests for invalid URL

* start redo admin test

* Fix for empty configuration and test

* remove admin test

* text updates after review

* suppress appevent error

* fix tests

* update description

Co-authored-by: gotjosh <josue@grafana.com>

* fix text plus go lint

* updates after pr review

* Adding docs

* Update docs/sources/alerting/unified-alerting/fundamentals/alertmanager.md

Co-authored-by: gotjosh <josue@grafana.com>

* Update docs/sources/alerting/unified-alerting/fundamentals/alertmanager.md

Co-authored-by: gotjosh <josue@grafana.com>

* Update docs/sources/alerting/unified-alerting/fundamentals/alertmanager.md

Co-authored-by: gotjosh <josue@grafana.com>

* Update docs/sources/alerting/unified-alerting/fundamentals/alertmanager.md

Co-authored-by: gotjosh <josue@grafana.com>

* Update docs/sources/alerting/unified-alerting/fundamentals/alertmanager.md

Co-authored-by: gotjosh <josue@grafana.com>

* Update docs/sources/alerting/unified-alerting/fundamentals/alertmanager.md

Co-authored-by: gotjosh <josue@grafana.com>

* Update docs/sources/alerting/unified-alerting/fundamentals/alertmanager.md

Co-authored-by: gotjosh <josue@grafana.com>

* prettier

* updates after docs feedback

Co-authored-by: gotjosh <josue.abreu@gmail.com>
Co-authored-by: gotjosh <josue@grafana.com>
2021-11-12 22:19:16 +01:00
idafurjes
d72e389d3d
Add context for GetAlertNotificationUidQuery (#41633) 2021-11-12 14:35:38 +01:00
Ieva
ba7d65edf5
Revert "allow using targetOrgId parameter to set organisation ID for a request (#41561)" (#41643)
This reverts commit 08276225c1.
2021-11-12 14:23:16 +01:00
Ivana Huckova
9b9e41e036
Prometheus: Disable exemplar queries for alerting (#41607)
* Prometheus: Dont include empty exempalr frame in results

* Prometheus: Never run exemplar queries for alerting

* Remove exemplar field from alerting and set exemplar to false

* Add tests for frontend

* Add test for backend
2021-11-12 12:49:06 +01:00
Joan López de la Franca Beltran
44837fc592
Replace encryption.Service usages by secrets.Service (#41625)
* Replace encryption.Service by secrets.Service on expr.Service

* Replace encryption.Service by secrets.Service on live pkg

* Rename encryption.Service to encryption.Internal to clarify it must be not used
2021-11-12 12:16:39 +01:00
Ieva
dcae138379
Access Control: adding group field to roles (#41465)
* add group field to roles in AC models

* change to using group_name as the column name

* add a migration for group column
2021-11-12 10:42:47 +00:00
Jack Westbrook
3c3cf2eee9
Plugins Catalog: Install and show the latest compatible version of a plugin (#41003)
* fix(catalog): prefer rendering installed version over latest version

* feat(catalog): signify installed version in version history

* feat(catalog): introduce installedVersion and latestVersion

* refactor(catalog): use latestVersion for installation, simplify plugindetails header logic

* refactor(catalog): clean up installedVersion and latestVersion

* feat(catalog): use table-layout so versions list table has consistent column widths

* test(catalog): update failing tests

* removed the need of having a latest version in the plugin catalog type root level.

* fixed flaky test depending on what locale it was being running with.

* added missing test to verify version for a remote plugin.

* fixed version in header.

* preventing the UI from break if no versions are available.

* fixed failing test due to missing mock data.

* added todo as a reminder.

* refactor(catalog): prefer grafana plugin icons over gcom notfound images

* refactor(Plugins/Admin): change constant name

* refactor(Plugins/Admin): add comment to make condition easier to understand

* chore: update go modules

* feat(Backend/Plugins): add "dependencies" field to `PluginListItem`

* feat(Plugins/Admin): show the grafana dependency for the installed version

* refactor(Plugins/Admin): use the local version of links

* refactor(Plugins/Admin): prefer the local version for `.type`

* refactor(Plugins/ADmin): prefer the local `.description` field

* fix(Plugins/Admin): fix tests

* test(plugins/api): update the expected response for the `api/plugins` tests

* chore(Plugins/Admin): add todo comments to check preferation of remote/local values

* feat(backend/api): always send the grafana version as a header when proxying to GCOM

* feat(plugins/admin): use the `isCompatible` flag to get the latest compatible version

* feat(plugins/admin): show the latest compatible version in the versions list

* fix(plugins/admin): show the grafana dependency for the latest compatible version

* fix(plugins/admin): update the version list when installing/uninstalling a plugin

* test(plugins/admin): add some test-cases for the latest-compatible-version

* fix(plugins/admin): show the grafana dependency for the installed version (if installed)

* feat(plugins/backend): add the `dependencies.grafanaDependency` property to the plugin object

* test(plugins/backend): fix tests by adjusting expected response json

Co-authored-by: Marcus Andersson <marcus.andersson@grafana.com>
Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com>
2021-11-12 11:07:12 +01:00
Selene
25ad916473
OAuth: Fix group mapping when use generic OAuth (#41418)
* Fix group mapping when use generic OAuth

* Fix lint

* Fix lint
2021-11-12 10:22:04 +01:00
Ieva
08276225c1
allow using targetOrgId parameter to set organisation ID for a request (#41561) 2021-11-11 16:39:08 +00:00
Erik Sundell
eb40723bcb
Cloudwatch: Enable dimension filtering when loading dimension values (#41566)
* fix dimension filter

* refactor tests

* add comments

* fix typo
2021-11-11 16:48:35 +01:00
Gabriel MABILLE
0f36152127
UserCacheService: Use value instead of pointer (#41549) 2021-11-11 16:25:57 +01:00
Eric Leijonmarck
4fd3dd41bc
ServiceAccounts: Delete ServiceAccount (#40470)
* Add extra fields to OSS types to support enterprise

* WIP service accounts

* Update public/app/features/api-keys/ApiKeysForm.tsx

Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com>

* Create a service account at the same time as the API key

* Use service account credentials when accessing API with APIkey

* Throw better error

* Use Boolean for "create service account button"

* Add GetRole to service, merge RoleDTO and Role structs

This patch merges the identical OSS and Enterprise data structures, which improves the code for two reasons:

1.  Makes switching between OSS and Enterprise easier
2.  Reduces the chance of incompatibilities developing between the same functions in OSS and Enterprise

* Start work cloning permissions onto service account

* If API key is not linked to a service account, continue login as usual

* Fallback to old auth if no service account linked to key

* Commented

* Add CloneUserToServiceAccount

* Update mock.go

* Put graphical bits behind a feature toggle

* Start adding LinkAPIKeyToServiceAccount

* Update pkg/models/user.go

Co-authored-by: Eric Leijonmarck <eric.leijonmarck@gmail.com>

* Update pkg/api/apikey.go

Co-authored-by: Eric Leijonmarck <eric.leijonmarck@gmail.com>

* Update pkg/api/apikey.go

Co-authored-by: Eric Leijonmarck <eric.leijonmarck@gmail.com>

* Finish LinkAPIKeyToServiceAccount

* Update comment

* Handle api key link error

* Update pkg/services/sqlstore/apikey.go

Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>

* Feature toggle

* Update pkg/services/accesscontrol/accesscontrol.go

Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>

* Not needed (yet)

* Better error messages for OSS accesscontrol

* Set an invalid user id as default

* ServiceAccountId should be string

* Re-arrange field names

* ServiceAccountId is integer

* Update ossaccesscontrol.go

* Linter

* Remove fronend edits

* Remove console log

* Update ApiKeysForm.tsx

* feat: add serviceaccount deletion

* feat: make sure we do not accidently delete serviceaccount

* feat: ServiceAccount Type

* refactor: userDeletions function

* refactor: serviceaccount deletions\

* refactor: error name and removed attribute for userDeletecommand

* refactor:: remove serviceaccount type for now

* WIP

* add mocked function

* Remove unnecessary db query, move to right place

* Update pkg/services/accesscontrol/mock/mock.go

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>

* Update pkg/services/accesscontrol/mock/mock.go

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>

* Update pkg/services/accesscontrol/mock/mock.go

Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>

* Better error messages

* Better and correcter error messages

* add mocked function

* refactor: move function call, add error msg

* add IsServiceAccount and fix table

* add service accounts package

* WIP

* WIP

* working serviceaccountsapi registration

* WIP tests

* test

* test working

* test running for service

* moved the error out of the models package

* fixed own review

* linting errors

* Update pkg/services/serviceaccounts/database/database.go

Co-authored-by: Jeremy Price <Jeremy.price@grafana.com>

* tests running for api

* WIP

* WIP

* removed unused secrets background svc

* removed background svc for serviceaccount infavor or wire.go

* serviceaccounts manager tests

* registering as backend service

Co-authored-by: Jeremy Price <jeremy.price@grafana.com>
Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com>
Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
Co-authored-by: Ieva <ieva.vasiljeva@grafana.com>
Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
2021-11-11 15:10:24 +00:00
Karl Persson
3c659f1ea0
Access Control: Move part of access control database (#40483)
* Add accesscontrol migrations

* Add ResourceStore interface and related structs

* Add team/user/builtin-role

* Add accesscontrol database with functions to handle managed roles and
permissions

* Add ResourceManager

* Add GetUserPermissions

* Update pkg/services/accesscontrol/accesscontrol.go

Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
2021-11-11 14:02:53 +01:00
Erik Sundell
fa3261eaf2
ignore empty tags (#41529) 2021-11-11 13:38:04 +01:00
Jeremy Price
69c5370e94
Accesscontrol: Add additional API keys to service account, move cloneserviceaccount to sqlstore (#41189)
* Add additional api key, move cloneserviceaccount

* Remove TODOs, for now

* Error messages

* Linter

* Security check

* Add comments

* Take service account id from correct variable

* Update user.go
2021-11-11 10:42:21 +00:00
Hugo Häggmark
4e1059649a
Admin: Fix so Timezone is saved when saving preferences (#41583)
* Configuration: Fix so Timezone is saved when saving preferences

* Updating package.json and yarn.lock

* Chore: force drone reload

* Chore: trying with the git protocol

* Chore: revert back to main

* Chore: deleted cached pa11y file

* Chore: revert

* Chore: trying with YARN_CHECKSUM_BEHAVIOR=reset

* Chore: YARN_CHECKSUM_BEHAVIOR=reset worked but reverting back waiting for other fix
2021-11-11 11:13:01 +01:00
Gábor Farkas
eb47a58029
InfluxDB: fix numeric aliases in queries (#41531)
* influxdb: alerting: handle out-of-range numeric aliases

* influxdb: updated documentation
2021-11-11 09:18:06 +01:00
Gilles De Mey
dbe78e47b1
fix: check lotex endpoint URL (#41429)
* fix: check lotex endpoint URL

* Add validation for data sources URLs

Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>
2021-11-11 07:45:56 +01:00
Isabella Siu
fc3d3ff003
CloudMonitoring: Move data manipulation to backend (#41379) 2021-11-10 08:58:04 -05:00
Santiago
a45e4ff73f
graphLink and tableLink template functions (#41369)
* graphLink and tableLink functions, docs updated

* Code review changes

* extract query struct outside of graphLink and tableLink functions

* Fix docs

* Update docs/sources/alerting/unified-alerting/alerting-rules/alert-annotation-label.md

Co-authored-by: Jean-Philippe Quéméner <JohnnyQQQQ@users.noreply.github.com>

* Update docs/sources/alerting/unified-alerting/alerting-rules/alert-annotation-label.md

Co-authored-by: Jean-Philippe Quéméner <JohnnyQQQQ@users.noreply.github.com>

* Update docs/sources/alerting/unified-alerting/alerting-rules/alert-annotation-label.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Update docs/sources/alerting/unified-alerting/alerting-rules/alert-annotation-label.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Fix linting errors

Co-authored-by: Jean-Philippe Quéméner <JohnnyQQQQ@users.noreply.github.com>
Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
2021-11-10 10:36:03 -03:00
Marcus Andersson
e5421dd53e
Chore: Change so we cache loading plugins by its version (#41367)
* making it possible to cache plugins based on the version.

* feat(plugincache): introduce function to invalidate entries

* removed todo's

* added tests for the cache buster.

* fixed tests.

* fixed failing tests.

Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
2021-11-10 11:54:58 +01:00
Marcus Efraimsson
baab021fec
Chore: Refactor usage of legacy data contracts (#41218)
Refactor usage of legacy data contracts. Moves legacy data contracts 
to pkg/tsdb/legacydata package.
Refactor pkg/expr to be a proper service/dependency that can be provided 
to wire to remove some unneeded dependencies to SSE in ngalert and other places.
Refactor pkg/expr to not use the legacydata,RequestHandler and use 
backend.QueryDataHandler instead.
2021-11-10 11:52:16 +01:00
George Robinson
d6ed5d295e
Alerting: Fix NoDataFound for alert rules using the AND operator (#41305)
This commit fixes an issue in alerting where NoDataFound is false
when using the AND operator to compare two conditions in an alert
rule and one of the conditions has no data.
2021-11-10 10:28:49 +00:00
Will Browne
8adefa32fd
Plugins: Return error from QueryData when plugin is not found (#41494)
* Plugins: Return error from QueryData when plugin is not found

* use nil for resp
2021-11-10 10:39:32 +01:00
Selene
a3b9c764d3
Encryption: Add Azure key vault dependency (#41353)
* Add Azure key vault dependency

* Fix go.mod

Co-authored-by: Leonard Gram <leo@xlson.com>
2021-11-09 19:33:54 +02:00
Alexander Emelin
e2ed140de2
Live: rename remote write backends to write configs (#41467) 2021-11-09 19:12:10 +03:00
Yuriy Tseretyan
24ad769831
Alerting: Fix flaky TestAlertInstanceOperations (#41435)
* use UID generator for text
2021-11-09 10:42:58 -05:00
Ryan McKinley
490d21fc5c
ds/query: use datasourceId if it exists in the request (#41446) 2021-11-09 07:11:09 -08:00
Tania B
f6545ab8f4
Chore: Add current provider test for secrets service (#41387)
* Chore: Add current provider test for secrets service

* Refactor the test

* Fix linting issue
2021-11-09 16:40:37 +02:00
Marcus Efraimsson
3be452f995
DataProxy: Fix issue overriding response body when response status is 101 (#41364)
When a request going through Grafana data source proxy responds with a websocket 
upgrade response we cannot override the response body since it produces an error. 
This problem seems to have been introduced in Grafana v8.0 by #38962. 
In addition #40303 added same problem.

Fixes #41292
2021-11-09 14:33:54 +01:00
Marcus Efraimsson
36cea0b48e
Cli: Improve error handling for installing plugins (#41257)
Improves error handling when installing plugins by checking for 
error before adding a defer of closing of the zip reader to not 
create a panic when there's an invalid zip file.

Fixes #41029
2021-11-09 11:18:21 +01:00
Alexander Emelin
78e9fe520b
Live: pipeline Loki output (#41272) 2021-11-09 13:10:43 +03:00
Ilya Stoliar
8e778aa98f
CloudWatch: Add AWS RoboMaker metrics and dimension (#41450) 2021-11-09 08:29:09 +01:00
ying-jeanne
54de1078c8
remove the global log error/warn etc functions (#41404)
* remove the global log error/warn etc functions and use request context logger whenever possible
2021-11-08 17:56:56 +01:00
Katarina Yang
c4306f9b3e
Chore: add context to login (#41316)
* Chore: add context to login attempt file and tests

* Chore: add context

* Chore: add context to login and login tests

* Chore: continue adding context to login

* Chore: add context to login query
2021-11-08 15:53:51 +01:00
gotjosh
6220872633
Alerting: fix bug where user is able to access rules from namespaces user is not part of (#41403)
* Add fix
* Add tests
Co-authored-by: Yuriy Tseretyan <yuriy.tseretyan@grafana.com>
Co-authored-by: Armand Grillet <2117580+armandgrillet@users.noreply.github.com>
Co-authored-by: Jean-Philippe Quéméner <JohnnyQQQQ@users.noreply.github.com>
Co-authored-by: George Robinson <george.robinson@grafana.com>
2021-11-08 14:26:08 +01:00
Leon Sorokin
f0a108afb3
MarketTrend: add new alpha panel (#40909) 2021-11-05 18:01:26 -07:00
Ivana Huckova
2daae9eba8
Prometheus: Fix showing of errors (#41356)
* Prometheus: Fix showing of errors

* Refactor and add comment
2021-11-05 18:00:48 +01:00
Ryan McKinley
3489721ed6
api/ds/query: simplify data sources lookup for queries and expressions (#41172) 2021-11-05 08:12:55 -07:00
Will Browne
8a42fca485
process app plugins first (#41346) 2021-11-05 15:07:53 +01:00
Will Browne
14742ea44a
add oauth pass thru logic to api/ds/query (#41352) 2021-11-05 15:07:04 +01:00
Agnès Toulet
3a6b8535b1
API: return resource ID when deleting datasource with UID and library element (#41342)
* API: return resource ID when deleting datasource and library element

* keep status codes consistent

* fix element ID

* add test

* improve response struct

* update endpoints documentation

* LibraryElementIDResponse -> DeleteLibraryElementResponse
2021-11-05 15:06:14 +01:00