Commit Graph

895 Commits

Author SHA1 Message Date
Torkel Ödegaard
723f5bc9e8 fix: dsahboard_version data column type changed to MEDIUMTEXT, fixes #8813 2017-07-24 12:30:13 +02:00
Daniel Lee
16cda723d3 migrations: dashboard version migration handles nulls
If a dashboard has a null value for updated_by then the migration
for the dashboard version table fails. This change uses coalesce to
set -1 instead of null when inserting into the created_by column
which has a non-null constraint. Fixes #8783.
2017-07-05 22:06:00 +02:00
Liang Jiameng
109fd998ed Add a new notifier : DingTalk (#8473)
* add alerting notifier: DingDing

* add alerting notifier: DingDing

* add dingding unit test

* add dingding unit test

* delete debug code & format code style.

* fix build failed: dingding_test.go
2017-07-04 15:16:32 +02:00
Daniel Lee
b8aa203707 signup: fix email sent logic for tempuser
Fixes #8656 and properly sets the email_sent and email_sent_on fields
for a tempuser (signup user).
2017-06-30 20:21:08 +02:00
Torkel Ödegaard
08b37186a5 fix: fixed failing sql unit test 2017-06-07 15:42:48 +02:00
Torkel Ödegaard
e7e675e471 Merge branch 'walmartlabs-master' (Dashboard History Feature, #8472) 2017-06-07 14:30:03 +02:00
Torkel Ödegaard
391dc1e225 dasboard_history: fixed sql integration test 2017-06-07 14:25:46 +02:00
Torkel Ödegaard
46412c8475 dasboard_history: security fix, added orgId filter to dashboard version lookup 2017-06-07 14:21:40 +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
e2061312f5 refactoring: moved compare dashboard version command out of sqlstore, the code in this command did not use any sql operations and was more high level, could be moved out and use existing queries to get the versions 2017-06-06 00:15:40 +02:00
Torkel Ödegaard
746d6cdc88 refactoring: changed name on compare command to make properties more explainatory 2017-06-05 23:29:25 +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
82d4d54dc5 refactoring: fixed broken unit test in last commit 2017-06-05 17:51:51 +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
c296ae1178 refactoring: fixing unit tests broken in last commit 2017-06-05 16:52:36 +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
Anton Yackushev
bab21c9069 misspell: Corrected some misspelled words 2017-06-05 15:20:34 +03:00
Torkel Ödegaard
f3980504e2 Merge branch 'master' into walmartlabs-master 2017-06-05 13:43:00 +02:00
Dan Cech
f224fd8310 reduce length of dashboard columns used in compound indexes (#8507) 2017-06-04 14:28:03 +02:00
sanchitraizada
77c046aac6 Implement review feedback 2017-06-01 17:57:09 -04:00
Dan Cech
c0d5b61403 tweak column lengths for utf8mb4 support on older mysql (#8483) 2017-05-29 08:31:36 +02:00
Ben Tranter
a927b893ae Use DBSession for getMaxVersion 2017-05-25 23:04:00 -04: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
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
Torkel Ödegaard
b17a1ed557 playlist: fixed dashboard play ordering, fixes #7688 2017-05-24 13:21:43 +02:00
Torkel Ödegaard
359421b5e8 refactor: sqlstore inTransaction consolidated to one version, fixes #8376 2017-05-23 10:56:23 +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
43d5525aaa Merge branch 'master' into alert_state 2017-05-18 13:38:34 +02:00
Dan Cech
9dc220b8e2 include error message in email notification (#8392) 2017-05-17 09:51:51 +02:00
Torkel Ödegaard
f84dc24fcb alerting: improving and fixing alert history, #7257 2017-05-15 16:17:05 +02:00
Torkel Ödegaard
f697f81950 sqlite: fixed database table looked handling, now retries up to 5 times, fixes #7992 2017-05-15 12:19:19 +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
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
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
b22b3e5bb9 mysql: added default query template 2017-04-21 16:28:01 +02:00
Daniel Lee
ee3a553800 Merge pull request #8163 from bashgeek/telegram_metrics
Add metrics/matches to Telegram notifications (proposed fix for #8110)
2017-04-19 15:03:03 +02:00
Daniel Schmitz
d123b951e9 Fixed parsing error 2017-04-19 17:02:52 +08:00
Torkel Ödegaard
e164eba677 mysql: began work on backend macro engine 2017-04-19 10:10:08 +02:00
Daniel Schmitz
7078d5d524 Added metrics/matches to telegram notifications; Added some HTML to beautify 2017-04-19 15:53:23 +08:00
Torkel Ödegaard
0bae7212f6 annotations: removed category stuff, my mistake, we need tags 2017-04-18 17:15:22 +02:00
Alexander Zobnin
7aa992bde4 initial category types 2017-04-17 18:56:39 +03:00
Alexander Zobnin
f0816b37bd rename annotation_category to category 2017-04-17 18:53:10 +03:00
Torkel Ödegaard
60ef7d8768 Merge branch 'master' into create-annotations 2017-04-14 22:36:34 +02:00
Dan Cech
f490c5f12c use X-Grafana-Org-Id header to ensure backend uses correct org (#8122) 2017-04-14 15:47:39 +02:00
Alexander Zobnin
ab99a7c1c7 graph(create annotation): add initial annotation_category table 2017-04-13 16:57:22 +03:00