Commit Graph

66 Commits

Author SHA1 Message Date
Konstantin Chukhlomin
1188f8df73 gofmt fixes 2017-09-15 16:11:02 +02:00
Konstantin Chukhlomin
72d7c4d620 Added GCS support #8370 2017-09-15 16:11:02 +02:00
wangguoliang
652fce7e76 Optimize some wrong usage and spelling
Signed-off-by: wgliang <liangcszzu@163.com>
2017-09-07 17:50:11 +08:00
Torkel Ödegaard
34cda65998 fix: png rendering api & timeout parameter now works as it should AND default render timeout increased from 30 to 60 seconds, fixes #8710 2017-07-31 16:04:04 +02:00
Ben Tranter
1fd7b60efe Add more information to basic diff logic 2017-06-29 14:38:48 -04:00
Ben Tranter
a3d22ae9c7 Document logic behind basic diff 2017-06-22 18:23:31 -04:00
Ben Tranter
b54b43a42e Add tests for diff formatters 2017-06-22 18:08:37 -04: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
577dfee086 dasboard_history: fixed json diff so only dashbord is compared and not the whole dashboard revision object (message and restoreFrom etc was showing up in json diff) 2017-06-07 13:36:03 +02:00
Torkel Ödegaard
8f6c9c5946 dasboard_history: some polish around styles & diff colors, and minor fixes 2017-06-07 12:39:06 +02:00
Torkel Ödegaard
ef1dfed0d8 dasboard_history: big refactoring of how the compare api looked, now a POST with a model for new & base version, refactored a simplified UI code as well, this was done to lay foundation to make it possible to do diff against current in browser unsaved version 2017-06-07 11:50:09 +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
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
befc15c5a1 fix: s3 image uploads to us-east-1 (us standard) did not return correct image urls so images shared to slack and other services was not correct, fixes #8444 2017-05-23 15:50:22 +02:00
berghauz
48cf58e739 Indenting fix 2017-05-17 03:58:18 +03:00
berghauz
c713bd9a9a Proxy support added, fixes #7922
Well, i'm really want to see it working in 4.3.0
2017-05-17 02:50:56 +03:00
rogerswingle
02455753b5 Specify region for s3 (#8251) 2017-05-01 19:22:20 +02:00
Daniel Lee
6538e86793 webdav: add tests + path.join for public url param
Fixes #7914. Fixes #7921
2017-04-25 17:22:18 +02:00
fir4
6d9e8bd147 webdav: allow specification of a different public_url than upload url 2017-04-25 17:22:18 +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
be5c4f47a6 s3: support for alternative s3 bucket url syntax, closes #7871 2017-03-20 14:10:44 +01:00
Mitsuhiro Tanda
b387a8759e use session.NewSession() (#7745) 2017-03-06 21:08:16 +01:00
bergquist
05952688c5 tech: avoid using http.DefaultClient 2017-02-24 17:22:12 +01:00
Torkel Ödegaard
1a9aaa4138 feat(server side png rendering): added timezone parameter for server side rendering, refactoring PR #7264 2017-01-31 07:48:10 +01:00
Ryuichi Sakai
1bc55a2d38 Enable image rendering to use browser time offset 2017-01-15 22:01:28 +09:00
Torkel Ödegaard
d354f3a8af fix(alerting): fixed evaluation for no_value condition, fixes #7244 (#7247)
* fix(alerting): fixed evaluation for no_value condition, fixes #7244

* feat(alerting): moving null library into grafana, fixing handling on no value / no series
2017-01-13 12:32:30 +01:00
Mitsuhiro Tanda
7e4c101d02 S3 IAM support (#7058)
* add s3 dependencly

* rewrite image uploader by aws-sdk-go

* improve backward compatibility of s3 image uploading

* set default for expires option

* remove acl and expires
2017-01-11 14:00:49 +01:00
jifwin
e73b82d54f Disable web-security for phantomjs rendering (#6469) 2016-12-06 08:37:36 +01:00
Torkel Ödegaard
d1feaaf4f3 Merge branch 'v4.0.x' 2016-12-05 10:54:01 +01:00
Torkel Ödegaard
ab07667b69 fix(rendering): minor fix for server side rendering when using non default http addr setting and non default domain setting, #6813 2016-12-05 10:51:46 +01:00
bergquist
b4b7156f42 fix(webdav): adds missing auth headers
closes #6779
2016-12-02 16:20:15 +01:00
Daniel Lee
af07adb146 refactor(securejsondata): extract to class
Extract from pluginsettings class so that the
securejsondata type can be used in the other
classes. Encrypt and decrypt functions
extracted too.
2016-11-24 13:22:25 +01:00
Torkel Ödegaard
ea5cb0d076 fix(server side rendering): Fixed address used when rendering panel via phantomjs and using non default http_addr config, fixes #6660 2016-11-23 15:35:43 +01:00
bergquist
92121ea656 feat(alerting): add nop uploader
ref #6183
2016-10-05 07:34:48 +02:00
bergquist
1a32ab64b6 tech(renderer): improve renderOpts names 2016-09-26 11:07:36 +02:00
Torkel Ödegaard
175c651e65 fix(server side rendering): Fixed issues with server side rendering for alerting & for auth proxy scenarios, fixes #6115, fixes #5906 2016-09-23 12:29:53 +02:00
Torkel Ödegaard
0d083bad14 Merge branch 'master' of github.com:grafana/grafana
Conflicts:
	pkg/components/imguploader/s3uploader.go
2016-09-07 10:14:36 +02:00
Torkel Ödegaard
50b41130ca feat(alerting): fixed s3 upload issue, progress on alerting on null/missing data, updated ini package to get the support for line continuations 2016-09-07 10:11:00 +02:00
bergquist
d1a7a23c84 test(imageupload): add more specific tests
torkels commit will fix this unit test :)
2016-09-07 10:05:01 +02:00
bergquist
99e99922b4 feat(alerting): add support for uploading images to webdav.
closes #5770
2016-08-11 16:48:54 +02:00
Torkel Ödegaard
357358898d feat(annotations): working on alert annotations, #5694 2016-08-01 10:07:00 +02:00
Torkel Ödegaard
2b276d5cd1 feat(alerting): working on alert notification and image rendering 2016-07-30 13:36:21 +02:00
Torkel Ödegaard
4fc50742a0 feat(alerting): working on image rendering with alert notifications 2016-07-29 14:55:02 +02:00
fg2it
303cd8a5af [RenderToPng fix] (#4901)
* removing useless code

* fix various minor typo

* don't silence phantomjs timeout and allow more time

* fix gofmt
2016-05-04 09:07:45 +02:00
Torkel Ödegaard
0398face05 feat(plugins): dashboard import for data sources is working! #4298 2016-03-12 10:13:49 +01:00
Torkel Ödegaard
3fb0b71822 refactor(): refactoring json usage 2016-03-12 00:13:06 +01:00
Torkel Ödegaard
40b2f00dc5 fix(): fixed from db -> json 2016-03-11 23:39:42 +01:00
Torkel Ödegaard
1f9f439acb lib(): added simplejson lib 2016-03-11 23:28:33 +01:00
Torkel Ödegaard
c5a817194a more work on dashboard importing and templating 2016-03-11 17:31:57 +01:00