Commit Graph

58 Commits

Author SHA1 Message Date
Daniel Lee c602afb9c6 WIP: dashboard search by folder + toggle for list or tree mode 2017-06-12 15:49:09 +02:00
Daniel Lee 6c736e002a WIP: add dummy root folder to folder picker
Can move a dash from a folder back to root level as well
2017-06-12 15:49:09 +02:00
Daniel Lee 68b9342de3 WIP: dashboard search by type (folder or dash) 2017-06-12 15:49:09 +02:00
Daniel Lee 53d11d50fc WIP: remove browse mode for dashboard search
Dashboard folders included in all searches. If a dashboard matches
a search and has a parent folder then the parent folder is appended
to the search result. A hierarchy is then returned in the result
with child dashboards under their parent folders.
2017-06-12 15:49:09 +02:00
Daniel Lee 1248728d7f WIP: rough prototype of dashboard folders
Breaks some stuff like selected dash in the search result.
In dashboard search, if the user is not searching then the result is
returned as a tree structure. No ACL's or user group ux yet.
2017-06-12 15:49:09 +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 5409f4c0eb dashboard_history: fixed issue with save as & overwrite 2017-06-06 14:39:57 +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 f18ebea03e fix: dashboard save modals had double submit on enter after my refactoring this morning 2017-06-05 18:01:16 +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 e6616cc551 Merge pull request #10 from walmartlabs/version-control
History and Version Control for Dashboard Updates
2017-05-25 14:50:47 -07: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 359421b5e8 refactor: sqlstore inTransaction consolidated to one version, fixes #8376 2017-05-23 10:56:23 +02:00
utkarshcmu c737704eeb Removed playlist item when dashboard is deleted 2016-11-06 01:49:43 -08: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
bergquist 48e1a17ac2 feat(alerting): remove dummie values from email notifier 2016-06-23 16:30:12 +02:00
bergquist dd8c3d0355 Merge branch 'master' into alerting 2016-06-20 10:44:48 +02:00
Torkel Ödegaard 10daf1d63a Revert "Enable the "limit" param in /api/search"
This reverts commit 3d77685108.
2016-06-17 11:22:39 +02:00
Torkel Ödegaard dee5f582d7 Merge branch 'master' into alerting_definitions 2016-06-09 10:45:16 +02:00
Thibault Chataigner 3d77685108 Enable the "limit" param in /api/search 2016-06-06 16:15:20 +00:00
bergquist 3ef2be13df feat(alerting): move alert deletion to alert code 2016-04-26 15:48:29 +02:00
bergquist c83af353b2 feat(alerting): renames alert table to alert_rule 2016-04-25 14:42:24 +02:00
bergquist bdd3e2ad73 Merge branch 'master' into alerting_definitions 2016-04-25 11:22:35 +02:00
Torkel Ödegaard 97656d65ec db(dashboard): minor fix for dashboard delete 2016-04-25 11:22:13 +02:00
bergquist 03e6fc951f feat(alerting): delete alerts when dashboard gets deleted 2016-04-23 14:14:18 +02:00
Torkel Ödegaard 7023dedc05 feat(preferences): refactoring PR #4399 2016-03-20 11:52:19 +01:00
utkarshcmu 66621d762e Added getDashboardSlugById api 2016-03-17 01:01:58 -07:00
Torkel Ödegaard 0398face05 feat(plugins): dashboard import for data sources is working! #4298 2016-03-12 10:13:49 +01:00
bergquist 435d0f22f5 fix(dashlist): better handling of invalid dashboard ids 2016-03-07 11:04:02 +01:00
bergquist dd7e215e78 feat(dashslist): make sure dashbords exists in recently viewd dashboards
closes #4249
2016-03-05 12:27:37 +01:00
bergquist d27bb4d3fb style(playlist): move dashboard access to dashboard.go 2016-01-29 01:41:23 +01:00
Torkel Ödegaard e6d09b3266 fix(db): remove stars and tags when removing user or dashboard, fixes #2016 2015-08-12 09:23:46 +02:00
Torkel Ödegaard 835fd383ad fix(postgres): Dashboard search is now case insensitive when using Postgres, fixes #1896 2015-08-10 20:25:01 +02:00
Torkel Ödegaard c709a28f02 More work on email and notification infra #1456 2015-06-05 08:15:38 +02:00
Torkel Ödegaard 50a1feb90a Dashboard list panel: Now supports search by multiple tags, Closes #2096 2015-06-02 11:04:06 +02:00
Torkel Ödegaard dc607b8e8a Dashboard search now supports filtering by multiple dashboard tags, Closes #2095 2015-06-02 10:24:20 +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 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 38d851eb98 Another HTTP API fix 2015-05-04 08:19:29 +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 3c2bfbfc1c Search: Dashboard results should be sorted alphabetically, Fixes #1685 2015-03-31 22:06:19 +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 3f96afba73 Merge branch 'fixDashboardDelete' of https://github.com/raintank/grafana into raintank-fixDashboardDelete
Conflicts:
	pkg/services/sqlstore/dashboard.go
2015-02-25 14:31:44 +01:00
Anthony Woods b9b63f695d fixes #1518 fix table name used in dashboard delete. 2015-02-24 08:56:10 +00:00
Torkel Ödegaard 26e4809e2e Big Backend Refatoring: Renamed Account -> Org 2015-02-23 20:07:49 +01:00