117 Commits

Author SHA1 Message Date
eb82a75668 Provisioning: Show file path of provisioning file in save/delete dialogs (#16706)
* Add file path to metadata and show it in dialogs

* Make path relative to config directory

* Fix tests

* Add test for the relative path

* Refactor to use path relative to provisioner path

* Change return types

* Rename attribute

* Small fixes from review
2019-04-30 13:32:18 +02:00
2d7fc55df7 Provisioning: Do not allow deletion of provisioned dashboards (#16211)
* Unprovision dashboard in case of DisableDeletion = true

* Rename command struct

* Handle removed provision files

* Allow html in confirm-modal

* Do not show confirm button without onConfirm

* Show dialog on deleting provisioned dashboard

* Changed DeleteDashboard to DeleteProvisionedDashboard

* Remove unreachable return

* Add provisioned checks to API

* Remove filter func

* Fix and add tests for deleting dashboards

* Change delete confirm text

* Added and used pkg/errors for error wrapping
2019-04-10 13:29:10 +02:00
a881497908 Max number of repeated panels per row
Instead of min width
2019-01-09 08:01:42 +01:00
36aec52c08 return actual error if failing to update alert data 2018-11-22 11:19:08 +01:00
ec4698fb96 alerting: propagate alert validation issues to the user instead of just 'invalid alert data' message 2018-10-12 23:03:54 -07:00
c817aecd66 provisioning: only update dashboard if hash of json changed 2018-05-31 21:05:52 +02:00
d7688241c6 Merge branch 'master' into readonly_dashboards 2018-04-17 16:27:51 +02:00
26bb22bffa Merge pull request #11554 from grafana/11553_viewer_general_access
User with org viewer role permission fixes
2018-04-17 13:50:45 +02:00
8a5cb088d3 Merge branch 'master' into readonly_dashboards 2018-04-17 10:50:04 +02:00
91fb2e07ce pkg: fix codespell issues 2018-04-13 20:31:29 +02:00
4f44376564 remove comment/unused variable 2018-04-13 17:11:52 +02:00
b4863002c9 permission: fix user with org viewer save/move permissions
User with org viewer role should not be able to save/move dashboards
in/to general folder.
2018-04-11 00:23:50 +02:00
949484b949 provisioning: simplify db query
the GetProvisionedDashboardQuery wasent used for anything
else than check if a dashboard is provisioned or not. So
we simplified this query to make it more maintainable.
2018-04-10 12:30:37 +02:00
7845eab502 provisioning: fixes typo 2018-04-10 09:32:05 +02:00
6bbeb723ca Merge branch 'master' into readonly_dashboards 2018-04-05 20:30:27 +02:00
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
627df67992 dashboards: reject updates of provisioned dashboards 2018-03-27 15:12:47 +02:00
d6faa3d06f provisioning: improve UX when saving provisioned dashboards 2018-03-26 15:08:46 +02:00
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
fce1e3f7f1 Merge branch 'master' into 10630_folder_api 2018-02-19 13:32:45 +01:00
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
fa1b92a12b provisioning: uses unix epoch timestamps. (#10907)
* provisioning: uses unix epoch timestamps.
2018-02-14 15:28:30 +01:00
8dd4d505ee Merge branch 'dashboard-search-permissions-filter' 2018-02-14 10:48:55 +01:00
cb8c82f7f6 Merge branch 'master' into 10630_folder_api 2018-02-12 15:14:41 +01:00
e949eb3f58 Merge branch 'master' into dashboard-search-permissions-filter 2018-02-09 15:16:34 +01:00
8e8f3c4332 dashboard and folder search with permissions 2018-02-08 17:11:01 +01:00
5a85fb6d32 Merge branch 'master' into provisioning 2018-02-08 13:43:19 +01:00
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
b549d29319 Merge branch 'master' into provisioning 2018-02-08 11:01:09 +01:00
cc0cc8dd73 changes to new urlformat for home dashboard (#10738) 2018-02-05 10:24:48 +01:00
b07ac3c054 Merge branch '7883_new_url_structure' into 10630_folder_api 2018-02-01 18:29:00 +01:00
fcd86fb24f make it easier for dashboards to generate ur; 2018-02-01 14:08:51 +01:00
992fd37010 alert: use new url format 2018-02-01 14:08:51 +01:00
ef90b3e49c Merge branch '7883_new_url_structure' into 7883_frontend_step2 2018-02-01 11:08:39 +01:00
b135df9a6c Merge remote-tracking branch 'upstream/master' into 7883_new_url_structure 2018-02-01 10:48:06 +01:00
eff687bece Merge pull request #10694 from grafana/7883_backend
backend for new url structure.
2018-02-01 09:35:00 +01:00
90933b0621 dashboard: refactor logic for retrieving url for folder/dashboard 2018-01-31 23:14:48 +01:00
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
58cfb23625 retry uid generation 2018-01-31 17:29:17 +01:00
7e96052594 ensure dashboard title is unique in folder 2018-01-31 14:18:54 +01:00
bb3183f6cd removes uniqnes check on slug when saving dashboards 2018-01-31 10:29:52 +01:00
eb765d288c alertlist: disable pause button when user does not have permission 2018-01-30 23:35:27 +01:00
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
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
9fb7b887db dashboards: add url property to dashboard meta and search api responses
#7883
2018-01-30 23:18:34 +01:00
7ee691dc48 dashboards: api for retrieving uid by slug. #7883 2018-01-30 23:18:34 +01:00
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
e229f8aea8 dashboards: extract short uid generator to util package. #7883 2018-01-30 23:18:34 +01:00
5b35c694dc dashboard: generate and include uid in dashboard model. #7883 2018-01-30 23:18:34 +01:00
f08932b78a WIP: folder api. #10630 2018-01-30 10:53:28 +01:00