Commit Graph

3957 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
8918922179 alerting: fixed issue with included alerting error & no data reasons, fixes #8412 2017-05-18 14:10:12 +02:00
Torkel Ödegaard
43d5525aaa Merge branch 'master' into alert_state 2017-05-18 13:38:34 +02:00
Daniel Lee
4182acda58 Merge pull request #8332 from sliceratwork/master
upgrade to Font Awesome 4.7.0
2017-05-17 14:58:14 +02:00
Daniel Lee
540ee35393 timerange: new quick ranges, month and year so far
The new time ranges can also be used for time range overrides in the
override relative time field. E.g. now/M or now/y.
2017-05-17 13:52:39 +02:00
Daniel Lee
e61b392916 core: fix linting errors in specs files 2017-05-17 13:47:44 +02:00
Torkel Ödegaard
87f5222907 typescript: fixed issue with tslint in testsW 2017-05-17 13:43:17 +02:00
Torkel Ödegaard
d261f33c3d influxdb: influxdb query editor changes 2017-05-17 13:27:56 +02:00
Torkel Ödegaard
972be88569 fix: singlestat gauge sizing issue when panel is very wide, fixes #7773 2017-05-17 11:56:40 +02:00
Torkel Ödegaard
fc146fe54e Merge branch 'master' of github.com:grafana/grafana 2017-05-17 11:33:24 +02:00
Torkel Ödegaard
8e03f321eb fix: Elasticsearch table aggregation and support for many aggregations of same type, now uses field name if more than 1 aggregation of same type, fixes #4709 2017-05-17 11:33:08 +02:00
Dan Cech
9dc220b8e2 include error message in email notification (#8392) 2017-05-17 09:51:51 +02:00
Torkel Ödegaard
02c79a6389 influxdb: improvements to influxdb query editor, SLIMIT, LIMIT and ORDER BY now added on demand by plus button 2017-05-16 16:28:58 +02:00
Torkel Ödegaard
8b11712f5e fix: Graphite issue with toggle edit mode in query editor, fixes #8377 2017-05-16 14:29:30 +02:00
Torkel Ödegaard
f84dc24fcb alerting: improving and fixing alert history, #7257 2017-05-15 16:17:05 +02:00
Konstantin Koniev
9566197620 Internationalise keybindings. (#8311) 2017-05-12 14:59:56 +02:00
Torkel Ödegaard
910e54d75e Merge branch 'master' of github.com:grafana/grafana 2017-05-11 16:31:31 +02:00
Torkel Ödegaard
2e7ac8f2da heatmap: fix for unit options width 2017-05-11 15:20:13 +02:00
Mitsuhiro Tanda
5e85558e9e (prometheus) fix graph link (#8349) 2017-05-11 14:24:13 +02:00
Torkel Ödegaard
f976e465c4 mysql: minor improvement for table panel 2017-05-11 11:06:13 +02:00
Torkel Ödegaard
4ce0bf4d16 mysql: improved mysql data source, added test feature when adding data source, fixed cache issue 2017-05-11 10:50:24 +02:00
Torkel Ödegaard
ab6740c685 heatmap: Docs and heatmap fixes 2017-05-11 10:19:47 +02:00
Torkel Ödegaard
30b6c3b54a build: fixed heatmap test 2017-05-11 08:56:32 +02:00
Suzana Pescador
8c9cc4fae1 [Bug] Coloring Background on siglestat panel #7242 (#8334)
The bug was happening because the background color was being based on
the rounded value (accounting the user defined decimals). Changed it to
use the pure value (not the rounded) to follow whats being done in the
value color, and also in the table thresholds (they don't consider the
decimals when comparing to thresholds).
2017-05-10 20:02:35 +02:00
Torkel Ödegaard
1d4338ba54 Merge branch 'master' of github.com:grafana/grafana 2017-05-10 17:19:03 +02:00
Torkel Ödegaard
0a68dabb89 heatmap: Fixes & progress on heatmap docs 2017-05-10 17:17:51 +02:00
Suzana Pescador
d6eefcb5ce Can't remove default avg column in table #4515 (#8335)
Avg column was being added at every rendering, if the table was empty.
Now the column will be added once as an initialization when selecting a
'timeseries_aggregations' transform.
2017-05-10 15:51:34 +02:00
Torkel Ödegaard
d791f902e9 heatmap: more refactoring 2017-05-10 13:05:26 +02:00
Andrei Stefan
b054b1faac upgrade to Font Awesome 4.7.0 2017-05-10 09:28:00 +03:00
Torkel Ödegaard
acff78d421 Merge branch 'master' into heatmap-refactoring2 2017-05-09 12:41:11 +02:00
Torkel Ödegaard
8bbff2c44e table: refactoring table options, now column styles are in a seperate tab 2017-05-09 12:35:44 +02:00
Torkel Ödegaard
e218052a90 fix: fixed slow down issue in table panel by removing the fillter null values feature (#7602), not sure the filter null values is a good table option, should be done in metric query, fixes #8234 2017-05-09 12:07:06 +02:00
Torkel Ödegaard
79120a0b1f Merge branch 'master' of github.com:grafana/grafana 2017-05-09 08:33:43 +02:00
Torkel Ödegaard
8d072de556 elasticsearch: changed default terms min_doc_count to 1 and order by to desc, closes #8231 2017-05-09 08:33:37 +02:00
Anton Yackushev
fdc97010b4 Rename fielddata_fields to docvalue_fields (#8317)
The parameter fielddata_fields is deprecated and removed in 5.0 https://github.com/elastic/elasticsearch/issues/19027
2017-05-09 07:16:48 +02:00
Torkel Ödegaard
25a267a7ab fix: segment used influxdb naming for variable in options callback, should be more generic 2017-05-08 16:08:53 +02:00
Torkel Ödegaard
f168c9e53d table: minor ux options update 2017-05-08 15:57:15 +02:00
Torkel Ödegaard
076a94560b Merge branch 'table-options' 2017-05-08 15:31:29 +02:00
Torkel Ödegaard
be284adacc table: more table options refactoring 2017-05-08 15:26:05 +02:00
Torkel Ödegaard
556829eda9 table: began table options redesign 2017-05-08 11:17:29 +02:00
lpavlovi
c323d2fc4c Removed panelElemName - appears to not be used anywhere (#8313) 2017-05-07 08:19:08 +02:00
Dan Cech
e8fbfce59a remove unneeded import, update docs text 2017-05-05 13:11:44 -04:00
Dan Cech
0f24b45c1a Merge branch 'master' into table-col-alias 2017-05-05 12:41:35 -04:00
Dan Cech
29653d2bec refactor and add column alias tests 2017-05-05 12:40:49 -04:00
Torkel Ödegaard
fbf39598b8 heatmp: removed series stats option, lacked tests 2017-05-05 17:33:54 +02:00
Torkel Ödegaard
ece21b2d95 heatmap: more refactoring 2017-05-05 17:28:33 +02:00
Torkel Ödegaard
dd5a426911 heatmap: refactoring heatmap 2017-05-05 16:15:08 +02:00
Torkel Ödegaard
43c6f74904 heatmap: removed fill background, and highlight card options 2017-05-05 12:33:04 +02:00
Torkel Ödegaard
4412e41738 ux: updated heatmap and alertlist icons 2017-05-05 11:43:42 +02:00
Torkel Ödegaard
5c9810fba4 docs: added in app docs & links to annotation docs 2017-05-05 11:30:44 +02:00