Commit Graph

182 Commits

Author SHA1 Message Date
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