Commit Graph

10641 Commits

Author SHA1 Message Date
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
d1d47b5697 docs: updated changelog with fix for InfluxDB query issue, #8459 2017-05-24 16:49:30 +02:00
Torkel Ödegaard
90871ca12e Merge branch 'v4.3.x' 2017-05-24 16:48:05 +02:00
Torkel Ödegaard
896f849b84 fix: influxdb query editor did no show alias by input field when in text editor mode, fixes #8459 2017-05-24 16:47:38 +02:00
Dhia
ac28c4b233 add Referer header to logs. This is useful to link datasource requests to dashboard that originated it (#8399) 2017-05-24 13:47:29 +02:00
Torkel Ödegaard
8b7a0100b1 docs: updated changelog with info on merged PR #8405 2017-05-24 13:46:33 +02:00
Torkel Ödegaard
dcf7385cc1 sensu: added input tooltip to source property 2017-05-24 13:44:38 +02:00
joe miller
090594a0bc support setting the source and handler attribute in sensu notifications (#8405)
* support setting the handler attribute in sensu alert notifications

* allow the user to set the source attribute of Sensu notifications
2017-05-24 13:42:24 +02:00
Dan Cech
007c08f2a8 remove X-Forwarded-* headers added by nginx when proxying data source & plugin requests (#8418)
* remove X-Forwarded-* headers added by nginx when proxying data source & plugin requests

* properly handle X-Forwarded-For
2017-05-24 13:39:40 +02:00
Daniel Parks
2d29d7b3d6 Add support for AWS DMS CloudWatch metric (#8458) 2017-05-24 13:24:24 +02:00
Torkel Ödegaard
3133721422 docs: update changelog 2017-05-24 13:23:11 +02:00
Torkel Ödegaard
28bff0c1f3 Merge branch 'v4.3.x' 2017-05-24 13:22:09 +02:00
Torkel Ödegaard
b17a1ed557 playlist: fixed dashboard play ordering, fixes #7688 2017-05-24 13:21:43 +02:00
Torkel Ödegaard
e6d79dfedf docs: updated changelog 2017-05-24 11:23:41 +02:00
Torkel Ödegaard
5740702cb5 Merge branch 'master' of github.com:grafana/grafana 2017-05-24 11:21:17 +02:00
Torkel Ödegaard
a5318def66 Merge branch 'v4.3.x' 2017-05-24 11:20:35 +02:00
Torkel Ödegaard
634ee0f9fa fix: graphg panel logarithmic scale goes blow x-axis, fixes #8244 2017-05-24 11:20:07 +02:00
Prasanna Gautam
6541ffe045 minor change: more accurate variable name (#8449) 2017-05-24 08:38:13 +02:00
Torkel Ödegaard
12c8bf9b18 Update CHANGELOG.md 2017-05-23 16:45:15 +02:00
Torkel Ödegaard
d4048e1423 docs: updated download links 2017-05-23 16:18:37 +02:00
Torkel Ödegaard
6257fbced6 docs: updated changelog 2017-05-23 15:54:44 +02:00
Torkel Ödegaard
330cb92b24 Merge branch 'v4.3.x' 2017-05-23 15:52:24 +02:00
Torkel Ödegaard
befc15c5a1 fix: s3 image uploads to us-east-1 (us standard) did not return correct image urls so images shared to slack and other services was not correct, fixes #8444 2017-05-23 15:50:22 +02:00
Torkel Ödegaard
3695337980 refactoring: Elasticearch filter label PR #8420 2017-05-23 15:14:23 +02:00
Torkel Ödegaard
648e8a9547 Merge branch 'master' of https://github.com/limefamily/grafana into limefamily-master 2017-05-23 14:48:14 +02:00
Torkel Ödegaard
1e3a42ca68 packaging: added rpm fonts to rpm package dependencies (#8442) 2017-05-23 13:53:03 +02:00
Torkel Ödegaard
21e61319f1 Merge branch 'master' of github.com:grafana/grafana 2017-05-23 13:52:24 +02:00
Torkel Ödegaard
48fdfe721e build: updated master version to 4.4.0-pre1 2017-05-23 13:52:07 +02:00
Torkel Ödegaard
423ad4d36e docs: updated docs 2017-05-23 12:45:15 +02:00
Torkel Ödegaard
bd8a0be3aa Update CHANGELOG.md 2017-05-23 12:26:30 +02:00
Torkel Ödegaard
d9c6f7a141 release: bumped version to 4.3.0 2017-05-23 11:14:53 +02:00
Torkel Ödegaard
044668a395 login: minor fix to login page 2017-05-23 11:10:16 +02:00
Torkel Ödegaard
90dbd4978b Merge branch 'master' of github.com:grafana/grafana 2017-05-23 10:56:37 +02:00
Torkel Ödegaard
359421b5e8 refactor: sqlstore inTransaction consolidated to one version, fixes #8376 2017-05-23 10:56:23 +02:00
Daniel Lee
73cb035231 mysql: annotation support. Fixes #8382
Simple query editor - a text area with a Show Help section.
Validation for empty query and if the time_sec column is missing.
2017-05-23 09:53:20 +02:00
Matt Toback
d47078e27f 2017! 2017-05-22 17:29:24 -04:00
Torkel Ödegaard
5e33b5fcfa docs: updated changelog 2017-05-22 15:39:46 +02:00
Torkel Ödegaard
c34db77f04 grafana_com: changed name of oauth grafana_net integration (old settings names still work), and updated login button look, closes #8415 2017-05-22 14:56:50 +02:00
Torkel Ödegaard
7c50563f0f fix: fixed crash when gzip was enabled 2017-05-22 14:09:54 +02:00
Torkel Ödegaard
a64c06d02c mysql: add user permission notice mysql config view, closes #8359 2017-05-22 13:53:43 +02:00
Torkel Ödegaard
966cefc8d0 docs: updated changelog 2017-05-22 13:04:59 +02:00
Torkel Ödegaard
a0b9dcad4d alert: alerting annotation improvements, fixes #8421 2017-05-22 13:02:49 +02:00
Torkel Ödegaard
370db82238 docs: updated changelog 2017-05-22 10:55:22 +02:00
Torkel Ödegaard
20e631a22d fix: All alert annotations showed up in unsaved/new dashboards graph panels with alert, fixes #8361 2017-05-22 10:49:26 +02:00
Junliang Huang
6d3246e39e docs(readme): remove dev.ini reference (#8419)
remove dev.ini reference as it seems not working anymore.
2017-05-21 10:07:21 +02:00
Joe Handzik
d4264cbfc2 Make location for plugins consistent (#8429)
Please let me know if this changed in a more recent version of Grafana, but when using 4.2.0 the manual install directions were off a little (there was no `data/plugins` directory, only a `plugins` directory).

Signed-Off-By: Joe Handzik <joseph.t.handzik@hpe.com>
2017-05-21 10:03:57 +02:00
Dave Scott
f7215608e9 Update VictorOps notifier w/ auto resolve and image URL (#8431)
* Fixed newline JSON buy in VictorOps integration

* Fixed payload sent to VictorOps so that link displays correctly

* Fixed formatted to resolve go error

* Add auto resolve incidents and image URL to VictorOps notifier
2017-05-21 10:02:48 +02:00
Torkel Ödegaard
7cb6466251 feat: query troubleshooter, improving json explorer 2017-05-20 23:43:59 +02:00
Torkel Ödegaard
d840645dd7 feat: metrics tab, minor change 2017-05-20 23:03:04 +02:00
Torkel Ödegaard
a8673a2e33 feat: metrics tab 2017-05-20 22:41:34 +02:00