Commit Graph

40 Commits

Author SHA1 Message Date
Torkel Ödegaard
e85a3f1d04 fix redirect issue, caused by timing of events between angular location change and redux state changes 2018-11-16 11:29:32 +01:00
Andrzej Ressel
9d5ccaef54
Merge branch 'master' into feature/save_json 2018-04-22 21:24:52 +02:00
Andrzej Ressel
dc11f1da81 Make dashboard JSON editable 2018-04-08 20:00:18 +02:00
Marcus Efraimsson
bcdb3ec84d provisioning: ux fixes when saving provisioned dashboards
Wider modal.
Tried to improve provisioning description text.
Code editor for json.
Button that allows to save the json to a file.
2018-04-05 20:28:04 +02:00
bergquist
d6faa3d06f provisioning: improve UX when saving provisioned dashboards 2018-03-26 15:08:46 +02:00
Marcus Efraimsson
bb7a6718f1 Fix save as dashboard from folder to General folder (#10988)
* dashboards: fix save as dashboard from folder to general folder

* dashboards: disable save button in save dashboard as dialog when creating a new folder
2018-02-22 10:52:21 +01:00
Torkel Ödegaard
2e9433c495 fix: fixed redirect after save, fixes #10946 2018-02-16 16:29:14 +01:00
Marcus Efraimsson
0e8377a9f4 Update logic for create/update dashboard, validation and plugin dashboard links (#10809)
* enables overwrite if dashboard allready exist in folder

* dashboard: Don't allow creating a folder named General

* dashboards: update logic for save/update dashboard

No id and uid creates a new dashboard/folder.
No id and uid, with an existing title in folder allows overwrite
  of dashboard.
Id without uid, allows update of existing dashboard/folder without
  overwrite.
Uid without id allows update of existing dashboard/folder without
  overwrite.
Id without uid, with an existing title in folder allows overwrite
  of dashboard/folder and updated will have the uid of overwritten.
Uid without id, with an existing title in folder allows overwrite
  of dashboard/folder and new will have the same uid as provided.
Trying to change an existing folder to a dashboard yields error.
Trying to change an existing dashboard to a folder yields error.

* dashboards: include folder id when confirmed to save with overwrite

* dashboards: fixes due to new url structure

Return importedUrl property in response to importing dashboards and
getting plugin dashboards and use this for redirects/links in the
frontend.
2018-02-08 12:48:38 +01:00
Torkel Ödegaard
541b0a0ca1 fix: fixed bug with redirect after new dashboard saved, related to buggy angularjs location path/url and base href, fixes #10817 2018-02-07 14:10:23 +01:00
Marcus Efraimsson
b135df9a6c Merge remote-tracking branch 'upstream/master' into 7883_new_url_structure 2018-02-01 10:48:06 +01:00
Marcus Efraimsson
8009307c16 dashboards: when saving dashboard redirect if url changes
Redirect if new dashboard created or existing url changes.
#7883
2018-01-31 00:32:51 +01:00
Daniel Lee
bc5fae5367 dashfolders: merge conflict 2018-01-25 14:54:50 +01:00
Daniel Lee
f443cb8229 dashfolders: fix bug in save as modal 2018-01-20 01:58:28 +01:00
Torkel Ödegaard
42d7308034 fix: save as enter key now works and folder selection also works, fixes #10464 2018-01-16 12:50:24 +01:00
Alexander Zobnin
77843623b2 don't save dashboard on make editable, #10236 2017-12-27 09:49:12 +01:00
Torkel Ödegaard
3a1f52d8a2 prettier: ran on all files again, sorry. now settings are defined in package.json 2017-12-21 08:39:31 +01:00
Marcus Efraimsson
d41ce4f9ca Various dashboard folders improvements (#10309)
* dashfolders: fix url for create dashboard from manage dashboards

Don't include folderId querystring if you don't manage a folder and
creating a new dashboard from there.

* dashfolders: don't store folderId in dashboard model

Use folderId from meta instead
#10307

* dashfolders: minor ux fix

* dashfolders: minor fix for edit folder title
2017-12-20 21:17:55 +01:00
Torkel Ödegaard
85879a7014 prettier: change to single quoting 2017-12-20 12:33:33 +01:00
Torkel Ödegaard
fadfc665e4 tech: ran pretttier on all typescript files 2017-12-19 16:06:54 +01:00
Torkel Ödegaard
0e44fe082b Merge branch 'master' into develop 2017-11-17 15:49:17 +01:00
Patrick O'Carroll
d800e64368 fixes: #1871 Dropdown starred (#9490)
adding the ability to star dashboard in search and dashboard-list

closes #1871
2017-11-15 15:01:44 +01:00
Torkel Ödegaard
215d59865e changed name back to use underscore instead of camelcase, need to think more about this 2017-10-12 20:02:07 +02:00
Torkel Ödegaard
087b55aece newgrid: progress on fullscreen/edit view modes 2017-10-11 11:42:49 +02:00
Torkel Ödegaard
18337f610d Merge branch 'master' into develop 2017-09-22 08:42:07 +02:00
Torkel Ödegaard
b8d9722b4f tech: removing unused variables from typescript files, and making tslint rules more strict 2017-09-21 16:40:18 +02:00
Torkel Ödegaard
a9e3130ef6 Merge branch 'master' into develop 2017-09-13 16:06:34 +02:00
Torkel Ödegaard
f6100dd8eb ux: success/error alerts refactoring, #9214 2017-09-12 09:05:32 +02: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
7381d2565d WIP: adds folder-picker to save as dialog 2017-06-12 15:49:09 +02:00
Torkel Ödegaard
c4e872b9da dashboard_history: minor changes and fixes 2017-06-06 16:27:28 +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
Torkel Ödegaard
fdfcd5cbf0 refactoring:: dashboard save modal and save as modal needed an update 2017-06-05 14:56:11 +02: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
b45bd07032 ux(dashboard): when saving dashbord with default new dashboard title show Save As Dialog, #6099 2016-10-25 11:11:21 +02:00
Torkel Ödegaard
42961ef8a0 fix(dashbard): fixed issue confirmig when saving a dashboard with conflict 2016-10-22 12:34:18 +02:00
Torkel Ödegaard
30645a6d3d refactor(alerting): initial step for seperating alerting and dash model, #6273 2016-10-14 13:06:29 +02:00
Torkel Ödegaard
73fc659011 fix(graph): fixed issue with old threshold to new threshold model migration, fixes #6236 2016-10-11 13:22:46 +02:00
Torkel Ödegaard
22e8885690 feat(testdata): progress on test data stuff 2016-09-27 18:36:00 +02:00
Torkel Ödegaard
5ded88fa4d feat(templating): progress on variable system refactoring, #6048 2016-09-19 11:34:08 +02:00
Torkel Ödegaard
524f505664 tech(templating): refactoring, updated dashboardSrv to typescript 2016-09-19 10:08:05 +02:00