Commit Graph

377 Commits

Author SHA1 Message Date
Carl Bergquist 44b365028f
Build: Upgrades to go 1.12.3 (#16491)
fixes go vet issue that 1.12.3 detects
2019-04-12 09:44:02 +02:00
Andrej Ocenas 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
Leonard Gram a615b78f8a permissions: removes global access to bus from MakeUserAdmin. 2019-03-19 14:01:20 +01:00
Leonard Gram 9f8e43916d permissions: refactor. 2019-03-19 14:01:19 +01:00
Hugo Häggmark a90b3e331e config: updated feature toggle name 2019-03-19 13:59:39 +01:00
Leonard Gram 0b209de5d1 dashboard: only admin permission added to dashboard in folder. 2019-03-19 13:57:30 +01:00
Leonard Gram d593ffe3c1 dashboards: better error handling 2019-03-19 13:57:30 +01:00
Leonard Gram c8c004095c permissions: broken out func for making creator admin. 2019-03-19 13:57:21 +01:00
Marcus Efraimsson cf500f3157
restore to current folder when restoring old dashboard version 2019-03-06 14:38:40 +01:00
bergquist 8a3a3cccc3 moves metric package to /infra
ref #14679
2019-02-24 21:12:51 +01:00
bergquist e163aadfe4 use authtoken for session quota restrictions
closes #15360
2019-02-12 15:10:55 +01:00
Torkel Ödegaard 2dc2471b5c Revert "Updated home dashboard, removed home dashboard header"
This reverts commit 0151846e1e.
2019-01-28 15:01:42 +01:00
Torkel Ödegaard 0151846e1e Updated home dashboard, removed home dashboard header 2019-01-22 17:23:24 +01:00
Marcus Efraimsson 36aec52c08
return actual error if failing to update alert data 2018-11-22 11:19:08 +01:00
Marcus Efraimsson 5f9fecd254
feat: team preferences 2018-11-12 20:01:53 +01:00
Torkel Ödegaard ec4698fb96 alerting: propagate alert validation issues to the user instead of just 'invalid alert data' message 2018-10-12 23:03:54 -07:00
Mario Trangoni 0870464ea5 Fix goconst issues
See,
$ gometalinter --vendor --disable-all --enable=goconst --disable=gotype --deadline=6m ./...
build.go:113:15⚠️ 2 other occurrence(s) of "linux" found in: build.go:119:15 build.go:491:34 (goconst)
build.go:119:15⚠️ 2 other occurrence(s) of "linux" found in: build.go:113:15 build.go:491:34 (goconst)
build.go:491:34⚠️ 2 other occurrence(s) of "linux" found in: build.go:113:15 build.go:119:15 (goconst)
build.go:381:21⚠️ 2 other occurrence(s) of "windows" found in: build.go:423:13 build.go:487:13 (goconst)
build.go:423:13⚠️ 2 other occurrence(s) of "windows" found in: build.go:381:21 build.go:487:13 (goconst)
build.go:487:13⚠️ 2 other occurrence(s) of "windows" found in: build.go:381:21 build.go:423:13 (goconst)
pkg/api/dashboard.go:67:22⚠️ 5 other occurrence(s) of "Anonymous" found in: pkg/api/dashboard.go:67:35 pkg/api/dashboard.go:131:10 pkg/api/dashboard.go:406:13 pkg/api/folder.go:98:22 pkg/api/folder.go:98:35 (goconst)
pkg/api/dashboard.go:67:35⚠️ 5 other occurrence(s) of "Anonymous" found in: pkg/api/dashboard.go:67:22 pkg/api/dashboard.go:131:10 pkg/api/dashboard.go:406:13 pkg/api/folder.go:98:22 pkg/api/folder.go:98:35 (goconst)
pkg/api/dashboard.go:131:10⚠️ 5 other occurrence(s) of "Anonymous" found in: pkg/api/dashboard.go:67:22 pkg/api/dashboard.go:67:35 pkg/api/dashboard.go:406:13 pkg/api/folder.go:98:22 pkg/api/folder.go:98:35 (goconst)
pkg/api/dashboard.go:406:13⚠️ 5 other occurrence(s) of "Anonymous" found in: pkg/api/dashboard.go:67:22 pkg/api/dashboard.go:67:35 pkg/api/dashboard.go:131:10 pkg/api/folder.go:98:22 pkg/api/folder.go:98:35 (goconst)
pkg/api/folder.go:98:22⚠️ 5 other occurrence(s) of "Anonymous" found in: pkg/api/dashboard.go:67:22 pkg/api/dashboard.go:67:35 pkg/api/dashboard.go:131:10 pkg/api/dashboard.go:406:13 pkg/api/folder.go:98:35 (goconst)
pkg/api/folder.go:98:35⚠️ 5 other occurrence(s) of "Anonymous" found in: pkg/api/dashboard.go:67:22 pkg/api/dashboard.go:67:35 pkg/api/dashboard.go:131:10 pkg/api/dashboard.go:406:13 pkg/api/folder.go:98:22 (goconst)
pkg/api/index.go:63:47⚠️ 2 other occurrence(s) of "light" found
in: pkg/api/index.go:91:22 pkg/api/index.go:93:16 (goconst)
pkg/api/index.go:91:22⚠️ 2 other occurrence(s) of "light" found in: pkg/api/index.go:63:47 pkg/api/index.go:93:16 (goconst)
pkg/api/index.go:93:16⚠️ 2 other occurrence(s) of "light" found in: pkg/api/index.go:63:47 pkg/api/index.go:91:22 (goconst)
pkg/components/null/float.go:71:25⚠️ 2 other occurrence(s) of "null" found in: pkg/components/null/float.go:103:10 pkg/components/null/float.go:112:10 (goconst)
pkg/components/null/float.go:103:10⚠️ 2 other occurrence(s) of "null" found in: pkg/components/null/float.go:71:25 pkg/components/null/float.go:112:10 (goconst)
pkg/components/null/float.go:112:10⚠️ 2 other occurrence(s) of "null" found in: pkg/components/null/float.go:71:25 pkg/components/null/float.go:103:10 (goconst)
pkg/services/alerting/notifiers/pagerduty.go:79:16⚠️ 2 other occurrence(s) of "Triggered metrics:\n\n" found in: pkg/services/alerting/notifiers/kafka.go:64:16 pkg/services/alerting/notifiers/opsgenie.go:98:16 (goconst)
pkg/services/alerting/notifiers/kafka.go:64:16⚠️ 2 other occurrence(s) of "Triggered metrics:\n\n" found in: pkg/services/alerting/notifiers/pagerduty.go:79:16 pkg/services/alerting/notifiers/opsgenie.go:98:16 (goconst)
pkg/services/alerting/notifiers/opsgenie.go:98:16⚠️ 2 other occurrence(s) of "Triggered metrics:\n\n" found in: pkg/services/alerting/notifiers/pagerduty.go:79:16 pkg/services/alerting/notifiers/kafka.go:64:16 (goconst)
pkg/social/social.go:85:11⚠️ 2 other occurrence(s) of "grafana_com" found in: pkg/social/social.go:162:14 pkg/social/social.go:197:11 (goconst)
pkg/social/social.go:162:14⚠️ 2 other occurrence(s) of "grafana_com" found in: pkg/social/social.go:85:11 pkg/social/social.go:197:11 (goconst)
pkg/social/social.go:197:11⚠️ 2 other occurrence(s) of "grafana_com" found in: pkg/social/social.go:85:11 pkg/social/social.go:162:14 (goconst)
pkg/tsdb/elasticsearch/time_series_query.go:92:17⚠️ 3 other occurrence(s) of "count" found in: pkg/tsdb/elasticsearch/response_parser.go:152:8 pkg/tsdb/elasticsearch/response_parser.go:167:31 pkg/tsdb/elasticsearch/response_parser.go:315:9 (goconst)
pkg/tsdb/elasticsearch/response_parser.go:152:8⚠️ 3 other occurrence(s) of "count" found in: pkg/tsdb/elasticsearch/time_series_query.go:92:17 pkg/tsdb/elasticsearch/response_parser.go:167:31 pkg/tsdb/elasticsearch/response_parser.go:315:9 (goconst)
pkg/tsdb/elasticsearch/response_parser.go:167:31⚠️ 3 other occurrence(s) of "count" found in: pkg/tsdb/elasticsearch/time_series_query.go:92:17 pkg/tsdb/elasticsearch/response_parser.go:152:8 pkg/tsdb/elasticsearch/response_parser.go:315:9 (goconst)
pkg/tsdb/elasticsearch/response_parser.go:315:9⚠️ 3 other occurrence(s) of "count" found in: pkg/tsdb/elasticsearch/time_series_query.go:92:17 pkg/tsdb/elasticsearch/response_parser.go:152:8 pkg/tsdb/elasticsearch/response_parser.go:167:31 (goconst)
pkg/tsdb/elasticsearch/time_series_query.go:78:9⚠️ 2 other occurrence(s) of "date_histogram" found in: pkg/tsdb/elasticsearch/response_parser.go:84:22 pkg/tsdb/elasticsearch/response_parser.go:369:24 (goconst)
pkg/tsdb/elasticsearch/response_parser.go:84:22⚠️ 2 other occurrence(s) of "date_histogram" found in: pkg/tsdb/elasticsearch/time_series_query.go:78:9 pkg/tsdb/elasticsearch/response_parser.go:369:24 (goconst)
pkg/tsdb/elasticsearch/response_parser.go:369:24⚠️ 2 other occurrence(s) of "date_histogram" found in: pkg/tsdb/elasticsearch/time_series_query.go:78:9 pkg/tsdb/elasticsearch/response_parser.go:84:22 (goconst)
2018-09-23 21:19:21 +02:00
bergquist f424d13b53 provisioning: dont override permissions 2018-04-10 12:35:06 +02:00
bergquist 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
bergquist bcbe7a1c55 provisioning: adds error handling 2018-04-10 09:31:35 +02:00
bergquist 627df67992 dashboards: reject updates of provisioned dashboards 2018-03-27 15:12:47 +02:00
bergquist d6faa3d06f provisioning: improve UX when saving provisioned dashboards 2018-03-26 15:08:46 +02:00
Julian Kornberger 0a415c50d0 Make golint happier 2018-03-22 22:38:44 +01:00
Julian Kornberger 7aab6a8887 Make golint happier 2018-03-22 12:40:21 +01:00
Dan Cech bbd6adabbf
move quota to dedicated service 2018-03-07 17:19:35 -05:00
Dan Cech c0ecdee375
rename Context to ReqContext 2018-03-07 11:54:50 -05:00
Dan Cech 338655dd37
move Context and session out of middleware 2018-03-06 18:16:49 -05:00
Daniel Lee ecf438f8d0 dashboard: add permission check for diff api route
ref #10770
2018-02-27 17:53:30 +01:00
Marcus Efraimsson 3f3175972e dashboards: fix batch dashboard/folder delete response
Use message returned from backend and use that as alert success response to user
2018-02-21 16:38:09 +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
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
Marcus Efraimsson 55100d5ff9
Merge pull request #10760 from grafana/10749_link_to_folder
Fix link to folder from permissions list
2018-02-05 11:34:59 +01:00
Marcus Efraimsson 7d3b990e91 permissions: fix link to folder from permissions list
Also, closing Add Permissions CTA when DashboardPermissions and
FolderPermissions unmounts.
Fixes #10749"
2018-02-05 11:10:37 +01:00
Carl Bergquist cc0cc8dd73 changes to new urlformat for home dashboard (#10738) 2018-02-05 10:24:48 +01:00
Marcus Efraimsson 3a906ea335 Merge branch 'master' into 10630_folder_api 2018-02-02 14:34:10 +01:00
bergquist 130a2b6499 handle new error message 2018-02-02 11:06:32 +01:00
Daniel Lee 512f6992f1 dashfolders: rename Root folder to General. Closes #10692 2018-02-02 10:39:26 +01:00
Marcus Efraimsson 4e0542d740 dashboards: revert logic of returning 404 in dashboard api if it's a folder for now 2018-02-01 18:41:04 +01:00
Marcus Efraimsson b07ac3c054 Merge branch '7883_new_url_structure' into 10630_folder_api 2018-02-01 18:29:00 +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 c0c3f17d84 dashboards: when restoring a dashboard to an older version, set current uid 2018-01-31 18:40:54 +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
Marcus Efraimsson 95d063621e dashboards: new route for deleting dashboards by uid 2018-01-31 18:40:54 +01:00
bergquist 9aa488c084 Merge remote-tracking branch 'origin/7883_frontend_step' into 7883_backend
* origin/7883_frontend_step:
  dashboards: make scripted dashboards work using the old legacy urls
  dashboards: redirect from old url used to load dashboard to new url
  dashboards: add new default frontend route for rendering a dashboard panel
  dashboards: fix links to recently viewed and starred dashboards
  dashboards: use new *url* prop from dashboard search for linking to dashboards
  dashboards: when saving dashboard redirect if url changes
  dashboards: add new default frontend route for loading a dashboard
  dashboards: return url in response to save dashboard. #7883
2018-01-31 15:57:03 +01:00
bergquist bb3183f6cd removes uniqnes check on slug when saving dashboards 2018-01-31 10:29:52 +01:00
Marcus Efraimsson 369597f7b2 dashboards: return url in response to save dashboard. #7883 2018-01-31 00:09:14 +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 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 46e1296700 dashboards: return uid in response to creating/updating a dashboard. #7883 2018-01-30 23:18:34 +01:00
Daniel Lee a00a42d9ee api: extract api test code to common_test.go 2018-01-30 13:17:48 +01:00
Marcus Efraimsson f08932b78a WIP: folder api. #10630 2018-01-30 10:53:28 +01:00
Daniel Lee d74a98feff dashfolders: link to folder for inherited permissions
In the permissions view in dashboard settings, this adds a
link to the parent folder for inherited permissions. Which
allows the user to easily navigate to the folder and change
inherited permissions.
2018-01-29 16:10:47 +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
Daniel Lee c27a74bb6b dashfolders: check permissions for new dashboard
ref #10275. Use the parent folder permissions if new dashboard and
it does not have an id yet.
2018-01-09 14:44:36 +01:00
Daniel Lee 61ed0b0381 dashfolders: remove role requirements on dashboard routes
and rely on the permission system instead.
2018-01-09 14:44:36 +01:00
Torkel Ödegaard a7645b710d Merge remote-tracking branch 'origin/master' into develop 2017-12-13 19:18:10 +01:00
Carl Bergquist 35106537f2 Replace Read Only Editor role with ViewersCanEdit setting (#10166)
* removes readonly editor role

* adds viewersCanEdit setting

This enable you to allow viewers to edit/inspect
dashboards in grafana in their own browser without
allowing them to save dashboards

* remove read only editor option from all dropdowns

* migrates all read only viewers to viewers

* docs: replace readOnlyEditor with viewersCanEdit
2017-12-13 18:53:42 +01:00
Torkel Ödegaard 8a61e0967e Merge branch 'master' into develop 2017-12-12 13:22:13 +01:00
Torkel Ödegaard cafed8ce8f Merge branch 'master' into develop 2017-12-12 13:19:07 +01:00
bergquist ff1b71bc20 allow overriding dashboards from api 2017-12-12 13:18:00 +01:00
bergquist 5aab6b5c20 removes last pieces of dashboard.json 2017-12-07 16:26:07 +01:00
bergquist f5eac2e91d dashboards as cfg: expose dashboard service as interface 2017-12-07 15:27:01 +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 9cebb23e01 dashboards as cfg: revert minor changes 2017-12-07 15:27:01 +01:00
Daniel Lee f70fb7dbf3 dashboard: fix home dashboard getting started panel 2017-10-24 19:22:56 +02:00
Torkel Ödegaard df61558018 grid: fixed geting started panel pos 2017-10-10 19:48:06 +02:00
Torkel Ödegaard 4819e50441 newgrid: fixes to default home dashboard 2017-08-25 14:47:57 +02:00
Torkel Ödegaard 3066280216 added code from #8504, and #8021 2017-06-23 17:13:58 -04:00
Torkel Ödegaard fc69d59cae dashboard folder search fix 2017-06-23 16:00:26 -04:00
Daniel Lee 6d86afd472 dashfolders: use canadmin permission in settings menu 2017-06-23 00:36:17 +02:00
Torkel Ödegaard aa634402d9 dashboard acl fixes 2017-06-22 17:43:55 -04:00
Torkel Ödegaard 74840178cf refactoring dashboard folder security checks 2017-06-19 15:22:42 -04:00
Torkel Ödegaard f7194878fe dashboard guardian refactoring starting to work 2017-06-19 13:47:44 -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
Torkel Ödegaard 3fe031d25d refactoring: Dashboard guardian 2017-06-16 21:25:24 -04:00
Torkel Ödegaard d9dca72ee4 dashboard_folders: refactoring picker and folder selection in dashboard settings & save as menu 2017-06-16 16:57:37 -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 92717ccafb WIP: permission checking for dash version api methods 2017-06-14 00:28:34 +02:00
Daniel Lee a861b1b9ba WIP: check permissions for delete/post dashboard 2017-06-12 23:05:32 +02:00
Daniel Lee 3913f16550 WIP: add permission check for GetDashboard 2017-06-12 16:48:51 +02:00
Daniel Lee 5c89c4b2bd WIP: dashlist in template for new folder 2017-06-12 15:49:09 +02:00
Daniel Lee 82afe8228f WIP: add parentid to getdashboard query result 2017-06-12 15:49:09 +02:00
Daniel Lee f1e1da39e3 WIP: get Dashboard Permissions
The guardian class checks if the user is allowed to get the
permissions for a dashboard.
2017-06-12 15:49:09 +02:00
Torkel Ödegaard 46412c8475 dasboard_history: security fix, added orgId filter to dashboard version lookup 2017-06-07 14:21:40 +02:00
Torkel Ödegaard ef1dfed0d8 dasboard_history: big refactoring of how the compare api looked, now a POST with a model for new & base version, refactored a simplified UI code as well, this was done to lay foundation to make it possible to do diff against current in browser unsaved version 2017-06-07 11:50:09 +02:00
Torkel Ödegaard 948e5ae74d dashboard_history: further css & markup fixes, removing style overrides & resuing existing styles and markup components 2017-06-06 23:04:14 +02:00
Torkel Ödegaard 7b5f7ed553 dashboard_history: SQL did not work when using MySQL, fixes to dashboard version numbering, so inserts start at 1, added migration to fix old dashboards with version 0 2017-06-06 15:40:10 +02:00
Torkel Ödegaard e2061312f5 refactoring: moved compare dashboard version command out of sqlstore, the code in this command did not use any sql operations and was more high level, could be moved out and use existing queries to get the versions 2017-06-06 00:15:40 +02:00
Torkel Ödegaard 746d6cdc88 refactoring: changed name on compare command to make properties more explainatory 2017-06-05 23:29:25 +02:00
Torkel Ödegaard cabbfe9adc refactoring: moved dashboard history item formating (message) and fixed dashboard history migration issue, and removed from frontend tests that where no longer needed 2017-06-05 22:59:04 +02:00
Torkel Ödegaard c87418d060 refactoring: Dashboard history restore operation is now reusing existing
operations instead of duplicating a bunch of get & save logic.
2017-06-05 17:45:27 +02:00
Torkel Ödegaard e18007153d refactoring: Renamed dashboard version queries that wrongly had Command suffix, added missing OrgId to dashboard history commands and queries 2017-06-05 16:34:32 +02:00
sanchitraizada 77c046aac6 Implement review feedback 2017-06-01 17:57:09 -04:00
Ben Tranter b6e46c9eb8 History and Version Control for Dashboard Updates
A simple version control system for dashboards. Closes #1504.

Goals

1. To create a new dashboard version every time a dashboard is saved.
2. To allow users to view all versions of a given dashboard.
3. To allow users to rollback to a previous version of a dashboard.
4. To allow users to compare two versions of a dashboard.

Usage

Navigate to a dashboard, and click the settings cog. From there, click
the "Changelog" button to be brought to the Changelog view. In this
view, a table containing each version of a dashboard can be seen. Each
entry in the table represents a dashboard version. A selectable
checkbox, the version number, date created, name of the user who created
that version, and commit message is shown in the table, along with a
button that allows a user to restore to a previous version of that
dashboard. If a user wants to restore to a previous version of their
dashboard, they can do so by clicking the previously mentioned button.
If a user wants to compare two different versions of a dashboard, they
can do so by clicking the checkbox of two different dashboard versions,
then clicking the "Compare versions" button located below the dashboard.
From there, the user is brought to a view showing a summary of the
dashboard differences. Each summarized change contains a link that can
be clicked to take the user a JSON diff highlighting the changes line by
line.

Overview of Changes

Backend Changes

- A `dashboard_version` table was created to store each dashboard
  version, along with a dashboard version model and structs to represent
  the queries and commands necessary for the dashboard version API
  methods.
- API endpoints were created to support working with dashboard
  versions.
- Methods were added to create, update, read, and destroy dashboard
  versions in the database.
  - Logic was added to compute the diff between two versions, and
  display it to the user.
  - The dashboard migration logic was updated to save a "Version
  1" of each existing dashboard in the database.

Frontend Changes

- New views
- Methods to pull JSON and HTML from endpoints

New API Endpoints

Each endpoint requires the authorization header to be sent in
the format,

```
Authorization: Bearer <jwt>
```

where `<jwt>` is a JSON web token obtained from the Grafana
admin panel.

`GET "/api/dashboards/db/:dashboardId/versions?orderBy=<string>&limit=<int>&start=<int>"`

Get all dashboard versions for the given dashboard ID. Accepts
three URL parameters:

- `orderBy` String to order the results by. Possible values
  are `version`, `created`, `created_by`, `message`. Default
  is `versions`. Ordering is always in descending order.
- `limit` Maximum number of results to return
- `start` Position in results to start from

`GET "/api/dashboards/db/:dashboardId/versions/:id"`

Get an individual dashboard version by ID, for the given
dashboard ID.

`POST "/api/dashboards/db/:dashboardId/restore"`

Restore to the given dashboard version. Post body is of
content-type `application/json`, and must contain.

```json
{
  "dashboardId": <int>,
  "version": <int>
}
```

`GET "/api/dashboards/db/:dashboardId/compare/:versionA...:versionB"`

Compare two dashboard versions by ID for the given
dashboard ID, returning a JSON delta formatted
representation of the diff. The URL format follows
what GitHub does. For example, visiting
[/api/dashboards/db/18/compare/22...33](http://ec2-54-80-139-44.compute-1.amazonaws.com:3000/api/dashboards/db/18/compare/22...33)
will return the diff between versions 22 and 33 for
the dashboard ID 18.

Dependencies Added

- The Go package [gojsondiff](https://github.com/yudai/gojsondiff)
  was added and vendored.
2017-05-24 19:14:39 -04:00
Torkel Ödegaard 05772b30d7 feat(ux): completed work on getting started panel, #6466 2016-12-08 10:25:05 +01:00
Pavlos Daoglou 7f7f080ad8 [5443] Check if title is empty before save a new dashboard 2016-11-29 12:25:20 +02:00
bergquist 421c1eed82 fix(dashboard): fixes bug when saving dashboards 2016-11-24 11:22:13 +01:00
Carl Bergquist df2b2e3058 feat(alerting): validate alerts before saving dashboard (#6691)
ref #6576
2016-11-24 09:50:35 +01:00
bergquist 04f417a423 feat(alerting): enabled by default. configurable elert engine
closes #6210
2016-10-10 13:09:16 +02:00
Torkel Ödegaard b0fe69822a Merge branch 'master' into alerting
Conflicts:
	public/app/core/services/alert_srv.ts
	public/app/partials/confirm_modal.html
2016-07-18 18:22:35 +02:00
Torkel Ödegaard b2acac3a41 feat(apps): more polish on app dashboard save warning, #5529 2016-07-12 08:41:56 +02:00
Torkel Ödegaard d9096110f8 Merge branch 'master' into alerting
Conflicts:
	pkg/api/dashboard.go
	pkg/models/dashboards.go
	pkg/services/sqlstore/dashboard.go
2016-07-11 18:28:07 +02:00
Torkel Ödegaard 68a8d9bc91 feat(apps): more work on plugin dashboard sync 2016-07-08 13:41:46 +02:00
Torkel Ödegaard d44325affd feat(apps): progress on app dashboard imports 2016-07-08 09:35:06 +02:00
Torkel Ödegaard 2b4a9954b1 feat(alerting): progress on alerting UI and model, refactoring of dashboard parser and tests into extractor component, moved tests from sqlstore to alerting package 2016-06-11 10:13:33 +02:00
Torkel Ödegaard f36a44c49a Merge branch 'master' into alerting_definitions
Conflicts:
	conf/defaults.ini
	pkg/api/dashboard.go
2016-06-06 08:43:01 +02:00
Torkel Ödegaard 35a7a3a52b feat(instrumentation): added some more timers 2016-06-03 17:00:39 +02:00
Torkel Ödegaard e2c794ff31 feat(instrumentation): lots of refactoring to support tag based backend, #4696 2016-06-02 21:06:49 +02:00
bergquist a8ac37f517 feat(usage_metrics): add timer metrics 2016-06-01 15:04:58 +02:00
bergquist 1686d86c3b Merge branch 'master' into alerting_definitions 2016-05-30 08:26:08 +02:00
bergquist b2a4d8083e feat(alerting): add datasource ref to alert rule 2016-05-25 12:57:49 +02:00
bergquist 8c2b6b532d fix(preferences): fixes broken default home dashboard
closes #5167
2016-05-25 09:56:45 +02:00
Torkel Ödegaard c41c771e9a fix(home dashboard): fixed handling error when default dashboard is not found, fixes #5141 2016-05-24 07:39:58 +02:00
bergquist 45b2b4bc52 feat(alerting): add feature toggles for alerting functions 2016-05-23 08:00:42 +02:00
bergquist 7860a2a1b8 feat(alerting): make sure dashboard id exists 2016-04-20 09:55:32 +02:00
bergquist 91a1a823e2 feat(alerting): add basic tables for alerting definitions 2016-04-13 10:33:45 +02:00
Torkel Ödegaard ab1048b7ee feat(preferences): theme and home dashbord settings now work work on profile and org settings page 2016-04-02 13:54:06 -07:00
Torkel Ödegaard 38a10f8be4 progress 2016-04-01 17:34:30 -07:00
Torkel Ödegaard 7023dedc05 feat(preferences): refactoring PR #4399 2016-03-20 11:52:19 +01:00
utkarshcmu cb42cfc6af Removed unwanted api, moved logic into backend 2016-03-17 02:29:34 -07:00
utkarshcmu 66621d762e Added getDashboardSlugById api 2016-03-17 01:01:58 -07:00
Peggy Li 773a5631c5 Fix typo in function name 2016-02-29 10:52:57 -08:00
utkarshcmu 00a6efa15e Excluded total calculations from backend 2016-02-01 23:26:11 -08:00
utkarshcmu 972ac99b7c Added more metadata 2016-01-28 09:53:19 -08:00
utkarshcmu 58121d89fc Updated http_api docs 2016-01-27 22:02:33 -08:00
utkarshcmu 6a1192172d Api stores dashboard creator 2016-01-27 21:55:54 -08:00
utkarshcmu d8b90721b3 Able to display login Id of the user in Last Updated By 2015-12-18 03:38:49 -08:00
utkarshcmu af371249f9 Successfully displayed userdId in UI 2015-12-18 01:52:05 -08:00
utkarshcmu e0ffcda32e Added UI , DB settings 2015-12-18 00:20:23 -08:00
utkarshcmu 5559ad1238 Return correct updated+created timestamps to frontend 2015-11-21 05:03:00 -08:00
Torkel Ödegaard 09b3433e32 change(dashboards): made home dashboard and json file dashboards editable unless otherwise specified in json file, closes #2567 2015-10-26 18:54:32 +01:00
woodsaj 6488324cf1 enhance quota support.
now includes:
- perOrg (users, dashboards, datasources, api_keys)
- perUser (orgs)
- global (users, orgs, dashboards, datasources, api_keys, sessions)
2015-09-11 23:17:10 +08:00
woodsaj 852f9bd277 refactor quota settings 2015-09-11 01:47:33 +08:00
woodsaj 76e9ebde36 always return after errors. 2015-09-11 01:03:58 +08:00
woodsaj 0688050552 add quota middleware to enforce quotas. issue #321
Conflicts:
	pkg/api/api.go
2015-09-11 01:03:47 +08:00
Torkel Ödegaard fb7b475457 Backend: Load dashboards with capital letters in the dashboard url slug (url id), Fixes #2163 2015-06-19 14:42:55 -04:00
Torkel Ödegaard c709a28f02 More work on email and notification infra #1456 2015-06-05 08:15:38 +02:00
Torkel Ödegaard ff3843bc7f Roles: New user role that replaces the old role behavior, Closes #2088 2015-06-01 17:01:04 +02:00
Torkel Ödegaard 85c3a0aa14 Panel menu now hides edit actions for users with role Viewer, Closes #1826 2015-06-01 16:36:15 +02:00
Torkel Ödegaard 448a8b8d1c Major refactorings around searching, moved to seperate package, trying to move stuff out of models package, extend search support searching different types of entities and different types of dashboards, #960 2015-05-13 13:36:24 +02:00
Torkel Ödegaard bb7d79e6d2 Refactoring search to support more than just db dashboards 2015-05-13 10:45:53 +02:00
Torkel Ödegaard 187834b17c Trying to get dashboard loading and dashboard meta flags like canSave, canStar more managable 2015-05-13 09:58:45 +02:00
Torkel Ödegaard 35cc0a1cc0 Rewriting anb abstracting how dashboards are loaded, unifying db, json files, and script dashboards, #960 2015-05-12 17:39:56 +02:00
Torkel Ödegaard b3be51f17f Lots of work on search and dashboard loading, trying to generalize concepts and code, #960 2015-05-12 14:11:30 +02:00
Torkel Ödegaard e5c1169120 HTTP API: GET /api/dashboards/db/:slug response changed property to to match the POST request nameing, Fixes #1928 2015-05-04 08:36:44 +02:00
Torkel Ödegaard 73ee8a5985 HTTP API: fix for POST /api/dashboards/db returned 200 ok when dashboard was not found, Fixes #1929 2015-05-04 07:46:53 +02:00
Torkel Ödegaard d987532262 Added server metrics 2015-03-22 15:14:00 -04:00
Torkel Ödegaard 04d25dc58a Dashboard: When saving a dashboard and another user has made changes inbetween, the user is promted with a warning if he really wants to overwrite the other's changes, Closes #718 2015-03-02 22:24:01 +01:00
Torkel Ödegaard 26e4809e2e Big Backend Refatoring: Renamed Account -> Org 2015-02-23 20:07:49 +01:00
Torkel Ödegaard 727fc9d3a6 Updated search result view, removed delete link, added delete action from dashboard cogs dropdown 2015-02-07 20:25:53 +01:00
Torkel Ödegaard 10820f31c2 Changed go package path 2015-02-05 10:37:13 +01:00
Torkel Ödegaard 1ac3355b03 updated frontend with style changes 2015-02-03 22:06:07 +01:00
Torkel Ödegaard 42a5aefb23 Worked on home dashboard 2015-02-03 15:04:35 +01:00
Torkel Ödegaard ad3d15e28d Worked on dashboard starring and unstarring, renamed favorite model to star 2015-02-02 11:32:32 +01:00
Torkel Ödegaard 1d6413bfae More work on backend for user favorites 2015-01-29 12:10:34 +01:00
Torkel Ödegaard 90925273a0 User / Account model split, User and account now seperate entities, collaborators are now AccountUsers 2015-01-19 18:01:04 +01:00
Torkel Ödegaard 22156fe309 Big refactoring for context.User, and how current user info is fetching, now included collaborator role 2015-01-16 14:32:18 +01:00
Torkel Ödegaard 3226a3a58e Fixed hashing of passwords, Closes #3 2015-01-08 09:00:00 +01:00
Torkel Ödegaard 1ae52d2472 Dashboard search by tag, and tag cloud now works, god dam I hate SQL 2015-01-07 12:37:24 +01:00
Torkel Ödegaard bcdbec61d7 Dashboard search works better, tag cloud should be done soon 2015-01-06 18:39:26 +01:00
Torkel Ödegaard 0e3f91508e Added validation to stop duplicate dashboards with same name from being saved 2015-01-05 17:04:29 +01:00
Torkel Ödegaard 8faa806c90 Refactoring dashboard delete and search 2014-12-29 13:58:06 +01:00
Torkel Ödegaard 164d11c816 InfluxDB now works in proxy mode, influxdb username and password is added in the backend and never exposed to frontend, #8 2014-12-29 13:36:08 +01:00