Commit Graph

101 Commits

Author SHA1 Message Date
Mario Trangoni
91fb2e07ce pkg: fix codespell issues 2018-04-13 20:31:29 +02:00
bergquist
5596707531 alert: fixes broken link back to grafana
If Grafana was configured to use a subpath it
was included twice in the link from the
alert notification back to Grafana.

closes #11403
2018-03-27 20:26:51 +02:00
Marcus Efraimsson
3f588b4c48 dashboards: created/updated and createdby/updatedby should be set before save
If creating a new folder/dashboard created/updated and createdby/updatedby should always be set.
If updating an existing folder/dashboard updated and updatedby should always be set.
2018-02-22 11:54:28 +01:00
Marcus Efraimsson
fce1e3f7f1 Merge branch 'master' into 10630_folder_api 2018-02-19 13:32:45 +01:00
Marcus Efraimsson
53cd39fde5 Shouldn't be able to overwrite a dashboard if you don't have permissions (#10900)
* dashboards: new command for validating dashboard before update

Removes validation logic from saveDashboard and later on use the new command for validating
dashboard before saving a dashboard. This due to the fact that we need to validate permissions
for overwriting other dashboards by uid and title.

* dashboards: use the new command for validating dashboard before saving

Had to refactor dashboard provisioning a bit to be able to sidetrack the permission validation
in a somewhat reasonable way.
Adds some initial tests of the dashboard repository, but needs to be extended later. At least
now you can mock the dashboard guardian

* dashboards: removes validation logic in the save dashboard api layer

Use the dashboard repository solely for create/update dashboards and let it do all
the validation. One exception regarding quota validation which still is in api layer
since that logic is in a macaron middleware.
Need to move out-commented api tests later.

* dashboards: fix database tests for validate and saving dashboards

* dashboards: rename dashboard repository to dashboard service

Split the old dashboard repository interface in two new interfaces, IDashboardService and
IDashboardProvisioningService. Makes it more explicit when using it from the provisioning package
and there's no possibility of calling an incorrect method for saving a dashboard.

* database: make the InitTestDB function available to use from other packages

* dashboards: rename ValidateDashboardForUpdateCommand and some refactoring

* dashboards: integration tests of dashboard service

* dashboard: fix sqlstore test due to folder exist validation

* dashboards: move dashboard service integration tests to sqlstore package

Had to move it to the sqlstore package due to concurrency problems when running
against mysql and postgres. Using InitTestDB from two packages added conflicts
when clearing and running migrations on the test database

* dashboards: refactor how to find id to be used for save permission check

* dashboards: remove duplicated dashboard tests

* dashboards: cleanup dashboard service integration tests

* dashboards: handle save dashboard errors and return correct http status

* fix: remove log statement

* dashboards: import dashboard should use dashboard service

Had to move alerting commands to models package due to problems with import cycles of packages.

* dashboards: cleanup dashboard api tests and add some tests for post dashboard

* dashboards: rename dashboard service interfaces

* dashboards: rename dashboard guardian interface
2018-02-19 11:12:56 +01:00
Leonard Gram
fa1b92a12b
provisioning: uses unix epoch timestamps. (#10907)
* provisioning: uses unix epoch timestamps.
2018-02-14 15:28:30 +01:00
Torkel Ödegaard
8dd4d505ee Merge branch 'dashboard-search-permissions-filter' 2018-02-14 10:48:55 +01:00
Marcus Efraimsson
cb8c82f7f6 Merge branch 'master' into 10630_folder_api 2018-02-12 15:14:41 +01:00
Torkel Ödegaard
e949eb3f58 Merge branch 'master' into dashboard-search-permissions-filter 2018-02-09 15:16:34 +01:00
Torkel Ödegaard
8e8f3c4332 dashboard and folder search with permissions 2018-02-08 17:11:01 +01:00
Leonard Gram
5a85fb6d32 Merge branch 'master' into provisioning 2018-02-08 13:43:19 +01:00
Marcus Efraimsson
0e8377a9f4 Update logic for create/update dashboard, validation and plugin dashboard links (#10809)
* enables overwrite if dashboard allready exist in folder

* dashboard: Don't allow creating a folder named General

* dashboards: update logic for save/update dashboard

No id and uid creates a new dashboard/folder.
No id and uid, with an existing title in folder allows overwrite
  of dashboard.
Id without uid, allows update of existing dashboard/folder without
  overwrite.
Uid without id allows update of existing dashboard/folder without
  overwrite.
Id without uid, with an existing title in folder allows overwrite
  of dashboard/folder and updated will have the uid of overwritten.
Uid without id, with an existing title in folder allows overwrite
  of dashboard/folder and new will have the same uid as provided.
Trying to change an existing folder to a dashboard yields error.
Trying to change an existing dashboard to a folder yields error.

* dashboards: include folder id when confirmed to save with overwrite

* dashboards: fixes due to new url structure

Return importedUrl property in response to importing dashboards and
getting plugin dashboards and use this for redirects/links in the
frontend.
2018-02-08 12:48:38 +01:00
Leonard Gram
b549d29319 Merge branch 'master' into provisioning 2018-02-08 11:01:09 +01:00
Carl Bergquist
cc0cc8dd73 changes to new urlformat for home dashboard (#10738) 2018-02-05 10:24:48 +01:00
Marcus Efraimsson
b07ac3c054 Merge branch '7883_new_url_structure' into 10630_folder_api 2018-02-01 18:29:00 +01:00
bergquist
fcd86fb24f make it easier for dashboards to generate ur; 2018-02-01 14:08:51 +01:00
bergquist
992fd37010 alert: use new url format 2018-02-01 14:08:51 +01:00
Marcus Efraimsson
ef90b3e49c Merge branch '7883_new_url_structure' into 7883_frontend_step2 2018-02-01 11:08:39 +01:00
Marcus Efraimsson
b135df9a6c Merge remote-tracking branch 'upstream/master' into 7883_new_url_structure 2018-02-01 10:48:06 +01:00
Carl Bergquist
eff687bece
Merge pull request #10694 from grafana/7883_backend
backend for new url structure.
2018-02-01 09:35:00 +01:00
Marcus Efraimsson
90933b0621 dashboard: refactor logic for retrieving url for folder/dashboard 2018-01-31 23:14:48 +01:00
Marcus Efraimsson
b23560ed5a dashboards: add validation to delete dashboard by slug
Validates that there are only one folder/dashboard having that slug,
otherwise returns 412 Precondition Failed
2018-01-31 18:40:54 +01:00
bergquist
58cfb23625 retry uid generation 2018-01-31 17:29:17 +01:00
bergquist
7e96052594 ensure dashboard title is unique in folder 2018-01-31 14:18:54 +01:00
bergquist
bb3183f6cd removes uniqnes check on slug when saving dashboards 2018-01-31 10:29:52 +01:00
Daniel Lee
eb765d288c alertlist: disable pause button when user does not have permission 2018-01-30 23:35:27 +01:00
Marcus Efraimsson
fd59241e35 dashboards: revert adding api for retrieving uid by slug
Since we're already have possibility to get a dashboard by slug
it makes little sense to have a separate endpoint in api for
retrieving uid by slug.
#7883
2018-01-30 23:18:34 +01:00
Marcus Efraimsson
4829ea0e9f util: remove retry logic in shortid_generator
Use shortid.MustGenerate() instead of shortid.Generate(). Instead
of returning errors it will panic.
2018-01-30 23:18:34 +01:00
Marcus Efraimsson
9fb7b887db dashboards: add url property to dashboard meta and search api responses
#7883
2018-01-30 23:18:34 +01:00
Marcus Efraimsson
7ee691dc48 dashboards: api for retrieving uid by slug. #7883 2018-01-30 23:18:34 +01:00
Marcus Efraimsson
13d5db7d19 dashboards: add support for retrieving a dashboard by uid
Introduces new url in api /dashboards/<uid> for fetching dashboard by unique id
Leave the old dashboard by slug url /dashboards/db/<slug> for backward
compatibility and for supporting fallback
WIP for #7883
2018-01-30 23:18:34 +01:00
Marcus Efraimsson
e229f8aea8 dashboards: extract short uid generator to util package. #7883 2018-01-30 23:18:34 +01:00
Marcus Efraimsson
5b35c694dc dashboard: generate and include uid in dashboard model. #7883 2018-01-30 23:18:34 +01:00
Marcus Efraimsson
f08932b78a WIP: folder api. #10630 2018-01-30 10:53:28 +01:00
bergquist
d62d5c7418 provisioning: delete dashboards from db when file is missing 2018-01-25 15:25:07 +01:00
bergquist
67a9e6a71d provisioing: add lookup table provisioned dashboards 2018-01-23 21:52:55 +01:00
Daniel Lee
94a54248c1 dashfolders: show folders use can save to in picker
Instead of returning all folders a user has some sort of access to,
this change creates a new end point that returns folders the user
has write access to. This new endpoint is used in the folder picker
2018-01-20 01:58:28 +01:00
bergquist
237d469ed4 dashboards as cfg: create dashboard folders if missing
closes #10259
2017-12-28 13:33:11 +01:00
Torkel Ödegaard
cafed8ce8f Merge branch 'master' into develop 2017-12-12 13:19:07 +01:00
bergquist
16f072b320 dashboards as cfg: move saving logic for dashboards into its own service 2017-12-07 15:27:01 +01:00
bergquist
d69b63cbc0 dashboards as cfg: read first cfg version 2017-12-07 15:27:01 +01:00
Marcus Efraimsson
a335150ad1 dashfolders: Add a helper for creating a dashboard folder 2017-11-28 12:51:40 +01:00
Torkel Ödegaard
fc69d59cae dashboard folder search fix 2017-06-23 16:00:26 -04:00
Torkel Ödegaard
d6341162cb refactoring dashboad folder acl checks 2017-06-19 11:54:37 -04:00
Torkel Ödegaard
cbbbccf12a refactoring dashoard folder guardian 2017-06-17 18:24:38 -04:00
Daniel Lee
dd02bf7c9b WIP: adds API check to stop folders being included in folders 2017-06-16 02:45:47 +02:00
Daniel Lee
9f79b9b8c5 WIP: fix go fmt error 2017-06-12 15:49:09 +02:00
Daniel Lee
97c13b77bf WIP: Add or update Dashboard ACL
SQL Integration Tests for the guardian class too.
2017-06-12 15:49:09 +02:00
Daniel Lee
3785894b40 WIP: guardian service for search
Removes restricted dashboards from search result.
2017-06-12 15:49:09 +02:00
Daniel Lee
1248728d7f WIP: rough prototype of dashboard folders
Breaks some stuff like selected dash in the search result.
In dashboard search, if the user is not searching then the result is
returned as a tree structure. No ACL's or user group ux yet.
2017-06-12 15:49:09 +02:00