Commit Graph

920 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 4ce0bf4d16 mysql: improved mysql data source, added test feature when adding data source, fixed cache issue 2017-05-11 10:50:24 +02:00
Daniel Lee 4a35126bf6 api: health check returns 503 if db is failing
ref #3302
2017-05-10 15:23:59 +02:00
Torkel Ödegaard b042c53980 ux: updated heatmap icon 2017-05-03 08:56:51 +02:00
Mitja Z c92d719a72 added support for listening on unix socket #4030 (#8221) 2017-04-27 08:54:21 +02:00
Torkel Ödegaard 19a04b7e4a change: minor change to health check api endpoint 2017-04-25 17:24:36 +02:00
Torkel Ödegaard f6f2d85aa7 change: minor change to health check api endpoint 2017-04-25 17:24:06 +02:00
Torkel Ödegaard 368e847d12 feat: added api health endpoint that does not require auth and never creates sessions, returns db status as well. #3302 2017-04-25 17:17:45 +02:00
Torkel Ödegaard b780415f25 fix: change to remember me cookie encoding 2017-04-25 15:33:15 +02:00
Daniel Lee aee4af2148 api: omit unused fields for /api/datasources
Fixes #7822
2017-04-25 15:23:36 +02:00
Torkel Ödegaard 87c978ebc9 fix: better error handling / messsage when testing email notification when stmp is not configured, fixes #8093 2017-04-25 13:16:41 +02:00
Dan Cech b489e93d94 Config Array Syntax (#8204)
* refactor util encryption library so it doesn't have to import log

* add util.SplitString to handle space and/or comma-separated config lines

* go fmt
2017-04-25 09:14:29 +02:00
Torkel Ödegaard c78c460f79 mysql: worked on mysql data soruce 2017-04-20 17:10:23 +02:00
Torkel Ödegaard dbe5480edc create annotations work 2017-04-14 11:41:02 +02:00
Torkel Ödegaard dbeeb32ab6 Merge branch 'master' into popover-forms 2017-04-13 16:22:08 +02:00
Torkel Ödegaard 593b2ef866 annotation: added region support to annoations 2017-04-12 16:26:34 +02:00
Torkel Ödegaard 0156a94a49 annotations: you can now read annoations via manually created annoation query 2017-04-12 15:46:41 +02:00
Torkel Ödegaard 8eb112d119 plugins: refactoring builtIn data source concept, now means data source plugins that you do not need to add via data sources page, that is automatically added as selectable data source, #8095 2017-04-12 08:23:44 +02:00
Torkel Ödegaard e80494390a Merge branch 'always_displayed_datasources' of https://github.com/ctide/grafana into ctide-always_displayed_datasources 2017-04-12 07:44:59 +02:00
Mitsuhiro Tanda d2bf2e86ed upgrade to aws-sdk-go v1.8.11 (#8091)
* upgrade to aws-sdk-go v1.8.11

* fix test
2017-04-12 06:40:44 +02:00
Chris Burkhart d12dc2bfa7 Add alwaysDisplayed option to datasource plugins, this will allow it to show up as an option to select when adding queries to a panel without actually adding it as a datasource. 2017-04-11 13:47:53 -07:00
Torkel Ödegaard 07466b6725 security: fixed returning info on weither user exists or not in password reset call, fixes #7619 2017-04-11 16:50:16 +02:00
Alexander Zobnin d553498a33 graph(add annotation): initial backend implementation #1286 2017-04-10 20:22:58 +03:00
Torkel Ödegaard 1cd632cc43 plugins: added state property to plugins 2017-04-07 12:00:03 +02:00
Torkel Ödegaard d6d2080f11 mysql: minor progress on response processing 2017-03-31 11:45:25 +02:00
Torkel Ödegaard bd4f073425 mysql: minor update 2017-03-30 20:23:40 +02:00
Torkel Ödegaard 8f90c6115d mysql: progress on mysql data source 2017-03-29 22:54:18 +02:00
Torkel Ödegaard 6965064ea9 Merge branch 'master' into sql-proxy 2017-03-29 16:40:14 +02:00
Seuf 319b8d8fca Configurable signout menu activation (#7968) 2017-03-29 11:33:28 +02:00
Daniel Lee beb85f413a oauth: delete session key instead of set to empty
Adds the Delete function to the Session wrapper so that the Macaron
function for deleting keys from a Session can be used.

https://go-macaron.com/docs/middlewares/session#implement-provider-interface
2017-03-23 15:26:13 +01:00
Daniel Lee 79cef75fed Merge pull request #7426 from Altoros/altoros/authorization-errors
Add common type for oauth authorization errors
2017-03-23 15:25:35 +01:00
gomlgs e99137598e Cloudwatch: Correctly obtain IAM roles within ECS container tasks. (#7892)
We now obtain credentials based on the container task's role
rather than just relying on the credentials of the enclosing
container instance.

Fixes #6700.
2017-03-22 07:15:19 +01:00
Torkel Ödegaard 970619ed52 Merge branch 'disable-login' 2017-03-20 11:18:41 +01:00
Mitsuhiro Tanda a67497e679 add new s3 metrics (#7846) 2017-03-20 09:09:08 +01:00
Dan Cech 737c29ec8c disable inviting new users to orgs if login form is disabled 2017-03-17 16:35:05 -04:00
Daniel Lee 9efb6e76e9 users: adds search and pagination (#7753)
ref #7469. Follow up change that adds proper paging with 50 results
per page as well as a search box to search by name, login or email.
2017-03-07 16:03:54 +01:00
Mitsuhiro Tanda b387a8759e use session.NewSession() (#7745) 2017-03-06 21:08:16 +01:00
bergquist 03354bc49a tech: replace context.TODO with background ctx 2017-02-24 09:20:28 +01:00
Daniel Lee 96a3ed0ac3 docs: new /api/users/search route
ref #7469. Description of new route that
adds paging for the users list.
2017-02-21 16:09:15 +01:00
bergquist 70b36a02af Revert "tech: use context package over xperimental version"
This reverts commit 99f1c30071.
2017-02-20 22:04:51 +01:00
bergquist 99f1c30071 tech: use context package over xperimental version 2017-02-20 21:44:15 +01:00
bergquist 5174d050f2 middlware: change org when url contains orgid
closes #6948
ref #1613
2017-02-17 15:02:14 +01:00
bergquist 12f1ea71fd chore: delete empty test 2017-02-17 12:07:46 +01:00
bergquist cf871b1284 http: close http server gracefully. 2017-02-17 10:33:47 +01:00
Roman Vynar 4fcd5eab29 Add advanced TLS settings to harden setup. (#7347)
* Hardcoded the most secured TLS options.
2017-02-15 14:29:20 +01:00
Torkel Ödegaard 902cf5f889 fix(): google analytics fix 2017-02-15 14:26:57 +01:00
Jan Garaj 79cd48f64c Cloudwatch AWS/SES metrics (#7568) 2017-02-15 08:12:24 +01:00
Daniel Lee 193d468ed3 admin: adds paging to global user list
Currently there is a limit of 1000 users in the global
user list. This change introduces paging so that an
admin can see all users and not just the first 1000.

Adds a new route to the api - /api/users/search that
returns a list of users and a total count. It takes
two parameters perpage and page that enable paging.

Fixes #7469
2017-02-13 12:59:36 +01:00
Carl Bergquist 7f4f38e773 Merge pull request #7519 from huydx/master
(feat) support datasource delete by name api
2017-02-10 15:53:34 +01:00
huydx 143cbe921f (feat) support datasource delete by name api 2017-02-10 23:30:14 +09:00