Compare commits

..

2876 Commits

Author SHA1 Message Date
Torkel Ödegaard
925ead51b6 Updated version to 2.1 2015-08-04 16:19:48 +02:00
Torkel Ödegaard
85b606b7d2 fix(test): fix for failing unit test 2015-08-04 15:44:29 +02:00
Torkel Ödegaard
5302d3bb31 Added pidfile arg to systemd service spec, fixes #2360 2015-08-04 15:44:07 +02:00
Torkel Ödegaard
775a805959 fix(): fix for cleaning up repeat panel scope for orphaned panels or duplicated panels 2015-08-04 15:15:03 +02:00
Torkel Ödegaard
0586dbaf8b feat(save_as): imporved save as dialog, now auto focus, and enter key to submit works, closes #2426 2015-08-03 10:46:07 +02:00
Torkel Ödegaard
dd6a34e60a fix(influxdb): very minor fix to editor, blur event for alias input caused two refresh events, fixes #2429 2015-08-03 10:18:18 +02:00
Torkel Ödegaard
49c1d1a4ca docs(ldap): fixed minor issue in ldap example config doc 2015-08-01 10:32:36 +02:00
Torkel Ödegaard
6d6c9b782b fix(ldap): minor fixes, should not have any real impact, #2421 2015-08-01 10:30:05 +02:00
Torkel Ödegaard
733332a8f4 Merge pull request #2422 from grafana/grafana-light-tweak
updated some hard-coded colors to variables
2015-08-01 08:34:43 +02:00
Trent White
6b6b102079 updated some hard-coded colors to variables so they work well on light theme 2015-07-31 15:51:31 -04:00
Torkel Ödegaard
50895c7e37 fix(ldap): fixed issue with ldap group to grafana org role syncing, #1450 2015-07-31 16:38:41 +02:00
Torkel Ödegaard
66a37aa945 docs(): updated whats new in 2.1 doc 2015-07-31 15:22:13 +02:00
Torkel Ödegaard
0fd4c3bd00 fix(templating): small fixed toplaceholder text in template variable editor 2015-07-31 14:56:51 +02:00
Torkel Ödegaard
0d3321c686 docs(): updated whats new in grafana 2.1 article 2015-07-31 10:09:32 +02:00
Torkel Ödegaard
7cae087eb9 fix(influxdb_09): fixed handling of regex measurement in explore queries, fixes #2415 2015-07-31 09:17:14 +02:00
Torkel Ödegaard
4c7e52288d fix(templating): another fix for panel links and repeat panels, #2410 2015-07-30 12:04:52 +02:00
Torkel Ödegaard
e108fecdd6 fix(influxdb): fixed issue with empty influxdb result object, fixes #2294 2015-07-30 10:51:26 +02:00
Torkel Ödegaard
be6ddb08bd docs(): added auth proxy to config docs 2015-07-30 10:37:49 +02:00
Torkel Ödegaard
2cc53f328b fix(templating): fixed scoped vars issue when generating urls for panel links, fixes #2410 2015-07-30 08:28:42 +02:00
Torkel Ödegaard
aaae23e9f0 fix(templating): fixed issue with templated dashboard and error selectOptionsForCurrentValue undefined 2015-07-30 08:08:08 +02:00
Torkel Ödegaard
fb81a4f318 Merge pull request #2299 from espenfjo/kairosdb-sensible-tag-values
KairosDB: Update the template functionality to cohere with the very closely related OpenTSDB plugin
2015-07-29 20:46:13 +02:00
Torkel Ödegaard
95bce39751 docs(): updates to whats new arcticle, and changed one screenshot 2015-07-29 15:36:04 +02:00
Torkel Ödegaard
a34af84176 docs(): fixed wording in sentence in whats new in 2.1 article 2015-07-29 15:00:53 +02:00
Torkel Ödegaard
610a94ea03 docs(): lots of updates to whats new in 2.1 doc article 2015-07-29 10:24:46 +02:00
Torkel Ödegaard
0367edf898 Merge pull request #2380 from stesie/graphite-function-removeEmptySeries
New graphite function: removeEmptySeries
2015-07-29 08:24:35 +02:00
Torkel Ödegaard
4279c0b77f Merge pull request #2402 from wKich/patch-1
Fix font awesome icons in OS X Safari
2015-07-27 11:04:08 +02:00
wKich
cae06f6cf4 Fix font awesome in OS X Safari 2015-07-27 12:41:11 +05:00
Torkel Ödegaard
07b5995e85 Merge pull request #2395 from Dieterbe/fix-unknown-config-key-message
fix unknown key error formatting
2015-07-24 13:24:55 +02:00
Dieter Plaetinck
0f7a77f45b fix unknown key error formatting 2015-07-24 12:29:03 +02:00
Torkel Ödegaard
cd832ea77c Merge pull request #2384 from sbengo/improved_http_api_doc
Added docs to http_api
2015-07-23 09:43:02 +02:00
sbengo
82c7764679 Added docs to http_api
Finished the documentation of API HTTP

Notes: 
· Data source proxy calls not documented - Too long request/response text.
· Dashboard from JSON file no do documented - Need more study to underestand how it works.
2015-07-22 13:11:55 +02:00
Torkel Ödegaard
a386733c04 docs(): updates to docs 2015-07-21 16:19:49 +02:00
Trent White
381e9dac34 new images for regex color and negative y transform 2015-07-21 16:19:49 +02:00
Trent White
736aadb186 formatting and some hr to make it more organized 2015-07-21 16:19:49 +02:00
Torkel Ödegaard
4acfa1faef Merge pull request #2378 from sbengo/improved_http_api_doc
Added details on api documentation
2015-07-21 12:15:22 +02:00
sbengo
b9085c1522 Added details on api documentation
Added example request and example response of sections: Dashboard, Datasources, Organisation.

If you agree, I will complete the documentation following the same formatting.
2015-07-21 12:01:04 +02:00
Torkel Ödegaard
55af0ce297 fix(ui): fix scrolling issue when editors are open, fixes #2371 2015-07-21 11:05:25 +02:00
Torkel Ödegaard
6b25453f11 templating(influxdb): regex escape values when multi or all format is enabled, closes #2373 2015-07-21 11:00:09 +02:00
Torkel Ödegaard
06a32ce7be emails(): updated email templates 2015-07-21 09:59:40 +02:00
Torkel Ödegaard
75c1c1bccc Merge pull request #2377 from grafana/nopzor1200-patch-1
Update templating.md
2015-07-21 09:34:15 +02:00
raj dutt
0c25c1f0ca Update templating.md 2015-07-20 20:05:56 -04:00
Torkel Ödegaard
1b12e3fbf9 Merge pull request #2376 from mattttt/patch-3
Relative link for What's New in v2 was incorrect
2015-07-20 23:13:22 +02:00
Matt
a7a2a166e6 Relative link for What's New in v2 was incorrect 2015-07-20 17:09:58 -04:00
Torkel Ödegaard
0d7aba2502 Merge pull request #2372 from jshafton/influxdb-0.9.x-order-by-removal
Fixes "no datapoints" from InfluxDB 0.9.1 data source
2015-07-20 18:27:34 +02:00
Jacob Shafton
ce45879efb Fixes "no datapoints" from InfluxDB 0.9.1 data source
This removes usage of the `ORDER BY` clause for InfluxDB 0.9.x data
sources, which is currently not supported in the latest InfluxDB master
(0.9.1).
2015-07-20 11:13:57 -05:00
Torkel Ödegaard
f465a79924 Merge pull request #2366 from raventools/remove-hubot-script
Remove grafana.coffee
2015-07-20 08:28:13 +02:00
Stephen Yeargin
fc28423141 Remove grafana.coffee
Proposing the deprecation of this in favor of the [hubot-grafana](https://www.npmjs.com/package/hubot-grafana) package, which offers cross-adapter support, dashboard browsing and can be augmented with Amazon S3 credentials.

Fixes #2206
2015-07-20 01:02:45 -05:00
Torkel Ödegaard
0a59d6ab2f fix(repeat panel): fix for unwanted unsaved changes warnings when using repeat panel, #2364 2015-07-18 10:14:21 +02:00
Torkel Ödegaard
9bf9bb0273 fix(ldap): fixed issue with ldap group mappings to org roles sync, #1450 2015-07-18 09:55:21 +02:00
Torkel Ödegaard
5744c70399 fix(ldap conf): fixed another issue in ldap conf example 2015-07-18 09:31:53 +02:00
Torkel Ödegaard
f3342ae7d3 fix(ldap conf): updated ldap conf example to use literal string syntax for bind_password 2015-07-18 09:30:09 +02:00
Torkel Ödegaard
39430e1cee Merge pull request #2361 from mtanda/fix_link
Fix dashboard/panel link in Scripted Dashboard
2015-07-17 15:49:08 +02:00
Torkel Ödegaard
142a323efd fix(save as): fixed issue with save as and overwriting a dashboard with the same name 2015-07-17 15:34:15 +02:00
Torkel Ödegaard
ea198fea6e fix(graph): fixed legend color when having many many series, fixes #2359 2015-07-17 15:20:12 +02:00
Torkel Ödegaard
666013b010 fix(panel repeat): fixed issue with repeat panels in combination with setting variable values from URL, fixes #2351 2015-07-17 14:59:05 +02:00
Torkel Ödegaard
c7dafd4b42 fix(repeat panel): fixed issue with snapshoting a dashboard with repeated panels, Fixes #2352 2015-07-17 14:45:49 +02:00
Stefan Siegl
ea623cb5a1 New graphite function removeEmptySeries 2015-07-17 12:32:29 +02:00
Mitsuhiro Tanda
8ac47b4e24 fix dashboard/panel link in scripted dashboard 2015-07-17 15:40:52 +09:00
Torkel Ödegaard
5b0585ac7f feat(ldap): removed ssl_server_name and added some validation to ldap config, #1450 2015-07-16 12:58:30 +02:00
Torkel Ödegaard
2f4d3be303 fix(panellinks): fixed open in new tab issue for dashboard links, Fixes #2354 2015-07-16 12:06:49 +02:00
Torkel Ödegaard
9afdea8d2a feat(ldap): added config options for ssl skip verify, and ssl server name, #1450 2015-07-16 11:59:26 +02:00
raj dutt
a065f93777 Update singlestat.md 2015-07-15 14:27:55 -07:00
Torkel Ödegaard
e1345337ac docs(): small fix to time range doc page 2015-07-15 17:41:45 +02:00
Torkel Ödegaard
494810393a feat(templating): new template variable selection dropdown now supports accepting custom values that are not an actual selectable value, Fixes #2344 2015-07-15 17:21:54 +02:00
Torkel Ödegaard
8daec7bde2 fix(packaging): fixed issue with restart on upgrade in debian package, Fixes #2320 2015-07-15 14:57:52 +02:00
Torkel Ödegaard
b891677ba5 docs(ldap): added ldap integration docs and config examples, #1450 2015-07-15 14:48:39 +02:00
Torkel Ödegaard
d63a77d8b1 fix(build): fixed ldap config file sample issue and build script 2015-07-15 13:52:30 +02:00
Torkel Ödegaard
2cbe6cdfd8 fix(build): fixed issue in build.go 2015-07-15 11:06:29 +02:00
Torkel Ödegaard
ddd20e5376 Merge branch 'ldap' 2015-07-15 10:14:36 +02:00
Torkel Ödegaard
08cd949d6f feat(ldap): added ldap go dependencies 2015-07-15 10:12:11 +02:00
Torkel Ödegaard
0b5ba55131 feat(ldap): work on reading ldap config from toml file, #1450 2015-07-15 10:08:23 +02:00
Torkel Ödegaard
262a09bb2d feat(ldap): added support for binding initially with an admin user searching for user and then binding again to authenticate current user, #1450 2015-07-14 17:35:11 +02:00
Torkel Ödegaard
0320baeb5b feat(ldap): user org role sync working 2015-07-14 16:42:55 +02:00
Torkel Ödegaard
42670c27d5 feat(ldap): more work on org role sync 2015-07-14 15:46:11 +02:00
Torkel Ödegaard
fe41a4e6fa feat(ldap): began work on org role sync 2015-07-14 14:29:07 +02:00
Torkel Ödegaard
a7b1df34c5 feat(ldap): more unit tests for ldap to grafana user sync 2015-07-14 10:20:30 +02:00
Torkel Ödegaard
567a42a756 docs(http_api): updated http docs and mentioned basic auth option 2015-07-13 22:20:58 +02:00
Torkel Ödegaard
2fa9311eee Progress on ldap support, #1450 2015-07-13 16:45:47 +02:00
Torkel Ödegaard
14f439f8ba refactor(ldap): refactoring ldap code, #1450 2015-07-13 15:37:25 +02:00
Torkel Ödegaard
bfe7b77313 More work on ldap auth, got memberOf working in the docker ldap test server, playing with config options and structures, #1450 2015-07-13 14:23:59 +02:00
Torkel Ödegaard
a69086a718 Merge branch 'master' into ldap 2015-07-13 09:50:19 +02:00
Torkel Ödegaard
3e3980dbac made snapshot post url http scheme agnostic, #1725 2015-07-13 09:37:10 +02:00
Torkel Ödegaard
9f6c9cd6ff fix(graphite): raw query mode (disable graphite query editor mode) is now persisted property on the query, Fixes #2328, Fixes #2307 2015-07-12 18:18:04 +02:00
Torkel Ödegaard
ca1cd89190 Updated singlestat docs again 2015-07-10 15:53:39 +02:00
Torkel Ödegaard
9f8eae908d Updated singlestat docs 2015-07-10 15:34:54 +02:00
Torkel Ödegaard
db1847bc1d More work on ldap, gotten ldap search (read attributes) to work 2015-07-10 15:29:34 +02:00
Torkel Ödegaard
d9936f2dff Merge pull request #2329 from mattttt/patch-2
Update Singlestat Docs
2015-07-10 15:24:48 +02:00
Matt
3774114a4c Update Singlestat Docs
Need some additional clarification in Spark Line and Value to text before this is merged.
2015-07-10 09:13:45 -04:00
Torkel Ödegaard
4bc5b37c09 Merge pull request #2321 from gmembre/master
Adding GOPATH
2015-07-10 13:33:15 +02:00
Torkel Ödegaard
ac1ca639d6 Merge pull request #2327 from languitar/hide-in-legend-override
Series override option to hide legend entries
2015-07-10 13:32:35 +02:00
Torkel Ödegaard
83b67c0693 Fixed link to CLA, Fixes #2326 2015-07-10 13:31:21 +02:00
Johannes Wienke
244e682c2b Series override option to hide legend entries
Adds a series override option to hide certain series from the legend.

* public/app/components/timeSeries.js: boolean flag to decide display in
  legend and application of override option for this flag
* public/app/panels/graph/legend.js: exclude hidden series
* public/app/panels/graph/seriesOverridesCtrl.js: add legend override
  option

This fixes #2324
2015-07-10 12:16:41 +02:00
Torkel Ödegaard
0ef7271326 Started work on LDAP again, #1450 2015-07-10 11:10:48 +02:00
gmembre
3fa228dcbb Correcting typo 2015-07-09 22:49:27 +02:00
gmembre
14e25100d4 Adding GOPATH 2015-07-09 22:17:12 +02:00
Torkel Ödegaard
b2c0eefbbc Merge pull request #2313 from alaverty/master
Fixed invalid json example, added missing comma
2015-07-09 22:05:35 +02:00
Torkel Ödegaard
8eee0d574c Merge branch 'influxdb-09-fields-enhancements' 2015-07-09 17:17:46 +02:00
Torkel Ödegaard
150fd869a0 Finalized work on influxdb field and func selection, #2311 2015-07-09 17:17:17 +02:00
Torkel Ödegaard
50795adcf0 feat(influxdb 0.9): field lookup and other enhancements, #2311 2015-07-09 16:36:47 +02:00
Torkel Ödegaard
3f2c1de28d fix(OpenTSDB): fixed issue with OpenTSDB and query to result matching, Fixes #2315 2015-07-09 09:00:13 +02:00
Alex Laverty
dca45f177f Fixed invalid json example, added missing comma 2015-07-09 11:50:29 +10:00
Torkel Ödegaard
597c1f6a41 feat(influxdb): began work on some influxdb enhancements, #2311 2015-07-08 17:41:36 +02:00
Torkel Ödegaard
c2da54139a Merge pull request #2306 from davewongillies/grafana_ini_perms
set mode 0640 and group grafana on /etc/grafana/grafana.ini
2015-07-08 14:49:17 +02:00
Torkel Ödegaard
afcc388d8a Merge pull request #2308 from davewongillies/config_mysql_sessions
Minor update to documentation for MySQL sessions
2015-07-08 14:48:17 +02:00
David Gillies
5cd1c5c522 Minor update to documentation for MySQL sessions 2015-07-08 22:40:43 +10:00
Torkel Ödegaard
63f8800007 fix(docs): Updated getting started docs, Closes #2273, Closes #1978 2015-07-08 14:17:53 +02:00
David Gillies
a958965e64 set mode 0640 and group grafana on /etc/grafana/grafana.ini 2015-07-08 22:13:38 +10:00
Torkel Ödegaard
5d7c485991 fix(templating): can now use template vars in collapsed row title, Fixes #2305 2015-07-08 13:44:36 +02:00
Espen Fjellvær Olsen
d97f24cfc3 Update QueryController to conform with OpenTSDB Controller 2015-07-08 13:00:22 +02:00
Torkel Ödegaard
3b39c43193 Updated docs version and version fragment 2015-07-08 11:06:11 +02:00
Torkel Ödegaard
b746b63036 Updated config docs with info about [dashboards.json] section , #2302 2015-07-08 10:53:06 +02:00
Torkel Ödegaard
7c707017e7 Merge pull request #2303 from Dieterbe/datasource-docs
fix datasource api docs
2015-07-08 10:51:24 +02:00
Torkel Ödegaard
ce155a1d87 Merge pull request #2301 from tmonk42/influxdb_quoting
add double quotes around tags
2015-07-08 09:42:14 +02:00
Espen Fjellvær Olsen
48975e6533 Keep QueryController up to date as well 2015-07-08 09:36:25 +02:00
Espen Fjellvær Olsen
3e05eb23fd Update documentation based on templating changes 2015-07-08 09:29:54 +02:00
Espen Fjellvær Olsen
3980d25c23 Remove superfluous whitespaces 2015-07-08 09:29:54 +02:00
Espen Fjellvær Olsen
2255cb53f0 Close the gap between the key and the value in the js objects 2015-07-08 09:29:54 +02:00
Espen Fjellvær Olsen
521072daea KairosDB: Streamline the Templating with the very related OpenTSDB plugin
Since KairosDB is a fork of OpenTSDB it makes sense to (At least for the time being) keep their code bases similar-ish.
2015-07-08 09:29:54 +02:00
Dieter Plaetinck
66ba19b7ba clearer errors
"Not found" should only be for http path/method not found (404)
if it's about specific resources, we should be explicit for clarity
2015-07-08 08:55:31 +02:00
Dieter Plaetinck
ac37b54ddb fix datasource api docs
reflects change in e2f6633d57
2015-07-07 16:07:56 -07:00
Haneysmith, Nathan
56c332a3dd more test updates for influxdb quoting 2015-07-07 13:19:15 -07:00
Haneysmith, Nathan
cd53c78449 updating tests for influxdb quoting 2015-07-07 13:15:51 -07:00
Haneysmith, Nathan
f237cac074 add double quotes around tags 2015-07-07 11:56:36 -07:00
Torkel Ödegaard
f6ad386ba7 Fixed capital G in Graphite in docs, reviewed annotation docs, Closes #2275 2015-07-07 17:14:57 +02:00
Torkel Ödegaard
24e527ae02 Updated Graphite docs, Closes #2271 2015-07-07 14:50:23 +02:00
Torkel Ödegaard
8d7ac3862c Fixed issue with dashlinks/panellinks and sending template variable value 'All', Fixes #2297 2015-07-07 14:28:49 +02:00
Torkel Ödegaard
af50188a60 Removed alpha notice for influxdb 0.9 data source config 2015-07-06 17:16:17 +02:00
Torkel Ödegaard
572d35506b Removed some editor srv properites from data sources, they are not needed there anymore, they are in plugin.json, Closes #2283 2015-07-06 15:58:16 +02:00
Torkel Ödegaard
a4b8a88ae5 Worked on templating docs, Closes #2274 2015-07-06 15:01:57 +02:00
Torkel Ödegaard
dbd46a523f Work arround for slower template variable dropdown when variable has many thousand values, now only top 1000 values are rendered to html, you can still search all values, Closes #2246 2015-07-06 13:43:08 +02:00
Torkel Ödegaard
3c86c9908c Added docs for dashboard list panel, #2276 2015-07-06 12:24:11 +02:00
Torkel Ödegaard
37d75905ed Added min span option for panel repeater, #1888 2015-07-06 09:57:00 +02:00
Torkel Ödegaard
19812feb62 Increased max metric suggest count to 1000 for OpenTSDB, Closes #2281 2015-07-06 09:22:34 +02:00
Torkel Ödegaard
90ecb4c544 Merge pull request #2286 from awiddersheim/fix/parenthesis_typo
Fix 'paranthesis' typo to 'parenthesis'
2015-07-06 09:03:52 +02:00
Torkel Ödegaard
42926c48e5 Merge pull request #2287 from awiddersheim/feature/allow_pipe_graphite_lexer
Allow pipe ('|') in Graphite lexer
2015-07-06 09:00:43 +02:00
Andrew Widdersheim
e20e2117f7 Fix 'paranthesis' typo to 'parenthesis'
This typo is most noticable in the Graphite lexer error hint message.
2015-07-05 21:22:40 -04:00
Andrew Widdersheim
7f602feff4 Allow pipe ('|') in Graphite lexer
Allow for Graphite lexer to understand metric names like
'net|usage_average'.
2015-07-05 21:19:12 -04:00
Torkel Ödegaard
a79c1cb23f Merge pull request #2280 from Dieterbe/patch-1
fix config flag
2015-07-04 08:00:19 +02:00
Dieter Plaetinck
582ebf25f9 fix config flag 2015-07-03 17:27:55 -07:00
Torkel Ödegaard
896bbd00e1 Merge pull request #2279 from gcormier9/patch-2
Support dot (.) in metric name
2015-07-03 22:30:57 +02:00
gcormier9
4a9949e643 Support dot (.) in metric name
I'd like to update the regex in order to support dot in metric name. For example "cpu.usage.average".
2015-07-03 15:57:46 -04:00
Torkel Ödegaard
fc81cda971 Updated OpenTSDB docs, Closes #2272 2015-07-03 15:13:06 +02:00
Torkel Ödegaard
7a030e0c3b Finished improving InfluxDB docs, Closes #2270 2015-07-03 15:09:46 +02:00
Torkel Ödegaard
69c027156c Updated influxdb docs, adding docs specific to influxdb 0.9, #2270 2015-07-02 17:13:12 +02:00
Torkel Ödegaard
2ac07f12b0 Merge branch 'master' of https://github.com/williamjoy/grafana 2015-07-02 10:05:45 +02:00
Torkel Ödegaard
5494be4493 Some fixes related to OpenTSDB enhancements, #1250 2015-07-02 10:04:15 +02:00
Torkel Ödegaard
8ed0df64c7 Fixes to OpenTSDB datasource, and added support for repeat panels and repeat rows 2015-07-01 08:56:47 +02:00
Torkel Ödegaard
e8c65dc384 Updated OpenTSDB docs 2015-06-30 15:37:59 +02:00
Torkel Ödegaard
e508db994e OpenTSDB: Support for template variable values lookup queries, Closes #1250 2015-06-30 15:32:43 +02:00
Torkel Ödegaard
f7b7401a53 Updated changelog with new OpenTSDB enhancement, #1177 2015-06-30 12:34:57 +02:00
Torkel Ödegaard
f58e228d11 Merge branch 'lexh-restrict-tag-keys-values' 2015-06-30 12:28:01 +02:00
Torkel Ödegaard
97f54ac385 Small fix to PR 2119 2015-06-30 12:27:42 +02:00
Torkel Ödegaard
aedaae852b Fixed minor mistake in last commit 2015-06-30 12:14:13 +02:00
Torkel Ödegaard
ae0f8c77d1 Auth: You can now authenicate against api with username / password using basic auth, Closes #2218 2015-06-30 09:37:52 +02:00
Torkel Ödegaard
d0e7d53c69 Fixed case insensitive search for file based dashboards, Fixes #2258 2015-06-30 08:17:28 +02:00
Torkel Ödegaard
647e43dcbd Merge pull request #2259 from donnpebe/fix
Fix wrong metrics counter
2015-06-30 08:07:04 +02:00
Torkel Ödegaard
0d856cc135 Error message for missing dashboards.json config section, Closes #2256 2015-06-30 08:05:05 +02:00
Donn Pebe
df33cbc8c5 Fix wrong metrics counter 2015-06-30 12:52:55 +07:00
Torkel Ödegaard
a38a06a077 updated changelog with influxdb 0.9 support comment, Closes #1525 2015-06-29 16:07:58 +02:00
Torkel Ödegaard
15e6a4266c Fixed OR statement for influxdb 0.9 editor, #1525 2015-06-29 16:03:30 +02:00
Torkel Ödegaard
11170dd34c feat(singlestat): Added support for string values, Closes #2203 2015-06-29 09:22:08 +02:00
Torkel Ödegaard
68a45608e6 Merge branch 'master' of github.com:grafana/grafana 2015-06-29 09:02:39 +02:00
Torkel Ödegaard
0838f432ca refactor(influxdb series handling): performance and refactoring of PR #2179, also switched to InfluxDB epoch json format 2015-06-29 09:02:07 +02:00
Torkel Ödegaard
c0d2241523 Merge branch 'topic-multi-select-influxdb9' of https://github.com/randywallace/grafana into randywallace-topic-multi-select-influxdb9 2015-06-29 08:20:10 +02:00
Torkel Ödegaard
6e8505ae61 Merge pull request #2242 from sbouchex/master
Added Pressure units (mbar and hPa) and db unit
2015-06-29 08:14:40 +02:00
Torkel Ödegaard
aaeab3177e Merge pull request #2243 from craftytrickster/blank-variable-fix
Added fix for template variables when no options are available to select
2015-06-29 08:14:01 +02:00
Torkel Ödegaard
b18921cd07 Merge pull request #2244 from Dieterbe/saymynamesaymyname
clarify which handler is not found
2015-06-29 08:12:25 +02:00
Torkel Ödegaard
c776db5485 Merge pull request #2250 from jamtur01/panelmetacap
Capitalise panel menu items
2015-06-29 08:05:31 +02:00
James Turnbull
f14c6efaf8 Capitalise panel menu items
It's a minor thing but other options seem to be generally capitalised. This felt discordant.
2015-06-28 14:42:39 -04:00
Sébastien Bouchex Bellomié
9d4cce74b2 Added dB unit 2015-06-27 16:59:34 +02:00
Dieter Plaetinck
194273a643 clarify which handler is not found 2015-06-26 12:32:24 -07:00
Sébastien Bouchex Bellomié
05fc34533f Merge remote-tracking branch 'grafana/master' 2015-06-26 20:21:32 +02:00
David Raifaizen
ca42d976a7 Added fix for template variables when no options are available to select 2015-06-26 14:15:14 -04:00
Torkel Ödegaard
20d5d0eee6 Fixed issue with annotations that only occurs in optimized build, Fixes #2176, Fixes #2239 2015-06-26 19:42:33 +02:00
Torkel Ödegaard
693af182c7 Fixed broken playlist in master, Fixes #2240 2015-06-26 19:11:52 +02:00
aba824a317 Added Pressure units (mbar and hPa) 2015-06-26 17:34:21 +02:00
5f513773c1 Added Pressure units (mbar and hPa) 2015-06-26 17:28:53 +02:00
999894cccb Added Pressure unit (mbar and hPa) 2015-06-26 17:22:41 +02:00
Torkel Ödegaard
906e70e599 Batch all influxdb 0.9 queries (per panel) in one request, #1525 2015-06-26 11:27:49 +02:00
Torkel Ödegaard
3f167d7fd1 more work on influxdb 0.9 query editor and query builder, can now handle regex conditions, tag operator and tag value quotes changes automatically depending if the tag value is a regex or not, #1525 2015-06-26 10:38:39 +02:00
Torkel Ödegaard
dd8d6bc705 Changed regex typeahead lookup, also works with literal regex patterns 2015-06-26 09:40:55 +02:00
Torkel Ödegaard
43afd7dff9 Fixed on blur event for influxdb 0.9 raw query editor, #1525 2015-06-26 07:54:55 +02:00
Torkel Ödegaard
9266d3789b Merge remote-tracking branch 'origin/kariosdb'
Conflicts:
	public/test/test-main.js
2015-06-25 18:34:41 +02:00
Torkel Ödegaard
dc70894d83 Merge pull request #2224 from masaori335/kairosdb-doc
Add docs of KairosDB Datasource Plugin
2015-06-25 17:08:03 +02:00
Torkel Ödegaard
24bab47f14 fix(create org): Anonymous user can no longer create org, Fixes #2227 2015-06-25 17:06:43 +02:00
Masaori Koshiba
74b8e8244a Add docs of KairosDB Datasource Plugin 2015-06-25 06:54:47 +09:00
Torkel Ödegaard
7806da11e6 Fixed issue with test data source connection and direct access, Fixes #2219 2015-06-24 21:31:16 +02:00
Torkel Ödegaard
ec98f9181b Fixed issue with new variable value select dropdown and parent -> child updates, Fixes #2215 2015-06-23 20:09:17 +02:00
Torkel Ödegaard
ba2deb5f7b Merge branch 'master' of github.com:grafana/grafana 2015-06-22 22:30:03 +02:00
Torkel Ödegaard
7794442277 Make influxdb 0.9 raw query mode still show alias input field, #1525 2015-06-22 22:29:49 +02:00
Torkel Ödegaard
fb8775124c Merge pull request #2207 from lahma/features/influxdb-scoped-vars
#1525 add support for scoped vars for InfluxDB 0.9
2015-06-22 21:26:09 +02:00
Marko Lahma
680865f13c #1525 add support for scoped vars for InfluxDB 0.9 2015-06-22 22:22:29 +03:00
Torkel Ödegaard
5373a699dd Merge branch 'master' of github.com:grafana/grafana 2015-06-22 18:56:12 +02:00
Torkel Ödegaard
177acf835c fixed mysql session example config 2015-06-22 18:47:46 +02:00
Torkel Ödegaard
f3ba491a73 Merge pull request #2205 from raventools/bug/make-status-command-return-correct-exitcode
make status command exit with proper code
2015-06-22 18:43:35 +02:00
Phil Dier
0e73c1bf78 make status command exit with proper code 2015-06-22 11:27:37 -05:00
Torkel Ödegaard
98a07eff81 Worked on enhancing panel links to support dash link features, like auto variable to url params includes, Closes #2200 2015-06-22 17:44:46 +02:00
Torkel Ödegaard
3f917b0af5 Updated org creation view, after creating new org user is switched to that org and redirect to org details view, Closes #2198 2015-06-22 08:13:21 +02:00
Torkel Ödegaard
d3c6db1ba8 Fixed tabindex for organization dropdown, Fixes #2150 2015-06-19 16:42:45 -04:00
Torkel Ödegaard
2a693f7f08 Fixed issue with multi select template variable and restoring state from url, #2196 2015-06-19 15:10:34 -04:00
Torkel Ödegaard
fb7b475457 Backend: Load dashboards with capital letters in the dashboard url slug (url id), Fixes #2163 2015-06-19 14:42:55 -04:00
Torkel Ödegaard
26e5d7a3de Graph: fixed PNG rendering of panels with legend table to the right, #2185 2015-06-19 14:13:25 -04:00
Torkel Ödegaard
cfeba99776 Merge branch 'patch-1' of https://github.com/greggsoft/grafana 2015-06-19 13:04:21 -04:00
Torkel Ödegaard
c0b4f7b6d2 updated graphite docs, Closes #2165 2015-06-19 13:03:09 -04:00
Torkel Ödegaard
021c6ac1cb fixed panel menu while in fullscreen mode 2015-06-19 12:42:10 -04:00
Torkel Ödegaard
261e5ebbd4 Fixed bug in singlestat panel and null value handling, #2189 2015-06-19 11:51:46 -04:00
Torkel Ödegaard
388fba4569 Merge pull request #2190 from zsxking/master
Update documents about environment variable override rules.
2015-06-18 16:04:37 -04:00
Shaoxuan Zhang
eda13a9626 Merge pull request #1 from zsxking/zsxking-docs-env-conf
Update configuration.md
2015-06-18 10:00:25 -10:00
Mikhail Menshenin
5da656e559 Missed double quote fix 2015-06-18 10:05:29 +05:00
Shaoxuan Zhang
d23762e06b Update configuration.md
Mention replacing `.` with `_` with environment variable override.
2015-06-17 17:57:23 -10:00
Randy D. Wallace Jr
5e6d876bd0 Support Multiple Fields in InfluxDB 0.9+
* Update influxdb 0.9 plugin to iterate thru fields returned by InfluxDB
  and output ea. field metric separately
* Updates default label to include Field Name
* Update spec to include updated label
* Add spec for multiple fields
* Do not print the field in the label when the name is value
2015-06-17 14:43:54 -04:00
Torkel Ödegaard
5e9c44b23b Merge pull request #2174 from raintank/add_robots_txt
add support for robots.txt file
2015-06-15 16:16:24 -07:00
Anthony Woods
196b7846cc add support for robots.txt file 2015-06-15 19:02:38 -04:00
Torkel Ödegaard
311946900e Fixed email subject test 2015-06-14 06:08:18 +02:00
Torkel Ödegaard
9b12350855 Added support for templated email subjects 2015-06-14 06:07:36 +02:00
Torkel Ödegaard
fd319bd5f5 Moved requirejs to bower, #677 2015-06-13 23:01:54 +02:00
Torkel Ödegaard
6f982b2791 Moved angular-bindonce to bower 2015-06-13 22:20:39 +02:00
Torkel Ödegaard
05f934548b Moved angular-native-dragdrop to bower 2015-06-13 22:17:28 +02:00
Torkel Ödegaard
f22bffe98a Upgraded angular to 1.4.0 and moved angular dependency to bower, #677 2015-06-13 21:14:08 +02:00
Torkel Ödegaard
87c65bcea0 Migrating to use bower for component dependencies 2015-06-13 20:53:08 +02:00
Torkel Ödegaard
6f4b206a99 Added bowerrc file 2015-06-13 20:43:12 +02:00
Torkel Ödegaard
2c88b418fd Fix import from elasticsearch limit, Fixes #1843, Fixes 2154 2015-06-13 20:20:48 +02:00
Torkel Ödegaard
66e60357dc Set email when creating user from auth_proxy header, Fixes #2156 2015-06-13 20:14:44 +02:00
Torkel Ödegaard
30db7e64fb Fixed example redis session config, Fixes #2157 2015-06-13 20:06:53 +02:00
Torkel Ödegaard
c6c733a40b Merge branch 'master' of github.com:grafana/grafana 2015-06-13 20:01:50 +02:00
Torkel Ödegaard
4a9bc70ca0 Added new style override, transform negative-Y, Closes #2162 2015-06-13 20:01:15 +02:00
Torkel Ödegaard
a815511aef Fixed failing unit test 2015-06-12 10:05:38 +02:00
Torkel Ödegaard
bae1e2f0c1 Fix for validating tags in dashboard json in backend, Fixes #2152 2015-06-12 09:04:10 +02:00
Torkel Ödegaard
7ce31bfaa0 changed dependency for gosimple/slug, they had finally removed the gopkgs dependency, Fixes #2153 2015-06-12 08:53:20 +02:00
Torkel Ödegaard
48175101c6 Fixes to template variable with tags and inital state after dashboard load, #2080 2015-06-11 13:38:13 +02:00
Torkel Ödegaard
e5280d55b3 Make template variables work in row titles, #1956 2015-06-11 09:35:59 +02:00
Torkel Ödegaard
3675b3fcaa Fixed issue with clearing admin permissions, Fixes #2143 2015-06-11 08:29:12 +02:00
Torkel Ödegaard
5962bcbc6c Do not show create org link when allow_org_create is set to false, Fixes #2135 2015-06-11 08:16:09 +02:00
Torkel Ödegaard
b39f8fb4de Do not show Switch to Org item for current organization in the org dropdown, Fixes #2136 2015-06-11 08:05:33 +02:00
Torkel Ödegaard
6deaa87a4c mention fpm in build from source docs, Closes #2145 2015-06-11 07:59:57 +02:00
Torkel Ödegaard
5562651ef0 Fixed spelling on graphite docs page 2015-06-10 17:03:16 +02:00
Torkel Ödegaard
2c00267d58 Changed to more strict sinon version to work around issue in latest sinon 2015-06-10 15:08:32 +02:00
Torkel Ödegaard
b5418c40ba fixed AMPQ -> AMQP typo 2015-06-10 14:44:42 +02:00
Torkel Ödegaard
2266ef6809 Minor api refactoring / code clean up 2015-06-10 10:15:42 +02:00
Torkel Ödegaard
ca67b49d67 Merge branch 'restrict-tag-keys-values' of https://github.com/lexh/grafana into lexh-restrict-tag-keys-values 2015-06-10 10:07:23 +02:00
Torkel Ödegaard
63cc794f37 Small style fix to login page 2015-06-10 08:27:38 +02:00
Torkel Ödegaard
fca6c85abb Fixed clear selections icon for new variable dropdown, #2080 2015-06-09 10:30:51 +02:00
Torkel Ödegaard
604f8a22f7 Fixed state issue with variable value dropdown, #2080 2015-06-09 10:22:43 +02:00
Torkel Ödegaard
f6845cd107 Variable value select fixes and refactorings 2015-06-09 10:06:36 +02:00
Torkel Ödegaard
c20fa85b82 Renamed variable value select to select dropdown 2015-06-09 09:45:24 +02:00
Torkel Ödegaard
bb2d810709 Final work password reset email, Closes #1456 2015-06-08 18:25:04 +02:00
Torkel Ödegaard
95fd34ed14 Merge branch 'emailing' 2015-06-08 17:57:33 +02:00
Torkel Ödegaard
db0c442eaf Added configuration options for smtp 2015-06-08 17:56:56 +02:00
Torkel Ödegaard
42fc68baa5 Simplified emailing system and combined mailer and notifications packages 2015-06-08 16:51:25 +02:00
Torkel Ödegaard
c8bc0b3bf8 Lots of work on user password reset, #1456 2015-06-08 13:39:02 +02:00
Torkel Ödegaard
aa4d60c21e Worked on reset password views, refactored out password strength to a reusable directive 2015-06-08 10:57:01 +02:00
Torkel Ödegaard
4f0a4ea7e7 Merge pull request #2104 from masaori335/kairosdb-metric-find-query
Add metricFindQuery in KairosDB Datasource Plugin
2015-06-06 08:50:02 +02:00
Torkel Ödegaard
e40b462040 began work on reset password view, and angular controller 2015-06-05 11:45:04 +02:00
Torkel Ödegaard
89418a155a More work on email and notification infra #1456 2015-06-05 11:08:19 +02:00
Torkel Ödegaard
901685bb63 Updated sample config and config docs with example for postgres session provider_config string, #2118 2015-06-05 08:18:37 +02:00
Torkel Ödegaard
c709a28f02 More work on email and notification infra #1456 2015-06-05 08:15:38 +02:00
Lex Herbert
463a750c07 OpenTSDB: Restrict typeahead tag keys and values
When selecting metric tag keys, we only are interested in keys which are
associated with this metric. Likewise, when selecting a value for a
certain key, we only want to consider values which apply to the given
key and metric.
2015-06-04 17:45:09 -07:00
Torkel Ödegaard
10abf61383 Merge pull request #2115 from tmonk42/exit_codes
fixing up init script exit codes
2015-06-04 21:06:30 +02:00
Haneysmith, Nathan
fcba62894b remove trailing exit 0 from deb init 2015-06-04 11:40:49 -07:00
Haneysmith, Nathan
77215182f7 fixing up init script exit codes 2015-06-04 11:01:04 -07:00
Torkel Ödegaard
3706d0dedd More work on email and notification infra #1456 2015-06-04 17:23:46 +02:00
Torkel Ödegaard
3f5ab189cd Began work on emailing service #1456 2015-06-04 14:29:39 +02:00
Torkel Ödegaard
eb793f7feb Initial work on ldap support, #1450 2015-06-04 09:34:42 +02:00
Masaori Koshiba
4d0c04b80d Add tag support 2015-06-04 01:23:58 +09:00
Masaori Koshiba
e9a842259a Add metricFindQuery in KairosDBDatasource 2015-06-03 22:55:31 +09:00
Torkel Ödegaard
2c7d33cdfa Merge branch 'master' into ldap 2015-06-03 14:54:48 +02:00
Torkel Ödegaard
83279604c6 updated search handler 2015-06-03 14:53:52 +02:00
Torkel Ödegaard
c821568ac7 Merged new template dropdown 2015-06-03 14:53:52 +02:00
Torkel Ödegaard
1c38619d8c Fixed intendation 2015-06-03 14:53:52 +02:00
Torkel Ödegaard
8cfe89eaf9 Updated variable dropdown 2015-06-03 14:53:52 +02:00
Torkel Ödegaard
cb63344394 Added hover tooltip for tags 2015-06-03 14:53:52 +02:00
Torkel Ödegaard
8934c83742 Small fixes for template variable groups (tags) 2015-06-03 14:53:52 +02:00
Torkel Ödegaard
b0451dc1b3 More refinements of tag selection and state restoration after dashboard load 2015-06-03 14:53:52 +02:00
Torkel Ödegaard
b5a846154a Trying to make progres on persisting selection state, restoring selection state for new multi variable dropdown, proving to be really complex 2015-06-03 14:53:52 +02:00
Torkel Ödegaard
f48d0fcb13 More work on tags in variable dropdown, now the actual tag values query is hooked up and works, #2080 2015-06-03 14:53:52 +02:00
Torkel Ödegaard
650d3d5046 Fixed tag selection issues 2015-06-03 14:53:52 +02:00
Torkel Ödegaard
0992b6a616 Progress on template variable dropdown, lots of unit tests for selection behavior, 2015-06-03 14:53:52 +02:00
Torkel Ödegaard
53ed407448 Lots of refactoring of variable dropdown trying to clean up code and make it unit testable 2015-06-03 14:53:52 +02:00
Torkel Ödegaard
d96f5598ca Breaking out logic for variable dropdown into a controller, this needs some unit tests 2015-06-03 14:53:52 +02:00
Torkel Ödegaard
137cbe5bb4 work on variable multi select 2015-06-03 14:53:52 +02:00
Torkel Ödegaard
6f783f5a3b Single variable select state highlight fixed, Closes #2073 2015-06-03 14:53:52 +02:00
Torkel Ödegaard
6ed17fe62f Removed selection state for single select variables 2015-06-03 14:53:52 +02:00
Torkel Ödegaard
7d25d6f191 progress on tag selection in variable dropdown 2015-06-03 14:53:52 +02:00
Torkel Ödegaard
0bd50c06d7 Template varaible dropdown work 2015-06-03 14:53:52 +02:00
Torkel Ödegaard
9a74105103 Trying out dark headers and footers for template dropdown 2015-06-03 14:53:52 +02:00
Torkel Ödegaard
a433e0e79c More work on variable dropdown 2015-06-03 14:53:52 +02:00
Torkel Ödegaard
483ef20527 Reworking variable value dropdown, take3 2015-06-03 14:53:52 +02:00
Torkel Ödegaard
c5d3eb53f0 Merge pull request #2098 from pborreli/typos
Fixed typos
2015-06-02 18:31:14 +02:00
Pascal Borreli
f582ac88b3 Fixed menu 2015-06-02 17:12:12 +01:00
Pascal Borreli
7b69b789b8 Fixed typos 2015-06-02 16:45:44 +01:00
Torkel Ödegaard
5c8b571c3f Fixed look of tag cloud in search 2015-06-02 13:44:46 +02:00
Torkel Ödegaard
bfe5a56a47 Updated dashboard links editor, just changed With tag > With tags 2015-06-02 12:52:31 +02:00
Torkel Ödegaard
8cfbd2f8bf Increased width of query input field in dashlist panel editor 2015-06-02 11:05:48 +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
6df9012141 Updated dashboard links feature to support search by my multiple tags, #1944 2015-06-02 10:35:10 +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
1a71da417c Merge pull request #2092 from robertjakub/master
new role Read Only Editor - admin (small fix for #2088)
2015-06-02 09:00:47 +02:00
Torkel Ödegaard
2446168356 Sort tags in search results, Closes #2091 2015-06-02 09:00:37 +02:00
robert jakub
153ab4afaa new role Read Only Editor - admin (small fix for #2088) 2015-06-01 20:26:41 +02:00
Torkel Ödegaard
ff3843bc7f Roles: New user role that replaces the old role behavior, Closes #2088 2015-06-01 17:01:04 +02:00
Torkel Ödegaard
86f5152092 When role is viewer and edit URL is loaded view mode will be loaded instead, Closes #2089 2015-06-01 16:49:14 +02:00
Torkel Ödegaard
83e7c48767 User role 'Viewer' are now prohibited from entering edit mode (and doing other transient dashboard edits). A new role will replace the old Viewer behavior 2015-06-01 16:39:01 +02:00
Torkel Ödegaard
85c3a0aa14 Panel menu now hides edit actions for users with role Viewer, Closes #1826 2015-06-01 16:36:15 +02:00
Torkel Ödegaard
50645cc36b Added test connection action to all data sources, Closes #1997 2015-06-01 14:16:59 +02:00
Torkel Ödegaard
afede880e6 added url validation when adding data source, Fixes #2043 2015-06-01 14:02:24 +02:00
Torkel Ödegaard
e2f6633d57 Began work on data source test / validation, #1997 & #2043 2015-06-01 12:15:49 +02:00
Torkel Ödegaard
fc43ce657c allow data source proxy to proxy requests over self signed https connections, Closes #2069 2015-06-01 11:00:29 +02:00
Torkel Ödegaard
8f9eeb5ebd Merge pull request #2067 from bcandrea/private-email-in-github-oauth
Use private email address in GitHub OAUTH
2015-05-29 08:22:46 +02:00
Torkel Ödegaard
db2ff68fef Merge pull request #2072 from yinchuan/patch-1
update docs for configration: allowed_domains
2015-05-29 08:22:09 +02:00
yinchuan
ed974a808b Update configuration.md 2015-05-29 11:39:59 +08:00
yinchuan
0108dfa803 Update configuration.md 2015-05-29 11:23:14 +08:00
Andrea Bernardo Ciddio
cf147cdeaf GitHub users without a public email should be authenticated using their primary private email address 2015-05-28 16:47:20 +01:00
Torkel Ödegaard
57fac6b9aa Removed invalid scripted dashboard example, Closes #2063 2015-05-28 11:41:32 +02:00
Torkel Ödegaard
aeb8bc8755 Share link should always have absolute time range, Closes #2060 2015-05-28 09:35:55 +02:00
Torkel Ödegaard
96bd66e811 Made the annotation tags support more cross datasource compatible 2015-05-27 14:30:23 +02:00
Torkel Ödegaard
494ede5bbf Big refactoring/rewrite for how annotation tooltips are shown, also work on #1474 2015-05-27 13:11:32 +02:00
Torkel Ödegaard
e76d2ec9c2 worked on tags in search and dashboards 2015-05-27 11:16:15 +02:00
Torkel Ödegaard
7b972926ae Merge branch 'variable-tags' 2015-05-27 10:43:02 +02:00
Torkel Ödegaard
4a71a79cb8 Slight refactoring in annotationSrv 2015-05-27 10:42:52 +02:00
Torkel Ödegaard
99556057d1 Fixed bug with auto refresh option being reset when changing relative time when now delay is configured, Fixes #2042 2015-05-26 16:48:23 +02:00
Torkel Ödegaard
921d672a2c Worked on alias pattern for InfluxDB 0.9 editor, #1525 2015-05-26 11:01:28 +02:00
Torkel Ödegaard
5f004f95f2 Fixed issue with json dashboard index, json file dashboards turned up when filtering on 'is starred' 2015-05-25 15:42:59 +02:00
Torkel Ödegaard
284106b8a8 Updated changelog 2015-05-25 15:26:22 +02:00
Torkel Ödegaard
abed438d7d Merge pull request #2052 from indrekj/org-support
Add github organizations support
2015-05-25 14:16:46 +02:00
Torkel Ödegaard
0047ce067d SingleStatPanel: fix for color thresholds and value to text mapping combo, Fixes #2044 2015-05-25 10:24:01 +02:00
Torkel Ödegaard
58f743f87d Merge pull request #2053 from blt04/phantomjs-tls
Render panel images with any SSL protocol
2015-05-25 09:57:56 +02:00
Torkel Ödegaard
867e333464 Merge pull request #2045 from robertjakub/master
add pps (packets per second) format
2015-05-25 09:56:41 +02:00
Torkel Ödegaard
de683b3360 Merge pull request #2030 from felixrabe/patch-1
Fix latest.json
2015-05-25 09:56:10 +02:00
Brandon Turner
b2a0ae0f83 Render panel images with any SSL protocol
This uses any available SSL protocol (instead the phantomjs default:
SSLv3) to render panels to PNGs.  This is useful when reverse proxing
grafana and SSLv3 is disabled due to security vulnerabilities or other
reasons.
2015-05-25 01:52:49 -05:00
Indrek Juhkam
b55d9350e7 Add github organizations support 2015-05-23 17:06:51 +03:00
robert jakub
3dc2a114fa add pps (packet per second) format 2015-05-22 17:08:10 +02:00
Torkel Ödegaard
57bacb339c Merge pull request #2038 from craftytrickster/annotation-fix
Fixed variable name for annotations
2015-05-22 06:34:17 +02:00
David Raifaizen
2191921690 Fixed variable name for annotations 2015-05-21 14:36:35 -04:00
Torkel Ödegaard
23fcf85500 Merge pull request #2034 from kkoehler/api-doc
Api doc
2015-05-21 13:28:08 +02:00
Kristian Köhler
3c6b647398 added admin stuff 2015-05-21 12:56:30 +02:00
Kristian Köhler
1821809e69 listing of all none admin methods 2015-05-21 12:46:26 +02:00
Torkel Ödegaard
ba3f6f9d3e InfluxDB 09 fix, do not treat empty results as an error 2015-05-21 10:20:49 +02:00
Felix Rabe
9bedd83f39 Fix latest.json
The trailing comma trips up both Python and JS JSON parsers.
2015-05-21 00:13:50 +02:00
Torkel Ödegaard
592330b5a7 Expose data source extended properties (jsonData), to the frontend, Closes #2023 2015-05-20 18:29:20 +02:00
Torkel Ödegaard
2202094e41 work on tags in variables 2015-05-20 18:18:03 +02:00
Torkel Ödegaard
3354365177 Api handler refactoring using the wrap and response func/type, fixed small issue in influxdb 0.9 response handling 2015-05-20 14:59:38 +02:00
Torkel Ödegaard
a39e484aaa Merge pull request #2007 from anryko/master
Update latest.json
2015-05-20 09:04:06 +02:00
Torkel Ödegaard
51af06edf7 Merge pull request #2022 from dalmatinerdb/proxy-url-fix
fixing #2021
2015-05-20 09:03:23 +02:00
Heinz N. Gies
7cf9046dc5 fixing #2021
This tiny commit fixes a routing problem for proxy requests. The
router was expecting a url path behind the proxy id, if none was
given (read: the service proxied was at the root of a host) then
the router would return a 404. With this patch it now propperly
uses ProxyDataSourceRequest.
2015-05-19 23:49:30 +02:00
Torkel Ödegaard
25c6b64fed Began working on exploring variable value groups/tags 2015-05-19 16:54:08 +02:00
Torkel Ödegaard
a8aab0cb2b Worked on user administration page, a grafana server admin can now add and edit organization roles for any user, #2014 2015-05-19 11:47:14 +02:00
Torkel Ödegaard
788e7fd36d Lots of api refactoring for org routes, #2014 2015-05-19 10:16:32 +02:00
Torkel Ödegaard
74bf1f23fb Small progress on #2014 2015-05-19 09:09:21 +02:00
Torkel Ödegaard
bf9e51928d Fix to signed in user when user <-> org link is gone 2015-05-19 09:02:37 +02:00
Torkel Ödegaard
bfe6d5434e Fixed placeholder text in templating editor 2015-05-19 08:46:45 +02:00
Torkel Ödegaard
f81bde5643 Refactoring some api handlers to use the new Response return object 2015-05-18 21:23:40 +02:00
Torkel Ödegaard
fbc6bb2112 More refactoring of user http api, trying to reuse handlers for sign in user and admin operations 2015-05-18 19:06:19 +02:00
Torkel Ödegaard
62e8841e8c Fixed spelling of Peta unit Quadr 2015-05-18 17:54:12 +02:00
Torkel Ödegaard
5270c4bc74 refactorin api code for user routes, preparation for admin improvements, #2014 2015-05-18 17:52:23 +02:00
Torkel Ödegaard
a993bc1331 Merge pull request #2012 from Dieterbe/publish-no-recurse
no unbound recursion in publish()
2015-05-18 16:16:08 +02:00
Dieter Plaetinck
e9f38b9fc0 no unbound recursion in publish()
unbound recursion approach can blow up call stack,
and - I think - allocate memory unboundedly as well.

We can simply loop until err != nil

I didn't actually test this live, though tests succeed
2015-05-18 10:04:01 -04:00
Torkel Ödegaard
5896903bd3 Began work on alias support and alias patterns for InfluxDB 0.9, #1525 2015-05-18 15:01:05 +02:00
Torkel Ödegaard
f41c314329 Minor layout fix to templating editor, making input fields a little less wide 2015-05-18 11:47:12 +02:00
Torkel Ödegaard
84618a6076 Style and layout changes for InfluxDB 0.9 editor #1525 2015-05-18 11:40:50 +02:00
Torkel Ödegaard
b61f30de94 Lots of progress on InfluxDB Query Editor, show tag keys, values and measurement dropdowns now take into account already selected tags or measurements, so you can start with tag keys and the select measurement, #1525 2015-05-18 10:49:45 +02:00
Torkel Ödegaard
afe76ba260 Merge pull request #2009 from fffw/patch-1
fix mac.md for incorrect href
2015-05-18 09:10:04 +02:00
fffw
1302630abe fix mac.md for incorrect href 2015-05-18 14:47:00 +08:00
anryko
a6d993ecdc Update latest.json 2015-05-17 18:12:20 +02:00
Torkel Ödegaard
65796d7477 Merge pull request #2005 from masaori335/kairosdb-template
Templated dashboards support in KairosDB Plugin
2015-05-17 15:56:52 +02:00
Masaori Koshiba
41a73a7adb Expand variables in KairosDB Plugin 2015-05-17 21:46:14 +09:00
Torkel Ödegaard
05d725d0b8 Slight refactoring, #1525 2015-05-16 22:37:08 +02:00
Torkel Ödegaard
7a41ecb63f Minor work on InfluxDB 0.9 query editor, #1525, hit a roadblock with the new InfluxDB query language, does not support tag and tag values discovery queries with filters, not sure if I need to move to SHOW SERIES style queries 2015-05-16 22:37:08 +02:00
Torkel Ödegaard
6fd37779b8 More work on new influxdb query editor, #1525 2015-05-16 22:37:08 +02:00
Torkel Ödegaard
d14b570d76 Merge pull request #2003 from tmonk42/redact_provider_config
Addresses #1853, redact session provider secrets
2015-05-16 06:44:29 +02:00
Haneysmith, Nathan
2af28b90c2 whitespace update per gofmt 2015-05-15 13:25:41 -07:00
Haneysmith, Nathan
09b0e6e388 Addresses #1853, redact session provider secrets
In cases where a database is used for session storage, redact the
session_provider config value. I assumed "@" as the marker for a
database vs file/memory.
2015-05-15 11:11:02 -07:00
Torkel Ödegaard
5ca8d590bd Working on new query editor for influxdb 0.9, looking good! #1525 2015-05-15 15:58:07 +02:00
Torkel Ödegaard
11c8e80ea9 Working on new query editor for influxdb 0.9, #1525 2015-05-15 11:38:37 +02:00
Torkel Ödegaard
ea993b6404 Some inital ldap work 2015-05-15 09:37:16 +02:00
Torkel Ödegaard
a258e2e608 Added log base 2 graph y axis scale 2015-05-14 17:39:31 +02:00
Torkel Ödegaard
e69bacaee1 Merge branch 'color_by_regex' 2015-05-14 12:34:37 +02:00
Torkel Ödegaard
8c0e1060e6 Graph: Define series color using regex rule, Closes #590 2015-05-14 12:34:30 +02:00
Torkel Ödegaard
fb56bc59f2 Create pid file before runtime init, Fixes #1990 2015-05-14 10:33:56 +02:00
Torkel Ödegaard
1c9993f185 Backend configuration: When unknown key was detected the log error was not visible in log file due to logging was initialized after user config file is loaded, logging is now initialized twice, once based on defaults and command line arguments, then then again after user config file, Fixes #1992 2015-05-14 10:15:46 +02:00
Torkel Ödegaard
2dac975805 began work on color by regex / series override for color, #590 2015-05-13 21:34:50 +02:00
Torkel Ödegaard
2bb63835b6 Merge pull request #1991 from jeffbmartinez/fixGrammarInDocs
Fix minor grammar issue in docs index page
2015-05-13 19:30:29 +02:00
jeff martinez
bfafb83604 Fix minor grammar issue in docs index page 2015-05-13 09:58:58 -07:00
Torkel Ödegaard
ea54f6923b Added graphite function changed, closes #1961 2015-05-13 16:32:33 +02:00
Torkel Ödegaard
1a401780ba Updated changelog with completed story, JSON dashboards added to search, Closes #960 2015-05-13 14:01:48 +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
c8146e759f Fixed json index unit test 2015-05-13 10:57:18 +02:00
Torkel Ödegaard
bb7d79e6d2 Refactoring search to support more than just db dashboards 2015-05-13 10:45:53 +02:00
Torkel Ödegaard
fb35f7210c Fixed failing golang test 2015-05-13 10:06:06 +02:00
Torkel Ödegaard
187834b17c Trying to get dashboard loading and dashboard meta flags like canSave, canStar more managable 2015-05-13 09:58:45 +02:00
Torkel Ödegaard
4822d02787 Things are starting to work again 2015-05-12 19:24:11 +02:00
Torkel Ödegaard
35cc0a1cc0 Rewriting anb abstracting how dashboards are loaded, unifying db, json files, and script dashboards, #960 2015-05-12 17:39:56 +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
a40299b4dc Progress on json file index and search #960 2015-05-12 12:20:03 +02:00
Torkel Ödegaard
1a9f630710 Began work on adding json files to search, #960 2015-05-11 20:04:03 +02:00
Torkel Ödegaard
48ddd7213f Removed unused keybinding, ctrl+l, Fixes #1962 2015-05-11 10:03:34 +02:00
Torkel Ödegaard
582e680b12 Singlestat: threshold checks are now done on a rounded value, rounded to same number of decimals as is shown, Fixes #1983 2015-05-11 09:57:10 +02:00
Torkel Ödegaard
a04a403539 Merge branch 'docs-2.0'
Conflicts:
	docs/sources/installation/configuration.md
	docs/sources/installation/docker.md
2015-05-11 08:02:28 +02:00
Torkel Ödegaard
564162442d Merge pull request #1982 from jamtur01/conflink
Fixed a series of installation doc issues
2015-05-11 07:57:10 +02:00
James Turnbull
7da3ee72c7 More docs fixes
1. Set paragraph size to 80 chars for better readability.
2. More formatting fixes.
3. More spelling and grammar fixes.
2015-05-10 16:52:40 -04:00
James Turnbull
823294f055 Fixed a series of installation doc issues
1. Fixed several spelling and grammar issues.
2. Fixed 404s for the Configuration page.
3. Fixed several Markdown formatting issues.
4. Tidy up of several pages.
2015-05-10 16:15:34 -04:00
Torkel Ödegaard
5aa495d0e4 Restored some previous grafana modifications to jquery flot 2015-05-09 19:47:21 +02:00
Torkel Ödegaard
2e6c2347eb Did some jquery flot performance tuning, added text size cache that reduced render times by 25% (for single serie graphs) 2015-05-09 19:31:00 +02:00
Torkel Ödegaard
a256d71ef9 Merge pull request #1954 from jtyr/patch-1
Adding Ansible role for Grafana v2.x
2015-05-09 15:34:01 +02:00
Torkel Ödegaard
b7a8551290 Merge pull request #1946 from DaveBlooman/theme_colour
Add Android 5 theme colour
2015-05-09 15:33:38 +02:00
Torkel Ödegaard
8f0269de76 Merge branch 'subsecond-influx' of https://github.com/abrander/grafana 2015-05-09 15:28:39 +02:00
Torkel Ödegaard
1a6e6f405d Merge branch 'master' of github.com:grafana/grafana 2015-05-09 15:28:23 +02:00
Torkel Ödegaard
59a2109cab Investigating some performance optimizations, added more perf instrumentation & measurements 2015-05-09 15:26:39 +02:00
Torkel Ödegaard
31781bc509 Fixed the link to the config page 2015-05-08 11:23:48 +02:00
Torkel Ödegaard
db2161c7e6 Merge pull request #1967 from benheilman/detach_stderr_in_init_script
Detach stderr in rpm initscript
2015-05-08 11:19:14 +02:00
Torkel Ödegaard
7d4e676cfd Dashboard: Custom Navigation links & dynamic links to related dashboards, #1944 2015-05-08 11:04:46 +02:00
Torkel Ödegaard
2dcb98a8ed Merge branch 'master' of github.com:grafana/grafana 2015-05-08 11:03:25 +02:00
Torkel Ödegaard
0bde1bb857 Dashboard and nav links are near completion now, #1944 2015-05-08 10:56:54 +02:00
Anders Brander
d685644dee Updated test to match e906a19 2015-05-07 22:48:44 +02:00
Anders Brander
e906a1979c Allow kbn.secondsToHms() to return result in milliseconds. 2015-05-07 22:33:32 +02:00
Ben Heilman
0a9958c74e Detach stderr in rpm initscript 2015-05-07 14:47:27 -05:00
Torkel Ödegaard
04f9a6fdd0 Merge pull request #1963 from abrander/measurement-in-quotes
Quote 'measurement' properly in getAltSegments() (influxdb 0.9)
2015-05-07 20:29:34 +02:00
Anders Brander
5eee33a11f Quote 'measurement' properly in getAltSegments() to allow for dots in measurement identifier (Influxdb 0.9). 2015-05-07 19:51:55 +02:00
Torkel Ödegaard
4b4f398e83 more work on dashboard links, this feature is taking forever, dam angular, and dam complexity 2015-05-07 19:14:13 +02:00
Torkel Ödegaard
9655014041 More polish and refinements to dashboard links 2015-05-07 13:10:04 +02:00
Torkel Ödegaard
85e65e61d3 More work on dashboards links 2015-05-07 09:35:39 +02:00
Jiri Tyr
e32259ccc9 Adding Ansible role for Grafana v2.x
Adding Ansible role which is compatible with Grafana v2.x.
2015-05-07 00:31:20 +01:00
Torkel Ödegaard
15137422a6 More work on dashboards links 2015-05-06 16:40:43 +02:00
Torkel Ödegaard
1f48c07395 more work on dash links 2015-05-06 10:57:32 +02:00
Torkel Ödegaard
26c9a19392 A lot of css style polish for submenu (template var selection, and new dashlinks) 2015-05-06 09:41:30 +02:00
Torkel Ödegaard
2c3aad785d Fix in unsaved changes service 2015-05-06 07:59:47 +02:00
Torkel Ödegaard
ece9e8dcea Merge branch 'master' into dashlinks 2015-05-06 07:48:45 +02:00
DaveBlooman
85c45c2b8f Add Android 5 theme colour 2015-05-05 22:42:56 +01:00
Torkel Ödegaard
8149381f01 minor refactoring and markup fix 2015-05-05 20:59:21 +02:00
Torkel Ödegaard
e221cbfbd6 Merge branch 'sidemenu_default_open' of https://github.com/raintank/grafana 2015-05-05 20:34:07 +02:00
Torkel Ödegaard
0c56ae4f32 more work on, #1944 2015-05-05 20:33:06 +02:00
Torkel Ödegaard
1e196fc091 Began work on dashboard links and nav feature, #1944 2015-05-05 19:56:49 +02:00
Torkel Ödegaard
d4c0d5d81b changed position for checkbox label 2015-05-05 13:37:20 +02:00
Torkel Ödegaard
12c770f0ab markup update for templating editor 2015-05-05 13:33:57 +02:00
Torkel Ödegaard
637988b104 UI Polish, refactoring markup 2015-05-05 13:26:42 +02:00
Torkel Ödegaard
71edd9ff1b DashEditView: fix for small ui bug, when having dashboard settings view open and entering panel edit mode, did not cause dash edit view to be closed 2015-05-05 12:38:18 +02:00
Torkel Ödegaard
34539c0c13 Enforce domain, host header validation against domain setting, Refactoring of PR #1866, Closes #1732 2015-05-05 11:21:06 +02:00
Torkel Ödegaard
1f2cba81eb Merge branch 'enforce-domain' of https://github.com/gummiboll/grafana 2015-05-05 11:15:09 +02:00
Torkel Ödegaard
e458ca7b47 Templating: updated template editor view & form 2015-05-05 10:56:39 +02:00
Anthony Woods
b915bb98fb fix whitespace 2015-05-05 16:21:37 +08:00
Anthony Woods
8aef297e71 show sidemenu when admin user logs in the first time. #54 2015-05-05 10:43:19 +08:00
Torkel Ödegaard
c628ac9bbb Upgraded to JQuery 2.1.1 -> 2.1.3, and spectrum.js, Fixes #1932 2015-05-04 14:36:46 +02:00
Torkel Ödegaard
385048b620 Templating: You can now select multiple template variables values at the same time. Closes #1922 2015-05-04 10:13:12 +02:00
Torkel Ödegaard
e5c1169120 HTTP API: GET /api/dashboards/db/:slug response changed property to to match the POST request nameing, Fixes #1928 2015-05-04 08:36:44 +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
020d7d4939 Update docs, fixed mistake in http api docs, Fixes #1928 2015-05-03 16:46:46 +02:00
Torkel Ödegaard
697529d0e8 Worked on golang code coverage via coveralls 2015-05-02 17:24:03 +02:00
Torkel Ödegaard
b51a8f11d5 Added back coveralls coverage 2015-05-02 17:05:07 +02:00
Torkel Ödegaard
a4a8cd05d2 Updated to nodejs packages and karma code coverage setup 2015-05-02 16:59:19 +02:00
Torkel Ödegaard
38fc85d619 Final tweaks to auth proxy feature 2015-05-02 12:30:53 +02:00
Torkel Ödegaard
be589d81c7 Auth: Support for user authentication via reverse proxy header (like X-Authenticated-User, or X-WEBAUTH-USER), Closes #1921 2015-05-02 12:06:58 +02:00
Torkel Ödegaard
ba883d25fe More middleware unit tests cover all current auth mechanisms 2015-05-02 09:24:56 +02:00
Torkel Ödegaard
f416e2d1ac More middleware unit test, starting to look really good 2015-05-01 22:26:16 +02:00
Torkel Ödegaard
cb8110cd48 Refactoring, worked on middleware unit tests, and began thinking about api unit tests, #1921 2015-05-01 16:23:36 +02:00
Torkel Ödegaard
8d081a081d Fixed configuration docs issue, Fixes #1924 2015-05-01 15:01:31 +02:00
Torkel Ödegaard
d1e9b6d6ae Began work on auth_proxy feature (#1932), and began work on testing http api, and auth middleware 2015-05-01 11:55:59 +02:00
Torkel Ödegaard
e7ac367392 SignUp: password strength meter updated, Fixes #1892 2015-05-01 11:22:21 +02:00
Anthony Woods
7a8851c5ab default sidemenu to open #54 2015-05-01 17:02:00 +08:00
Torkel Ödegaard
e771d8e944 Organization: You can now update the organization user role directly (without removing and readding the organization user). Closes #1899 2015-05-01 09:48:07 +02:00
Torkel Ödegaard
b48b11e902 Added new graphite function spec, weightedAverage, Closes #1879 2015-05-01 08:52:34 +02:00
Torkel Ödegaard
5de9230924 Security: New config option to disable the use of gravatar for profile images, Closes #1891 2015-05-01 08:40:13 +02:00
Torkel Ödegaard
59fcd3914d corrected master version 2015-05-01 08:08:31 +02:00
Torkel Ödegaard
95fcddcd95 More work on panel & row repeats, #1888, updated changelog 2015-05-01 08:07:57 +02:00
Torkel Ödegaard
293d0c3093 Merge branch 'panel_repeat' 2015-04-30 11:15:40 +02:00
Torkel Ödegaard
e17f56b4ad Final polish on panel & row repeats, #1888, still some missing places where scopedVars needs to be used 2015-04-30 11:15:26 +02:00
Torkel Ödegaard
32e0ce1beb Minor code refinements to panel repeat code, #1888 2015-04-30 10:50:23 +02:00
Torkel Ödegaard
25ef49494b Final polish on repeat panel variable selection, #1888 2015-04-30 10:47:51 +02:00
Torkel Ödegaard
3ee1ea28e1 Templating: Support for search filtering and keyboard up/down filtering in the new multi variable value selector dropdown, #1144 2015-04-30 09:09:12 +02:00
Torkel Ödegaard
0a8cf26731 Merge branch 'docs-2.0' 2015-04-30 08:12:37 +02:00
Morton Fox
a8b2074fc6 Fix the first CLA link. 2015-04-30 08:05:13 +02:00
Torkel Ödegaard
14be5e3ff7 Merge branch 'master' of github.com:grafana/grafana 2015-04-30 08:04:32 +02:00
Torkel Ödegaard
6de071a5f3 Merge pull request #1911 from mortonfox/patch-1
Fix the first CLA link.
2015-04-30 08:03:05 +02:00
Morton Fox
0a2b03ba52 Fix the first CLA link. 2015-04-29 16:35:03 -04:00
Torkel Ödegaard
dbc64c21a7 Merge branch 'master' into panel_repeat 2015-04-29 18:03:26 +02:00
Torkel Ödegaard
294f7f1f0d Merge branch 'v2.0.x'
Conflicts:
	conf/sample.ini
2015-04-29 15:59:35 +02:00
Torkel Ödegaard
d10ce90936 Fixed XSS issue with file based dashboards, was really casued by an issue with alertSrv accepting html in message alerts 2015-04-29 15:50:47 +02:00
Torkel Ödegaard
fe0bf876d9 Style changes and polish to multi variable value selection, #1144 2015-04-29 15:34:14 +02:00
Torkel Ödegaard
c5be95e46c Began polish and tweaks of new template variable multi select dropdown 2015-04-29 14:23:29 +02:00
Torkel Ödegaard
b762f56aee Merge branch 'master' into panel_repeat
Conflicts:
	public/app/features/templating/templateValuesSrv.js
2015-04-29 13:59:15 +02:00
Torkel Ödegaard
74a8fa61f2 Merged with 2.0 docs and restored some stuff 2015-04-29 10:33:37 +02:00
Torkel Ödegaard
964d47d517 Merge branch 'docs-2.0' 2015-04-29 10:30:29 +02:00
Torkel Ödegaard
a38da2f7c6 Merge pull request #1901 from davidak/master
add gigabytes as unit
2015-04-29 10:29:49 +02:00
Torkel Ödegaard
593f2e0851 Merge pull request #1903 from craftytrickster/influx09-annotation-bugfix
Fixed Annotations with InfluxDb9 Datasources
2015-04-29 10:29:29 +02:00
Torkel Ödegaard
9ae3d66da7 Fixed docs, screencasts page 2015-04-29 10:18:11 +02:00
Torkel Ödegaard
4c7545e909 Updated docs Makefile 2015-04-29 10:14:02 +02:00
Torkel Ödegaard
a0e80e5869 Updated 2.0 docs, merged with master and removed docs for features in 2.1, doc updates related to 2.0 needs to be done to this branch 2015-04-29 10:13:00 +02:00
Torkel Ödegaard
75e6947c5a Merge branch 'master' into docs-2.0 2015-04-29 10:11:52 +02:00
Torkel Ödegaard
3007add4ca small docs fix 2015-04-29 10:10:44 +02:00
Torkel Ödegaard
67fbb173e3 Merge pull request #1904 from iandanforth/patch-1
Correct deb version number in install guide.
2015-04-29 10:09:25 +02:00
Torkel Ödegaard
0d3fbb8659 Added message alerts when login failed due to github team membership or email domain requirement, #1731, #1660 2015-04-29 10:08:01 +02:00
Torkel Ödegaard
32fa8180fa Github OAuth: You can now configure a Github team membership requirement, Closes #1731 2015-04-29 09:52:52 +02:00
Torkel Ödegaard
884dc53f8a smalĺ refactorings 2015-04-29 09:49:33 +02:00
Torkel Ödegaard
d812414621 Merge branch 'github-team-membership-requirement' of https://github.com/dewski/grafana into dewski-github-team-membership-requirement 2015-04-29 09:44:23 +02:00
Torkel Ödegaard
52c32d8b10 Merge branch 'issue1862' of https://github.com/raintank/grafana into raintank-issue1862 2015-04-29 09:31:21 +02:00
Torkel Ödegaard
eace358f1c Merge branch 'issue1907' of https://github.com/raintank/grafana
Conflicts:
	pkg/api/dtos/models.go
2015-04-29 09:29:55 +02:00
Torkel Ödegaard
e7c43bf614 expose org id to frontend, Closes #1907 2015-04-29 09:26:12 +02:00
Anthony Woods
81636d8634 expose orgId via currentUser object. fixes #1907 2015-04-29 15:14:49 +08:00
Anthony Woods
b72eba1ef2 refactor handling of refresh when urlValues being used for templates. fixes #1862 2015-04-29 14:55:39 +08:00
Garrett Bjerkhoel
1fdc5277ae Update documentation for team_ids option 2015-04-28 20:38:05 -07:00
Garrett Bjerkhoel
1d7f945268 Handle special error case if connect.UserInfo returns an error 2015-04-28 20:22:45 -07:00
Garrett Bjerkhoel
eb37fc089b Check for active team membership when fetching s.UserInfo 2015-04-28 20:22:21 -07:00
Garrett Bjerkhoel
979d0ca70f Add new error type for team membership permissions 2015-04-28 20:21:44 -07:00
Garrett Bjerkhoel
7ea579bb71 Add team_ids configuration option 2015-04-28 20:19:48 -07:00
Ian Danforth
a0dad38974 Correct deb version number in install guide. 2015-04-28 15:09:22 -07:00
David Raifaizen
e5844afb0f Corrected missing annotations: true tag from the influxdb9 plugin json and fixed influxseries data handling 2015-04-28 16:29:32 -04:00
davidak
c4ac3d61b1 add gigabytes as unit 2015-04-28 20:53:29 +02:00
Torkel Ödegaard
8c14e565a7 Restored the variable color for the label/name in the submenu 2015-04-28 17:54:22 +02:00
Torkel Ödegaard
53cb0feda9 Various fixes, restored search auto focus 2015-04-28 17:28:34 +02:00
Torkel Ödegaard
14e8c15a3a Lots of new unit tests for unsaved changes service 2015-04-28 16:42:40 +02:00
Torkel Ödegaard
aaea80e053 A lot of refactoring opf unsaved changes service so it can be unit tested better 2015-04-28 13:45:59 +02:00
Torkel Ödegaard
f6a61c1ec5 Changes to unsaved changes service to ignore repeated panels and rows, #1888 2015-04-28 12:02:39 +02:00
Torkel Ödegaard
5768f10769 More optimizations and unit tests for panel repeats #1888 2015-04-28 10:23:35 +02:00
Torkel Ödegaard
bcb80eb38f more tweaks 2015-04-28 09:26:20 +02:00
Torkel Ödegaard
9590f485f1 More optimizations and unit tests for panel repeats, this time reuse rows, #1888 2015-04-28 09:24:07 +02:00
Torkel Ödegaard
32fe723da6 More optimizations and unit tests for panel repeats, #1888 2015-04-28 08:44:48 +02:00
Torkel Ödegaard
48b25bc327 Fix to graph panel, and width=0 bug 2015-04-28 06:40:23 +02:00
Torkel Ödegaard
3044a74a52 Optimization and unit tests for panel and row repeat feature, #1888 2015-04-27 18:37:39 +02:00
Torkel Ödegaard
ca7aa294e0 Began wriing unit test for new panel repeat features, #1888 2015-04-27 17:20:32 +02:00
Torkel Ödegaard
5175cf70ef fixed version in package.json 2015-04-27 15:07:13 +02:00
Torkel Ödegaard
5cb7721ab2 Updated config sample.ini with oauth allow_sign_up 2015-04-27 15:06:42 +02:00
Torkel Ödegaard
158b77d54e small update to panel repeats 2015-04-27 15:01:27 +02:00
Torkel Ödegaard
f8f302faad Merge branch 'panel_repeat' of github.com:grafana/grafana into panel_repeat
Conflicts:
	public/app/partials/submenu.html
	public/css/less/submenu.less
	src/app/partials/roweditor.html
2015-04-27 14:01:55 +02:00
Torkel Ödegaard
3f97bd8212 Added files removed in merge 2015-04-27 13:59:20 +02:00
Torkel Ödegaard
bf6f0f1a65 Merge branch 'master' into panel_repeat
Conflicts:
	public/app/features/dashboard/dashboardCtrl.js
	public/app/partials/submenu.html
	public/css/less/submenu.less
	public/test/specs/templateSrv-specs.js
	src/app/partials/roweditor.html
2015-04-27 13:53:02 +02:00
Torkel Ödegaard
8a986ec340 Using CTRL+S should not work when dashboardMeta.canSave is false, #1834 2015-04-27 10:59:14 +02:00
Torkel Ödegaard
b0ef659add Stop users from entering panel edit mode when dashboard editable is false, #1834 2015-04-27 10:56:36 +02:00
Torkel Ödegaard
29a7490af2 Small fix for unsaved changes when using save as feature 2015-04-27 10:29:04 +02:00
Torkel Ödegaard
ad45b63e79 Merge branch 'editable_false' of github.com:grafana/grafana into editable_false 2015-04-27 10:10:01 +02:00
Torkel Ödegaard
16fc6e8b42 More work on editable false dashboards, #1834 2015-04-27 10:09:32 +02:00
Torkel Ödegaard
af277f560f Merge branch 'master' into editable_false 2015-04-27 08:53:57 +02:00
Torkel Ödegaard
ff403efe09 Merge pull request #1887 from masaori335/kairosdb-tag-suggention
Refactoring of tag suggestion in KairosDB Plugin
2015-04-26 20:31:29 +02:00
Masaori Koshiba
df9403809b Fix conflict 2015-04-26 23:14:50 +09:00
Masaori Koshiba
d86814b6c5 Refactoring of tag suggestion 2015-04-26 23:02:40 +09:00
Torkel Ödegaard
d66e510c42 Merge pull request #1867 from maddenca/patch-1
Documented units for timepicker
2015-04-26 15:35:59 +02:00
Torkel Ödegaard
87007994af Merge branch 'kairosdb-metric-text' of https://github.com/masaori335/grafana into kariosdb 2015-04-26 15:22:21 +02:00
Torkel Ödegaard
03e4afa736 Merge pull request #1882 from masaori335/kairosdb-appearance
Fix query editor appearance of KairosDB Plugin
2015-04-26 15:15:05 +02:00
Torkel Ödegaard
f120e96eeb Merge pull request #1883 from masaori335/kairosdb-merge-master
Merge branch 'master' into kariosdb
2015-04-26 15:14:28 +02:00
Masaori Koshiba
7e044e29ba Change metric form input text
Preparation of templated dashboard support.
2015-04-26 19:31:04 +09:00
Masaori Koshiba
63ac6640e6 Merge branch 'master' into kairosdb-merge-master 2015-04-26 11:04:02 +09:00
Torkel Ödegaard
e410fbb558 Corrected SQL migration for snapshot table column type change, #1880 2015-04-25 20:28:50 +02:00
Torkel Ödegaard
4eeaa6bf9d Merge pull request #1881 from raintank/issue1880
fixes #1880 correct mysql statement for modifying column data type
2015-04-25 20:24:22 +02:00
Masaori Koshiba
5d57931060 Fix appearance of query editor 2015-04-26 00:24:04 +09:00
Anthony Woods
f227002a80 fixes #1880 dashboard_snapshot table does not have a data column 2015-04-25 18:51:25 +08:00
Anthony Woods
d84d92f73c fixes #1880 correct mysql statement for modifying column data type 2015-04-25 18:46:30 +08:00
Torkel Ödegaard
a0cbca4cad more work on editable false, #1834 2015-04-25 11:10:28 +02:00
Masaori Koshiba
0a23a996bc Remove targetLetters 2015-04-25 16:12:10 +09:00
Torkel Ödegaard
380b7f4d94 updated version to 2.1.0-pre1 2015-04-24 15:57:20 +02:00
Torkel Ödegaard
bad2d1a974 Merge pull request #1869 from marknoe1/extra_uom
Added units for voltage, current and frequency
2015-04-24 15:55:53 +02:00
Torkel Ödegaard
4fd2c0570c Replaced slug dependency with one that did not use gopkgs.com 2015-04-24 15:46:16 +02:00
Torkel Ödegaard
fd274592d4 Merge branch 'master' into editable_false 2015-04-24 12:06:50 +02:00
Torkel Ödegaard
7064d87106 Firefox/IE issue, invisible text in dashboard search fixed, Fixes #1872 2015-04-24 11:20:09 +02:00
Mark Oellermann
f8ceb341d6 Added units for voltage, current and frequency 2015-04-24 13:23:54 +10:00
Chris Madden
3fdab59029 Documented units for timepicker
Timepicker units (like s, m, M, etc) were not in the documentation so I have added them.
2015-04-23 23:53:15 +02:00
Emil Thelin
2d7c7871b0 Fixes broken test 2015-04-23 20:56:31 +02:00
Emil Thelin
9fd3ef2687 Enforce domain 2015-04-23 20:38:00 +02:00
Anthony Woods
b6a4db3f8a always refresh varible options if refresh=true 2015-04-24 00:19:16 +08:00
Torkel Ödegaard
b99ee2562e Restored sql integration tests to use in mem sqlite3 2015-04-23 16:21:49 +02:00
Torkel Ödegaard
8526025792 MySQL: Dashboard.data column type changed to mediumtext (sql migration added), Fixes #1863 2015-04-23 16:18:46 +02:00
Torkel Ödegaard
236c4e65f8 Began work on dashboard: editable flag, that actually stops users from changing anything, #1834 2015-04-23 15:26:48 +02:00
Torkel Ödegaard
d92fae07a5 Merge pull request #1860 from aibou/master
Fix and update documents
2015-04-23 14:55:17 +02:00
aibou
968b1b4308 Fix and update documents 2015-04-23 17:42:04 +09:00
Torkel Ödegaard
e9a174d1c5 Merge pull request #1854 from ton31337/master
Remove exit 0 at the end of init.d script
2015-04-23 08:45:26 +02:00
Torkel Ödegaard
2c52224013 /api/login/ping Fix for issue when behind reverse proxy and subpath, Fixes #1857 2015-04-23 08:24:30 +02:00
Donatas Abraitis
869cf705e0 Remove exit 0 at the end of init.d script 2015-04-22 22:29:56 +03:00
Torkel Ödegaard
9f6a348851 Updated install docs with 2.0.2 version 2015-04-22 19:23:28 +02:00
Torkel Ödegaard
aa52f6675c updated changelog 2015-04-22 17:56:07 +02:00
Torkel Ödegaard
9cc5e981dd Bumped version to 2.0.2 2015-04-22 17:51:50 +02:00
Torkel Ödegaard
da74fa0862 Updated configuration and http api docs 2015-04-22 17:44:47 +02:00
Torkel Ödegaard
1dfc576263 Panel timeshift: You can now use panel timeshift without a relative time override, Fixes #1848 2015-04-22 13:54:31 +02:00
Torkel Ödegaard
170e8a5d76 Another docs update 2015-04-22 13:47:15 +02:00
Torkel Ödegaard
bd0bf3747e Began work on http api docs, #1822 2015-04-22 13:23:33 +02:00
Torkel Ödegaard
a11b180480 Snapshots: Fixed issue with snapshoting dashboards with an interval template variable, Fixes #1846 2015-04-22 12:27:12 +02:00
Torkel Ödegaard
f8cfbedefd Removed semver dependency from go build script 2015-04-22 08:56:14 +02:00
Torkel Ödegaard
90a77bdf85 Fixed failure loop in init.d script when grafana will not start (due to permission issue or other), Fixes #1837 2015-04-22 08:47:53 +02:00
Torkel Ödegaard
e438d21cc0 fixed minor issue in build file 2015-04-22 08:26:49 +02:00
Torkel Ödegaard
dc88fff704 Migration: Import dashboards from Elasticsearch was capped at 100, now capped at 10000, Fixes #1843 2015-04-22 07:50:23 +02:00
Torkel Ödegaard
8ff316252e Update info text in grafana test data source, Fixes #1840 2015-04-21 21:17:32 +02:00
Torkel Ödegaard
dabdf1b7fd Graph Panel + Legend Table mode: Many series casued zero height graph, now legend will never reduce the height of the graph below 50% of row height, Fixes #1832 2015-04-21 18:46:44 +02:00
Torkel Ödegaard
6fb6e44ece updated rpm install docs 2015-04-21 17:17:08 +02:00
Torkel Ödegaard
6df299886e Updated windows install instructions 2015-04-21 13:30:15 +02:00
Torkel Ödegaard
b25411ef6b Updated license link on docs page 2015-04-21 10:23:10 +02:00
Torkel Ödegaard
dfa5b005cc Updated docs makefile 2015-04-21 10:20:55 +02:00
Torkel Odegaard
73b512859a Small ui align fix to graph axis and grid edit ui 2015-04-21 09:48:50 +02:00
Torkel Ödegaard
c2a4e4720b Merge pull request #1827 from bergquist/set_default_line_fill_to_1
Change default values for linewidth and fill.
2015-04-21 09:43:46 +02:00
carl bergquist
74c5015648 Change default values for linewidth and fill. 2015-04-21 09:27:15 +02:00
Torkel Odegaard
5bddf79d09 Correctly determine arch for windows builds 2015-04-21 08:56:32 +02:00
Torkel Odegaard
05bed2fd8a Fixed folder location for readme and license files in bin tar / zip package 2015-04-21 08:20:34 +02:00
Torkel Ödegaard
c3f0ef4126 Merge pull request #1821 from masaori335/kairosdb-refactoring
Clean up KairosDB Plugin
2015-04-20 21:08:53 +02:00
Torkel Ödegaard
e549a9c09c Fixed minor docs issue 2015-04-20 18:16:55 +02:00
Torkel Ödegaard
8ef3ee1319 Updated appveyor spec file again (windows CI server, hope to get windows builds soon) 2015-04-20 18:09:57 +02:00
Masaori Koshiba
c762ad8db2 Refactoring KairosDB Plugin 2015-04-21 00:48:25 +09:00
Torkel Ödegaard
929dc2b29c updated appveyor (Windows ci build) spec file 2015-04-20 16:19:55 +02:00
Torkel Ödegaard
a5d3c1a655 Updated docs 2015-04-20 14:20:01 +02:00
Torkel Ödegaard
a933192b56 Updated docs version selector 2015-04-20 13:46:14 +02:00
Torkel Ödegaard
41565335ed Updated docs with new latest packages 2015-04-20 13:35:39 +02:00
Torkel Ödegaard
9540e12e2e Updated version to 2.0.1 to work around rpm and deb versioning scheme does not support regular semver prerelease naming standard, it seems like 2.0.0-beta3 is newer than 2.0.0 for rpm and deb packages. 2015-04-20 13:21:42 +02:00
Torkel Ödegaard
9766106686 Added link to rpm GPG key 2015-04-20 12:38:49 +02:00
Torkel Ödegaard
3d8beb918b Docs updates and update to tar package 2015-04-20 12:33:32 +02:00
Torkel Ödegaard
123ea331e6 Updated build.go to create latest packages correctly 2015-04-20 12:10:54 +02:00
Torkel Ödegaard
b5a77d4f4a Updated version to 2.0.0 and updated changelog 2015-04-20 11:54:36 +02:00
Torkel Ödegaard
9852972db8 Merge remote-tracking branch 'origin/nopzor1200-patch-1' 2015-04-20 11:47:36 +02:00
Torkel Ödegaard
b286ed6bb8 Small UI polish to playlist creation view 2015-04-20 11:47:09 +02:00
Torkel Odegaard
b56a084810 Updated nodejs version in appveyor ci build spec file 2015-04-20 09:19:19 +02:00
Torkel Odegaard
c9a28ddd38 Windows build: updates to build stuff to create better windows packages 2015-04-20 08:10:23 +02:00
Torkel Odegaard
bb7ee1c5a3 Panel title: switched from context-menu cursor to pointer, context-menu does not work on windows in chrome and firefox, but works on other platforms :( 2015-04-20 07:29:25 +02:00
nopzor1200
1772e15b46 Update index.md 2015-04-19 23:24:35 -04:00
nopzor1200
360efdf71f Update whats-new-in-v2.md 2015-04-19 23:18:33 -04:00
nopzor1200
56d1e6834a Update timerange.md 2015-04-19 22:03:18 -04:00
nopzor1200
f1e267498e Update timerange.md 2015-04-19 22:02:44 -04:00
nopzor1200
4ba6bf8e27 Update playlist.md 2015-04-19 21:46:22 -04:00
nopzor1200
101c44f22d Update playlist.md 2015-04-19 21:37:34 -04:00
nopzor1200
7f967524b9 Update index.md 2015-04-19 21:27:37 -04:00
Torkel Odegaard
01e171373c Updated appvayor file again 2015-04-19 21:31:42 +02:00
Torkel Odegaard
229a4a8aab appveyor, install mingw 2015-04-19 20:59:14 +02:00
Torkel Odegaard
f6feb455a9 Updated to appveyor ci spec file 2015-04-19 20:45:18 +02:00
Torkel Odegaard
fbf4eac257 Added appveyor, trying to test if a windows CI build will be possible 2015-04-19 20:38:24 +02:00
nopzor1200
48b5d235d8 Update index.md 2015-04-19 14:25:10 -04:00
Torkel Ödegaard
0d8e024c18 Merge pull request #1814 from masaori335/kairosdb-test
Add a basic test of KairosDBDatasource
2015-04-19 18:23:00 +02:00
Masaori Koshiba
cc9d2fc139 Suppress LOG in test 2015-04-20 00:51:43 +09:00
Masaori Koshiba
dbc07827cf Add a basic test of KairosDBDatasource 2015-04-19 23:47:29 +09:00
Masaori Koshiba
05c27d8340 Rename 'KairosDBTargetCtrl' to 'KairosDBQueryCtrl' 2015-04-19 21:52:04 +09:00
Masaori Koshiba
d57ffad5e1 Add a space between arguments 2015-04-19 21:43:18 +09:00
Torkel Odegaard
ebdbbbc000 Updated building on windows instructions in the docs 2015-04-19 09:44:14 +02:00
Torkel Odegaard
1edb13d715 Fixed gofmt formating 2015-04-19 09:29:08 +02:00
Torkel Ödegaard
aa8beda4ec Merge pull request #1800 from alienth/allowsignup
Add allow_sign_up setting for auth.google/github.
2015-04-19 09:16:48 +02:00
Torkel Odegaard
7178dcad35 Windows: Fixed runtime issue with file logging config that casued errors on startup 2015-04-19 09:14:50 +02:00
William Wei
76b517b361 allow graphite metrics name contain '~'
when a metrics name contains '~', id does not impact graph display.
but you can not use grafana UI to edit metrics with realtime
graphite query.
2015-04-17 15:51:26 +08:00
Jason Harvey
ddaac50a25 Add allow_sign_up override for auth.google/github. 2015-04-16 13:43:18 -08:00
Torkel Ödegaard
a446286869 Fixed issue with unsaved changes srv being triggerd by starring / unstarring a dashboard, Fixes #1795 2015-04-16 17:21:03 +02:00
Torkel Ödegaard
c54f0fe58b Merge pull request #1783 from williamjoy/master
oauth google: read api_url from config file
2015-04-16 08:15:31 +02:00
Torkel Ödegaard
7c8166cad2 updated build script 2015-04-15 15:41:56 +02:00
Torkel Ödegaard
3db2aaada6 Bumped version to rc1 2015-04-15 15:17:19 +02:00
Torkel Ödegaard
649d40ed66 Data source proxy: Fixed issue with using data source proxy when grafana is behind nginx suburl, Fixes #1784 2015-04-15 15:13:52 +02:00
Torkel Ödegaard
d71b626114 Graph Panel: Legend in table mode now aligns, graph area is reduced depending on how many series, Fixes #1786, Fixes #1749 2015-04-15 14:53:20 +02:00
Torkel Ödegaard
fc47fb8f64 Backend auth: remember cookie is needed for oauth logins as well 2015-04-15 13:38:38 +02:00
Torkel Ödegaard
10e5e5c400 fixed godep dependency 2015-04-15 13:31:30 +02:00
Torkel Ödegaard
942e8fdba8 Support for unicode / international characters in dashboard title (improved slugify), Fixes #1734, Fixes #827 2015-04-15 12:36:02 +02:00
Torkel Ödegaard
6ba8854854 Readded link in top header, Fixes #1756 2015-04-15 12:17:31 +02:00
William Wei
b7c0d99cdf get google api url from config file
instead of using https://www.googleapis.com/oauth2/v1/userinfo in
code.
2015-04-15 18:11:54 +08:00
Lichun Wei
bc4584d9fe Merge pull request #1 from grafana/master
sync from upstream
2015-04-15 18:04:52 +08:00
Torkel Ödegaard
53b1d6a5b2 Row editor: increased width of title field, Fixes #1755 2015-04-15 10:52:09 +02:00
Torkel Ödegaard
836e4b4911 Dashboard snapshot: Should not require login to view snapshot, Fixes #1780 2015-04-15 10:39:03 +02:00
Torkel Ödegaard
e9afd30b47 Updated changelog with, Github OAuth: Now works with Github for Enterprise, thanks @williamjoy 2015-04-15 10:31:56 +02:00
Torkel Ödegaard
aefbcb7049 Merge pull request #1782 from williamjoy/master
#1781 try fix oauth with github enterprise - add config of api_url
2015-04-15 10:21:09 +02:00
William Wei
4fd2622e55 grafana/grafana#1781 add oauth api url as config
read github api from config file instead of using public github:
http://api.github.com/user

this would be useful when you are using github enterprise edition
2015-04-15 14:18:10 +08:00
William Wei
d048e39cde grafana/grafana#1781 add oauth api url as config 2015-04-15 14:03:28 +08:00
Torkel Ödegaard
140f1307b4 Small fix to singlestat panel and unit selector 2015-04-14 17:13:39 +02:00
Torkel Ödegaard
9d10b5ab52 Updated docker docs 2015-04-14 16:53:54 +02:00
Torkel Ödegaard
edb39a072e Updated rpm install docs page with yum repo info 2015-04-14 16:49:42 +02:00
Torkel Ödegaard
d66d989308 Updated debian install instructions with apt repo 2015-04-14 16:28:57 +02:00
Torkel Ödegaard
05c3b96202 Updated install docs page 2015-04-14 14:06:53 +02:00
Torkel Ödegaard
e9c7264fd9 Docs updates 2015-04-13 14:12:03 +02:00
Torkel Ödegaard
0b1c1bb8b4 updated package version 2015-04-13 14:06:33 +02:00
Torkel Ödegaard
47a18bba99 Fixed defaults.ini, missing allowed_domains key, #1729 2015-04-13 14:04:52 +02:00
Torkel Ödegaard
7ffdb488c1 Updated opentsdb docs article with info on adding the data source 2015-04-13 11:49:12 +02:00
Torkel Ödegaard
2c1188f664 Updated influxdb docs page with info on how to add a datasource 2015-04-13 11:35:43 +02:00
Torkel Ödegaard
60ab08ed1b Updated Graphite docs page with instruction on how to add a graphite data source 2015-04-13 09:37:07 +02:00
Torkel Ödegaard
2bb85d216e Fixed fixed decimal option bug, when fixed decimal value was set to zero, Fixes #1764 2015-04-13 09:05:42 +02:00
Torkel Ödegaard
7be8fb8432 Updated install docs 2015-04-13 08:14:13 +02:00
Torkel Ödegaard
a4ef1e22d6 Updated docs 2015-04-13 07:55:07 +02:00
Torkel Ödegaard
3335041d39 Trying to split install docs into seperate pages 2015-04-13 07:34:55 +02:00
Torkel Ödegaard
19e881513b updated changelog 2015-04-12 21:34:37 +02:00
Torkel Ödegaard
41777c01f1 Updated config docs 2015-04-12 21:31:35 +02:00
Torkel Ödegaard
6b26c8d46f updated to install docs 2015-04-12 21:28:01 +02:00
Torkel Ödegaard
d4339ae9d2 Updated packaging post install 2015-04-12 16:23:43 +02:00
Torkel Ödegaard
bdc4d14036 Updated postinstall scripts 2015-04-12 16:19:44 +02:00
Torkel Ödegaard
ed82f6c681 Added upgrade step that moves sqlite3 database to new location, #1758 2015-04-12 15:58:08 +02:00
Torkel Ödegaard
d4e6ae2804 Fixed issue in rpm init.d script 2015-04-12 15:52:51 +02:00
Torkel Ödegaard
32275cb009 Merge pull request #1760 from masaori335/kairosdb-cleanup
Cleanup KairosDB Plugin
2015-04-12 15:37:45 +02:00
Torkel Ödegaard
ff353197fb Merge pull request #1759 from masaori335/kairosdb-fix-icon
Fix class names in query.editor.html of KairosDB plugin
2015-04-12 15:37:33 +02:00
Masaori Koshiba
88bf0cdb9e Fix styles around 'function' 2015-04-12 20:51:35 +09:00
Masaori Koshiba
a2b751976e Add space before and after binary operators 2015-04-12 20:41:09 +09:00
Masaori Koshiba
ddb4b928a0 Delete MetricListToObject which never used 2015-04-12 20:28:01 +09:00
Masaori Koshiba
2b5fa599fb Fix styles warned by jshint 2015-04-12 20:28:00 +09:00
Masaori Koshiba
ae2201ef6f Add space after keywords 2015-04-12 20:28:00 +09:00
Masaori Koshiba
ed69ddedbf Fix styles warned by jscs 2015-04-12 20:27:51 +09:00
Masaori Koshiba
66f5411402 Fix class names in query.editor.html of KairosDB Plugin 2015-04-12 18:39:41 +09:00
Torkel Ödegaard
a60bf642e1 Updated build.go 2015-04-12 09:51:56 +02:00
Torkel Ödegaard
be8a72c35b Updated rpm post install script, #1758 2015-04-12 09:49:28 +02:00
Torkel Ödegaard
cc14705404 Update changelog 2015-04-12 09:42:27 +02:00
Torkel Ödegaard
6de584aafc Updated to config file finding, and added homepath command line option 2015-04-12 09:15:49 +02:00
Torkel Ödegaard
cc427b1307 Merge branch 'master' into packaging_refactoring 2015-04-10 17:45:01 +02:00
Torkel Ödegaard
00cdb5e36a Merge pull request #1738 from mtanda/suppress_redrawing_by_tooltip
Suppress redrawing when Shared Crosshair is disabled
2015-04-10 17:44:39 +02:00
Torkel Ödegaard
437cd50039 Merge pull request #1740 from craftytrickster/master
When performing a metric find query, the InfluxDb9 datasource needs a qu...
2015-04-10 17:41:56 +02:00
Torkel Ödegaard
61add0ecc6 Merge pull request #1742 from mattttt/patch-1
Typo fix in help_modal.html
2015-04-10 17:41:21 +02:00
Torkel Ödegaard
8accb8865a restart on upgrade default to false 2015-04-10 17:36:25 +02:00
Torkel Ödegaard
c44248440e Updated to rpm package 2015-04-10 17:32:40 +02:00
Torkel Ödegaard
d32c03ed11 Rpm working again, systemd working on centos 7 2015-04-10 16:20:01 +02:00
Torkel Ödegaard
3e49609099 started work on new rpm package 2015-04-10 11:35:14 +02:00
Torkel Ödegaard
c47f4bc97c systemd service is working on debian jessie 2015-04-10 11:26:03 +02:00
Torkel Ödegaard
8ee7d5c2d5 Deb package is starting to work 2015-04-10 11:05:56 +02:00
Torkel Ödegaard
2020fedfdb Fixed issue with overriding default config values via command line 2015-04-10 10:58:32 +02:00
Matt
40b2535728 Typo fix in help_modal.html
Fixed typo in header (Keyboard shutcuts -. Keyboard shortcuts)
2015-04-09 16:18:15 -04:00
David Raifaizen
2d016c5a3f When performing a metric find query, the InfluxDb9 datasource needs a query type in order to return results succesfully. This parameter is not available when called from the templateValuesSrv, which is causing an error 2015-04-09 12:05:18 -04:00
Mitsuhiro Tanda
ba3bb57926 suppress all graph redrawing when shared tooltip is enabled 2015-04-10 00:34:23 +09:00
Torkel Ödegaard
4c6d7630cd more work on refining config loading, and packaging 2015-04-09 17:18:04 +02:00
Torkel Ödegaard
d1767144a8 Reworking configuration loading and overriding 2015-04-09 12:16:59 +02:00
Torkel Ödegaard
a991cda233 Began work on refactoring reading config values 2015-04-08 20:31:42 +02:00
Torkel Ödegaard
9c2040aa9b More deb & rpm work, systemd testing 2015-04-08 16:58:05 +02:00
Torkel Ödegaard
96ee1c17a3 Worked on new deb & rpm packaging and init.d scripts 2015-04-08 14:10:04 +02:00
Torkel Ödegaard
6911572fa1 Panel image rendering: now works under self-signed https cert, Fixes #1726 2015-04-08 09:06:01 +02:00
Torkel Ödegaard
059db533d5 HTTP API: grafana /render calls nows with api keys, Fixes #1649 2015-04-08 08:59:12 +02:00
Torkel Ödegaard
f28af4f369 OpenTSDB: another improvement to OpenTSDB query -> query result matching 2015-04-07 21:47:06 +02:00
Torkel Ödegaard
1bd238191c OpenTSDB: better matching for query -> query result series 2015-04-07 21:42:21 +02:00
Torkel Ödegaard
c07d48d930 A big refactoring for how sessions are handled, Api calls that authenticate with api key will no longer create a new session 2015-04-07 19:21:14 +02:00
Torkel Ödegaard
00a713c42e Updated configuration docs with cert_key and cert_file info, Closes #1722 2015-04-07 16:48:30 +02:00
Torkel Ödegaard
01c97e69dd Updated influxdb 0.9 datasource config view to mention incomplete state of data source 2015-04-07 13:56:35 +02:00
Torkel Ödegaard
646298f5c5 Handle errors when loading dashboard with template variables that query data sources that cannot be found 2015-04-07 13:48:26 +02:00
Torkel Ödegaard
8f73328e25 Fixed datasource proxy and session timeout issue for OpenTSDB, #1667 2015-04-07 09:53:59 +02:00
Torkel Ödegaard
b5112aeee2 Data source proxy, and session timeout fix for influxdb, #1667 2015-04-07 09:50:03 +02:00
Torkel Ödegaard
22adf0d06e Datasource proxy & session timeout fix (casued 401 Unauthorized error after a while), Fixes #1667 2015-04-07 09:25:00 +02:00
Torkel Ödegaard
382f7066d9 Fixed importing dashboards from graphite web issue 2015-04-06 14:46:06 +02:00
Torkel Ödegaard
08c19692ea Updated configuration docs 2015-04-06 14:19:18 +02:00
Torkel Ödegaard
eb575685aa OAuth: Specify allowed email address domains for google or and github oauth logins, Closes #1660 2015-04-06 14:16:22 +02:00
Torkel Ödegaard
7a95451288 Fixed graph tooltip lingering when changing dashboard using keyboard, Fixes #1700 2015-04-06 11:42:50 +02:00
Torkel Ödegaard
538ec7c0a0 Unsaved changes: Do not show for snapshots, scripted and file based dashboards, Fixes #1707 2015-04-06 11:22:35 +02:00
Torkel Ödegaard
ea800dd838 Added login to organization users table, Fixes #1683 2015-04-04 10:14:51 +02:00
Torkel Ödegaard
b8c378f2f0 Updated golang/x/oauth2 dependency, #1710 2015-04-04 09:50:25 +02:00
Torkel Ödegaard
e86bedddb2 Updated gitignore file 2015-04-02 15:37:22 +02:00
Torkel Ödegaard
1e1a6df480 Playlist: fixed issue where dashboard title was not visible when playing playlist 2015-04-02 15:37:03 +02:00
Torkel Ödegaard
7aa1ab855e Row editor fix: fixed issue when opening row editor when dashboard settings view is opened, Fixes #1688 2015-04-02 10:05:33 +02:00
Torkel Ödegaard
776f15055a Fixed grafana version in dash settings footer, Fixes #1699 2015-04-02 09:50:57 +02:00
Torkel Ödegaard
b291b18a87 Unsaved changes improvements: ignore row collapse state, ignore graph legend sort order, Closes #1702 2015-04-02 09:44:16 +02:00
Torkel Ödegaard
e6492f7db9 Share modal: Override UI theme via URL param for Share link, rendered panel, or embedded panel, Closes #1701 2015-04-02 09:21:38 +02:00
Torkel Ödegaard
3b737999d6 Unsaved changes: Do not show for users with role , Fixes #1703 2015-04-02 08:08:22 +02:00
Torkel Ödegaard
00fa7f5e86 Removed unusued config, updated sample config with session config 2015-04-02 07:51:16 +02:00
Torkel Ödegaard
fde5ba85a0 Docs: Updated configuration docs with port 80 tips 2015-04-01 17:24:24 +02:00
Torkel Ödegaard
a96e4a343c Only create admin user specified in config file when there are no users in the database, Fixes #1680 2015-04-01 16:05:42 +02:00
Torkel Ödegaard
36110d0977 Updated migration docs 2015-04-01 15:56:39 +02:00
Torkel Ödegaard
1f330d7753 Basic auth: Fixed issue when using basic auth proxy infront of Grafana, Fixes #1673 2015-04-01 15:23:26 +02:00
Torkel Ödegaard
cf877e6567 added postgres and redis session options 2015-04-01 09:45:42 +02:00
Torkel Ödegaard
c3fa68ade8 Data source proxy: Fixed issue with Gzip enabled and data source proxy, Fixes #1675 2015-04-01 09:00:17 +02:00
Torkel Ödegaard
5422d13607 Postgres fix update 2015-04-01 08:26:02 +02:00
Torkel Ödegaard
d8f614ed98 Merge pull request #1665 from mattrobenolt/bool
Let xorm convert `False` into the right type
2015-04-01 08:25:20 +02:00
Torkel Ödegaard
4ca125da41 Delete snapshot fix: the action is now shows confirmation directly in the modal (not opening a new tab with api call as in beta1), Fixes #1682 2015-04-01 08:24:03 +02:00
Torkel Ödegaard
3c2bfbfc1c Search: Dashboard results should be sorted alphabetically, Fixes #1685 2015-03-31 22:06:19 +02:00
Torkel Ödegaard
03e336ba9e Fixed minor issue doing snapshot from home (root) dashboard 2015-03-31 21:48:54 +02:00
Torkel Ödegaard
76ea0f432a updated master version to beta2 2015-03-31 19:20:34 +02:00
Torkel Ödegaard
7eb45e1799 MySQL session: fixed problem using mysql as session store, Fixes #1681 2015-03-31 19:18:41 +02:00
Torkel Ödegaard
4af1dcd54f Updated defaults.ini, reverted change in previous commit 2015-03-31 17:42:51 +02:00
Torkel Ödegaard
463c519954 Dashlist panel: added fresh panel when changing limit, Fixes #1677 2015-03-31 17:30:27 +02:00
Torkel Ödegaard
1d0a3660bd Fixed issue with updating default data source, it required page reload to take effect, should not be required, now fixed, Fixes #1671 2015-03-31 14:31:47 +02:00
Torkel Ödegaard
b83367063e Small improvement to dashboard loading error handling 2015-03-31 14:03:01 +02:00
Torkel Ödegaard
aa724fc11e Remove datasource names in panels from snapshots 2015-03-31 10:48:14 +02:00
Matt Robenolt
cedb11ebab Let xorm convert False into the right type 2015-03-30 18:11:39 -07:00
Torkel Ödegaard
ffe389af4a Updated to whats new guide 2015-03-30 19:18:15 +02:00
Torkel Ödegaard
b313637848 updated confiuration docs 2015-03-30 17:39:16 +02:00
Torkel Ödegaard
2eeae21777 Updated whats new docs guide 2015-03-30 17:35:38 +02:00
Torkel Ödegaard
2af9dfebea Merge pull request #1657 from lfrancke/patch-1
Update index.md
2015-03-30 17:04:28 +02:00
Lars Francke
dade6fc191 Update index.md
Fixes two typos and a minor inconsistency
2015-03-30 16:55:37 +02:00
Torkel Ödegaard
fb0629a913 Bumbped version to 2.0.0-beta1 2015-03-30 15:45:02 +02:00
Torkel Ödegaard
060d0b777b Updated install docs and changelog 2015-03-30 12:31:12 +02:00
Torkel Ödegaard
dc03ca8879 Opening search closes fullscreen edit or fullscreen view 2015-03-30 12:25:17 +02:00
Torkel Ödegaard
de51aeab7b updates to whats new doc, and building from source, also small fix for panel snapshot, single panelsnapshot should expand panel span to 12 2015-03-30 11:08:46 +02:00
Torkel Ödegaard
b46f8bad6d Added check for allow_user_org_create, updated admin docs 2015-03-30 10:12:24 +02:00
Torkel Ödegaard
8982dc5ed3 Update getting started 2015-03-30 09:38:40 +02:00
Torkel Ödegaard
2d2462fe63 Updated configuration docs 2015-03-30 09:22:58 +02:00
Torkel Ödegaard
b1fedca46e Merge pull request #1656 from nopzor1200/patch-5
Update gettingstarted.md
2015-03-30 08:39:38 +02:00
Torkel Ödegaard
929187a934 Merge pull request #1655 from nopzor1200/patch-4
Update admin.md
2015-03-30 08:38:58 +02:00
Torkel Ödegaard
7f34462f9a Merge pull request #1654 from nopzor1200/patch-3
Update influxdb.md
2015-03-30 08:38:14 +02:00
nopzor1200
2c54937104 Update gettingstarted.md
fleshed out 'getting started' text
2015-03-29 16:39:08 -04:00
Torkel Ödegaard
472b8c6e8d Fixed link in docs 2015-03-29 21:27:48 +02:00
Torkel Ödegaard
8e33c2c4d3 Mini work on InfluxDB 0.9 datasource, still needs a lot of work 2015-03-29 20:47:34 +02:00
Torkel Ödegaard
795cee13c8 KairosDB data source plugin is messy, needs a lot of clean up & refactoring, please help 2015-03-29 20:30:59 +02:00
Torkel Ödegaard
15188c4a88 Moved kairosdb data source to correct folder 2015-03-29 20:13:32 +02:00
Torkel Ödegaard
48f5a77e24 Merge branch 'master' into kariosdb 2015-03-29 20:08:28 +02:00
Torkel Ödegaard
c42d09b267 Enabled snapshot sharing of single panels, enabled sharing of snapshot dashboards (but you cannot snapshot a snapshot 2015-03-29 15:01:27 +02:00
Torkel Ödegaard
0f791c9fa8 Refactoring of share modal 2015-03-29 14:30:03 +02:00
Torkel Ödegaard
ceb079a7ea removed old docs, need to update export & import docs, and playlist docs 2015-03-29 13:46:37 +02:00
Torkel Ödegaard
607b273b28 Merge branch 'master' into kariosdb 2015-03-29 13:42:00 +02:00
Torkel Ödegaard
ce99e7b294 Updated gitignore and added config.js 2015-03-29 13:41:01 +02:00
Torkel Ödegaard
a20c276c84 Updated readme 2015-03-29 13:39:51 +02:00
Torkel Ödegaard
2186b09ed7 Removed travis file, circle ci is the primary CI service 2015-03-29 13:34:58 +02:00
Torkel Ödegaard
38db91c7be Fixed failing go unit test 2015-03-29 13:33:34 +02:00
Torkel Ödegaard
902f5d895a Updated readme 2015-03-29 13:30:03 +02:00
Torkel Ödegaard
6d565cb355 Merge branch 'patch-3' of https://github.com/mattrobenolt/grafana 2015-03-29 13:08:28 +02:00
Torkel Ödegaard
6a9256bb00 Bumped version to prebeta3 2015-03-29 13:07:40 +02:00
Torkel Ödegaard
b48b2ac656 Updated grunt tasks for the src -> public directory change 2015-03-29 13:06:53 +02:00
Torkel Ödegaard
fde11be279 Renamed src directory to public 2015-03-29 12:57:28 +02:00
Torkel Ödegaard
adb5d6da84 Merge branch develop (Grafana 2.0 branch) into master 2015-03-29 12:52:07 +02:00
Matt Robenolt
92d869e85c typo: sqllite -> sqlite 2015-03-28 16:26:51 -07:00
nopzor1200
e8e83bdbce Update admin.md 2015-03-28 18:40:25 -04:00
nopzor1200
bb8f8fccca Update influxdb.md
clarified some language, split into influx 0.9 and influx 0.8 since they are now two separate datasources/queryeditors
2015-03-28 17:30:36 -04:00
Torkel Ödegaard
1824caa5ea Updated snapshot share icon size 2015-03-28 21:04:38 +01:00
Torkel Ödegaard
dfac87db05 Removed unused function from kbn.js 2015-03-28 18:04:22 +01:00
Torkel Ödegaard
15c8a5e351 Merge pull request #1651 from nopzor1200/patch-1
Updates to migration doc
2015-03-28 18:02:13 +01:00
Torkel Ödegaard
8e9a0eddf5 Custom snapshot topnav header, new custom dashboard snapshot icon, #1623 2015-03-28 17:53:52 +01:00
nopzor1200
1200dd4b75 Update migrating_to2.md 2015-03-28 11:57:00 -04:00
nopzor1200
f969fce4d4 Update migrating_to2.md
minor tweaks
2015-03-28 00:39:13 -04:00
nopzor1200
45419195aa Update migrating_to2.md
some suggested updates
2015-03-28 00:30:39 -04:00
Torkel Ödegaard
80c771c945 Added googla analytics id setting 2015-03-27 17:13:44 +01:00
Torkel Ödegaard
6bd2736116 added transparent panel option 2015-03-27 14:39:03 +01:00
Torkel Ödegaard
f7b4f331f3 Updating docs 2015-03-27 14:23:23 +01:00
Torkel Ödegaard
618d4f0a9d Testing kariosdb datasource, hm.. needs a lot of work 2015-03-27 13:49:05 +01:00
Torkel Ödegaard
c01efad997 Updated config (minor description change) 2015-03-27 11:26:20 +01:00
Torkel Ödegaard
2933b89a82 Merge branch 'develop' into panel_repeat
Conflicts:
	src/app/partials/roweditor.html
	src/app/partials/submenu.html
	src/css/less/submenu.less
	src/test/specs/templateSrv-specs.js
2015-03-27 10:47:45 +01:00
Torkel Ödegaard
1d64ba3b5d Small style update to submenu (template variables, annotation menu) 2015-03-27 08:39:08 +01:00
Torkel Ödegaard
e646ae8be4 updated whats new doc 2015-03-27 07:39:06 +01:00
Torkel Ödegaard
d3db49ae3e Fixed snapshot sharing issue 2015-03-27 06:47:58 +01:00
Torkel Ödegaard
7be7aeb70a Fixed sql migration issue with dashboard snapshots 2015-03-26 21:20:44 +01:00
Torkel Ödegaard
541cd2e430 Dashboard snapshot: more work on snapshot deletion, and saving external reference, #1623 2015-03-26 20:59:41 +01:00
Torkel Ödegaard
4322f29f34 Dashboard snapshot: added delete key which can be used to delete snapshots, #1623 2015-03-26 20:34:58 +01:00
Torkel Ödegaard
7d0ae23c0e small docs update 2015-03-26 19:31:43 +01:00
Torkel Ödegaard
0122a9ab18 Updated whats new doc 2015-03-26 18:03:37 +01:00
Torkel Ödegaard
165647184d Updated docs: whats new in 2.0, added sharing reference docs page, #1571 2015-03-26 17:55:07 +01:00
Torkel Ödegaard
2ca86b6085 Changed log base 16 to log base 32, #452 2015-03-26 17:44:36 +01:00
Torkel Ödegaard
b04c50537d Progress on InfluxDB 0.9 support, but will take a break, it is impossible to work on this, cannot get any queries that use tags to work with InfluxDB 0.9rc15, just empty response, #1525 2015-03-26 13:51:43 +01:00
Torkel Ödegaard
fcac4c057c updated xorm, go-sqlite3 dependencies 2015-03-26 12:41:43 +01:00
Torkel Ödegaard
71aa2ef2c2 Changed reporting interval to 24 hour (1 hour was just for testing) 2015-03-26 12:20:24 +01:00
Torkel Ödegaard
03aa997673 merged with master and fixed ES issue 2015-03-26 12:14:37 +01:00
Torkel Ödegaard
df4a00f8ef Merge remote-tracking branch 'origin/master' into develop 2015-03-26 12:09:02 +01:00
Torkel Ödegaard
f343a46ca4 Singlestat panel: Fixed error handling, when query fail do not show last value, Fixes #1647 2015-03-26 12:05:08 +01:00
Torkel Ödegaard
b1f85dc8f1 Added expire option to dashboard snapshots, #1623 2015-03-26 12:00:52 +01:00
Torkel Ödegaard
722d74a41b Removed unused animate.min.css 2015-03-25 21:27:57 +01:00
Torkel Ödegaard
86a9fe6024 Removed unused bootstrap css 2015-03-25 21:11:21 +01:00
Torkel Ödegaard
68701c5cf9 More refinements to info text on share snapshot dialog, #1623 2015-03-25 20:55:41 +01:00
Torkel Ödegaard
f4280ca517 More refinements of dashboard snapshot dialog, #1623 2015-03-25 20:36:48 +01:00
Torkel Ödegaard
afeb65b3bf Snapshot sharing fix 2015-03-25 17:18:43 +01:00
Torkel Ödegaard
d9e56b678a Fixed intendation issue 2015-03-25 16:35:14 +01:00
Torkel Ödegaard
aa60edd9fe Fixed issue with external snapshot publish 2015-03-25 16:30:03 +01:00
Torkel Ödegaard
c4b8a9853e updated grunt-jscs dependency 2015-03-25 16:06:13 +01:00
Torkel Ödegaard
e640c51f84 Merge pull request #1639 from tuexss/patch-1
readme cleanup
2015-03-25 16:00:06 +01:00
Torkel Ödegaard
b37e100058 Merge pull request #1640 from tuexss/tuexss-https
http->https for latest version
2015-03-25 15:59:20 +01:00
Torkel Ödegaard
cb3593e472 Lots of small fixes, role viewer hides save icon and some actions in
config dropdown. Snapshot dashboard hides save, star, config menu icons.
Can now embedd panel from snapshotted dashboard.
2015-03-25 15:48:56 +01:00
Torkel Ödegaard
2e6d28027a Removed snapshot from dashboard settings dropdown, its only reached through the share menu 2015-03-25 14:19:14 +01:00
Torkel Ödegaard
9c5e116d09 Fixed small file nameing issue in build script 2015-03-25 14:14:45 +01:00
Torkel Ödegaard
10618637e2 Fixed bug in sql migration, closes #1643 2015-03-25 13:53:58 +01:00
Torkel Ödegaard
4e97df06a3 Removed ghost panel 2015-03-25 13:43:52 +01:00
Torkel Ödegaard
abe529b5be Merge pull request #1641 from tuexss/tuexss-https-1
http -> https for external links
2015-03-25 12:32:04 +01:00
Torkel Ödegaard
e31a3a64e1 OpenTSDB: Alias patterns (reference tag values), syntax is: or [[tag_tagname]], Closes #1344, match opentsdb response to query, Fixes #1601 2015-03-25 12:27:33 +01:00
tuexss
152b01064a http -> https for external links 2015-03-25 12:17:22 +01:00
tuexss
f235b516dc http->https for latest version 2015-03-25 12:14:26 +01:00
tuexss
1f6d5bfd53 readme cleanup 2015-03-25 12:03:20 +01:00
Torkel Ödegaard
da833cbc58 Small progress on influxdb 0.9 query editor, #1525 2015-03-25 11:07:12 +01:00
Torkel Ödegaard
9268ecf3e9 Some refinements to dashboard snapshots 2015-03-25 09:04:38 +01:00
Torkel Ödegaard
c8687560d6 Merge pull request #1636 from mattrobenolt/patch-2
Fix more Cache-Control headers
2015-03-25 07:22:22 +01:00
Matt Robenolt
5286f0856d Fix more Cache-Control headers
`max-age` is always with an `=`, not a `:`.
2015-03-24 17:30:26 -07:00
Torkel Ödegaard
789363b0ad Added ghost panel that shows up empty rows, this panel will show add panel buttons to more quickly/easier get to add a panel, #1635 2015-03-24 21:10:44 +01:00
Torkel Ödegaard
e6918c4b99 Merge branch 'develop' into ghost-panel 2015-03-24 19:53:56 +01:00
Torkel Ödegaard
f9cf673f81 removed accidental code, should have been part of ghost-panel branch commit 2015-03-24 19:49:51 +01:00
Torkel Ödegaard
cc71b1f07d Ghost panel test 2015-03-24 19:42:39 +01:00
Torkel Ödegaard
7919d79347 Another cache header fix 2015-03-24 17:16:13 +01:00
Torkel Ödegaard
22b78aa037 Merge pull request #1632 from swehner/limit-search-results
Limit ElasticSearch to return only title and tags for dashboard search
2015-03-24 17:04:35 +01:00
Torkel Ödegaard
a5c3855233 Added dashboard snapshot metrics 2015-03-24 16:49:12 +01:00
Torkel Ödegaard
ddd3df26b1 Fixed docs spelling issue, #1634 2015-03-24 15:52:22 +01:00
Torkel Ödegaard
c27db7a347 Small updates to share dashboard snapshot feature 2015-03-24 15:46:17 +01:00
Stefan Wehner
527e802b05 Limit ElasticSearch return to title and tags 2015-03-24 11:37:26 +01:00
Torkel Ödegaard
d758729633 Merge pull request #1629 from mattrobenolt/patch-1
Fix format of Cache-Control header
2015-03-24 11:13:55 +01:00
Matt Robenolt
3e9adeefbc Fix format of Cache-Control header 2015-03-23 21:58:29 -07:00
Torkel Ödegaard
5f0e7cd52a Added custom cache control headers for static content 2015-03-23 18:28:59 -04:00
Torkel Ödegaard
98c0209976 Dashboard snapshot: cleanup snapshot data after snapshot, #1623 2015-03-23 17:34:41 -04:00
Torkel Ödegaard
6f2a8e27b8 Dashboard Snapshot: added dashboard snapshot to changelog, #1623 2015-03-23 15:36:18 -04:00
Torkel Ödegaard
41820ccb05 Dashboard Snapshot sharing: singlestat panel now works, #1623 2015-03-23 15:32:38 -04:00
Torkel Ödegaard
4d13a5bffb Fixed failing style check 2015-03-23 14:00:03 -04:00
Torkel Ödegaard
7614ddb318 Updated design for snapshot sharing dialog, #1596 2015-03-23 13:58:30 -04:00
Torkel Ödegaard
a5fac17f2b Added public snapshot test, hosted on snapshots.raintank.io 2015-03-23 07:32:03 -04:00
Torkel Ödegaard
49a0ea53c7 Merge branch 'develop' of github.com:grafana/grafana into dashboard_snapshot_poc
Conflicts:
	src/app/features/dashboard/partials/shareDashboard.html
2015-03-22 22:04:13 -04:00
Torkel Ödegaard
44bc2b2d56 Updated conf description, metrics interval 2015-03-22 16:30:28 -04:00
Torkel Ödegaard
a26436f59b Server metrics fix 2015-03-22 16:13:16 -04:00
Torkel Ödegaard
1e4c62a70d updated server reporting 2015-03-22 15:45:13 -04:00
Torkel Ödegaard
526f3e1a31 Fixed failing unit test 2015-03-22 15:27:05 -04:00
Torkel Ödegaard
c67291da33 Updated 2015-03-22 15:25:21 -04:00
Torkel Ödegaard
9c9ebb4987 Updated server stats 2015-03-22 15:24:35 -04:00
Torkel Ödegaard
d987532262 Added server metrics 2015-03-22 15:14:00 -04:00
Torkel Ödegaard
7d4293f849 removed cli commands, need to be mobed to a seperate binary using http api, #1570 2015-03-22 06:48:53 -04:00
Torkel Ödegaard
c658189c85 Updated 2015-03-21 18:39:43 -04:00
Torkel Ödegaard
a8d9ec426b Merge branch 'develop' into panel_repeat 2015-03-21 15:57:53 -04:00
Torkel Ödegaard
9bae19a7ec Small fix to logarithmic scale 2015-03-21 15:34:26 -04:00
Torkel Ödegaard
bf898138b7 Small update to drilldown link editor 2015-03-21 12:09:04 -04:00
Torkel Ödegaard
245c6dbff0 Share Panel: The share modal now has an embed option, gives you an iframe that you can use to embedd a single graph on another web site, #1622 2015-03-21 12:09:04 -04:00
Torkel Ödegaard
f48f5428e5 Adding snapshot storage and route, #1623 2015-03-21 10:56:26 -04:00
Torkel Ödegaard
964f0861d6 more work on dashboard snapshots 2015-03-21 08:53:16 -04:00
Torkel Ödegaard
a76758255f Merge branch 'develop' into dashboard_snapshot_poc 2015-03-21 07:29:40 -04:00
Torkel Ödegaard
7db3703275 Share Panel: The share modal now has an embed option, gives you an iframe that you can use to embedd a single graph on another web site, #1622 2015-03-20 22:01:39 -04:00
Torkel Ödegaard
306358e73c Merge pull request #1621 from raintank/1619
fixes #1619 Secure PhantomJS Png rendering
2015-03-20 19:30:58 -04:00
Torkel Ödegaard
2bd2605ae9 Added poc of dashboard snapshot, sharable dashboard with data embedded 2015-03-20 19:16:59 -04:00
Anthony Woods
7010df0fe8 fixes #1619 Secure PhantomJS Png rendering
removes auth hack to allow phantomjs to query pages as a user
without auth.  Instead we pass phantomjs the session cookie,
which it then includes in the request.
2015-03-21 07:14:13 +08:00
Torkel Ödegaard
36a948965b Graph: added log base 16 and log base 1024 scales, #452 2015-03-20 18:12:12 -04:00
Torkel Ödegaard
5d6583ef7b Fixed small issue in share modal introdiced in recent commit 2015-03-20 15:07:38 -04:00
Torkel Ödegaard
0aab51a73f Added row repeats 2015-03-20 15:06:23 -04:00
Torkel Ödegaard
86e9d2cf07 more work on repeating row 2015-03-20 13:33:52 -04:00
Torkel Ödegaard
c7b4041879 Merge branch 'template_var_multi_select' into panel_repeat
Conflicts:
	src/app/features/dashboard/submenuCtrl.js
	src/test/specs/templateSrv-specs.js
2015-03-20 13:00:15 -04:00
Torkel Ödegaard
6e0947c0d9 Multi selecting starting to work 2015-03-20 12:55:55 -04:00
Torkel Ödegaard
3334e36397 Updated 2015-03-20 10:24:42 -04:00
Torkel Ödegaard
35888c814c more work on multi select 2015-03-19 23:09:50 -04:00
Torkel Ödegaard
0d817e0664 Merge branch 'develop' into template_var_multi_select 2015-03-19 15:17:00 -04:00
Torkel Ödegaard
a8363f02b8 Small changes to log scale handling, #452 2015-03-19 15:16:47 -04:00
Torkel Ödegaard
94c3a07115 Fixed small issue when using 'Save As', dashboard version was not reset 2015-03-19 10:32:47 -04:00
Torkel Ödegaard
01148ac1b9 Merge branch 'develop' into template_var_multi_select 2015-03-19 10:17:34 -04:00
Torkel Ödegaard
30047e6a9f Updated macaron and ini package 2015-03-19 10:17:16 -04:00
Torkel Ödegaard
c1d6fcd18d Fixed full screen edit css issue where part of the dashboard became visible 2015-03-18 19:57:54 -04:00
Torkel Ödegaard
94415e2b60 Fix for panel height in fullscreen mode 2015-03-18 19:42:18 -04:00
Torkel Ödegaard
d81d0c8c44 Graph: Adds logarithmic scale option (log base 10), Closes #452 2015-03-18 18:51:29 -04:00
Torkel Ödegaard
eb8b9c4ac3 Increase api_key.key varchar to 255 length 2015-03-18 13:20:15 -04:00
Torkel Ödegaard
080847ec4d Change: shared tooltip is now enabled by default in graph panel 2015-03-18 12:47:45 -04:00
Torkel Ödegaard
d08144e730 Began work on template multi select feature 2015-03-18 11:15:21 -04:00
Torkel Ödegaard
bb5eeee82e fixed small issue with share modal 2015-03-17 17:34:00 -04:00
Torkel Ödegaard
741a1736a4 can handle updates 2015-03-17 16:04:08 -04:00
Torkel Ödegaard
9f729900f2 work on scoped variable values 2015-03-17 13:33:58 -04:00
Anthony Woods
422324723a Merge pull request #1609 from raintank/1606
gofmt. remove extra whitespace
2015-03-18 00:55:06 +08:00
Torkel Ödegaard
5de499c7f6 Working on panel repeat 2015-03-17 12:30:42 -04:00
Anthony Woods
12e033976b Merge remote-tracking branch 'upstream/develop' into 1606 2015-03-17 23:43:40 +08:00
Anthony Woods
fc5839d8f1 gofmt. remove extra whitespace 2015-03-17 23:42:16 +08:00
Anthony Woods
32071445af Merge pull request #1607 from raintank/1606
fixes #1606 emit orgCreated event when new org created
2015-03-17 23:37:24 +08:00
Anthony Woods
bce62c49d0 fixes #1606 2015-03-17 23:10:49 +08:00
Anthony Woods
7235bd19ea Merge branch '1606' of github.com:raintank/grafana into 1606 2015-03-17 23:10:33 +08:00
Anthony Woods
6a09a7c398 fixes #1606 emit OrgCreated event when new org created. 2015-03-17 23:09:43 +08:00
Anthony Woods
068ccf1c0f fixes 1606 emit OrgCreated event when new org created. 2015-03-17 23:07:08 +08:00
Torkel Ödegaard
2a1434ce49 Merge pull request #1594 from eheydrick/docs-spelling
correct spelling
2015-03-17 09:46:38 -04:00
Torkel Ödegaard
1b59fb5be9 POC for repeating panels based on template variable options 2015-03-14 16:13:25 -04:00
Torkel Ödegaard
3fe54894a5 Merge branch 'develop' of github.com:grafana/grafana into develop 2015-03-14 15:29:59 -04:00
Torkel Ödegaard
2fec2c2fa0 Templating: Dashboard will now wait to load until all template variables that have refresh on load set or are initialized via url to be fully loaded and so all variables are in valid state before panels start issuing metric requests. Closes #1255 2015-03-14 15:29:41 -04:00
Torkel Ödegaard
ea4dbeaeb9 Merge pull request #1593 from jwilder/jw-docs
Add docs for building the docs locally
2015-03-14 15:36:29 +01:00
Torkel Ödegaard
d705ee70f0 Refactoring out http settings to its own partial 2015-03-13 18:42:46 +01:00
Torkel Ödegaard
448717a757 Fixed small issue when changing data source from metrics panel 2015-03-13 17:58:58 +01:00
Torkel Ödegaard
4b3224702c Fixed asset revving issue with css files 2015-03-13 11:11:31 +01:00
Torkel Ödegaard
ab307ec7f3 Fixed css issue with title headers 2015-03-13 10:20:39 +01:00
Torkel Ödegaard
3dc9f792e6 Fixed unstar issue 2015-03-13 09:52:59 +01:00
Torkel Ödegaard
9faa1fadcb Updated docs 2015-03-13 09:46:53 +01:00
Torkel Ödegaard
cb04b7f4e2 Fixed issue with legend values when all values are negative and some are null, #1468 2015-03-13 09:27:08 +01:00
Torkel Ödegaard
de94b48d77 Merge pull request #1597 from jwilder/jw-graph
Update graph docs for v2
2015-03-13 08:32:36 +01:00
Jason Wilder
aca83479be Update graph docs for v2
Still needs metric tab for each datasource and time range details.
2015-03-12 17:20:48 -06:00
Eric Heydrick
d5564b476f correct spelling 2015-03-12 15:03:59 -07:00
Jason Wilder
3693f36e59 Add docs for building the docs locally 2015-03-12 14:47:49 -06:00
Torkel Ödegaard
17063df3cc Changed default org name form 'main' to 'Main Org.' 2015-03-12 19:43:52 +01:00
Torkel Ödegaard
f417d9aa19 Merge pull request #1592 from jwilder/jw-fixes
Anonymous access fixes
2015-03-12 19:41:20 +01:00
Torkel Ödegaard
b91b47fc46 Graph & Singlestat: Users can now set decimal precision for legend and tooltips (override auto precision), Closes #1253 2015-03-12 19:36:50 +01:00
Jason Wilder
13206fbb69 Fix default anonymous org name 2015-03-12 11:51:54 -06:00
Jason Wilder
d3d896dccd Log more descriptive error when anonymous org is not found
Was logging:

  [middleware.go:78 func·004()] [E] Anonymous access organization error%!(EXTRA <nil>)
2015-03-12 11:49:05 -06:00
Torkel Ödegaard
e78b358643 Fixed annotations enabled check from annotationsSrv, Closes #1590 2015-03-12 15:50:39 +01:00
Torkel Ödegaard
b757048544 reduced dashboard title font-weight 2015-03-12 15:45:34 +01:00
Torkel Ödegaard
ebe41fca53 Moved dashboard title into dashboard search button 2015-03-12 15:10:27 +01:00
Torkel Ödegaard
96ad3a04d4 Removed 'Back to dashboard' top nav button, now have close button on the edit box below panel 2015-03-12 14:03:09 +01:00
Torkel Ödegaard
43ba5842bb Began work on doc for migrating from v1 to v2, new features in v2 overview guide, #1571 2015-03-12 10:52:29 +01:00
Torkel Ödegaard
b8979a7253 Merge branch 'docs-1.x' into develop 2015-03-11 20:57:22 +01:00
Torkel Ödegaard
813b851c10 fixed issue in cla docs 2015-03-11 20:56:03 +01:00
Torkel Ödegaard
c1d7bef768 added cert_key and cert_file to defaults.ini 2015-03-11 19:44:31 +01:00
Torkel Ödegaard
434a237764 Added ENV variable info to the configuration docs 2015-03-11 19:32:06 +01:00
Torkel Ödegaard
945cb3254c Updated config docs with oauth setup and config instructions 2015-03-11 18:13:48 +01:00
Torkel Ödegaard
9c2edba12b Working on config docs for grafana 2.0 2015-03-11 17:54:06 +01:00
Torkel Ödegaard
477e035f2e Fixed anonymous access mode, Closes #1586 2015-03-11 17:34:11 +01:00
Torkel Ödegaard
f3d4d2782f Simplified single org settings, now auto_assign_org, and auto_assign_org_role, new [users] config section, Closes #1585 2015-03-11 16:19:29 +01:00
Torkel Ödegaard
4f03a86414 Began work on configuration docs for Grafana 2.0, #1571 2015-03-11 15:13:52 +01:00
Torkel Ödegaard
6336edbc18 Merge branch 'docs-1.x' into develop 2015-03-11 10:47:09 +01:00
Torkel Ödegaard
1f550be949 updated docs system 2015-03-11 10:46:48 +01:00
Torkel Ödegaard
5f5bb8541b Updated docs 2015-03-11 10:32:12 +01:00
Torkel Ödegaard
70ce5d0a32 Updated install docs 2015-03-10 17:54:07 +01:00
Torkel Ödegaard
5f22e7da1f Restored steps to build setup phase, installing sqlite3, speeds up builds so much in dev 2015-03-10 17:34:28 +01:00
Torkel Ödegaard
2c28f8cdca Began work on grafana 2.0 install instructions 2015-03-10 17:25:11 +01:00
Torkel Ödegaard
4244ed33c8 Merge branch 'docs-1.x' into develop 2015-03-10 16:58:31 +01:00
Torkel Ödegaard
0c62ab0683 updated docs 2015-03-10 16:27:16 +01:00
Torkel Ödegaard
aaa98e13b6 updated docs 2015-03-10 16:17:50 +01:00
Torkel Ödegaard
0ff99dddb9 Updated docs 2015-03-10 14:41:19 +01:00
Torkel Ödegaard
2b22d11923 Updated version to prebeta2 2015-03-10 13:55:08 +01:00
Torkel Ödegaard
fa2e074b94 Fixed drilldown link issue, Fixes #1579 2015-03-10 13:52:53 +01:00
Torkel Ödegaard
e75acce6ed updated package.json upgrade of grunt contrib uglify 2015-03-10 13:46:50 +01:00
Torkel Ödegaard
390589fae2 Merge pull request #1580 from bbinet/fix-uglify-compress-issue
fix uglify TypeError
2015-03-10 13:40:25 +01:00
Bruno Binet
ae41fa3011 fix uglify TypeError
This patch fix the following uglify error:
TypeError: Cannot assign to read only property 'warnings' of true
Or we can upgrade grunt-contrib-uglify to latest v0.8.0 version which
should also fix the issue.

This issue has been reported on grunt-contrib-uglify bug tracker:
https://github.com/gruntjs/grunt-contrib-uglify/issues/298
2015-03-10 11:27:17 +01:00
Torkel Ödegaard
b693c7515c fixed issue in Dockerfile 2015-03-10 09:08:24 +01:00
Torkel Ödegaard
3119d15de5 Fixed issue in Dockerfile and docs VERSION file 2015-03-10 09:06:27 +01:00
Torkel Ödegaard
b99e7ed97e Updated docs version and updated build from source instructions 2015-03-10 09:03:05 +01:00
Torkel Ödegaard
f32c34c726 Merge branch 'master' into develop
Conflicts:
	.gitignore
2015-03-10 08:57:14 +01:00
Torkel Ödegaard
15cb1d8980 Added grafana 1.x docs to main repo 2015-03-10 08:56:03 +01:00
Torkel Ödegaard
99259d246b Fixed CLA in new docs 2015-03-10 08:51:26 +01:00
Torkel Ödegaard
8c7076c04a fixed doc image link 2015-03-10 08:20:50 +01:00
Torkel Ödegaard
81bae9a844 Updated docs 2015-03-09 21:58:01 +01:00
Torkel Ödegaard
d7ce7271fe Updated docs 2015-03-09 20:20:44 +01:00
Torkel Ödegaard
5ab64987eb Switching to mkdocs for documentation, and docs that are inside the main repo, adding existing docs, #1571 2015-03-09 17:12:59 +01:00
Torkel Ödegaard
dc46148ab6 Migrated from wercker to circle CI 2015-03-07 20:30:06 +01:00
Torkel Ödegaard
1b1bbcecec Added go vet step to circle.yml 2015-03-07 19:51:19 +01:00
Torkel Ödegaard
ebad9cb502 Fixed gofmt formating, updated precommit hook 2015-03-07 16:37:19 +01:00
Torkel Ödegaard
d8005af8ee updated circle with fmt formating test 2015-03-07 16:23:22 +01:00
Torkel Ödegaard
ba3ba0aca7 Removed docker as service from circle.yml 2015-03-07 15:58:35 +01:00
Torkel Ödegaard
880893914a Removed deploy step from circle, will go in another repo 2015-03-07 15:24:52 +01:00
Torkel Ödegaard
07a21e921d Updated circle.yml added package step 2015-03-07 14:04:12 +01:00
Torkel Ödegaard
2193f222c5 Fixed bug in build container build script 2015-03-07 13:58:28 +01:00
Torkel Ödegaard
f36ea13cb2 Added saving buildcontainer to cache directory 2015-03-07 13:55:12 +01:00
Torkel Ödegaard
595a1fe852 Added back test step to circle.yml 2015-03-07 13:53:10 +01:00
Torkel Ödegaard
3334e6bf61 Fixed bug in circle.yml 2015-03-07 13:48:02 +01:00
Torkel Ödegaard
0a82b75f2a Adding caching of buildcontainer 2015-03-07 13:46:27 +01:00
Torkel Ödegaard
5b563e3841 Updated circle.yml 2015-03-07 13:28:03 +01:00
Torkel Ödegaard
3a98ce775a Updated docker build script 2015-03-07 13:27:02 +01:00
Torkel Ödegaard
8c27a10612 Updated circle.yml 2015-03-07 13:23:57 +01:00
Torkel Ödegaard
e3ce8048ad Added deploy step that runs build in centos6 container 2015-03-07 13:22:52 +01:00
Torkel Ödegaard
0d367d4b54 Updated circle.yml 2015-03-07 13:07:22 +01:00
Torkel Ödegaard
028ae7053b Updated circle.yml added npm install and grunt test step 2015-03-07 12:55:26 +01:00
Torkel Ödegaard
3f3b14130b Updated circle 2015-03-07 12:52:31 +01:00
Torkel Ödegaard
820051d40b Updated circle.yml 2015-03-07 12:46:17 +01:00
Torkel Ödegaard
97499aaa75 Updated circle.yml 2015-03-07 12:43:17 +01:00
Torkel Ödegaard
cc89bc02f4 Working on trying to get CI builds on centos6 to solve GLIBC issue, #1568 2015-03-07 12:40:19 +01:00
Torkel Ödegaard
4cbcee7e15 Updated init.d script with chkconfig comment lines, now works on centos5 2015-03-06 11:21:41 +01:00
Torkel Ödegaard
ab47c2c734 Fixed influxdb 0.9 data source, renamed clone dashboard to Save As... 2015-03-06 10:01:18 +01:00
Torkel Ödegaard
3e6ec19fd4 Fixed bug in CloneDashboardCtrl 2015-03-06 08:23:36 +01:00
Torkel Ödegaard
5719e437ef Merge pull request #1556 from jwilder/jw-export
Add dashboards:export CLI command
2015-03-06 07:59:44 +01:00
Torkel Ödegaard
dba7062fbc Some more polish to confirm dialogs 2015-03-05 21:02:25 +01:00
Torkel Ödegaard
6786ffffac Small update to submenu (annotation/templating) css, #1554 2015-03-05 20:45:14 +01:00
Torkel Ödegaard
16320d66f2 Updated build file 2015-03-05 20:11:34 +01:00
Torkel Ödegaard
ec6dd35098 Fixed path to ZeroClipboard flash file 2015-03-05 20:10:05 +01:00
Torkel Ödegaard
f5f4689e7c Worked on styling for confirm dialogs, #1554 2015-03-05 20:04:54 +01:00
Torkel Ödegaard
259d330822 Began work on modal css polish, #1554 2015-03-05 18:01:41 +01:00
Torkel Ödegaard
79be106711 Fixed javascript style check error 2015-03-05 16:53:08 +01:00
Torkel Ödegaard
5ccd3e2f84 Updated share panel/dash look, added copy to clipboard button (using ZeroClipboard lib), #1554 2015-03-05 16:52:32 +01:00
Torkel Ödegaard
4f8d22796a Merge remote-tracking branch 'origin/master' into develop 2015-03-05 12:26:08 +01:00
Torkel Ödegaard
5be5ee9b1b Fixed panel error handling issue 2015-03-05 12:25:48 +01:00
Torkel Ödegaard
679f2aa262 removed console logging, left by mistake in last commit 2015-03-05 12:19:52 +01:00
Torkel Ödegaard
58034c24ce Merge remote-tracking branch 'origin/master' into develop 2015-03-05 11:17:39 +01:00
Torkel Ödegaard
1ac9b50f21 Increased limit before graph date axis switches to showing date and hour, Fixes #1558 2015-03-05 11:16:48 +01:00
Torkel Ödegaard
af9dc4c277 Fixed issue with OpenTSDB editor and checkboxes, Fixes #1559 2015-03-05 11:00:47 +01:00
Torkel Ödegaard
f817a8ca3c Merge remote-tracking branch 'origin/master' into develop
Conflicts:
	src/app/directives/grafanaPanel.js
	src/app/features/dashboard/dashboardCtrl.js
2015-03-05 10:45:27 +01:00
Torkel Ödegaard
97e5a04621 Fixed memory leak in bootstrap Typeahead code, Fixes #1497 2015-03-05 10:42:46 +01:00
Torkel Ödegaard
30294740bd Updated build script, changed deb and rpm config path to /etc/grafana, #1476 2015-03-04 16:23:30 +01:00
Torkel Ödegaard
6bf4edade1 Updated build.go to get better version/build names 2015-03-04 14:48:21 +01:00
Torkel Ödegaard
de1e762528 Fixed issue using mysql as session store, Closes #1557 2015-03-04 10:34:26 +01:00
Torkel Ödegaard
d043ee9407 Fixed js concat issue 2015-03-04 10:04:59 +01:00
Torkel Ödegaard
14766ad38e Updated wercker, moved s3sync to deploy step 2015-03-04 09:12:32 +01:00
Torkel Ödegaard
dfcf68f21d Moved npm install before test 2015-03-04 07:20:36 +01:00
Jason Wilder
433070a135 Add dashboards:export CLI command
Allows exporting all dashboards to a --dir or filtering dashboards
by title.  If no --dir is specified, a single dashboard must be
found and it will be sent to stdout which can be piped to a file.

Fixes #1498
2015-03-03 23:16:14 -07:00
Torkel Ödegaard
d89c77af54 Small changes to build scripts 2015-03-04 07:09:59 +01:00
Torkel Ödegaard
2d7d70b90f removed old todo file 2015-03-03 21:36:51 +01:00
Torkel Ödegaard
5dc905e35d Updated wercker file 2015-03-03 21:11:37 +01:00
Torkel Ödegaard
660d44b6ad Fixed form issue with firefox and IE, Closes #1551 2015-03-03 20:47:35 +01:00
Torkel Ödegaard
d3d39b3e17 s3 sync working finally 2015-03-03 20:35:42 +01:00
Torkel Ödegaard
3fd2f87b15 another wercker failure, trying this 2015-03-03 20:32:37 +01:00
Torkel Ödegaard
9e7a0f8d83 Updated wercker again 2015-03-03 20:26:39 +01:00
Torkel Ödegaard
6703f0514d Another attemp at s3 sync 2015-03-03 20:17:13 +01:00
Torkel Ödegaard
02f4eb53dd Updated wercker s3 step 2015-03-03 20:12:11 +01:00
Torkel Ödegaard
04597b3f54 Updated wercker test step 2015-03-03 20:08:20 +01:00
Torkel Ödegaard
4379f58213 Fixed intendation in wercker file 2015-03-03 19:59:53 +01:00
Torkel Ödegaard
2906d643a5 Testing s3sync from wercker build 2015-03-03 19:58:57 +01:00
Torkel Ödegaard
bec9504cd8 Updated wercker file again 2015-03-03 19:17:24 +01:00
Torkel Ödegaard
7a8889e7f5 Added rpm tools to wercker pre build step 2015-03-03 19:00:22 +01:00
Torkel Ödegaard
8054f6a2d1 Updated build and wercker, again 2015-03-03 18:11:16 +01:00
Torkel Ödegaard
f2595917c6 updated wercker build, trying to install ruby and fpm in wercker step 2015-03-03 18:00:58 +01:00
Torkel Ödegaard
55b40aeb65 updated build.go 2015-03-03 17:58:13 +01:00
Torkel Ödegaard
4f2bca08f1 Updated wercker file again... 2015-03-03 17:56:55 +01:00
Torkel Ödegaard
48d83a4dc4 Updated wercker file 2015-03-03 17:56:08 +01:00
Torkel Ödegaard
2362f9574e Updated wercker file 2015-03-03 17:50:33 +01:00
Torkel Ödegaard
8ba9b8d7bd added custom wercker box 2015-03-03 17:47:26 +01:00
Torkel Ödegaard
c6d4b5cc86 Working on build steps 2015-03-03 17:42:50 +01:00
Torkel Ödegaard
0db55b6194 Work on deb and rpm packages, both seem to work now, #1476 2015-03-03 17:14:58 +01:00
Torkel Ödegaard
59da4a0b3b Updates to build and wercker file 2015-03-03 12:09:15 +01:00
Torkel Ödegaard
9192acf250 Fixed js style errors 2015-03-03 10:20:52 +01:00
Torkel Ödegaard
7e0f1a57af Progress on deb and rpm packaging, renamed config files, added file logging, #1476 2015-03-03 10:18:37 +01:00
Torkel Ödegaard
f5cd3d853d Small update to confirm dialog 2015-03-03 08:03:21 +01: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
56c83cefe9 Fixed so that scripted dashboards and json file based dashboards works as in 1.x, Closes #1548 2015-03-02 18:26:43 +01:00
Torkel Ödegaard
6850a4d25d Progress on deb and rpm packaging, init.d script etc, #1476 2015-03-02 17:21:52 +01:00
Torkel Ödegaard
ad2065afc7 Began work on deb and rpm packaging, #1476 2015-03-02 15:50:03 +01:00
Torkel Ödegaard
9710771f16 Added basic auth to data source edit/create, add support for basic auth in data source proxy code, Closes #1510 2015-03-02 09:58:35 +01:00
Torkel Ödegaard
ea1164322b Small fixes 2015-03-02 08:33:06 +01:00
Torkel Ödegaard
bee501da4a Added different time period override to singlestat panel, added option to hide panel time override info, Closes #171 2015-03-01 12:06:05 +01:00
Torkel Ödegaard
57b5b4c376 Worked on relative time and timeshift overrides for singlestat, still an issue for how to visualize the time override 2015-03-01 11:48:09 +01:00
Torkel Ödegaard
2c3d3d0fe3 Refactoring out common panel metric and query code to a panelHelper service 2015-03-01 11:03:41 +01:00
Torkel Ödegaard
d0d995da09 Inital work on SQL metric/annotation data source, #1542 2015-02-28 17:27:30 +01:00
Torkel Ödegaard
a3fe1efa2b Merge branch 'css-tweaks' into develop, #1465 2015-02-28 16:41:24 +01:00
Torkel Ödegaard
e84d0dd6b3 Light theme tweaks after merge with bulletfactorys light theme fixes 2015-02-28 16:41:02 +01:00
Torkel Ödegaard
0f3bf488f2 Merge branch 'develop' into css-tweaks 2015-02-28 15:48:37 +01:00
Torkel Ödegaard
04ca85fe89 Moved dashboard theme option from the dashboard to a persisted user setting, #1458 2015-02-28 14:30:08 +01:00
Torkel Ödegaard
962b316bcf Some clean up and polish of data source edit view 2015-02-28 14:00:04 +01:00
Torkel Ödegaard
ae3b9617b6 Fixed dataproxy test 2015-02-28 12:34:51 +01:00
Torkel Ödegaard
3c554953a2 Changed default OpenTSDB downsample aggregator from sum to avg 2015-02-28 12:33:20 +01:00
Torkel Ödegaard
0b1044b46f Fixed plugins go test 2015-02-28 11:38:44 +01:00
Torkel Ödegaard
ba56535fa6 Merge branch 'light-theme-tweaks' of github.com:bulletfactory/grafana into css-tweaks
Conflicts:
	src/css/less/sidemenu.less
2015-02-28 11:37:38 +01:00
Torkel Ödegaard
2e0e8ba705 Fixed solo panel test 2015-02-28 11:15:21 +01:00
Torkel Ödegaard
c283f0996d Fixed solo panel view (used for png rendering) 2015-02-28 11:07:22 +01:00
Torkel Ödegaard
232f980c72 More work on restoring features after moving to plugin model for datasources, no annotations work again #1276 #1472 2015-02-28 10:52:25 +01:00
Torkel Ödegaard
4a72c37fc1 Fixes to edit view switching, and to templateValuesSrv 2015-02-28 10:29:17 +01:00
Torkel Ödegaard
dcfad7d61b Fixed playlist functionallity, broken after recent changes 2015-02-28 10:04:19 +01:00
Torkel Ödegaard
9e892bddf0 More work on restoring features after moving to plugin model for datasources, #1276 #1472 2015-02-28 09:46:37 +01:00
Torkel Ödegaard
109dd3240a Work on new datasource plugin model, #1276 #1472 2015-02-28 08:25:13 +01:00
Torkel Ödegaard
c198242292 A lot of work on backend plugin model for frontend components, right now for data sources, will enable dropin plugins for data sources and panels, #1472 2015-02-27 22:29:00 +01:00
Torkel Ödegaard
5bd5713a52 Began work on plugin system 2015-02-27 13:45:00 +01:00
Trent White
5c39a3d004 Reversed button cleanup for light theme 2015-02-26 17:57:32 -05:00
Trent White
4e607876ea further cleanup of styles to make sidebar more readable for light theme. This tweaked link colors, dropdown colors and table tweaks for things like Add API to make them feel a little more organized through shades of gray. 2015-02-26 15:22:15 -05:00
Torkel Ödegaard
011fdf7ab6 fixed bug in datasource schema migration 2015-02-26 19:36:11 +01:00
Trent White
708ddf5387 CSS tweaks to link styles for sidebar, nav bar, search pane. Also the nav bar height seemed off from the sidebar, so made that consistent. Variables were created when colors were hard-coded for both dark and light. This meant that both variables.light.less and variables.dark.less were updated. 2015-02-26 12:37:35 -05:00
Torkel Ödegaard
c75aa23092 New implementation for API Keys that only stores hashed api keys, and the client key is base64 decoded json web token with the unhashed key, Closes #1440 2015-02-26 17:23:28 +01:00
Torkel Ödegaard
6a2a6afc1d Merge branch 'develop' into apikey_hashed
Conflicts:
	pkg/api/apikey.go
	pkg/services/sqlstore/migrations.go
2015-02-26 15:48:54 +01:00
Torkel Ödegaard
7c241fd617 Added permissions section to admin > edit user view, an admin can now make another user admin, Closes #1517 2015-02-26 15:43:48 +01:00
Torkel Ödegaard
c14a90a3d0 A lot of work on new organization selection and sidenav dropdown, #1506 2015-02-26 13:01:34 +01:00
Torkel Ödegaard
528f54153c More work on experimental InfluxDB 0.9 support 2015-02-26 08:55:49 +01:00
Torkel Ödegaard
ae7f18f981 Made a copy of influxdb datasource named influxdb_08 so the main influxdb data source can be modified to support InfluxDB 0.9, made some initial experiments to get queries to work, but a lot more work is needed, #1525 2015-02-25 18:43:44 +01:00
Torkel Ödegaard
f5f07bd552 Fixed signout links from sidenav 2015-02-25 16:52:57 +01:00
Torkel Ödegaard
bbbd3320ef Created seperate admin sidenav #1506 2015-02-25 16:01:37 +01:00
Torkel Ödegaard
32450640e2 Moved clone dashboard above delete in dashboard settings dropdown 2015-02-25 14:32:57 +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
Torkel Ödegaard
9e789e6d82 More work on organization / admin nav, views, #1506 2015-02-25 14:27:34 +01:00
Torkel Ödegaard
e1d078f2c1 Final frontend changes for account -> org rename 2015-02-25 08:07:52 +01:00
Torkel Ödegaard
563d5e3ad8 All migrations work in sqlite3, mysql and postgres 2015-02-25 07:57:51 +01:00
Torkel Ödegaard
16fd256225 Added missing common.go 2015-02-24 19:10:41 +01:00
Torkel Ödegaard
f3f79792ab account -> org table migration is starting to work, need to test mysql and postgres 2015-02-24 18:32:29 +01:00
Torkel Ödegaard
ed68a4bb9a More work on SQL migrations 2015-02-24 17:59:21 +01:00
Torkel Ödegaard
02a89c752b Progress on database schema migration for account -> org refactor 2015-02-24 11:46:34 +01:00
Anthony Woods
b9b63f695d fixes #1518 fix table name used in dashboard delete. 2015-02-24 08:56:10 +00:00
Torkel Ödegaard
7293ee0894 Changed default OpenTSDB downsample aggregator to avg, #1438 2015-02-24 09:54:02 +01:00
Torkel Ödegaard
da41d99aa7 Fixed sql integration test 2015-02-23 20:48:43 +01:00
Torkel Ödegaard
26e4809e2e Big Backend Refatoring: Renamed Account -> Org 2015-02-23 20:07:49 +01:00
Torkel Ödegaard
e9e2fa2927 Started Account -> Organization rename 2015-02-23 18:29:01 +01:00
Torkel Ödegaard
5b2715515f Began work on Account -> Organization rethink, #1506 2015-02-23 16:40:04 +01:00
Torkel Ödegaard
a8c90e2365 Small update to commands 2015-02-23 14:20:24 +01:00
Torkel Ödegaard
f66968ae02 Merge remote-tracking branch 'origin/master' into develop 2015-02-23 13:05:46 +01:00
Torkel Ödegaard
a5fd40ed80 OpenTSDB: Fixed issue with auto interval variable going below 1s, Fixes #1325 2015-02-23 13:04:32 +01:00
Torkel Ödegaard
8cc4dae00b Merge remote-tracking branch 'origin/master' into develop 2015-02-23 12:57:12 +01:00
Torkel Ödegaard
2c5f19253c Added margin between opentsdb queries 2015-02-23 12:56:40 +01:00
Torkel Ödegaard
09f2950256 Merge remote-tracking branch 'origin/master' into develop
Conflicts:
	src/app/features/opentsdb/datasource.js
2015-02-23 12:50:58 +01:00
Torkel Ödegaard
65307c463a Refactoring opentsdb editor view, merging #1438, made Downsampling enabled by default 2015-02-23 12:48:07 +01:00
Torkel Ödegaard
2ae0ef94de Merge branch 'tsdb_downsample' of https://github.com/frogmaster/grafana into frogmaster-tsdb_downsample 2015-02-23 11:45:30 +01:00
Torkel Ödegaard
138e720695 Increased max user list to 1000 for user admin page, need to paging, but will have to wait a few days 2015-02-23 11:30:58 +01:00
Torkel Ödegaard
12e28c1895 added missing file 2015-02-23 11:24:45 +01:00
Torkel Ödegaard
1a106e5c38 Added change password ability to admin > edit user view, #1446 2015-02-23 11:24:22 +01:00
Torkel Ödegaard
15c52cacfb Import views are now consolidated into one view, and found through one navigation (dashboard search -> Import, Closes #1511 2015-02-23 10:50:50 +01:00
Torkel Ödegaard
4a93d205bb Moved dashboard import and json import to same view, found via dashboard search dropdown, #1511 2015-02-23 10:13:16 +01:00
Torkel Ödegaard
a146a24c06 Fixed small issue in search and showing Home dashboard when filtering by tag 2015-02-23 09:54:26 +01:00
Torkel Ödegaard
6347b9b0d7 Merge remote-tracking branch 'origin/develop' into develop 2015-02-22 08:45:44 +01:00
Torkel Ödegaard
fea6b970e5 Some prep work for using today as relative time, #1186 2015-02-22 08:44:37 +01:00
Torkel Ödegaard
afeaa9fecd Merge pull request #1507 from ryan-williams/typos
typo fixes, .gitignore tweak
2015-02-22 08:31:24 +01:00
Torkel Ödegaard
7e82626b17 Fixed bug with custom time range not being initialized correctly, Fixes #1427 2015-02-22 08:25:44 +01:00
Torkel Ödegaard
9b9aab27ca Graphs now update/refresh when you edit annotations, Fixes #1430 2015-02-22 08:09:58 +01:00
Torkel Ödegaard
31e5271921 Fixed number formating issue when InfluxDB return MAX float64, Fixes #1402 2015-02-22 07:44:40 +01:00
Torkel Ödegaard
8c977e37a9 Merge remote-tracking branch 'origin/master' into develop
Conflicts:
	README.md
2015-02-21 21:22:09 +01:00
Torkel Ödegaard
9c8134f8bc Dashboard: Fixed memory leak when switching dashboards, Fixes #1497 2015-02-21 21:19:51 +01:00
Ryan Williams
36ec15be8f fix some scripted-dashboard-comment typos 2015-02-20 19:51:23 +00:00
Ryan Williams
c29bf31f2b add intellij files to gitignore 2015-02-20 19:51:21 +00:00
Torkel Ödegaard
5b1727bcba Graph & Singlestat: Support for additional units, Fahrenheit (°F) and Celsius (°C), Humidity (%H), kW, watt-hour (Wh), kilowatt-hour (kWh), velocities (m/s, km/h, mpg, knot), Closes #1366 2015-02-20 14:45:00 +01:00
Torkel Ödegaard
7a14054057 Graph: Shared tooltip improvement, can now support metrics of different resolution/intervals, Closes #978, Fixes #1499 2015-02-20 14:07:24 +01:00
Torkel Ödegaard
481a4b0f1b Small fix to unsavedChangesSrv, did not handle new template variable correctly 2015-02-20 12:25:54 +01:00
Torkel Ödegaard
fe34c8f2e0 Worked on submenu row (templating, annotations), removed templating and annotation feature toggles, the submenu row will be visible as soon as there are any template vars or annotations, #1503 2015-02-20 12:20:10 +01:00
Torkel Ödegaard
923e18b2b9 Small design change for the submenu (templating, annotations), #1503 2015-02-20 11:27:57 +01:00
Torkel Ödegaard
596dfc304d Added guard for template variables missing query field, Fixes #1501 2015-02-20 10:45:23 +01:00
Torkel Ödegaard
47c6c6e1b7 Added change password feature, Closes #1455 2015-02-19 16:09:49 +01:00
Torkel Ödegaard
afc52f57a2 small fix to confirm modal 2015-02-19 10:42:13 +01:00
Torkel Ödegaard
0786977bcf Fixed css issue with sidebar 2015-02-19 10:15:24 +01:00
Torkel Ödegaard
181542249d Fixed failing influxdb-datasource test 2015-02-18 16:09:17 +01:00
Torkel Ödegaard
0d165e67c9 Fixed issue with influxdb, broken in recent commit today 2015-02-18 15:22:45 +01:00
Torkel Ödegaard
978b12b0dc Close dashboard edit views when clicking on dashboard title, added some tooltips to dashboard top nav 2015-02-18 15:17:31 +01:00
Torkel Ödegaard
2ca849c0c4 Changed docker image to debian:jessie 2015-02-18 14:43:58 +01:00
Torkel Ödegaard
3991d9dc06 Added error handling to dashboard imports, #1493 2015-02-18 14:18:54 +01:00
Torkel Ödegaard
60ae4afe87 Refresh frontend datasourceSrv after datasource update, no longer need to reload the page to use a newly added or updated datasource, #1493 2015-02-18 14:06:44 +01:00
Torkel Ödegaard
4ed54f6aa9 Force full reload when switching account, temp fix for refreshing frontend datasource, settings, and user account role 2015-02-18 13:18:29 +01:00
Torkel Ödegaard
17004ce3ae Fixed issue with login by username and uppercase letters in username, #1484 2015-02-18 13:00:39 +01:00
Torkel Ödegaard
596ce18aeb Worked on clone dashboard feature, #1488 2015-02-18 10:44:44 +01:00
Torkel Ödegaard
5c9ef9d9da Added form validation and css class for invalid timespans, #1494 2015-02-18 09:20:46 +01:00
Torkel Ödegaard
ad13fd0542 Added validation for correct timespans when using panel timeshift or relative time override, Fixes #1494 2015-02-18 09:08:12 +01:00
Torkel Ödegaard
26eb6e559e Removed use of absolute urls in dashboard search and dashlist, root_url option is now not required, it is required if you use oauth or proxy grafana under suburl, #1483 2015-02-17 18:43:37 +01:00
Torkel Ödegaard
946afccbb5 Fixed dashboard search dropdown issue where it closes dashboard settings view if open, also fixed so that clicking outside dashboard search will close it, Fixes #1489 2015-02-17 18:20:47 +01:00
Torkel Ödegaard
ea8307f79e Added influxdb docker block, and fixed issue when adding data source 2015-02-17 11:44:58 +01:00
Torkel Ödegaard
83d798dbad Small update to grafana.ini describe server options 2015-02-16 08:12:07 +01:00
Torkel Ödegaard
7f5f6763ea Fixed icon for ascending sort order in table legend, #1483 2015-02-16 07:52:16 +01:00
Torkel Ödegaard
8828db4fce Fixed issue with date range form validation, Closes #1485 2015-02-16 07:46:47 +01:00
Torkel Ödegaard
56d8fe4a22 Small changes to CLI commands PR 2015-02-16 07:40:21 +01:00
Jason Wilder
b6428b08d0 CLI: Fix config flag being ignored
Passing --config had no effect when passed.  It will now be applied as
the last config file and before any env var overrrides.
2015-02-15 15:06:02 -07:00
Jason Wilder
9223c95481 CLI: Order commands alphabetically 2015-02-15 14:01:48 -07:00
Jason Wilder
a3925e8aa0 CLI: Use console logger for dashbard:import command
More consistent w/ other commands and separates stdout/stderr
2015-02-15 13:51:41 -07:00
Jason Wilder
7c8fa067a2 CLI: Conver account flag to required arg
Follows the same convention as other commands.
2015-02-15 13:48:36 -07:00
Jason Wilder
f2e9ec63df CLI: Renamed import-json to dashboard:import
More consistent w/ other command names.
2015-02-15 13:45:25 -07:00
Jason Wilder
b97361b193 CLI: Add datasource:delete command 2015-02-15 13:36:10 -07:00
Jason Wilder
22652889b2 CLI: Add datasource:create command
Allows creating a datasource from the command line
2015-02-15 13:36:10 -07:00
Jason Wilder
04a970eda2 CLI: Use 8 char min col size instead of 20 2015-02-15 13:36:10 -07:00
Jason Wilder
f443b7087c CLI: Add datasource:info command
Describes the full datasource details given an account and
datasource name.
2015-02-15 13:36:10 -07:00
Jason Wilder
9cb1170361 CLI: Move duplicated config flag to global flag 2015-02-15 13:36:10 -07:00
Jason Wilder
dda760b9b5 CLI: Add datasource list command
Lists all the datasources for an account via the CLI
2015-02-15 13:36:10 -07:00
Jason Wilder
ca4124940a CLI: Remove redundant Cmd prefix from commands 2015-02-15 13:36:10 -07:00
Jason Wilder
90cd10e034 CLI: Add account:delete command 2015-02-15 13:36:10 -07:00
Jason Wilder
c1d4acc01e CLI: Use colorized console output
This extracts some of the colored logging functionality into some
convenience functions to log directly to the console (stdout) w/o
the usual logging prefixes and flags.  It's intended for console
messages when using grafana commands.
2015-02-15 13:36:10 -07:00
Jason Wilder
81531a29eb CLI: Add account:create command
Creates a new account attached to the default admin account for now.
2015-02-15 13:36:10 -07:00
Jason Wilder
7d4c319fcb CLI: Default logging output to stderr instead of stdout
Makes it possible to separate console output from logging output so
command output can be piped to a file cleanly.
2015-02-15 13:36:10 -07:00
Jason Wilder
ca37b24455 CLI: Add account list command 2015-02-15 13:36:10 -07:00
Torkel Ödegaard
f6c07fdabd Rewrote and redesign how the data source edit views look and work so they conform better to how account views look, removed tabs and put top nav items to add data source etc, made list, edit and new seperate url routes, #1483 2015-02-14 10:04:34 +01:00
Torkel Ödegaard
ed0fabd9de Fixed css issue with sidenav not extending to bottom of page when dashboard requires scrolling, #1483 2015-02-14 09:05:35 +01:00
Torkel Ödegaard
0767992662 fixed z-index pos for panel-menu compared to dashboard search dropdown, #1483 2015-02-14 08:40:15 +01:00
Torkel Ödegaard
a88187023d Added a sql integration test for api keys 2015-02-13 15:55:32 +01:00
Torkel Ödegaard
57dc12ee17 Merge pull request #1482 from raintank/issue_1481
fixes #1481.  correctly escape api_key.key column name
2015-02-13 15:47:12 +01:00
woodsaj
c9e5da48a4 Merge branch 'issue_1481' of github.com:raintank/grafana into issue_1481 2015-02-13 22:00:57 +08:00
woodsaj
7d69885e06 fixes #1481. correctly escape api_key.key column name
'key' is a reserved word in mysql. So when building a query,
the api-key.key column name needs to be escaped
2015-02-13 22:00:03 +08:00
woodsaj
55ba8ad0c4 fix issue 1481. correctly escape api_key.key column name
'key' is a reserved word in mysql. So when building a query,
the api-key.key column name needs to be escaped
2015-02-13 21:52:56 +08:00
Torkel Ödegaard
6263ec1d38 Fixed some playlist issues, error when adding duplicates 2015-02-13 14:36:16 +01:00
Torkel Ödegaard
1d86d4b94f Updated docker build, added test container script, added docker readme 2015-02-13 14:18:37 +01:00
Torkel Ödegaard
8aef2c13ec Worked on playlist mode, hides dashboard controls and dashboard search button, added prev, stop, next icon buttons 2015-02-13 09:31:40 +01:00
Torkel Ödegaard
8722ee8ad6 Worked on playlist update for Grafana 2.0, added dashboard search to playliststart view, #1460 2015-02-13 08:47:44 +01:00
Torkel Ödegaard
1a44036148 Fixed req.Host in datasource proxy, Fixes #1478 2015-02-13 07:26:33 +01:00
Torkel Ödegaard
e65a6cc063 added an inital admin settings view, very basic right now only displays all config options in grafana.ini 2015-02-12 15:46:14 +01:00
Torkel Ödegaard
29607d8951 Updated readme again 2015-02-12 13:45:53 +01:00
Torkel Ödegaard
366a9f71ad Updated readme build instructions 2015-02-12 13:44:22 +01:00
Torkel Ödegaard
79f798f67b Configuration file options can now be overriden using environment variables using GF_<SectionName>_<KeyName> syntax, if Section name contains dots in config they are replaced with underscores, and the section name and keyname needs to be all upper case, #1473 2015-02-12 13:31:41 +01:00
Torkel Ödegaard
2c16b0f0f3 added unit test for loading configuration file 2015-02-12 11:55:55 +01:00
Torkel Ödegaard
4df6668416 Merge branch 'develop' of github.com:grafana/grafana into develop 2015-02-12 10:34:52 +01:00
Torkel Ödegaard
0140a00884 Added two columns to user table, email_verified and theme, no used right now but will probably shortly 2015-02-12 10:32:22 +01:00
Torkel Ödegaard
2a31f16b76 Merge pull request #1467 from jwilder/jw-fixes
Small fixes to getting up and running
2015-02-12 02:26:54 +01:00
Jason Wilder
793eda7640 Assign new dashboard ID when importing dashboard via command-line 2015-02-11 15:20:36 -07:00
Jason Wilder
8230279932 Assign new ID to when importing dashboard via frontend
Fixes a panic: interface conversion: interface is string, not float64
when importing a dashboard that has a non-float ID.
2015-02-11 15:20:18 -07:00
Jason Wilder
a6df991b76 Update README.md w/ known working build tool versions 2015-02-11 14:55:26 -07:00
Jason Wilder
9cc0be0fc2 Add grafana binary to .gitignore
Running "go build" defaults to building a binary named
grafana in the root dir.
2015-02-11 14:55:26 -07:00
Torkel Ödegaard
0d0d802526 Removed data folder stuff, should not be in repo 2015-02-11 21:21:21 +01:00
Torkel Ödegaard
71f09ddd94 Added delete user action to user admin api, and made it work in UI, Closes #1466, #1446 2015-02-11 16:47:22 +01:00
Torkel Ödegaard
17f1224a5d Fixed light theme condition, Fixes #1462 2015-02-11 15:32:19 +01:00
Torkel Ödegaard
441e2ad2f3 Updated dockerfile and moved to docker/production folder 2015-02-11 13:53:42 +01:00
Torkel Ödegaard
39a6bf9784 Updated readme with info about the Grafana 2.0 develop branch 2015-02-10 19:38:55 +01:00
Torkel Ödegaard
8d130421c4 Updated readme with default admin user info 2015-02-10 17:10:07 +01:00
Torkel Ödegaard
add4adeec9 Fixed links to user admin views, and backend html routes for user admin edit/create urls, Closes #1451 2015-02-10 16:26:23 +01:00
Torkel Ödegaard
e165e2af95 Worked on user admin features, can now create and edit users as a grafana admin user, #1446 2015-02-10 15:36:51 +01:00
Torkel Ödegaard
088ad881e0 Updated phantomjs panel rendering code 2015-02-10 11:13:35 +01:00
Torkel Ödegaard
c5afcd8e09 Fixed issue with datasource proxying, it required account admin role when it should not 2015-02-10 10:19:43 +01:00
Torkel Ödegaard
5c795e9a50 Updated readme with docker info, updated build task 2015-02-09 16:18:30 +01:00
Torkel Ödegaard
cd8f938cab Fixed issue with sidenav toggle on non dashboard pages 2015-02-09 16:02:42 +01:00
Torkel Ödegaard
2de6f3434c Fixed default '@timestamp' time field for elasticsearch annotations, Fixes #1444 2015-02-09 13:34:12 +01:00
Torkel Ödegaard
5269422f7c Began work on hashing api keys 2015-02-09 13:30:04 +01:00
Torkel Ödegaard
c9f06e1da1 Fixed failing events test and issue with dashboard list panel 2015-02-08 11:24:03 +01:00
woodsaj
c4fe9d50bf correctly handle event being a ptr
Events are passed in as PTRs, so we need to de-reference when getting the type and value.
2015-02-08 18:13:32 +08:00
Torkel Ödegaard
2c5828528f Updates to account and admin views 2015-02-08 10:23:35 +01:00
Torkel Ödegaard
b1a95cacff Small css changes 2015-02-08 09:38:05 +01:00
Torkel Ödegaard
20b64d9b7e PanelSrv fix, now panel rerenders after column span change 2015-02-08 09:02:03 +01:00
Torkel Ödegaard
ab55412264 Refactoring of grafana (root scope view model), into contextSrv, made sidemenu always hide after login 2015-02-08 09:00:58 +01:00
Torkel Ödegaard
f82cb3aefe Various css updates 2015-02-07 22:00:33 +01:00
Torkel Ödegaard
48e5a82e7f Reduced height of search view 2015-02-07 20:43:20 +01:00
Torkel Ödegaard
727fc9d3a6 Updated search result view, removed delete link, added delete action from dashboard cogs dropdown 2015-02-07 20:25:53 +01:00
Torkel Ödegaard
51c640d409 Updated search result padding 2015-02-07 16:19:02 +01:00
Torkel Ödegaard
7ab83bf47f Updated position of search 2015-02-07 16:16:17 +01:00
Torkel Ödegaard
9818f81c5f Completed search makover 2015-02-07 16:12:29 +01:00
Torkel Ödegaard
8f4e440179 Working on new search box design 2015-02-07 15:40:31 +01:00
Torkel Ödegaard
83bf68ecad Added border for inverse button 2015-02-07 14:10:51 +01:00
Torkel Ödegaard
23bbc5160e Fixed validation for adding api keys, added unique index for api key name + account_id 2015-02-07 13:11:39 +01:00
Torkel Ödegaard
ed6d50d6ba Updated to profile page design 2015-02-07 13:04:24 +01:00
Torkel Ödegaard
b3a1bb2017 Sub nav for account page, some css changes 2015-02-07 12:28:47 +01:00
Teet Talviste
a0a4b04007 fix identation 2015-02-06 21:15:14 +02:00
Teet Talviste
ddfb36b511 satisfy travis: fix curly brace space 2015-02-06 21:07:31 +02:00
Teet Talviste
28f7806d19 fix some linting problems 2015-02-06 18:42:12 +02:00
Teet Talviste
72f6dc1e0c enable sending calculated interval to opentsdb downsample 2015-02-06 18:42:12 +02:00
Torkel Ödegaard
9a45a25e17 Removed inner black border for dashboard button 2015-02-06 17:24:19 +01:00
Torkel Ödegaard
9cadf0aa97 Updated phantomjs render script and wercker link in readme 2015-02-06 14:22:56 +01:00
Torkel Ödegaard
397dfc54cd Fixed bug in png rendering when having changed public url 2015-02-06 14:17:40 +01:00
Torkel Ödegaard
eeba128f8a Fixed release tar/zip keeping execution mode on phantomjs 2015-02-06 13:58:25 +01:00
Torkel Ödegaard
396b687e4b Added docker file for docker registry distribution 2015-02-06 11:40:04 +01:00
Torkel Ödegaard
cbe72ba9f4 Updated wercker file 2015-02-06 10:19:40 +01:00
Torkel Ödegaard
85c1c97ea2 Updated readme 2015-02-06 09:10:52 +01:00
Torkel Ödegaard
503e04d375 Updated readme 2015-02-06 08:54:43 +01:00
Torkel Ödegaard
4e5d5cd1a9 updated readme 2015-02-06 08:52:16 +01:00
Torkel Ödegaard
9cdd9e6d5f updated readme 2015-02-06 08:40:12 +01:00
Torkel Ödegaard
f8a10fa7af Updated account and profile pages, very temporary solution, do not like it at all 2015-02-06 08:21:00 +01:00
Torkel Ödegaard
e3764ad951 Fixed failing dashboard sql test 2015-02-05 15:53:15 +01:00
Torkel Ödegaard
edb7722ad6 Updated wercker file again 2015-02-05 15:29:06 +01:00
Torkel Ödegaard
39ee394068 updated wercker file to change package dir 2015-02-05 15:28:17 +01:00
Torkel Ödegaard
f4e26bba3f Removed unused node package 2015-02-05 12:39:47 +01:00
Torkel Ödegaard
102c896046 Updated build and wercker file for new repo structure 2015-02-05 12:27:58 +01:00
Torkel Ödegaard
e5fbbe96fd fixed error handling, and error logging for panel rendering 2015-02-05 12:23:24 +01:00
Torkel Ödegaard
8e1b753664 Added limit to dashboard list panel and search 2015-02-05 11:10:56 +01:00
Torkel Ödegaard
b6d5f49c0f Merge branch 'master' of github.com:torkelo/grafana-private into develop 2015-02-05 10:56:59 +01:00
Torkel Ödegaard
2cc9515fd6 Added missing mega bytes unit format to unit selection, #999 2015-02-05 10:56:39 +01:00
Torkel Ödegaard
0f63c04beb Fixed bug in user creation and admin role 2015-02-05 10:50:18 +01:00
Torkel Ödegaard
861e45aedf Merge remote-tracking branch 'origin/pro' 2015-02-05 10:37:41 +01:00
Torkel Ödegaard
10820f31c2 Changed go package path 2015-02-05 10:37:13 +01:00
Torkel Ödegaard
3ab7b5c3f7 Merge branch 'master' of /home/torkel/dev/go/src/github.com/torkelo/backend
Conflicts:
	.gitignore
	LICENSE.md
	README.md
2015-02-05 10:10:39 +01:00
Torkel Ödegaard
076905d14e Added isStarred to search result hit, very inefficient loading right now but can be cached later on 2015-02-05 09:49:00 +01:00
Torkel Ödegaard
d5471c153a Worked on dashlist panel, can now do searched 2015-02-05 09:48:14 +01:00
Torkel Ödegaard
69e7279cff fixed unit test failing on build server 2015-02-04 18:25:15 +01:00
Torkel Ödegaard
9e58921b23 Updated godeps file 2015-02-04 18:06:37 +01:00
Torkel Ödegaard
7fa6527ca8 Updated godeps file 2015-02-04 18:06:30 +01:00
Torkel Ödegaard
2fa8096569 Updated frontend 2015-02-04 17:21:57 +01:00
Torkel Ödegaard
ff47eccf4b Fixed javascript style checker issue 2015-02-04 17:21:42 +01:00
Torkel Ödegaard
5a6c04e3b0 frontend fixes 2015-02-04 17:20:38 +01:00
Torkel Ödegaard
896e6d4662 Merge branch 'notifications' 2015-02-04 17:15:16 +01:00
Torkel Ödegaard
d8db5189c1 More work on events, still have to convert pascal case event type name to rabbitmq dot notation, but after that should be done 2015-02-04 17:15:05 +01:00
Torkel Ödegaard
525179eb85 Added on wire event format 2015-02-04 16:57:20 +01:00
Torkel Ödegaard
dace35d31d Missed setting account name 2015-02-04 15:41:40 +01:00
Torkel Ödegaard
3752379106 Worked on event system, needs a little more work 2015-02-04 15:37:26 +01:00
Torkel Ödegaard
048b26a0fd Updated home dashboard 2015-02-04 11:50:40 +01:00
Torkel Ödegaard
07ec00641f update home dashboard 2015-02-04 11:50:22 +01:00
Torkel Ödegaard
60541a455f Worked on search filter flag IsStarred, and updated frontend with new dashboard list panel 2015-02-04 11:35:59 +01:00
Torkel Ödegaard
882ee4d49f A start on a dashboard list panel, can now list starred dashboards 2015-02-04 11:35:19 +01:00
Torkel Ödegaard
f0b13153ac fixed bug in frontend 2015-02-04 08:20:24 +01:00
Torkel Ödegaard
df51be02bf Fixed loading path for home dashboard 2015-02-04 08:20:00 +01:00
Torkel Ödegaard
96798ac70c Updated 2015-02-04 07:01:15 +01:00
Torkel Ödegaard
a28e4de3bd added fade transition for logo icon to hamburger 2015-02-04 07:01:03 +01:00
Torkel Ödegaard
ac73e78b3a Fixed unit test in frontedn 2015-02-03 22:18:38 +01:00
Torkel Ödegaard
613e209af3 Fixed solo panel unit test 2015-02-03 22:18:16 +01:00
Torkel Ödegaard
1ac3355b03 updated frontend with style changes 2015-02-03 22:06:07 +01:00
Torkel Ödegaard
5e4b026668 Css work applying new styles for topmenu dashboard button and logo/menu icon 2015-02-03 22:05:53 +01:00
Torkel Ödegaard
9d5979c01d Moved dashboards dir and started work on new panel for dashboard lists 2015-02-03 20:50:52 +01:00
woodsaj
a712f1a231 Add inital implementation of Notification events.
If notifications are enabled in the config, Adds a eventHandler
accepting Notification{} payloads to the internal Bus.  The
eventHandler then marshals the payload into json and sends it
to a rabbitmq topic exchange using the
Notification.Priority+Noticiation.EventType as the routing key.
eg.  INFO.account.created

Currently, notifications are only being emitted for
INFO.account.created
INFO.account.updated
INFO.user.created
INFO.user.updated
2015-02-03 23:57:42 +08:00
Torkel Ödegaard
42a5aefb23 Worked on home dashboard 2015-02-03 15:04:35 +01:00
Torkel Ödegaard
bc673fd969 Worked on loading a home dashboard through backend 2015-02-03 15:04:18 +01:00
Torkel Ödegaard
a127f2d572 Fixed png rendering 2015-02-03 13:45:52 +01:00
Torkel Ödegaard
16acdfc7c3 Merge branch 'master' of github.com:torkelo/grafana-private into pro 2015-02-03 13:36:25 +01:00
Torkel Ödegaard
858d7be8cf Migrated from ngmin to ngAnnotate 2015-02-03 13:36:04 +01:00
Torkel Ödegaard
1ca4ecc241 Updated grunt-jscs dependency version 2015-02-03 13:05:14 +01:00
Torkel Ödegaard
bd470abcf0 fontend styles updated 2015-02-03 10:46:52 +01:00
Torkel Ödegaard
dfef4727b6 Updated to sidemenu style 2015-02-03 10:46:33 +01:00
Torkel Ödegaard
3e5223b98d Merge branch 'master' of github.com:torkelo/grafana-private into pro 2015-02-03 09:43:21 +01:00
Torkel Ödegaard
0fe83d5198 minor css tweaks 2015-02-03 09:43:07 +01:00
Torkel Ödegaard
6b6b97c8d8 Minor bug fix for rememeber refresh interval after zooming two or more times, Fixes #1408 2015-02-03 09:27:00 +01:00
Torkel Ödegaard
5c3e366192 Fixed wrong icon class in annotations, broken after recent upgrade of font-awesome, Fixes #1416 2015-02-03 09:18:00 +01:00
Torkel Ödegaard
68a6a1bc15 Updated frontend, fix for paths to partials 2015-02-02 22:15:45 +01:00
Torkel Ödegaard
7fef460fa2 Fix for paths to partials 2015-02-02 22:15:15 +01:00
Torkel Ödegaard
4b7d802a9d Frontend updated with a big panel refactoring 2015-02-02 21:59:24 +01:00
Torkel Ödegaard
04ec222462 Big refactoring of the way panels are loaded and how they are built using directives, this way feel cleaner and allowed for placing the panel edit box outside the panel-container 2015-02-02 21:59:04 +01:00
Torkel Ödegaard
97758380e0 Worked on stars in search results 2015-02-02 17:17:57 +01:00
Torkel Ödegaard
b67f4dc390 Added stars to search results 2015-02-02 17:17:30 +01:00
Torkel Ödegaard
ad3d15e28d Worked on dashboard starring and unstarring, renamed favorite model to star 2015-02-02 11:32:32 +01:00
Torkel Ödegaard
1e3970c6e5 Worked on dashoard starring and unstarring, added dashboardMeta model 2015-02-02 11:32:00 +01:00
Torkel Ödegaard
706481b1a3 Updated frontend, fixed dashboard share feature 2015-02-02 09:46:03 +01:00
Torkel Ödegaard
66d9c4f1af Fixed share dashboard feature, sharing temp feature is currently removed 2015-02-02 09:45:45 +01:00
Torkel Ödegaard
cd17278c64 Updated frontend, a lot of markup, css fixes, restoring features 2015-02-02 09:00:04 +01:00
Torkel Ödegaard
f424abf87c more markup fixes 2015-02-02 08:59:38 +01:00
Torkel Ödegaard
8a5c91021d Various css and markup fixes for changed css classes 2015-02-02 08:34:54 +01:00
Torkel Ödegaard
ddc32d3cad updated frontend 2015-02-01 20:24:41 +01:00
Torkel Ödegaard
26535e163f fixing broken things in the markup for changed css classes 2015-02-01 20:23:52 +01:00
Torkel Ödegaard
cefdd86634 Minor css changes to graph panel & full edito mode 2015-02-01 19:59:53 +01:00
Torkel Ödegaard
56aa8ae6e0 more design work 2015-02-01 19:13:33 +01:00
Torkel Ödegaard
aa613bc767 updated frontend 2015-02-01 15:46:24 +01:00
Torkel Ödegaard
d272b0f56d Merge branch 'new_top_menu_design' into pro
Conflicts:
	src/app/partials/sidemenu.html
2015-02-01 15:46:08 +01:00
Torkel Ödegaard
6bc524dff8 progress on new design 2015-02-01 15:45:11 +01:00
Torkel Ödegaard
496e5bdad9 More progress on new design 2015-02-01 11:56:01 +01:00
Torkel Ödegaard
f00e5936c9 New design work 2015-01-31 18:00:26 +01:00
Torkel Ödegaard
6ea35fce66 Updated frontend 2015-01-30 15:10:43 +01:00
Torkel Ödegaard
3da90e09d5 Fixed logout link 2015-01-30 15:10:22 +01:00
Torkel Ödegaard
20c6925470 Fixed sub url setting bug 2015-01-30 14:21:32 +01:00
Torkel Ödegaard
465c72d98e More work on topnav and gf-box redesign 2015-01-30 14:12:16 +01:00
Torkel Ödegaard
59ade61687 dashboard-edit-view -> gf-box and new box design 2015-01-30 12:57:14 +01:00
Torkel Ödegaard
1ddc2e68bf Further progress on new design 2015-01-30 11:34:54 +01:00
Torkel Ödegaard
fcba5a6eeb More progress on new design 2015-01-30 10:25:10 +01:00
Torkel Ödegaard
2f7770b165 Work on new top nav design 2015-01-30 09:47:16 +01:00
Torkel Ödegaard
04d03f73b3 Added disable user sign up feature 2015-01-29 15:46:54 +01:00
Torkel Ödegaard
740709da04 Added disable user sign up feature 2015-01-29 15:46:36 +01:00
Torkel Ödegaard
2feab76a6f Merge branch 'pro' into temp_test 2015-01-29 15:08:53 +01:00
Torkel Ödegaard
d95c5e6674 Basic import of json dashboards is working, needs more work to handle updates, and continous watching, #22 2015-01-29 14:33:50 +01:00
Torkel Ödegaard
1d6413bfae More work on backend for user favorites 2015-01-29 12:10:34 +01:00
Torkel Ödegaard
3b5c813be7 worked on user frontend state, state like favorites, etc 2015-01-29 12:10:14 +01:00
Torkel Ödegaard
e02e60171e Began work on user favorites backend support & storage 2015-01-28 15:29:36 +01:00
Torkel Ödegaard
b25bf363b3 updated frontend, fixed new dashboard button 2015-01-28 14:31:09 +01:00
Torkel Ödegaard
9d0982f2f7 Merge branch 'master' of github.com:torkelo/grafana-private into pro
Conflicts:
	src/app/directives/dashEditLink.js
2015-01-28 14:30:16 +01:00
Torkel Ödegaard
25316cbe0e Fixed broken feature: new dashboard button 2015-01-28 14:25:35 +01:00
Torkel Ödegaard
cf5595bd64 mini fix for submenuEnabled being undefined, when initiating a dashboard with empty model 2015-01-28 14:24:11 +01:00
Torkel Ödegaard
12f2ca9262 updated build file 2015-01-28 13:10:09 +01:00
Torkel Ödegaard
5631d52f50 Added admin settings view 2015-01-28 11:39:35 +01:00
Torkel Ödegaard
a7a8ea3077 added admin settings view 2015-01-28 11:39:22 +01:00
Torkel Ödegaard
1cff564483 Fontend handling of account role to hide user actions and links that the user does not have access to 2015-01-28 11:33:50 +01:00
Torkel Ödegaard
c75e669204 Hide sidemenu links that the user does not have access to 2015-01-28 11:33:12 +01:00
Torkel Ödegaard
1758412a76 Settings fix 2015-01-28 10:54:14 +01:00
Torkel Ödegaard
aa261bbe23 Login: only enabled oauth options are shown on login page 2015-01-28 10:26:13 +01:00
Torkel Ödegaard
017eab8dcd Login: only enabled oauth options are now shown on login page 2015-01-28 10:25:53 +01:00
Torkel Ödegaard
7e26d7a4bf Fix to dashboard loading and error handling 2015-01-28 09:58:24 +01:00
Torkel Ödegaard
c6e110100a Just testing a thing 2015-01-27 18:20:12 +01:00
Torkel Ödegaard
a5e450a0dd Worked on anonymous access 2015-01-27 15:45:27 +01:00
Torkel Ödegaard
757b185398 Worked on ease of use for non multi tenant scenarios, Closes #20 2015-01-27 15:14:53 +01:00
Torkel Ödegaard
257519490a Worked on login remember cookie, and redirect after login 2015-01-27 12:05:23 +01:00
Torkel Ödegaard
4572747bd6 Worked on login remember cookie and redirect after login 2015-01-27 11:59:20 +01:00
Torkel Ödegaard
6e5ef561eb Updated Godeps 2015-01-27 10:11:18 +01:00
Torkel Ödegaard
95305e7e11 Changed from goconfig to its new counter part go-ini 2015-01-27 10:09:54 +01:00
Torkel Ödegaard
951ce0a102 API token -> API key rename 2015-01-27 08:26:11 +01:00
Torkel Ödegaard
11b74baf79 Api token -> api key rename 2015-01-27 08:25:52 +01:00
Torkel Ödegaard
c0353ab5d8 Graph: fix for legend show/hide toggle, after hiding requires new data fetch to show, Fixes #1393 2015-01-27 07:56:23 +01:00
Torkel Ödegaard
9fa0a4c973 Dashboard: fixed scroll isssue in firefox after dashboard import, Closes #1391 2015-01-27 07:47:01 +01:00
Torkel Ödegaard
db371d2a5d API: added admin role requirement for account changes, datasource admin, and api keys admin 2015-01-26 20:26:17 +01:00
Torkel Ödegaard
01cce09ef2 Updated frontend 2015-01-26 16:00:03 +01:00
Torkel Ödegaard
d2f21bc93e Merge branch 'master' into pro 2015-01-26 15:56:39 +01:00
Torkel Ödegaard
5ba2423626 Worked on account update view 2015-01-26 15:42:22 +01:00
Torkel Ödegaard
a6b0856020 Worked on account update view 2015-01-26 15:42:11 +01:00
Torkel Ödegaard
9a641ee7c0 Corrected the use of POST vs PUT, POST creates something, PUT updates, got them mixed up 2015-01-26 12:58:03 +01:00
Torkel Ödegaard
ab7e2f89fb Corrected the use of POST vs PUT, POST creates something, PUT updates, got them mixed up 2015-01-26 12:57:44 +01:00
Torkel Ödegaard
71ab8d6afc Merge branch 'master' of github.com:torkelo/grafana-private 2015-01-26 12:41:15 +01:00
Torkel Ödegaard
ea5da627af Panel: Different time periods, panels can override dashboard relative time and/or add a time shift, #171, only works for graph panel for now, need feedback for how to do it for singlestat panel 2015-01-26 11:49:18 +01:00
Torkel Ödegaard
1c8ef716a2 Began work on time overrides for panels, to enable different time periods on the same dashboard, #171 2015-01-26 10:57:08 +01:00
Torkel Ödegaard
6fc451da9e Small fix 2015-01-25 14:51:51 +01:00
Torkel Ödegaard
b940f4a97d Timepicker: New option in timepicker (under dashboard settings), to change now to be for example now-1m, usefull when you want to ignore last minute because it contains incomplete data, Closes #1242, Closes #374 2015-01-25 13:45:08 +01:00
Torkel Ödegaard
c2c81e7e6a Graph: Fix for all series tooltip showing series with all null values when Hide Empty option is enabled, Fixes #1359 2015-01-23 11:36:18 +01:00
Torkel Ödegaard
1508d0ac23 TemplatOCing: Fix to allow custom template variables to contain white space, now only splits on ',', Fixes #1363 2015-01-23 10:41:23 +01:00
Torkel Ödegaard
d3c37bda71 Graphite: Fix for nested complex queries, where a query references a query that references another query (ie the #[A-Z] syntax), Fixes #1372 2015-01-23 10:29:54 +01:00
Torkel Ödegaard
c82e2d74bf Login validation 2015-01-22 11:51:44 +01:00
Torkel Ödegaard
1a11b400b0 Polish and incorporating new design for login screen from matt 2015-01-22 10:14:29 +01:00
Torkel Ödegaard
1d8bb45d3a quickfix for support suburl for sidemenu nav 2015-01-21 20:14:53 +01:00
Torkel Ödegaard
fc9de68ee9 fixed broken html on login page 2015-01-21 20:01:22 +01:00
Torkel Ödegaard
1fb9bbba91 a lot of work on sidemenu, and encoding dash edit view in url 2015-01-21 19:45:23 +01:00
Torkel Ödegaard
cd4fc78aec trying to get dashboard settings, annotations and templating views be opened via url parameters 2015-01-21 16:29:04 +01:00
Torkel Ödegaard
4e6a04923a worked on new sidemenu design 2015-01-21 14:44:34 +01:00
Torkel Ödegaard
83899eb884 added hamburger 2015-01-21 13:05:55 +01:00
Torkel Ödegaard
3744bc3228 fixed server side rendering 2015-01-21 10:51:42 +01:00
Torkel Ödegaard
a0c8d3fa6f Small fix to data source view 2015-01-21 10:51:28 +01:00
Torkel Ödegaard
d3c13a1d8c removed old signup/register view 2015-01-21 09:55:15 +01:00
Torkel Ödegaard
3c8c53194f Sign up and login work 2015-01-21 09:52:40 +01:00
Torkel Ödegaard
8ed9212401 Redesigned and polished login view, still needs work on validation 2015-01-21 09:51:31 +01:00
Torkel Ödegaard
5cef73331c Fixed asteric icon in graphite metric path selector, broken after resent font awesome upgrade, #1361 2015-01-21 07:27:27 +01:00
Torkel Ödegaard
5760fa104c trying to cleanup login page 2015-01-21 06:41:09 +01:00
Torkel Ödegaard
4786e0f882 Changed name for vendor folder 2015-01-20 17:53:20 +01:00
Torkel Ödegaard
3bf7f6ed5f Updated build post processsing to include vendor dir 2015-01-20 17:53:01 +01:00
Torkel Ödegaard
9e6df378c3 worked on account creation 2015-01-20 16:29:48 +01:00
Torkel Ödegaard
9667f324f1 added ability to create accounts from profile page 2015-01-20 16:29:19 +01:00
Torkel Ödegaard
eec178458b Validation check for not removing the last account admin 2015-01-20 15:48:19 +01:00
Torkel Ödegaard
4ea5d80099 Various fixes to data access 2015-01-20 15:23:14 +01:00
Torkel Ödegaard
d9a33680a6 Fixes to account/account users 2015-01-20 15:22:45 +01:00
Torkel Ödegaard
0a695ba17a Final work on migration, now there is no usage of xorm table sync 2015-01-20 14:44:37 +01:00
Torkel Ödegaard
afb847acc8 a lot of work on database schema and migration setup, postgres now works, every integration test passes for all database types, only token table left to do 2015-01-20 14:15:48 +01:00
Torkel Ödegaard
8bb9126b77 added postgres support for db migrations 2015-01-20 09:20:44 +01:00
Torkel Ödegaard
2379c5b770 Added loglevel to migrator, added dashboard table & index migrations 2015-01-20 08:50:08 +01:00
Torkel Ödegaard
581efa857b Small fixes 2015-01-19 19:10:29 +01:00
Torkel Ödegaard
590c3b4b50 Fixes to account users view 2015-01-19 19:10:04 +01:00
Torkel Ödegaard
e750508d76 Fixes for update user and add token 2015-01-19 18:57:51 +01:00
Torkel Ödegaard
efe7279ead Quick fix for frontend for account to user split 2015-01-19 18:57:25 +01:00
Torkel Ödegaard
90925273a0 User / Account model split, User and account now seperate entities, collaborators are now AccountUsers 2015-01-19 18:01:04 +01:00
Torkel Ödegaard
f1996a9f1f Initial work on seperation between user and account 2015-01-19 16:28:45 +01:00
Torkel Ödegaard
e411b8e423 Fixed icons in graph tooltip, not updated after recent font awesome upgrade, Closes #1355 2015-01-19 13:08:18 +01:00
Torkel Ödegaard
d8e5be5782 Worked on database agnostic table creation for db migrations 2015-01-19 10:44:16 +01:00
Torkel Ödegaard
7d70ffe201 adding more columns for account table migration 2015-01-18 20:09:30 +01:00
Torkel Ödegaard
a64a38d7dd Added migration log and migration id, do not execute already executed migrations 2015-01-18 18:41:03 +01:00
Torkel Ödegaard
8bfed7508c More work on sql schema and migrations, starting to get somewhere 2015-01-18 14:51:51 +01:00
Torkel Ödegaard
68a77c4051 More progress on db schema setup and migrations, tricky stuff 2015-01-18 13:08:59 +01:00
Torkel Ödegaard
38f237efcb Merge branch 'master' of github.com:torkelo/grafana-pro 2015-01-18 08:56:32 +01:00
Torkel Ödegaard
2daffe2a15 Api import route updated 2015-01-18 08:56:19 +01:00
Torkel Ödegaard
1f987c1903 Began work on real sql schema definitions, and migration engine 2015-01-17 21:40:22 +01:00
Torkel Ödegaard
9a29b04561 Dashboard import/export now works 2015-01-17 10:39:26 +01:00
Torkel Ödegaard
1c5f902770 Added dashboard import feature 2015-01-17 10:39:01 +01:00
Torkel Ödegaard
3be11b9861 Small cosmetic change 2015-01-17 08:27:55 +01:00
Torkel Ödegaard
c970e82758 Small update to update account command 2015-01-17 08:20:25 +01:00
Torkel Ödegaard
a0036179d5 Removed alerts and graph from sidemenu, added required field to account input fields 2015-01-17 08:19:45 +01:00
Torkel Ödegaard
1532eb4278 Fixed png rendering 2015-01-16 17:00:31 +01:00
Torkel Ödegaard
64f98d2409 Mini fix for sidemenu 2015-01-16 17:00:02 +01:00
Torkel Ödegaard
ed879df1f4 Corrected spelling of SignedInUser (was SignInUser) 2015-01-16 16:17:35 +01:00
Torkel Ödegaard
2b05dac071 Api Key role is now correcty added do middleware context 2015-01-16 16:15:35 +01:00
Torkel Ödegaard
507bff8b59 Godep is acting strangly 2015-01-16 15:48:34 +01:00
Torkel Ödegaard
3912ed5023 Role checking when saving dashboard, making sure that the user has owner or editor role 2015-01-16 15:28:44 +01:00
Torkel Ödegaard
984ece646f Get access denied when trying to save from collaboration role viewer 2015-01-16 15:21:07 +01:00
Torkel Ödegaard
22156fe309 Big refactoring for context.User, and how current user info is fetching, now included collaborator role 2015-01-16 14:32:18 +01:00
Torkel Ödegaard
9637efd5ee renamed isAdmin to isGrafanaAdmin to make it less confusable with admin role 2015-01-16 14:31:09 +01:00
Torkel Ödegaard
52992928d5 Updated macaron dependency 2015-01-16 12:37:25 +01:00
Torkel Ödegaard
aa9ca68883 Tokens small fixes 2015-01-16 12:28:35 +01:00
Torkel Ödegaard
aaa717aac2 Refactoring apikeys into its own view 2015-01-16 12:28:09 +01:00
Torkel Ödegaard
4ece7fc038 Merge remote-tracking branch 'origin/tokens' into pro 2015-01-16 12:07:27 +01:00
Torkel Ödegaard
9feb8a73fd Added binding to tokens api and role validation 2015-01-16 12:06:24 +01:00
Torkel Ödegaard
d3cc6e518d updated collaborators 2015-01-16 12:06:05 +01:00
Torkel Ödegaard
f858f6b621 Add collaborator now handles role, added macaron-contrib/binding for binding and validation 2015-01-16 11:54:19 +01:00
Torkel Ödegaard
500e000661 Add collaborator now handles roles, added macaron-binding for binding and validation 2015-01-16 11:53:31 +01:00
Torkel Ödegaard
4c73d970e5 Merge branch 'master' of github.com:torkelo/grafana-private into pro 2015-01-16 09:32:06 +01:00
Torkel Ödegaard
becdaafdca Refactored away the graphite-target-inner / tight-form-row 2015-01-16 09:31:38 +01:00
woodsaj
3887aa72cb add tokens to UI under the Account Settings.
Adds support for adding and removing API tokens.
2015-01-16 16:04:46 +08:00
Torkel Ödegaard
72d7a7d91d changed grafana-target css names in partials 2015-01-16 08:50:26 +01:00
Torkel Ödegaard
e1f410d32e Starting css refactor for grafana-target 2015-01-16 08:35:32 +01:00
Torkel Ödegaard
cd5843e977 Fixed unit tests 2015-01-16 07:45:37 +01:00
Torkel Ödegaard
af3aa81d71 UI: Fixed position of confirm modal when scrolled down, Fixes #1345 2015-01-16 07:20:00 +01:00
Torkel Ödegaard
04bbdbad12 Worked on account update, moved collaborats to its own api url and files 2015-01-15 19:14:47 +01:00
Torkel Ödegaard
9d1dacb8d4 Worked on account update, moved collaborators to its own view 2015-01-15 19:14:07 +01:00
Torkel Ödegaard
f3bb2d41a7 removed sidemenu controller 2015-01-15 17:41:28 +01:00
Torkel Ödegaard
804bff55ec Accounts admin view/get api 2015-01-15 15:54:22 +01:00
Torkel Ödegaard
5b93e09714 Very basic start for accounts admin view 2015-01-15 15:53:55 +01:00
Torkel Ödegaard
fdfcc3ab2a Admin flagged users, create a default admin user on startup if missing 2015-01-15 14:44:15 +01:00
Torkel Ödegaard
cf344abff2 Admin menu only visible for admins 2015-01-15 14:43:44 +01:00
Torkel Ödegaard
5ec07db143 Refactoring of auth middleware, and starting work on account admin 2015-01-15 12:16:54 +01:00
Torkel Ödegaard
67b935188b Fixed failing unit test 2015-01-15 10:52:22 +01:00
Torkel Ödegaard
0dfd09ed0e fixed build.go setup 2015-01-14 20:51:22 +01:00
Torkel Ödegaard
6f63d63ee0 Working on account collaborators 2015-01-14 16:12:37 +01:00
Torkel Ödegaard
961ebbde6b Working on account collaborators 2015-01-14 16:12:19 +01:00
Torkel Ödegaard
50a5355de0 Merge pull request #17 from torkelo/tokenGetAccountFix
fix getAccountByToken query.
2015-01-14 14:59:23 +01:00
woodsaj
f25cffd24e fix getAccountByToken query. 2015-01-14 21:45:00 +08:00
Torkel Ödegaard
5e18afe916 Refactoring of api routes 2015-01-14 14:25:12 +01:00
Torkel Ödegaard
733a9af629 small changes 2015-01-14 14:24:54 +01:00
Torkel Ödegaard
166ce7d2ae Added Gzip option and the macaron Gzip middleware, but does not seem to work 2015-01-14 10:34:14 +01:00
Torkel Ödegaard
5833867b44 renamed register route to signup 2015-01-14 10:19:53 +01:00
Torkel Ödegaard
6cc1502c89 Renamed register routes/ctrl to signup 2015-01-14 10:19:35 +01:00
Torkel Ödegaard
ced5e5500e mini code cleanup of in auth 2015-01-14 10:14:07 +01:00
woodsaj
7b17e38f5d add Token authentication support
Added CRUD methods for Tokens.
Extend Auth Handler to check for the presence of a Bearer Authorization
header to authenticate against. If there is no header, or the token is not
valid, the Auth Handler falls back to looking for a Session.
2015-01-14 16:33:34 +08:00
Torkel Ödegaard
e58cd91487 updated frontend 2015-01-13 14:07:34 +01:00
Torkel Ödegaard
10fd66b7c5 removed old sample directory, Closes #1333 2015-01-13 10:19:32 +01:00
Torkel Ödegaard
9f4ea7301a Merge branch 'master' of github.com:torkelo/grafana-private into pro 2015-01-12 18:59:48 +01:00
Torkel Ödegaard
14e1bc8702 Graph & Singlestat: New axis/unit format selector and more units (kbytes, Joule, Watt, eV), and new design for graph axis & grid tab and single stat options tab views, #1331 2015-01-12 17:05:43 +01:00
Torkel Ödegaard
cc21c66b3a Updated design of singlestat options view, it now uses the new unit format selector, #1331 2015-01-12 17:02:58 +01:00
Torkel Ödegaard
1e9c51072a Added new units to dropdown in singlestat options, need to add new unit selector to singlestat panel, #1331 2015-01-12 16:24:44 +01:00
Torkel Ödegaard
4544f79471 Fixed influxdb and opentsdb editors to use latest markup and css, #1331 2015-01-12 16:18:35 +01:00
Torkel Ödegaard
a3da11c5bc Fixed legend values check, got rid of the legend values checkbox, #1331 2015-01-12 15:59:22 +01:00
Torkel Ödegaard
66631da1c7 Some last polish to thew new axis editor view, #1331 2015-01-12 15:47:47 +01:00
Torkel Ödegaard
d6f9ff34ce More work on new grap axis & grid edit tab, #1331 2015-01-12 15:37:22 +01:00
Torkel Ödegaard
a1e39ce24d Fixed show/hide axis toggles, #1331 2015-01-12 14:31:15 +01:00
Torkel Ödegaard
c39f9ed2f3 More work on refactoring and changing graph axis edit view, #1331 2015-01-12 14:00:30 +01:00
Torkel Ödegaard
3a27b610d5 Added all unit formats to new unit selector, #1331 2015-01-12 13:42:16 +01:00
Torkel Ödegaard
3dc30e4d8b Major reworking of the graph axis editor tab 2015-01-12 12:55:19 +01:00
Torkel Ödegaard
1a49d51d42 Merge branch 'Bps' of https://github.com/gitbisector/grafana into units
Conflicts:
	src/app/panels/graph/axisEditor.html
	src/app/panels/singlestat/editor.html
2015-01-12 10:06:12 +01:00
Torkel Ödegaard
0b46196ff5 Merge branch 'energy_formatting_units' of https://github.com/chron0/grafana into units
Conflicts:
	src/app/panels/graph/axisEditor.html
2015-01-12 10:04:11 +01:00
Torkel Ödegaard
ea6cea6f29 Merge branch 'master' of https://github.com/grimpy/grafana into units 2015-01-12 10:02:10 +01:00
Torkel Ödegaard
93fb02509b Removed flicker when refreshing a singlestat panel with spark line 2015-01-12 09:27:20 +01:00
Ties Bos
09a0ef2013 Add Bps support, much like bps 2015-01-11 22:19:59 -08:00
Torkel Ödegaard
ccbe055e5b Graph: Added right y axis label setting and graph support, Closes #599 2015-01-11 20:04:33 +01:00
Torkel Ödegaard
8e65f36131 Added system admin skeleton 2015-01-11 12:12:29 +01:00
Torkel Ödegaard
b66894f727 Added system admin page skeleton 2015-01-11 12:12:12 +01:00
Torkel Ödegaard
dc16c8c60c Added openldap docker/fig block, ldap auth seems to be complicated and take some time, not sure if that is high prio now 2015-01-11 12:11:49 +01:00
Torkel Ödegaard
92c3d80189 SingleStatPanel: You can now use template variables in pre & postfix, Closes #1321 2015-01-10 12:49:35 +01:00
Torkel Ödegaard
68cc3f86dd Handle default datasource management 2015-01-09 16:36:23 +01:00
Torkel Ödegaard
1d769fe41c Worked on handling marking a datasource as the default 2015-01-09 16:35:36 +01:00
Torkel Ödegaard
4edf0c9768 Fixed alert popup close icon 2015-01-09 16:28:58 +01:00
Torkel Ödegaard
d562dcd90c Default datasource and event system test 2015-01-09 11:01:37 +01:00
Torkel Ödegaard
f99e1ba441 Updated readme 2015-01-09 10:16:01 +01:00
Torkel Ödegaard
1b9b8ba2bf Fixed two icons 2015-01-09 10:15:42 +01:00
Torkel Ödegaard
16f7f68636 Plugins: fixed broken example panel plugin, Fixes #1318 2015-01-09 09:37:42 +01:00
Torkel Ödegaard
c1272de462 Merge branch 'master' of github.com:torkelo/grafana-private into pro 2015-01-08 19:04:38 +01:00
Torkel Ödegaard
31cf8812f6 Fixed some icons that I had missed when upgrading font awesome to 4.2 2015-01-08 19:03:45 +01:00
Torkel Ödegaard
a81a5315e1 Added graphite docker and fig config 2015-01-08 17:34:41 +01:00
Torkel Ödegaard
f332f22bed Updated icons to font-awesome 4.2 2015-01-08 15:00:34 +01:00
Torkel Ödegaard
08ae183877 Merge branch 'master' of github.com:torkelo/grafana-private into pro 2015-01-08 14:38:10 +01:00
Torkel Ödegaard
c4ce553936 Fixed icon in panel header when drilldown link is present 2015-01-08 14:37:50 +01:00
Torkel Ödegaard
6f987253ac Fixed dependency for unsavedChangesSrv 2015-01-08 12:27:54 +01:00
Torkel Ödegaard
1f1244f285 Upgrade Font-Awesome from 3.2 to 4.2 2015-01-08 12:23:11 +01:00
Torkel Ödegaard
3cf775a1f6 Added handling and view for 404 not found 2015-01-08 09:46:33 +01:00
Torkel Ödegaard
979349388c Added 404 not found view 2015-01-08 09:46:11 +01:00
Torkel Ödegaard
cdcf88cbdf fixed path for solo panel ctrl 2015-01-08 09:34:46 +01:00
Torkel Ödegaard
d573ee22f1 Fixed missing godep dependency for unit tests 2015-01-08 09:23:34 +01:00
Torkel Ödegaard
18ff1569b9 Added missing mysql driver package dependency 2015-01-08 09:01:39 +01:00
Torkel Ödegaard
3226a3a58e Fixed hashing of passwords, Closes #3 2015-01-08 09:00:00 +01:00
Torkel Ödegaard
164435f71d Moving code arround 2015-01-08 08:01:26 +01:00
Torkel Ödegaard
6d814af0cc Updated frontend 2015-01-08 07:40:17 +01:00
Torkel Ödegaard
ffbbb5bc9e Graph: Fixed issue when using zero as a grid threshold, Fixes #1309 2015-01-07 20:03:51 +01:00
Torkel Ödegaard
d3e11cabd5 Fixed link to server side rendered panel 2015-01-07 16:56:57 +01:00
Torkel Ödegaard
35326e1d92 Worked a little on anonymous access, needs more work 2015-01-07 16:37:24 +01:00
Torkel Ödegaard
9d629f2780 Tested with mysql, added simple fig file, need to write a more substantial fig setup 2015-01-07 14:05:57 +01:00
Torkel Ödegaard
1ae52d2472 Dashboard search by tag, and tag cloud now works, god dam I hate SQL 2015-01-07 12:37:24 +01:00
Torkel Ödegaard
37ba2511d5 fixed error handling in default dashboard route 2015-01-06 20:40:12 +01:00
Torkel Ödegaard
bcdbec61d7 Dashboard search works better, tag cloud should be done soon 2015-01-06 18:39:26 +01:00
Torkel Ödegaard
d03949a735 Worked on dashboard and tag search through backend 2015-01-06 18:38:48 +01:00
Torkel Ödegaard
63fa9f4535 InfluxDB: Fix handling of empty array in templating variable query, Fixes #1298 2015-01-06 17:32:39 +01:00
Torkel Ödegaard
3f266a3e1b Fixed dashboard search 2015-01-06 17:22:10 +01:00
Torkel Ödegaard
a5c8bbfe1f Fixed query param in dashboard search for grafana datasource 2015-01-06 17:15:38 +01:00
Torkel Ödegaard
584f40d0c4 Merge branch 'master' of github.com:torkelo/grafana-private into pro 2015-01-06 14:16:06 +01:00
Torkel Ödegaard
72974719ac Remember last dashboard 2015-01-06 14:15:48 +01:00
Torkel Ödegaard
d4c3463f68 InfluxDB: auto escape column names with special characters, Closes #1296 2015-01-06 13:26:09 +01:00
Torkel Ödegaard
47e4b77140 lodash remove override fix, Fixes #1304 2015-01-06 13:03:55 +01:00
Torkel Ödegaard
3e07605260 added a /api/metrics/test query that returns random walk series 2015-01-06 09:11:00 +01:00
Torkel Ödegaard
49b18e17d7 added test query feature to grafana datasource to generate a test graph on first login 2015-01-06 09:10:20 +01:00
Torkel Ödegaard
7c6f0ad445 Graphite: Added cumulative and minimumBelow graphite functions, Closes #1297 2015-01-05 20:25:55 +01:00
Torkel Ödegaard
0e3f91508e Added validation to stop duplicate dashboards with same name from being saved 2015-01-05 17:04:29 +01:00
Torkel Ödegaard
34427f34e8 side menu visible by default after login 2015-01-05 17:03:56 +01:00
Torkel Ödegaard
4131b75562 updated build script and readme with build instructions 2015-01-05 16:17:36 +01:00
Torkel Ödegaard
62af885c09 frontend build script fix 2015-01-05 11:05:21 +01:00
Torkel Ödegaard
344812f1e0 fix in grunt build script 2015-01-05 11:04:58 +01:00
Torkel Ödegaard
d06174fb56 Added build script written in go that adds build symbols for version, commit and build date 2015-01-05 10:46:58 +01:00
Torkel Ödegaard
72d9532207 updated login view with build info 2015-01-05 10:46:16 +01:00
Torkel Ödegaard
ab052a5ed3 Added missing letters to graphite datasource nested query interpolation, #1294 2015-01-05 10:02:03 +01:00
Torkel Ödegaard
6ebf766342 updated frontend 2015-01-05 08:47:44 +01:00
Torkel Ödegaard
d1b31bb3d6 moved stuff around, trying to get rid of the pro folders and fixing some issues 2015-01-05 08:47:29 +01:00
Torkel Ödegaard
19c70a126f fixed oauth login redirect when using app sub url 2015-01-05 08:21:52 +01:00
Torkel Ödegaard
4cc8a9bd18 More work on getting grafana pro to work in sub url 2015-01-05 07:59:18 +01:00
Torkel Ödegaard
9be53f0a79 Updates to support sub url 2015-01-05 07:58:15 +01:00
Torkel Ödegaard
f25a415a9e Work on making grafana work in sub url 2015-01-04 21:03:40 +01:00
Torkel Ödegaard
5feed2344a Fixes to make grafana work in sub url 2015-01-04 21:01:28 +01:00
Torkel Ödegaard
9ba34aabab updated build script to output bin in correct path 2015-01-04 18:57:16 +01:00
Torkel Ödegaard
0b855aeac9 updated wercker script 2015-01-04 18:37:45 +01:00
Torkel Ödegaard
176c042cb6 updated wercker script 2015-01-04 18:29:55 +01:00
Torkel Ödegaard
db4ab8d8a7 updated wercker deploy step 2015-01-04 18:14:28 +01:00
Torkel Ödegaard
836f48b24c updated wercker file again 2015-01-04 18:08:43 +01:00
Torkel Ödegaard
9e01740193 updated wercker script 2015-01-04 18:05:16 +01:00
Torkel Ödegaard
b77a2d0f42 updated wercker script 2015-01-04 17:58:04 +01:00
Torkel Ödegaard
c83b0f2680 updated wercker deploy script 2015-01-04 17:52:10 +01:00
Torkel Ödegaard
5a3d3f5098 updated build and release tasks 2015-01-04 17:51:48 +01:00
Torkel Ödegaard
30c7cb80f9 corrected intendation in wercker file 2015-01-04 15:13:43 +01:00
Torkel Ödegaard
a71e54113e fix to wercker file 2015-01-04 15:07:44 +01:00
Torkel Ödegaard
dff19db58d added test deploy step to wercker file 2015-01-04 15:05:40 +01:00
Torkel Ödegaard
31520844b4 fix in wercker file 2015-01-04 14:44:22 +01:00
Torkel Ödegaard
282b3b3170 Updated wercker file 2015-01-04 14:37:24 +01:00
Torkel Ödegaard
55bc150701 added backend config frontend componenet 2015-01-04 14:36:41 +01:00
Torkel Ödegaard
fc88429282 Graphite: query letter for the whole alfabet, Fixes #1294 2015-01-04 12:25:06 +01:00
Torkel Ödegaard
ee443d91dd Fixed account creation on first github login 2015-01-01 22:27:19 +01:00
Torkel Ödegaard
318338f967 Updated zip release task 2015-01-01 22:26:57 +01:00
Torkel Ödegaard
29c9330965 Changes to config file loading 2015-01-01 15:29:10 +01:00
Torkel Ödegaard
7c72705bc5 more work on build process 2015-01-01 15:28:28 +01:00
Torkel Ödegaard
ad4cf373a6 Work on unifying backend grafnaa and standalone grafana, and being able to build both from the same branch 2014-12-31 19:02:00 +01:00
Torkel Ödegaard
33e3fc70b2 trying to get revision asset replacements to work with different paths 2014-12-31 19:01:10 +01:00
Torkel Ödegaard
9c3cd87bee more work on two grunt build modes, backend/standalone modes 2014-12-31 16:19:45 +01:00
Torkel Ödegaard
f8ddfec98c progress on being able to use exact same code base for backend and standalone version, building optimized build needs a little more work 2014-12-31 14:18:34 +01:00
Torkel Ödegaard
53ff171436 Standalone and backend mode with same code base is starting to work 2014-12-31 12:54:12 +01:00
Torkel Ödegaard
75c77a44c9 Merge branch 'master' of github.com:torkelo/grafana-private into pro
Conflicts:
	src/app/app.js
	src/app/controllers/all.js
	src/app/routes/all.js
	src/app/services/datasourceSrv.js
	src/test/test-main.js
2014-12-31 12:07:22 +01:00
Torkel Ödegaard
11b44f2b01 changes to make requirejs optimizer complete 2014-12-31 11:50:34 +01:00
Torkel Ödegaard
d1e33ec071 Moved routes 2014-12-31 11:48:15 +01:00
Torkel Ödegaard
39f3cfc1eb moved dashboard stuff into a feature folder, not sure about this, but need better structure and better way to organize dependencies 2014-12-31 11:05:19 +01:00
Torkel Ödegaard
2f811375bb Moving templating to feature to feature folder 2014-12-31 09:35:00 +01:00
Torkel Ödegaard
8d7390e765 moved annotation editor and service to features folder 2014-12-31 09:28:30 +01:00
Torkel Ödegaard
8268c65c57 Trying to organize code more around features than the standard controllers, services structure 2014-12-30 21:24:55 +01:00
Torkel Ödegaard
f9b0a01c74 restructuring 2014-12-30 21:08:56 +01:00
Torkel Ödegaard
0a4ccdcef2 moved all graphite code into features/graphite 2014-12-30 20:49:04 +01:00
Torkel Ödegaard
2b02c87b16 updated godeps file 2014-12-30 12:05:01 +01:00
Torkel Ödegaard
e738a67e06 removed the need for symbolic link to grafana/src 2014-12-30 12:03:03 +01:00
Torkel Ödegaard
b2f70c12b9 Updated packages 2014-12-30 11:38:36 +01:00
Torkel Ödegaard
c4a48b35c0 Updated libs 2014-12-30 11:27:36 +01:00
Torkel Ödegaard
9cc47b6b58 Updated godeps file 2014-12-30 11:14:22 +01:00
Torkel Ödegaard
41083b08ce fixed typo in wercker.yml 2014-12-30 11:11:49 +01:00
Torkel Ödegaard
8d6b09e995 Trying to use godep in wercker build 2014-12-30 11:09:50 +01:00
Torkel Ödegaard
599a77c776 Added karma test step to build/relase grunt task 2014-12-30 11:05:24 +01:00
Torkel Ödegaard
d7e796097a Another wercker update 2014-12-30 10:58:13 +01:00
Torkel Ödegaard
79e5dd3794 Updated wercker file 2014-12-30 10:48:46 +01:00
Torkel Ödegaard
ef90f1dca6 Updated readme 2014-12-30 10:37:00 +01:00
Torkel Ödegaard
aafe2c5b98 Updated session lib 2014-12-30 10:28:27 +01:00
Torkel Ödegaard
e9fcca16bd updated to new golang/x/oauth2 2014-12-30 10:10:13 +01:00
Torkel Ödegaard
c04a2ababd added basic wercker file 2014-12-30 09:33:27 +01:00
Torkel Ödegaard
8faa806c90 Refactoring dashboard delete and search 2014-12-29 13:58:06 +01:00
Torkel Ödegaard
164d11c816 InfluxDB now works in proxy mode, influxdb username and password is added in the backend and never exposed to frontend, #8 2014-12-29 13:36:08 +01:00
Torkel Ödegaard
27b11b1d79 InfluxDB now works in proxy mode, influxdb username and password is added in the backend and never exposed to frontend, #8 2014-12-29 13:35:51 +01:00
Torkel Ödegaard
d9386cc2c3 Updated lastest.json 2014-12-29 11:24:14 +01:00
Torkel Ödegaard
38f348e642 Updated version to 1.9.1 2014-12-29 11:21:25 +01:00
Torkel Ödegaard
656ec9c48f SinglestatPanel: added more fontsize options, Closes #1187 2014-12-29 10:51:59 +01:00
Torkel Ödegaard
ec98c201e4 Datasource options are now included in bootData 2014-12-28 19:30:14 +01:00
Torkel Ödegaard
47f226be3b login force full page reload 2014-12-28 19:29:41 +01:00
Torkel Ödegaard
f3132b4513 Trying a different approach to providing frontend settings 2014-12-28 18:37:39 +01:00
Torkel Ödegaard
cfabccc5f2 Work on handling frontend settings 2014-12-28 18:37:09 +01:00
Torkel Ödegaard
f5e8f9334b Fixed test failing in chrome 2014-12-26 11:50:59 +01:00
Torkel Ödegaard
7be2105fd9 Merge pull request #1272 from matschaffer/plugin-spec-support
Allow for plugin testing.
2014-12-26 11:40:54 +01:00
Torkel Ödegaard
49ee388dcf Merge pull request #1274 from matschaffer/panel-alert-tweak
Bring panel alert to front and move tooltip to top.
2014-12-26 11:40:41 +01:00
Mat Schaffer
6cb4b4061c Bring panel alert to front and move tooltip to top.
This makes the panel a lot easier to mouse over without odd visual effects.
2014-12-23 18:12:04 -08:00
Mat Schaffer
85e50ece2e Allow for plugin testing.
With this change in place you can include plugin specs in `grunt test` by creating a `src/config.js` like that includes something like this:

```js
      plugins: {
        // list of plugin panels
        panels: [],
        // requirejs modules in plugins folder that should be loaded
        // for example custom datasources
        dependencies: ['grafana-plugins/atlasDatasource'],
        specs: ['grafana-plugins/specs/atlasDatasource-specs']
      }
```
2014-12-23 12:01:50 -08:00
Torkel Ödegaard
32ae0ea13e Plugins: Custom datasource example adapted to return timestamps in millieseconds, Fixes #1263 2014-12-23 11:32:25 +01:00
Torkel Ödegaard
a55a606a55 Refactoring dashboard data access 2014-12-22 12:25:08 +01:00
Torkel Ödegaard
22bf20a135 Refactoring get account by id and by login to queries 2014-12-19 13:40:02 +01:00
Torkel Ödegaard
5dcf6ff2d3 Refactoring set using account 2014-12-19 13:12:47 +01:00
Torkel Ödegaard
dede578c7d Updated to datasource management 2014-12-19 12:52:00 +01:00
Torkel Ödegaard
607b0c0c0e More refactoring and aligning code to the command query model 2014-12-19 11:53:27 +01:00
Torkel Ödegaard
d5a59ac6b7 More migration to command/query and sql tests, looking good 2014-12-19 11:08:49 +01:00
Torkel Ödegaard
ccba95542b Moved add collaborator to command way of doing it 2014-12-19 10:45:22 +01:00
Torkel Ödegaard
36c46112df Refactoring data access to command query model, and adding tests for sql code 2014-12-19 09:43:16 +01:00
Torkel Ödegaard
1b3bddd622 Graph: graph spinner should not stop until annotation request is complete, #1235 2014-12-19 08:39:23 +01:00
Torkel Ödegaard
e5811e29b1 Added username, site and password for influxdb datasources 2014-12-19 08:19:12 +01:00
Torkel Ödegaard
525b367a6f Config.js generation, simple temp solution, first is default datasource 2014-12-19 07:42:20 +01:00
Torkel Ödegaard
a7c816c65e Datasource proxy, switch to lookup by id 2014-12-19 07:27:25 +01:00
Torkel Ödegaard
a2a0e0394d Work on data source proxying, #6 2014-12-18 20:26:06 +01:00
Torkel Ödegaard
d69258e28f Backend can now generate config.js, the very basic stuff, more work needed 2014-12-18 15:41:38 +01:00
Torkel Ödegaard
4e542d8b83 Changed config.js to backend generated config.js 2014-12-18 15:41:01 +01:00
Torkel Ödegaard
731bb6ba03 Graph: hover tooltip and axis format units fix, bug introduced last week 2014-12-18 09:12:36 +01:00
Torkel Ödegaard
fed06ef97d Graph: Fix for y axis and scaled units (GiB etc) caused rounding, for example 400 GiB instead of 378 GiB, Fixes #1251 2014-12-18 08:44:47 +01:00
Torkel Ödegaard
ce947d4793 Update data sources now work, #8 2014-12-17 17:32:22 +01:00
Torkel Ödegaard
ad91093902 Update datasource now works, #8 2014-12-17 17:31:57 +01:00
Torkel Ödegaard
a58330f4d8 InfluxDB: Support more than 10 series name segments when using alias patterns, Closes #1126 2014-12-17 14:14:24 +01:00
Torkel Ödegaard
5a46c2397b OpenTSDB: Downsample query field now supports interval template variable, Closes #1242 2014-12-17 13:34:52 +01:00
Torkel Ödegaard
adf4e72cf8 More general backend work, in the middle of the night... Zzzz 2014-12-17 03:09:54 +01:00
Torkel Ödegaard
0e97030716 More datasource admin, and backendSrv work 2014-12-17 03:09:25 +01:00
Torkel Ödegaard
c7ed348ee8 Lots of progress on command/query bus concept, in memory sql testing, datasource admin 2014-12-16 21:05:49 +01:00
Torkel Ödegaard
27f07e9de2 Progress on data source admin 2014-12-16 16:45:07 +01:00
Torkel Ödegaard
adb1502e72 Data source admin progress 2014-12-16 16:44:45 +01:00
Torkel Ödegaard
f79588c191 Annotations: mini fix for annotations editor and the list of annotations 2014-12-16 15:47:10 +01:00
Torkel Ödegaard
b70a3f0958 started work datasources admin 2014-12-16 12:04:08 +01:00
Torkel Ödegaard
b3b096e204 Moved things around, started work on datasources view 2014-12-16 12:02:06 +01:00
Torkel Ödegaard
f665a30d28 Added lint step to Makefile 2014-12-16 10:45:16 +01:00
Torkel Ödegaard
53b00d80d6 Fixed GetOtherAccountsFor query 2014-12-16 09:06:49 +01:00
Torkel Ödegaard
705455d5d6 Set active account now works again 2014-12-15 21:56:16 +01:00
Torkel Ödegaard
973b9cad36 moved all http route handling into single package named api 2014-12-15 21:25:02 +01:00
Torkel Ödegaard
1663cbbb34 Merge branch 'master' of github.com:torkelo/grafana-pro
Conflicts:
	.bra.toml
2014-12-15 20:50:38 +01:00
Torkel Ödegaard
26ec858903 Moved grafana bin file to bin folder 2014-12-15 17:36:42 +01:00
Torkel Ödegaard
9f766557f1 Dashboard: fixed minor issue when trying to aborting dashboard delete from search list, Fixes #1233 2014-12-15 17:30:01 +01:00
Torkel Ödegaard
6c351c724d merged grafana upstream 2014-12-15 16:18:24 +01:00
Torkel Ödegaard
373118c5ee Merge branch 'master' of github.com:torkelo/grafana-private into pro 2014-12-15 16:17:59 +01:00
Torkel Ödegaard
a40c6e65dd Merge branch 'master' of github.com:torkelo/grafana-pro 2014-12-15 16:17:29 +01:00
Torkel Ödegaard
29749809d2 Updated 2014-12-15 16:17:20 +01:00
Torkel Ödegaard
846cf934f5 Graph: New legend option hideEmtpy to hide series with only null values from legend, Closes #1028 2014-12-15 16:13:34 +01:00
Torkel Ödegaard
162eb4ca35 Panel: duplicate now always adds the duplicated panel on the same row instead of creating a new row, Closes #1185 2014-12-15 15:21:29 +01:00
Torkel Ödegaard
2f18444a43 Graphite: alt node suggestions will now not include wildcard or template variables if the node is empty, Closes #1230 2014-12-15 15:16:03 +01:00
Torkel Ödegaard
8a4ff5bddc Merge pull request #1205 from noise/master
fix #1204: add separate datasource parameter withCredentials
2014-12-15 15:05:43 +01:00
Torkel Ödegaard
4ae7648bea Merge pull request #1193 from jklukas/master
Add offsetToZero to gfunc.
2014-12-15 12:37:27 +01:00
Torkel Ödegaard
dc75559758 Merge pull request #1206 from nikut/sumSeriesWithWildcards-params
allow multiple params for sumSeriesWithWildcards
2014-12-15 12:35:19 +01:00
Torkel Ödegaard
acd944a649 Graphite: movingAverage / movingMedian parameter type impovement, now handles int and interval parameter, Fixes #1207 2014-12-15 12:33:04 +01:00
Torkel Ödegaard
3c1b30e3c1 Graphite: parser fix for hard case where ip numbers are used as segments, Fixes #1224 2014-12-15 11:36:08 +01:00
Torkel Ödegaard
5daefc8b8e White theme: css fix for links in annotations tooltips, Fixes #1216 2014-12-15 10:53:37 +01:00
Torkel Ödegaard
715b9cbad0 Small fix, removed test code change 2014-12-11 09:44:45 -08:00
Torkel Ödegaard
7194e91d3b Singlestat: small fix for threshold evalutations, use greater or equal for threshold checks, Fixes #1192 2014-12-11 09:43:36 -08:00
Torkel Ödegaard
69d56b8ed7 Graph: fix for series tooltip when one series is hidden/disabled, #1199 2014-12-11 07:47:04 -08:00
Torkel Ödegaard
982a5b1a39 Panel: drilldown link, moved new params tooltip to params property, #1210 2014-12-11 07:26:00 -08:00
Torkel Ödegaard
6b8cb4ac7f Merge pull request #1210 from falkenbt/patch-1
Extend tooltip for drilldown link
2014-12-11 07:23:07 -08:00
Torkel Ödegaard
397f253180 Merge pull request #1214 from DazWorrall/useseriesabove
Added graphite function 'useSeriesAbove'
2014-12-11 07:21:00 -08:00
Darren Worrall
f93b6f7d85 Add missing default parameters to useSeriesAbove 2014-12-10 15:57:12 +00:00
Darren Worrall
edb2cf2cf2 Added graphite function 'useSeriesAbove' 2014-12-10 15:51:45 +00:00
falkenbt
fb12dd4688 Extend tooltip for drilldown link
It took me a bit to find out that variables need to be passed with var-variableName. 
The behavior is not specific to the drilldown link but I couldn't find it in any documentation elsewhere and it might help others to have it documented right here.
2014-12-09 17:23:44 +01:00
Niku Toivola
0a561e5aeb allow multiple params for sumSeriesWithWildcards 2014-12-09 11:41:01 +02:00
bret barker
c140c8cac9 fix #1204: add separate datasource parameter withCredentials 2014-12-08 09:35:55 -05:00
Jeff Klukas
06ab063671 Add offsetToZero to gfunc. 2014-12-04 09:00:47 -08:00
Torkel Ödegaard
1591a486cc Fixed typo in graphite editor tooltip 2014-12-02 14:51:21 -08:00
Torkel Ödegaard
b53efed1ef formating fix for the changelog 2014-12-02 14:49:42 -08:00
Torkel Ödegaard
7a202db5ad Updated latest.json 2014-12-02 14:24:34 -08:00
Torkel Ödegaard
af1ae7cab4 SinglestatPanel: decimal precision fix for uneven numbers, #1066 2014-12-02 13:55:56 -08:00
Torkel Ödegaard
24519cbf78 Updated version to 1.9.0 2014-12-02 11:21:18 -08:00
Torkel Ödegaard
01305462aa Row: css fix for collapsed rows with empty title 2014-12-02 11:07:51 -08:00
Torkel Ödegaard
90ae59ccaf Fixed png rending 2014-12-01 13:25:57 -08:00
Torkel Ödegaard
ff6a2d014a Refactored command/query interface 2014-12-01 08:56:03 -08:00
Torkel Ödegaard
246f41b88a Bus experiment 2014-11-28 22:16:49 +01:00
Torkel Ödegaard
a799fac983 Added Godeps and embedded dependencies 2014-11-28 11:56:03 +01:00
Torkel Ödegaard
50164324f3 moved back to a main.go file in root 2014-11-28 11:51:34 +01:00
Torkel Ödegaard
634d8c9978 sync with oss master 2014-11-28 09:14:54 +01:00
Torkel Ödegaard
e5eb0e3874 Merge branch 'master' of github.com:torkelo/grafana-private into pro 2014-11-27 15:01:48 +01:00
Torkel Ödegaard
63273f4ccf Merge branch 'master' of github.com:torkelo/grafana-private into pro 2014-11-27 14:59:58 +01:00
Torkel Ödegaard
7a4077405e Annotations: added html sanitation to prevent markup injection/XSS, Closes #1121 2014-11-27 14:46:01 +01:00
Torkel Ödegaard
9594effb6c Graph: Fix for tooltip series order when series draw order was changed with zindex property, Fixes #1108 2014-11-27 14:30:17 +01:00
Torkel Ödegaard
e750498696 Templating: added validation for allowed characters in variable names, Closes #1106 2014-11-27 14:22:55 +01:00
Torkel Ödegaard
69e18905f5 Templating: added validation to template editor for variable names, Fixes #1133 2014-11-27 14:17:31 +01:00
Torkel Ödegaard
ac4524cf9b Firefox: Workaround for Firefox bug, casued input text fields to not be selectable and not have placeable cursor, Fixes #1123 2014-11-27 13:35:03 +01:00
Torkel Ödegaard
7baad7ff10 Tech: updated angular libs 2014-11-27 13:31:55 +01:00
Torkel Ödegaard
d7ef6daeb8 SinglestatPanel: Fixed absolute drilldown link issue, Fixes #1150 2014-11-27 10:42:05 +01:00
Torkel Ödegaard
d8d5516e24 Create README.md 2014-11-26 12:57:16 +01:00
Torkel Ödegaard
93e3908a63 Merge pull request #1140 from johnou/support_negative_thresholds
Support for threshold colouring of zero / negative values.
2014-11-26 12:33:29 +01:00
Torkel Ödegaard
d7ee4b4573 Added missing files 2014-11-26 09:58:36 +01:00
Torkel Ödegaard
bf5f6ce97c Merge branch 'master' of github.com:grafana/grafana
Conflicts:
	CHANGELOG.md
2014-11-26 09:36:11 +01:00
Torkel Ödegaard
ed2ca5fced Graph: Fix to legend value Max and negative values, Fixes #1136 2014-11-26 09:34:21 +01:00
Johno Crawford
8dfe85f23e Support for negative thresholds. 2014-11-25 19:31:35 +00:00
Torkel Ödegaard
a492eceff0 refactoring 2014-11-24 17:37:20 +01:00
Torkel Ödegaard
be781bdb98 Tried postgres 2014-11-24 10:17:13 +01:00
Torkel Ödegaard
a8f915f049 Merge branch 'macaron' 2014-11-24 08:20:22 +01:00
Torkel Ödegaard
e750080f00 removed old code 2014-11-24 08:20:16 +01:00
Torkel Ödegaard
79beefe57c Updated grafana datasource 2014-11-24 08:05:07 +01:00
Torkel Ödegaard
fcdcd63dc7 get other accounts works 2014-11-24 08:04:41 +01:00
Torkel Ödegaard
846992930c Merge pull request #1109 from jklukas/master
Purge timspan variable from scripted templates.
2014-11-23 15:43:46 +01:00
Torkel Ödegaard
a1d652d578 SinglestatPanel: Added null point handling, and value to text mapping, Closes #1130, Fixes #1120, #951 2014-11-22 15:26:23 +01:00
Torkel Ödegaard
d0e057722b Graphite: added more optional parameters to aliasByNode function definition, #1124 2014-11-21 17:48:49 +01:00
Torkel Ödegaard
f04932aa67 More work on collaborators, and sql store 2014-11-21 16:43:04 +01:00
Torkel Ödegaard
d1be4e2a90 Light theme: tweaks to background color and table highlight rows, Closes #1119 2014-11-21 10:44:37 +01:00
Torkel Ödegaard
3cde783d1d Graphite: Lexer fix, allow equal sign (=) in metric paths, Fixes #1114 2014-11-21 10:25:36 +01:00
Torkel Ödegaard
e933369f56 Singlestat: changed singlestat title to centered position, Closes #1117 2014-11-21 10:17:08 +01:00
Torkel Ödegaard
e109f8d69c Graphite: added timeStack function definition, Closes #1118 2014-11-21 10:11:21 +01:00
Torkel Ödegaard
d198057eaf InfluxDB: fixed issue with using custom/absolute from time to now(), Fixes #1113 2014-11-21 10:06:42 +01:00
Torkel Ödegaard
88c2f18b20 Graphite: fixed aliasSub graphite func definition 2014-11-21 08:24:13 +01:00
Jeff Klukas
a30a604228 Purge timspan variable from scripted templates. 2014-11-20 09:32:19 -06:00
Torkel Ödegaard
4eefa73441 Progress on account and dashboard save/load 2014-11-20 15:19:44 +01:00
Torkel Ödegaard
00b4d233cc Small progress, save search works 2014-11-20 13:02:25 +01:00
Torkel Ödegaard
eb2c078898 Progres on move to sql from rethinkdb 2014-11-20 12:11:07 +01:00
Torkel Ödegaard
4b5eadf7b5 Merge branch 'master' of github.com:torkelo/grafana-private into pro 2014-11-20 09:16:49 +01:00
Torkel Ödegaard
9b68911d00 Made it it compile again 2014-11-20 09:16:28 +01:00
Torkel Ödegaard
62b58d8bb0 Updated scripted dashboard example 2014-11-20 09:09:59 +01:00
Torkel Ödegaard
a5951592f7 Merge branch 'master' of github.com:jklukas/grafana into jklukas-master 2014-11-20 09:08:00 +01:00
Torkel Ödegaard
6392d6514e Graphite: fixed: moving graphite function left/right did not update query, Fixes #1100 2014-11-20 09:00:30 +01:00
Torkel Ödegaard
91d6641326 Graph: fixed issue with shared tooltip when one or more series is hidden, Fixes #1094 2014-11-19 16:01:04 +01:00
Torkel Ödegaard
dd398f73c2 Css tweak to dark theme, mark submenu carets (ie arrows) white, Fixes #1098 2014-11-19 15:41:16 +01:00
Torkel Ödegaard
de10bd4ef6 DrilldownLink: template variables in params property was not interpolated, Fixes #1095 2014-11-19 15:33:00 +01:00
Torkel Ödegaard
56321da9c1 Bug: Fixed position for drilldown link tooltip when dashboard requires scrolling, Fixes #1093 2014-11-19 15:26:14 +01:00
Torkel Ödegaard
d0d1c5ea5f updated changelog 2014-11-19 11:57:00 +01:00
Torkel Ödegaard
e16872c864 Updated angular-dragdrop to fix issue with IE9, Fixes #1087 2014-11-19 11:55:18 +01:00
Jeff Klukas
1e425244d2 Refactor timspan default in scripted examples. 2014-11-18 14:24:55 -06:00
Torkel Ödegaard
0c6618d2f6 Small tweaks 2014-11-18 16:58:26 +01:00
Torkel Ödegaard
a9d7823186 Singlestat: only show thresholds options when coloring option is checked, Fixes #1077 2014-11-18 08:27:43 +01:00
Torkel Ödegaard
6c0f5329aa Graph: improved decimal precision in legend and graph hover when graph ticks use single decimal point, now graph legend and tooltip always use one more decimal precision than axis ticks (if axis ticks has decimals), Fixes #1072 2014-11-17 19:20:27 +01:00
Torkel Ödegaard
a677a4feff Updated changelog with share panel feature, #864, it was missing 2014-11-17 16:13:47 +01:00
Torkel Ödegaard
4f674c8d19 Updated changelog with RC1 release date 2014-11-17 15:21:43 +01:00
Torkel Ödegaard
e197163019 Changed version to 1.9-rc1 2014-11-17 11:19:17 +01:00
Torkel Ödegaard
7ba0099fa9 Panel: fixes to panel menu when in edito/fullscreen mode, Fixes #1069 2014-11-17 09:59:37 +01:00
Torkel Ödegaard
f45797ec4b trying out panel actions buttons 2014-11-17 09:11:54 +01:00
Torkel Ödegaard
02e1ac12b2 InfluxDB: fixed annotations, broken after switch to millisecond resolution, Fixes #1061 2014-11-17 07:09:21 +01:00
Torkel Ödegaard
bde138177d Singlestat: fixed decimal issue when value was 1, Fixes #1066 2014-11-15 10:38:01 +01:00
Torkel Ödegaard
2423f470ef Merge with oss master 2014-11-14 17:56:27 +01:00
Torkel Ödegaard
e5219af481 Merge branch 'master' of github.com:torkelo/grafana-private into pro
Conflicts:
	src/app/components/require.config.js
2014-11-14 17:40:16 +01:00
Torkel Ödegaard
21a4f3cc05 updated 2014-11-14 17:16:40 +01:00
Torkel Ödegaard
a9d9939bdd Merge branch 'pro' of github.com:torkelo/grafana-private into pro 2014-11-14 17:15:44 +01:00
Torkel Ödegaard
41fb2b4cc4 updated 2014-11-14 17:14:34 +01:00
Torkel Ödegaard
526e232c09 Merge branch 'pro' of github.com:torkelo/grafana-private into pro 2014-11-14 17:14:02 +01:00
Torkel Ödegaard
f2ed3d3ff2 Updated 2014-11-14 17:13:44 +01:00
Torkel Ödegaard
f5b1b192a0 Macaron and sqllite 2014-11-14 17:13:33 +01:00
chrono
a77c33d9b7 Added J,W & eV to unit formatting 2014-11-14 14:19:55 +01:00
Torkel Ödegaard
640c558446 Graph: added export graph time series data as csv file feature, accessed from panel menu dropdown, #861 2014-11-14 12:12:09 +01:00
Torkel Ödegaard
c11ce99bb3 SinglestatPanel: another small fix for drilldown link click while fullscreen mode, #1041 2014-11-14 11:41:36 +01:00
Torkel Ödegaard
8ad83b8d58 SinglestatPanel: small fix for drilldown link click while fullscreen mode, #1041 2014-11-14 11:36:20 +01:00
Torkel Ödegaard
873d3d7c4a SinglestatPanel: Added integration with drilldown link feature, if a drilldown link is present the entire singlestat panel will act as a link, with hover tooltip containing the link name, #951, #1041 2014-11-14 09:33:03 +01:00
Torkel Ödegaard
d4adaaaf2b Graphite: annotations stop working after recent change to millisecond resolution, Fixes #1061 2014-11-14 08:19:49 +01:00
Torkel Ödegaard
104493e725 SharePanel: fix for interval variables and auto value, Fixes #1056 2014-11-13 15:23:34 +01:00
Torkel Ödegaard
b172e7afdc SinglestatPanel: mini fix 2014-11-13 15:23:34 +01:00
Torkel Ödegaard
b1efbeb220 Merge pull request #1057 from kaos/master
panelmeta: fix metrics tab title.
2014-11-13 15:06:31 +01:00
Andreas Stenius
f2a6657b72 panelmeta: fix metrics tab title. 2014-11-13 14:29:42 +01:00
Torkel Ödegaard
4eb4974909 Graph: change to current legend value handling, if last value is null, current will pick next to last value, Closes #190 2014-11-12 13:47:06 +01:00
Torkel Ödegaard
3e2c898881 Graph: legend fix for current legend value 2014-11-12 13:40:22 +01:00
Torkel Ödegaard
2fb176a244 Graphite: fix for graphite query editor, when adding functions and the function selection dropdown get push down the selection did not work properly, Fixes #1038 2014-11-12 12:57:22 +01:00
Torkel Ödegaard
53a6a7b305 Annotations: fixed spelling issue in annoation error handling code 2014-11-12 12:41:53 +01:00
Torkel Ödegaard
2045380223 Graph: moved graph and graph tooltip directive into panels/graph folder 2014-11-12 11:58:04 +01:00
Torkel Ödegaard
1c0fc3c924 Graph: small fix to legend sorting, #1030 2014-11-12 10:19:33 +01:00
Torkel Ödegaard
0b966b7a28 Graph: legend sorting while in table mode implemented, panel persisted property, Closes #1030 2014-11-12 10:11:01 +01:00
Torkel Ödegaard
882a477c0f Graph: increase decimal precision in tooltip and legend values when unit scaling is applied, #1043 2014-11-12 09:09:05 +01:00
Torkel Ödegaard
ebcf2c3f68 InfluxDB: Support for sub second resolution graphs, Closes #714, #728, #752 2014-11-12 08:39:04 +01:00
Torkel Ödegaard
54fafb3a76 Graph: fix to typeahead for series overrides, (bug introduced in recent commit), Fixes #1046 2014-11-11 21:09:50 +01:00
Torkel Ödegaard
01bd662046 Graph: legend fix for bug when running optimized build, Fixes #1045 2014-11-11 21:06:01 +01:00
Jo De Boeck
98d934c8a4 Add mbytes and kbytes y_formats
Usefull when input data is stored in kbytes or mbytes
2014-11-11 19:22:22 +02:00
Torkel Ödegaard
9e26d3e85d SinglestatPanel: increased scaled decimal offset by 2 for, improves decimal precision when units gets scaled, #1043, #951 2014-11-11 16:30:20 +01:00
Torkel Ödegaard
17114778b7 Panel: fixed bug introduced in recent commit that caused blank title in optimized build, #1041 2014-11-11 15:00:31 +01:00
Torkel Ödegaard
98037ca0c6 SinglestatPanel: fixed issue when value is zero, #1039 2014-11-11 14:55:23 +01:00
Torkel Ödegaard
4ec59e8211 Tech: cleanup unused angular-strap directives, Closes #1029 2014-11-11 13:57:39 +01:00
Torkel Ödegaard
1e6a5ff8ec Updated changelog with #1041 2014-11-11 13:44:25 +01:00
Torkel Ödegaard
c12d830162 Panel: added search typeahead for dashboard links, #1041 2014-11-11 13:38:34 +01:00
Torkel Ödegaard
a49a9b3b64 Panel: more work on panel links, #1041 2014-11-11 12:51:57 +01:00
Torkel Ödegaard
5da3da5962 PanelLinks: began work on drilldown panel links feature, #1041 2014-11-11 11:48:27 +01:00
Torkel Ödegaard
8bb51d47f8 DashboardViewState: small fix for bug that caused issue for singlestat panel 2014-11-11 08:07:05 +01:00
Torkel Ödegaard
381b9ee7ee Graph: legend css tweaks 2014-11-11 07:51:52 +01:00
Torkel Ödegaard
a301c96c9d SharePanel: fix to share feature, Closes #1035 2014-11-10 16:18:59 +01:00
Torkel Ödegaard
f9c3cdab67 UI: replaced native confirm dialogs with nicer custom ones 2014-11-10 15:01:30 +01:00
Torkel Ödegaard
27ec0d532e began work on custom confirm modal 2014-11-10 10:40:45 +01:00
Torkel Ödegaard
3aa619b617 Panel: fixed duplicate panel, broken after yesterdays panel menu model refactoring 2014-11-09 09:44:16 +01:00
Torkel Ödegaard
ef92272bee Panel: fixed menu position after moving json to new dropdown 2014-11-08 19:28:16 +01:00
Torkel Ödegaard
815ef05daf Graph: refactoring some stuff with legend values 2014-11-08 19:16:22 +01:00
Torkel Ödegaard
2ab19148c1 Graph: toggle legend on/off from panel menu, #941, no keyboard shortcut yet, but could come 2014-11-08 18:12:05 +01:00
Torkel Ödegaard
d12f4a4aee Panels: refactoring panel meta model & menu, will open up panel specific menu actions 2014-11-08 16:27:49 +01:00
Torkel Ödegaard
81b1939f92 Graph: small fix to legend table mode 2014-11-08 11:44:23 +01:00
Torkel Ödegaard
834daeecd0 OpenTSDB: updated change log with templating support PR #917 2014-11-08 11:35:42 +01:00
Torkel Ödegaard
6aa0208316 Updated changelog with #1030 2014-11-07 14:23:18 +01:00
Torkel Ödegaard
aa87d8eb22 Graph: changed style of legend table mode to full width table and with headers, #1030 2014-11-07 14:20:58 +01:00
Torkel Ödegaard
cd21fa7016 Graph: new legend table display style, #1030 2014-11-07 13:57:52 +01:00
Torkel Ödegaard
7ba4f6b93f Singlestat: removed debug console.log 2014-11-07 13:56:28 +01:00
Torkel Ödegaard
e16a51ad06 Singlestat: fixed decimal precision bug, #951 2014-11-07 13:54:19 +01:00
Torkel Ödegaard
6861dc137f Graph: fix for legend show/hide toggle, broken by recent legend rewrite 2014-11-07 13:39:47 +01:00
Torkel Ödegaard
e530e4d4bc Tech: rewrite of how the legend is implement, performance increase, and will make future legend enhancements easier 2014-11-07 12:15:34 +01:00
Torkel Ödegaard
d150bc1e52 Graphite: added mapSeries and reduceSeries functions, Closes #1018 2014-11-07 06:34:47 +01:00
Torkel Ödegaard
cc8961360a Graphite: added maxDataPoints override option and a help section that describes how graphite point consolidation work, Closes #5 2014-11-06 16:25:46 +01:00
Torkel Ödegaard
c0539e483e Added singlestat panel to changelog 2014-11-06 14:10:25 +01:00
Torkel Ödegaard
f0b7099be3 SingleStatPanel: renamed panel to singlestat 2014-11-06 14:07:32 +01:00
Torkel Ödegaard
ee183d4574 SingleStatPanel: some more tweaks and polish 2014-11-06 13:57:16 +01:00
Torkel Ödegaard
fa813024ca SingleStatPanel: various fixes 2014-11-06 12:30:42 +01:00
Torkel Ödegaard
37176fa42d SingleStatPanel: Finnaly solved automatic decimal precision calculation for singlestat panel, #951 2014-11-06 12:17:46 +01:00
Torkel Ödegaard
7ff8931def SingleStatPanel: added font size options for value, prefix and postfix, #951 2014-11-06 10:47:46 +01:00
Torkel Ödegaard
2a962bf8fd Singlestat: progress on singlestat panel 2014-11-06 09:56:50 +01:00
Torkel Ödegaard
bbbcba8b98 Merge branch 'master' into valuepanel 2014-11-06 08:54:01 +01:00
Torkel Ödegaard
ecdcd10612 Graph: Series hide/show toggle changed to be default exclusive, so clicking on a series name will show only that series. (SHIFT or meta)+click will toggle hide/show. Closes #1007 2014-11-03 10:21:16 +01:00
Torkel Ödegaard
10ea140358 MetricEditors: Ability to reorder metric queries in metrics tag, Closes #716, Closes #856 2014-11-03 08:56:13 +01:00
Torkel Ödegaard
74e0309241 Fixes #912, URL parameters are lost when switching to fullscreen/edit mode 2014-11-02 11:56:51 +01:00
Torkel Ödegaard
c88bfbbf82 SingleStatPanel: editor cleanup 2014-11-02 11:36:11 +01:00
Torkel Ödegaard
4edb89eeb9 Merge branch 'summarize-alignToFrom' of github.com:adriensamson/grafana into adriensamson-summarize-alignToFrom 2014-10-30 09:24:27 +01:00
Torkel Ödegaard
cdb4b3cc7d Panel: fix fullscreen/edit view and page refresh when panel is in collapsed/hidden row, Fixes #992 2014-10-29 09:51:44 +01:00
Torkel Ödegaard
ed8dd03fa1 Merge branch 'master' into valuepanel 2014-10-29 09:24:49 +01:00
Torkel Ödegaard
e5bb7f7c2d CustomDatasource: fixed build optimization issue with custom datasources, Fixes #994 2014-10-28 19:00:46 +01:00
Torkel Ödegaard
a7b0f6dc9f ScriptedDashboard: datasource services are now available in scripted dashboards, you can query datasource for metric keys, generate dashboards, and even save them in a scripted dashboard (see scripted_gen_and_save.js for example), Closes #991 2014-10-28 16:16:52 +01:00
Torkel Ödegaard
c42986c07d Merge branch 'services_in_scripted_dashboard' 2014-10-28 16:14:41 +01:00
Torkel Ödegaard
a982dd1765 ScriptedDashboard: using grafana services in scripted dashboard 2014-10-28 16:14:28 +01:00
Torkel Ödegaard
c3900398fc Merge pull request #917 from mchataigner/master
adding templating in opentsdb graphs
2014-10-28 15:39:14 +01:00
Torkel Ödegaard
4b79a5e9da OpenTSDB: merged PR #930 adding counter max and counter reset options to OpenTSDB query editor 2014-10-28 12:41:17 +01:00
Torkel Ödegaard
eed2feea97 Merge branch 'opentsdb-counterMax' of github.com:rsimiciuc/grafana into rsimiciuc-opentsdb-counterMax 2014-10-28 12:36:15 +01:00
Torkel Ödegaard
60a2d9f624 Dashboard: fix for collapsed rows became invisible when hide controls was enabled, Fixes #987 2014-10-27 10:42:13 +01:00
Torkel Ödegaard
3cd33b6ffc Tech: added cache busting for requirejs fetches, will only affect config.js for optimized builds, should solve user issues where browsers cache config.js which causes initial confusing setup/config issues. 2014-10-26 08:45:42 +01:00
Torkel Ödegaard
e3942b3438 Graph: multi series tooltip fix for long series names, and metric value row alignment, Fixes #983, #984 2014-10-25 12:01:31 +02:00
Torkel Ödegaard
0bf37b8c00 Merge pull request #981 from swoop-inc/mb_value_update_bug
When get_data fails the legend should be cleared
2014-10-24 21:10:07 +02:00
Torkel Ödegaard
0e5dbf3889 Merge pull request #980 from maxstepanov/patch-1
Replace all $interval occurrences in query string
2014-10-24 21:07:38 +02:00
Torkel Ödegaard
785f96aabe Merge pull request #975 from swoop-inc/mb_support_influx_regex_merge
Add support for regex based series merging in InfluxDB
2014-10-24 21:01:52 +02:00
Mark Bell
5cec936128 When get_data fails the legend should be cleared 2014-10-24 14:51:45 -04:00
Max Stepanov
02861142cb Replace all $interval occurrences in query string
because template
2014-10-24 20:06:39 +03:00
Torkel Ödegaard
1cfc4d2f31 ScriptedDashboard: bugfix for scripted dashboards and collapsed rows, Fixes #965 2014-10-24 11:48:08 +02:00
Mark Bell
08e816a539 Add support for regex based series merging in InfluxDB 2014-10-23 10:35:57 -04:00
Torkel Ödegaard
272cf64aac SinglsStatPanel: more work on sparkline option for single stat panel 2014-10-23 13:44:15 +02:00
Torkel Ödegaard
ed57a4099b Merge branch 'master' into valuepanel 2014-10-23 13:35:54 +02:00
Torkel Ödegaard
79c5d48a3c Timepicker: Fix for Zoom out top menu link still visible when timepicker was disabled, Fixes #963 2014-10-23 12:36:25 +02:00
Adrien Samson
6c70122e55 Add alignToFrom param to summarize 2014-10-22 11:31:41 +02:00
Torkel Ödegaard
6c83699e6f Panel: css fix for panel fullscreen/edit mode for latest chrome 38 and Firefox 33, #954 2014-10-20 12:14:58 -04:00
Torkel Ödegaard
ff254ce08d Help: fix for help modal shortcut, and added missing shortcut, #952 2014-10-20 11:33:07 -04:00
Torkel Ödegaard
8a80ea26b8 Graph: fix for series override controller unit test 2014-10-20 10:10:18 -04:00
Torkel Ödegaard
b85fe62389 Graph: series override dropdown menu select did not work after recent commit that added typeahead to this dropdown 2014-10-20 10:06:34 -04:00
Torkel Ödegaard
31a4d9204c SingleStatPanel: Added graph to single stat panel, #951 2014-10-19 19:36:59 -04:00
Torkel Ödegaard
69fdfd5cb3 Merge branch 'master' into valuepanel 2014-10-19 12:34:01 -04:00
Torkel Ödegaard
16e7980982 Help: added help modal, accessed by shortcut '?', the help modal only contains a list of all shortcuts right now but will be extended in the future, #952 2014-10-19 12:30:41 -04:00
Torkel Ödegaard
e3e08cf8e7 Graph: fix for second y axis tick unit labels wrapping on the next line, Fixes #505 2014-10-18 13:31:15 -04:00
Torkel Ödegaard
cae6626b06 StatsPanel: small change to stats panel, #951 2014-10-17 10:38:15 -04:00
Torkel Ödegaard
956d93e871 StatsPanel: fine tuning colors 2014-10-17 10:36:04 -04:00
Torkel Ödegaard
7c4d1b7b01 StatsPanel: made big values template based 2014-10-16 13:44:52 -04:00
Torkel Ödegaard
9866e0851b Graph: single series tooltip and unit format change fix, Closes #946 2014-10-16 11:21:56 -04:00
Torkel Ödegaard
0a97a2435b StatsPanel: more progress 2014-10-16 11:16:20 -04:00
Torkel Ödegaard
5c80f03eae StatsPanel: small progress on stats panel 2014-10-15 18:16:04 -04:00
Torkel Ödegaard
dd03a4b011 Dashboard: fix for fullscreen mode and small gap sometimes showing the underlying dashboard 2014-10-15 17:37:08 -04:00
Torkel Ödegaard
6cd1bc32fe StatsPanel: more work on stats panel 2014-10-15 17:29:47 -04:00
Torkel Ödegaard
dd0193a9a8 Dashboard: removed wip stats panel from settings.js, accidental commit 2014-10-15 15:48:57 -04:00
Torkel Ödegaard
123faa6f8e Merge branch 'master' into valuepanel 2014-10-15 15:48:09 -04:00
Torkel Ödegaard
f743288ce0 Graph: fix for legends on the side and graph dimensions adaptation 2014-10-15 15:47:59 -04:00
Torkel Ödegaard
a1d764bd26 Merge branch 'master' into valuepanel
Conflicts:
	src/app/components/settings.js
2014-10-15 15:41:58 -04:00
Torkel Ödegaard
61f6bd2c80 Graph: added typehead dropdown menu combination for the series override selection 2014-10-15 14:13:53 -04:00
Torkel Ödegaard
fe620d8e44 Graph: fill below to series override option not automatically adds lines=false, as overrides, if you want lines just for the fill below series just remove the overrides, #940 2014-10-15 11:07:51 -04:00
Torkel Ödegaard
22db28d3e7 Graph: New series style override option 'Fill below to', useful to visualize max & min as shadow for the mean, #940 2014-10-15 10:55:46 -04:00
Torkel Ödegaard
1330488e13 Panel: plugins panels can now reside outsude the app/panels directory, added example plugin panel 2014-10-14 16:57:33 -04:00
Torkel Ödegaard
22297be3cf Merge branch 'master' into valuepanel 2014-10-13 12:30:34 -04:00
Raul Simiciuc
29d7d6994a added reset value 2014-10-13 13:43:25 +01:00
Raul Simiciuc
87e8162a2d fixed identation 2014-10-13 13:07:46 +01:00
Raul Simiciuc
38b71bf386 adding counterMax option to opentsdb 2014-10-13 12:36:26 +01:00
Torkel Ödegaard
920689b80e InfluxDB: series lookup & typeahead is now handled by influxdb list series regex queries, Closes #888 2014-10-12 12:47:50 -04:00
Torkel Ödegaard
e9c7523646 Graphite: added second optional parameter to averageSeriesWithWildcards, Closes #926 2014-10-11 06:24:44 -04:00
Torkel Ödegaard
88bbc720ca Graph: removed console logs 2014-10-11 06:08:33 -04:00
Torkel Ödegaard
1bf1469c80 Merge branch 'master' of github.com:grafana/grafana 2014-10-10 13:37:43 -04:00
Torkel Ödegaard
c74eda20dc Graph: fix for legend values min & max, avg & current when series only has null values, Closes #923 2014-10-10 13:37:33 -04:00
Torkel Ödegaard
db0a5bd537 Graph: fix for legend values min & max, avg & current when series only has null values, Closes #923 2014-10-10 10:45:34 -04:00
Torkel Ödegaard
c6cb01aa3b Graph: series tooltip length check 2014-10-10 10:05:12 -04:00
Torkel Ödegaard
7463f91878 Tech: removed jquery-ui and jquiery-ui-angular-drag-drop, replaced with native drag drop for angular, saved ~50kb in js libs, much cleaner & simpler usage, Also changed some behavior for drag drop, now panels are replaced when droped on (switch places), Closes #920 2014-10-09 20:30:23 -04:00
Mathieu Chataigner
482b31298f fixing unused var 2014-10-09 19:12:56 +02:00
Torkel Ödegaard
ce46ca2f39 Search: fixed bug introduced in recent PR #900, related to comment on #909 2014-10-09 12:31:51 -04:00
Mathieu Chataigner
de00d18a7e adding templating in opentsdb graphs 2014-10-09 16:59:29 +02:00
Torkel Ödegaard
b0cf0c558d Merge branch 'master' into valuepanel 2014-10-09 09:55:49 -04:00
Torkel Ödegaard
920e5c93e1 Graph: tooltip fix for single series tooltip and right floated value being pushed down 2014-10-08 17:00:07 -04:00
Torkel Ödegaard
0aae78c6bd Graph: fix for bars not displaying, caused by change in recent commit, added unit test so it does not happen again 2014-10-08 16:24:58 -04:00
Torkel Ödegaard
7fb048f423 Began work on experimental new stats panel 2014-10-08 11:43:51 -04:00
Torkel Ödegaard
e86207bb28 Fixed default panel title when creating new panel, tweaks to panel height calculation, Closes #910 2014-10-08 06:44:46 -04:00
Torkel Ödegaard
d7cd2b970e OAuth remake 2014-10-07 17:56:37 -04:00
Torkel Ödegaard
450d242d5f working on oauth 2014-10-07 15:54:38 -04:00
Torkel Ödegaard
2783196547 updated 2014-10-07 13:44:20 -04:00
Torkel Ödegaard
e84f06b503 more macaroon stuff 2014-10-07 11:53:25 -04:00
Torkel Ödegaard
75d60ccb69 Graphite: added perSecond function to the func def list 2014-10-07 06:40:45 -04:00
Torkel Ödegaard
9245cd6aae Merge branch 'inline_styles' of github.com:mikhailov/grafana into mikhailov-inline_styles 2014-10-07 06:32:13 -04:00
Torkel Ödegaard
d8183b60c3 Merge branch 'mikhailov-patch-1' 2014-10-07 06:31:05 -04:00
Torkel Ödegaard
a24272690d Merge branch 'patch-1' of github.com:mikhailov/grafana into mikhailov-patch-1 2014-10-07 06:30:53 -04:00
Torkel Ödegaard
40b088d6a2 Merge pull request #900 from mikhailov/patch-2
Speed search result parsing
2014-10-07 06:19:52 -04:00
Torkel Ödegaard
f1125d64de Updated default max search results to 100, #909 2014-10-07 06:17:33 -04:00
Torkel Ödegaard
0cba818364 Graph: legend and digest phase fix 2014-10-06 12:37:51 -04:00
Torkel Ödegaard
4285c751b3 Graph: fixed value formating for tooltip, need original data. flotcharts copys the data, so changes to value formats func after plot call does not affect the plot.getData() series 2014-10-06 12:17:48 -04:00
Torkel Ödegaard
1b0cddfa72 Graph: Tooltip refactoring for testability 2014-10-06 11:34:51 -04:00
Torkel Ödegaard
231a599f09 legend html markup cleanup 2014-10-06 11:34:51 -04:00
Torkel Ödegaard
7ffc4d388a Merge pull request #895 from ngmlabs/master
second parameter of groupByNode() should be 0 indexed
2014-10-06 09:50:19 -04:00
Torkel Ödegaard
1f24171238 Merge pull request #902 from toni-moreno/fix_multiple_highlight_points
Fix #901: correct positioning for multiple highlighted stacked and staircase points
2014-10-06 09:27:33 -04:00
toni-moreno
24917a6df5 correct positioning for multiple highlighted stacked and staircase points, fix to #901 2014-10-06 06:22:55 +02:00
Anatoly Mikhailov
67fde17209 Speed searching up a bit
Reuse ElasticSearch hits length via hits.total and cache it rahter than calculation length every iteration.
2014-10-05 23:24:41 +01:00
Anatoly Mikhailov
6abad666db Debounce/Throttling Searching event
New backend call to each keydown may hit the back-end performance.
500ms is reasonable delay to avoid too many requests while user is
typing a search query
2014-10-05 20:54:53 +01:00
Torkel Ödegaard
222319d924 macaron transition progress 2014-10-05 21:13:07 +02:00
mikhailov
2d3f396571 Extract repetitive CSS inline styles
Inline styles slow down rendering proportionally to containers number
2014-10-05 18:30:22 +01:00
Torkel Ödegaard
201e1d3e6d Macaron rewrite 2014-10-05 16:50:04 +02:00
Torkel Ödegaard
2c72831be1 before macaron 2014-10-05 15:34:24 +02:00
Torkel Ödegaard
a4204880e8 started work on new arch 2014-10-04 13:33:20 +02:00
George Negoita
51bcbdac75 second parameter of groupByNode() is 0 indexed 2014-10-04 02:33:36 +03:00
Torkel Ödegaard
5d120de70e Filtered logging and url query helper 2014-10-03 09:03:16 +02:00
Torkel Ödegaard
e63889d5c4 Css fix for metrics tab, help boxes did extend page height so could not scroll if they extended below screen, #891 2014-10-03 07:31:27 +02:00
Torkel Ödegaard
fe6a7c58bf Fixed issue casued by recent angular upgrade and stateful filter, casued template vars in graph titles no update properly, angular was not updated in 1.8.1 so this does affect any released version, Closes #892 2014-10-02 21:48:00 +02:00
Torkel Ödegaard
5f1b4e6183 added ldap dev docker file 2014-10-02 13:42:25 +02:00
Torkel Ödegaard
1e81f8ecfc Merge branch 'master' of github.com:torkelo/grafana-private into pro 2014-10-02 12:26:20 +02:00
Torkel Ödegaard
dac3cb15c4 Merge branch 'v1.8.x' 2014-10-02 12:17:37 +02:00
Torkel Ödegaard
ca654ccaf7 fixed stupid unit test mistake 2014-10-02 12:17:10 +02:00
Torkel Ödegaard
30512b7032 Merge fix from 'v1.8.x' branch
Conflicts:
	CHANGELOG.md
2014-10-02 12:15:21 +02:00
Torkel Ödegaard
bc8fd62cff Dashboard: fix for dashboard schema upgrade during load, ensure that annotation and templating object as a list array, Closes #890 2014-10-02 12:13:18 +02:00
Torkel Ödegaard
a9a51ee3c6 Fix to new checkboxes in features toggles tab 2014-10-02 11:54:06 +02:00
Torkel Ödegaard
28c5fc48ee updated sharePanel with width & height 2014-10-02 11:18:26 +02:00
Torkel Ödegaard
2d2da7c881 Small tweak to shared tooltip edit option in Display styles tab 2014-10-02 10:55:08 +02:00
Torkel Ödegaard
d22d8c4905 Added grafana logo to repo instead of fetching it from grafana.org, Fixes #881 2014-10-02 10:24:18 +02:00
Torkel Ödegaard
bcdc8eafa6 Updated gitter badge 2014-10-02 10:13:23 +02:00
Torkel Ödegaard
9cf6ace979 Updated gitter badge 2014-10-02 10:09:16 +02:00
Torkel Ödegaard
eef063cec2 Merge pull request #889 from gitter-badger/gitter-badge
Add a Gitter chat badge to README.md
2014-10-02 10:05:01 +02:00
The Gitter Badger
8b9bdf9054 Added Gitter badge 2014-10-02 07:59:43 +00:00
Torkel Ödegaard
05f9e5eef1 rendering 2014-10-01 21:07:58 +02:00
Torkel Ödegaard
eb28e63c08 updated 2014-10-01 20:02:42 +02:00
Torkel Ödegaard
1c7b898b01 Dashboard: show error when importing dashboard json file with broken/incorrect json syntax, Closes #878 2014-10-01 13:56:57 +02:00
Torkel Ödegaard
7ad18da08e update to test helper 2014-10-01 13:49:36 +02:00
Torkel Ödegaard
5530915b49 Updated AngularJS from 1.3-beta-17 to 1.3-RC3 2014-10-01 13:44:45 +02:00
Torkel Ödegaard
4a73e2d0e9 Solo panel and phantom rendering work 2014-10-01 13:20:30 +02:00
Torkel Ödegaard
b499bdea3b working on panel rendering 2014-10-01 11:37:04 +02:00
Torkel Ödegaard
de1de852fc worked on solo panel 2014-10-01 11:27:58 +02:00
Torkel Ödegaard
77f380c94b Graph: shared tooltip improvements, info tooltip when point counts are not the same, #850 2014-10-01 10:30:24 +02:00
Torkel Ödegaard
c34d2f91cc Merge branch 'master' of github.com:torkelo/grafana-private into pro 2014-10-01 09:47:44 +02:00
Torkel Ödegaard
ee42ea5f3b merged with master 2014-10-01 09:47:32 +02:00
Torkel Ödegaard
c79ab84fdf More fixes related to shared crosshair #880 2014-10-01 09:42:42 +02:00
Torkel Ödegaard
d77448d84e Fixed unit tests for grafanaGraph component 2014-10-01 09:10:49 +02:00
Torkel Ödegaard
8fc5a2785f Refactoring and fixes for PR #880 2014-10-01 09:08:11 +02:00
Torkel Ödegaard
27da2b026f Merge branch 'add_shared_croshair_to_dashboards' of github.com:toni-moreno/grafana into toni-moreno-add_shared_croshair_to_dashboards 2014-10-01 08:00:20 +02:00
Torkel Ödegaard
2e9cc2a74e Fix for SharePanelCtrl-specs and travis-ci timezone issue 2014-10-01 07:58:31 +02:00
toni-moreno
ffd370176d fix tooltip test expecting for stacked data 2014-10-01 07:15:20 +02:00
toni-moreno
44f2a375f6 Added shared crosshair to dashboards to track better all graphs, and little Fix for #884 2014-10-01 07:03:59 +02:00
Torkel Ödegaard
05cb97819c Updated changelog 2014-09-30 18:21:19 +02:00
Torkel Ödegaard
282c834d9f updated package.json 2014-09-30 17:58:02 +02:00
Torkel Ödegaard
4a6ff9e2aa Merge branch 'v1.8.x' 2014-09-30 17:57:30 +02:00
Torkel Ödegaard
ce972d4f19 Graph: css & scroll fix for dropdown menus in graph edit mode, Closes #855 2014-09-30 17:56:43 +02:00
Torkel Ödegaard
b250d10320 Trying to fox unit tests for sharePanelCtrl 2014-09-30 17:55:07 +02:00
Torkel Ödegaard
8a2541c220 Merge branch 'master' of github.com:torkelo/grafana-private into pro 2014-09-30 15:35:20 +02:00
Torkel Ödegaard
6991e5f3ef updated 2014-09-30 15:34:31 +02:00
Torkel Ödegaard
f63706d118 Small update to share panel 2014-09-30 15:31:18 +02:00
Torkel Ödegaard
c41aa64719 ShareModal: Added template variables to share url, and an option for it, #864 2014-09-30 15:19:48 +02:00
Torkel Ödegaard
285d246c65 PanelMenu: fixed interpolate template vars for new panel title/menu 2014-09-30 14:48:36 +02:00
Torkel Ödegaard
2c85205259 SharePanelModal: working on share feature, #864 2014-09-30 14:42:59 +02:00
Torkel Ödegaard
2d866b9298 Updated changelog with the new panel menu, Closes #770 2014-09-30 10:49:59 +02:00
Torkel Ödegaard
7a7629acf7 Panel-menu: small tweeks to css for cursor types 2014-09-30 10:43:13 +02:00
Torkel Ödegaard
debf820037 New checkbox change is complete 2014-09-30 10:27:56 +02:00
Torkel Ödegaard
f908ae8c40 added checkbox image for white theme 2014-09-30 09:50:01 +02:00
Torkel Ödegaard
022cbdda31 Merge branch 'master' into panel_edit_menu_poc 2014-09-30 09:25:19 +02:00
Torkel Ödegaard
ae2523aa59 Merge branch 'v1.8.x' 2014-09-30 09:23:07 +02:00
Torkel Ödegaard
bf361d2b02 Updated package.json version and latest.json, preparation for 1.8.1 release 2014-09-30 09:03:14 +02:00
Torkel Ödegaard
64f3303711 InfluxDB: save dashboard issue, another fix for #859 2014-09-30 09:02:25 +02:00
Torkel Ödegaard
06f382c454 Merge branch 'master' of github.com:grafana/grafana 2014-09-29 16:59:54 +02:00
Torkel Ödegaard
5f164d99ac Updated changelog with merged PR #850, shared multi series graph tooltip & crosshair 2014-09-29 16:59:17 +02:00
Torkel Ödegaard
2473ae3b47 Graph: shared multi series tooltip, refactoring PR #850 2014-09-29 16:57:05 +02:00
Torkel Ödegaard
3fb457ccd1 Merge branch 'master' into toni-moreno-add_shared_tooltips_to_graphs 2014-09-29 14:25:25 +02:00
toni-moreno
51333c9eda improved tooltip styles, add multiple highlight points, and changed highligth size when graph plotted without points. 2014-09-29 12:48:08 +02:00
Torkel Ödegaard
1aaf3961ff Merge pull request #867 from tobym/patch-1
Fix typo
2014-09-29 12:43:48 +02:00
Torkel Ödegaard
af4f3f62e9 Merged yaxis_precision branch, #877, updated changelog 2014-09-29 12:38:52 +02:00
Torkel Ödegaard
cc31a12b8c Smart decimal precision when using scaled unit format, Closes #877 2014-09-29 12:29:53 +02:00
Torkel Ödegaard
bc9989f9be replaced checkbox options with the new editor-opt-bool directive 2014-09-27 10:47:48 +02:00
toni-moreno
7f33bec71c fixing the previous fix, now working fine 2014-09-25 15:45:18 +02:00
toni-moreno
3ea94c3484 little fix when searching x index time 2014-09-25 06:35:49 +02:00
Toby Matejovsky
68adaea128 Fix typo 2014-09-24 19:01:23 -04:00
Torkel Ödegaard
4997068a0d Added directive element for the new checkboxes 2014-09-24 19:10:00 +02:00
Torkel Ödegaard
4c59ec815e work on share panel view, and better look for checkbox 2014-09-24 18:55:55 +02:00
Torkel Ödegaard
440ea666d9 more work on share panel, #864 2014-09-24 17:15:58 +02:00
Torkel Ödegaard
6f1a6d5a56 Changed name of emitAppEvent to just appEvent 2014-09-24 16:26:39 +02:00
Torkel Ödegaard
69e80fd11c working on share feature, and refactorings 2014-09-24 16:20:55 +02:00
Torkel Ödegaard
bef8cc2d70 Merge branch 'master' into panel_edit_menu_poc 2014-09-24 14:00:55 +02:00
Torkel Ödegaard
eaa899e9cf Small fix to fullscreen mode where scrolling would scroll the background dashboard & page header 2014-09-24 14:00:44 +02:00
Torkel Ödegaard
743c95d0f9 small fix to panel menu positioning 2014-09-24 12:45:03 +02:00
Torkel Ödegaard
a08cb52ad9 tweaks to new panel menu, now how top area of panel is clickable, and if no title a 5px high area can be clicked, this will enable panels without title which is something I have wanted 2014-09-24 12:41:55 +02:00
Torkel Ödegaard
b9604bf3bc Merge branch 'master' into panel_edit_menu_poc 2014-09-24 12:23:04 +02:00
Torkel Ödegaard
978a345ad8 Dashboard: When deleting dashboard show dashboard title in confirmation popup, Closes #860 2014-09-24 12:20:27 +02:00
Torkel Ödegaard
d5ffe6acef White theme: Fixes for hidden series legend text and disabled annotations color, Closes #852 2014-09-24 12:14:20 +02:00
Torkel Ödegaard
622c1a1dad small tweak to new panel edit menu 2014-09-24 11:58:02 +02:00
Torkel Ödegaard
79fea549ef Merge branch 'master' into panel_edit_menu_poc 2014-09-24 11:41:25 +02:00
Torkel Ödegaard
bce6e75cfa InfluxDB: Fix for bug when saving dashboard where title is the same as slugified url id, Fixes #859 2014-09-24 11:35:08 +02:00
Torkel Ödegaard
34f36fff5c small fix for graphite-web import 2014-09-24 11:17:34 +02:00
Torkel Ödegaard
f4e24038fe Import: Fixes to import from json file and import from graphite. Issues was lingering state from previous dashboard. Closes #840, Closes #853 2014-09-24 10:51:20 +02:00
Torkel Ödegaard
81747e1623 Annotations: Fix for annotations not reloaded when switching between 2 dashboards with annotations, Fixes #851 2014-09-24 09:03:04 +02:00
Torkel Ödegaard
d6f1c379c0 fixed text editor & scope issue 2014-09-23 22:30:01 +02:00
Torkel Ödegaard
6794260e3f Lots of progress on new panel edit menu, very tricky to get this right but think I am getting close to something that is good and will work long term 2014-09-23 22:10:10 +02:00
Torkel Ödegaard
1be840f19d More wort on panel edit menu 2014-09-23 16:11:31 +02:00
toni-moreno
f59bb6461a added shared tooltips to graphs 2014-09-23 13:51:59 +02:00
Torkel Ödegaard
bd3bae3af0 another attempt at improving panel edit menu 2014-09-23 10:52:31 +02:00
Torkel Ödegaard
0fbace7285 Row: fix for row editor and scroll pos, Fixes #846 2014-09-23 08:32:04 +02:00
Torkel Ödegaard
af8fec941c Graph: Fix for series draw order not being the same after hiding/unhiding series, Fixes #847 2014-09-23 08:18:59 +02:00
Torkel Ödegaard
139791b0d8 Merge branch 'master' into panel_edit_menu_poc 2014-09-22 18:11:52 +02:00
Torkel Ödegaard
7fe76d32d0 updated latest.json 2014-09-22 13:06:52 +02:00
Torkel Ödegaard
352ad3385a Updated changelog and package.json to new version 1.8.0 2014-09-22 12:59:21 +02:00
Torkel Ödegaard
010baad532 Dashboard: fixed init of editable setting, #837 2014-09-22 12:54:02 +02:00
Torkel Ödegaard
69d2a8f4fa style change to login page 2014-09-22 12:31:38 +02:00
Torkel Ödegaard
3bba8b2c26 Github oauth login works 2014-09-22 11:39:40 +02:00
Torkel Ödegaard
d584076b93 added github oauth sign in 2014-09-22 11:39:18 +02:00
Torkel Ödegaard
b0b77d667c added gravatar 2014-09-22 10:46:56 +02:00
Torkel Ödegaard
071ac0dc85 added gravatar 2014-09-22 10:46:38 +02:00
Torkel Ödegaard
ed8f5dbd22 Lots of progress on account management 2014-09-21 15:02:19 +02:00
Torkel Ödegaard
5dfeddf583 Lots of progress on account management 2014-09-21 15:02:06 +02:00
Torkel Ödegaard
cd9306df45 Lots of progress on account management 2014-09-21 15:01:59 +02:00
Torkel Ödegaard
e0dc530e94 Merge branch 'master' of github.com:torkelo/grafana-private into pro 2014-09-21 08:25:54 +02:00
Torkel Ödegaard
af52b20c4a Merge branch 'master' of github.com:grafana/grafana 2014-09-21 08:21:31 +02:00
Torkel Ödegaard
e82d171041 Dashboard: when opening search or dashboard settings, click the icon again will now hide the view, Closes #836 2014-09-21 08:19:41 +02:00
Torkel Ödegaard
19a35673fa updated 2014-09-20 16:55:54 +02:00
Torkel Ödegaard
639a44d996 accounts progress 2014-09-20 16:55:38 +02:00
Torkel Ödegaard
4f261389db changed placement of color selector popup 2014-09-20 16:55:02 +02:00
Torkel Ödegaard
6003fee33f Merge branch 'master' into panel_edit_menu_poc 2014-09-20 13:37:02 +02:00
Torkel Ödegaard
b56c3eb035 Changed color for warning alert 2014-09-20 13:32:26 +02:00
Torkel Ödegaard
015c929bd7 more account stuff 2014-09-20 13:24:06 +02:00
Torkel Ödegaard
992efda7f6 Account stuff 2014-09-20 12:14:19 +02:00
Torkel Ödegaard
32036d017e Account stuff 2014-09-20 12:14:03 +02:00
Torkel Ödegaard
40ff57d8c4 Account stuff 2014-09-20 12:13:46 +02:00
Torkel Ödegaard
cdabe50320 Merge branch 'master' of github.com:torkelo/grafana-pro
Conflicts:
	grafana
2014-09-20 08:58:17 +02:00
Torkel Ödegaard
c62ee78cba Merge branch 'pro' of github.com:torkelo/grafana-private into pro
Conflicts:
	src/css/less/grafana.less
	src/test/test-main.js
2014-09-20 08:57:40 +02:00
Torkel Ödegaard
a19a2c70ab Fixed spelling in config.sample.js 2014-09-20 08:33:16 +02:00
Torkel Ödegaard
40a491a80b Annotations: Elasticsearch annotation and field mapping fixes, small changes for PR #830 2014-09-20 08:30:59 +02:00
Torkel Ödegaard
a9a06ad51d Working on collaborators 2014-09-19 17:37:18 +02:00
Torkel Ödegaard
c65b7d1591 updated 2014-09-19 17:36:52 +02:00
Torkel Ödegaard
c287405471 Merge branch 'master' of github.com:torkelo/grafana-private into pro 2014-09-19 17:16:34 +02:00
Gregory Becker
06ec91c899 Give maximum width & height constraint to tooltip boxes
Extreme values that go beyond the screen resolution are very likely to be misplaced. This is a simple workaround. A better solution would be to improve the code placing the tooltip and make it handle tooltips containing more content than they can safely display.
2014-09-19 14:16:53 +01:00
Gregory Becker
10f9022d7c Support fields from nested objects pulled from Elasticsearch 2014-09-19 14:11:09 +01:00
Torkel Ödegaard
e78c48620f Trying to improve yaxis precision 2014-09-19 13:24:15 +02:00
Torkel Ödegaard
563dd898c1 Graph: fix for downscaling y-axis format, never downscale when value is zero, Fixes #826 2014-09-19 12:16:00 +02:00
Torkel Ödegaard
a97bcc3ca7 Elasticsearch: fix for issue when saving dashboard with title equal to slugified url, would cause the backward compatible fix to delete it, Closes #828 2014-09-19 10:37:43 +02:00
Torkel Ödegaard
fa31fc046e Merge pull request #823 from beevee/elasticsearch_basic_auth
enable withCredentials in elasticsearch basic auth
2014-09-18 15:54:58 +02:00
Torkel Ödegaard
a68a179c1e Small improvements to dashboard alerts, less intrusive, do not push down page anymore, Closes #822 2014-09-18 15:07:49 +02:00
Alexey Kirpichnikov
77b0d36b55 enable withCredentials in elasticsearch basic auth 2014-09-18 17:50:59 +06:00
Torkel Ödegaard
1705734435 updated 2014-09-18 12:04:22 +02:00
Torkel Ödegaard
e5fd35db34 small progress on adding collaborators 2014-09-18 12:04:03 +02:00
Torkel Ödegaard
158b708eac Small progress on adding collaborator 2014-09-18 12:03:46 +02:00
Torkel Ödegaard
aa47eeffb2 added default default support 2014-09-18 10:16:25 +02:00
Torkel Ödegaard
df00ac736f Merge branch 'master' of github.com:torkelo/grafana-private into pro 2014-09-18 09:38:32 +02:00
Torkel Ödegaard
f2a6fc4d5a Merge pull request #808 from lento/multiple-stacks
add override options to allow multiple stacks
2014-09-18 09:36:48 +02:00
Torkel Ödegaard
c9501d1119 Merge pull request #820 from jozog/master
Handle 'group' graphite method
2014-09-18 09:35:37 +02:00
Torkel Ödegaard
323ff3d491 Merge pull request #821 from linkslice/master
Update playlist.html
2014-09-18 09:35:13 +02:00
Bryan Irvine
98b3126e32 Update playlist.html 2014-09-17 11:04:06 -07:00
Julien Ozog
88ea524f44 Handle 'group' graphite method 2014-09-17 17:12:43 +02:00
Torkel Ödegaard
a0ab9113fc Graph: added percent y-axis format, Closes #818 2014-09-17 15:39:45 +02:00
Torkel Ödegaard
31398718e5 Workin on login user state 2014-09-17 15:25:19 +02:00
Torkel Ödegaard
4dfe8b6f69 Working on login user name state 2014-09-17 15:25:07 +02:00
Torkel Ödegaard
6dae8f44b9 Small fix for favicon 2014-09-17 13:58:32 +02:00
Torkel Ödegaard
4f798cfe56 Merge branch 'master' of github.com:torkelo/grafana-private into pro 2014-09-17 13:35:19 +02:00
Torkel Ödegaard
d8ea970f18 Added support for delete dashboard 2014-09-17 13:35:01 +02:00
Torkel Ödegaard
ecafc7bf8f Added support for delete dashboard 2014-09-17 13:34:42 +02:00
Torkel Ödegaard
bba3f3000f Search: remove dashboard from search result after dashboard deletion, Closes #753 2014-09-17 13:00:35 +02:00
Torkel Ödegaard
4b382e0faf Merge branch 'master' of github.com:torkelo/grafana-private into pro
Conflicts:
	src/css/less/grafana.less
	src/test/test-main.js
2014-09-17 09:54:40 +02:00
Torkel Ödegaard
2380a26987 updated 2014-09-17 09:49:28 +02:00
Torkel Ödegaard
d40e21a7e0 Chrome: Fix for display issue in chrome beta & chrome canary when entering edit mode, Closes #795 2014-09-17 09:29:51 +02:00
Torkel Ödegaard
94d2ae2a6a Merge branch 'master' of github.com:grafana/grafana 2014-09-17 09:06:37 +02:00
Torkel Ödegaard
3099198e47 Fixed default dashboard grafana logo when using https 2014-09-17 09:03:34 +02:00
Torkel Ödegaard
48e9b5f4be Merge pull request #810 from marcusoftnet/“AddingFavIcon”
Added a favicon. This will resolve issue #796
2014-09-16 13:38:32 +02:00
Torkel Ödegaard
430e2e439b Small fix to schemaUpgrade, Closes #807 2014-09-16 13:32:27 +02:00
Torkel Ödegaard
81a21c03b2 Merge branch 'favicon' 2014-09-16 13:20:42 +02:00
Torkel Odegaard
064a97e734 added favicon, Closes #796 2014-09-16 13:19:52 +02:00
Marcus Hammarberg
5e9ed95684 Added a favicon. This will resolve issue #796 2014-09-16 17:45:43 +07:00
Torkel Ödegaard
017d5617a5 Merge pull request #809 from alxrem/master
fix typos
2014-09-16 11:12:48 +02:00
Alexey Remizov
26bb2e0193 fix typos 2014-09-16 13:08:28 +04:00
Torkel Odegaard
ff91430fcc added favicons 2014-09-16 08:01:18 +02:00
Lorenzo Pierfederici
32a41a8422 add override options to allow multiple stacks 2014-09-15 18:12:20 -07:00
Torkel Ödegaard
8b93e20a0b Merge pull request #806 from starshayayord/master
Disable annoying Google Translate plugin
2014-09-15 19:15:57 +02:00
starshayayord
92bec31ccb Update index.html
disable google translate plugin
2014-09-15 18:51:58 +06:00
Torkel Ödegaard
f133a9de79 Merge branch 'master' of github.com:torkelo/grafana-pro
Conflicts:
	grafana
2014-09-13 18:36:40 +02:00
Torkel Ödegaard
9b2476451e Merge branch 'pro' of github.com:torkelo/grafana-private into pro
Conflicts:
	src/test/test-main.js
2014-09-13 18:36:17 +02:00
Torkel Ödegaard
b876d193c4 updated 2014-09-13 18:33:52 +02:00
Torkel Ödegaard
3944c37627 patches from master 2014-09-13 18:33:35 +02:00
Torkel Ödegaard
14080d1531 Merge remote-tracking branch 'origin/master' into pro
Conflicts:
	src/css/less/grafana.less
	src/test/test-main.js
2014-09-13 18:10:14 +02:00
Torkel Ödegaard
96a0d0aefa fixed changelog 2014-09-13 16:38:01 +02:00
Torkel Ödegaard
15f2b2cf9a Annotations: fixed InfluxDB annotation query, added unit test for annotation query, Fixes #802 2014-09-13 16:19:33 +02:00
Torkel Ödegaard
bf9eaea334 Updated lastest.json 2014-09-12 13:19:17 +02:00
Torkel Ödegaard
7b45a2ec51 Small fix to scripted async dashboard example 2014-09-12 13:15:06 +02:00
Torkel Ödegaard
48eb2083f2 Fix for graphite query letter assignment 2014-09-11 17:25:59 +02:00
Torkel Ödegaard
2c6ea276c1 Fixed small bug in graphite target controller when having variable for single parameter function 2014-09-11 17:19:39 +02:00
Torkel Ödegaard
5a3db0505f Small fix to elasticsearch save error handling 2014-09-11 16:00:59 +02:00
Torkel Ödegaard
6ca73f6df0 Do not render graph when width is zero, avoids plot errors 2014-09-11 14:25:20 +02:00
Torkel Ödegaard
762dab618a Small change to datasourceSrv, if datasource is not found, return default datasource 2014-09-11 14:07:27 +02:00
Torkel Ödegaard
a65c61442e minifix for spacing of question sign tooltips when html is minified 2014-09-11 14:01:37 +02:00
Torkel Ödegaard
4883b2a296 Fixed issue with using template variables in panel titles, and text panel, when selecting All option in variable 2014-09-11 13:54:59 +02:00
Torkel Ödegaard
b1abe72ab6 small update to text panel editor 2014-09-11 11:34:32 +02:00
Torkel Ödegaard
a640d55297 Added informatio & help blocks to graphite metric editor 2014-09-11 09:27:49 +02:00
Torkel Ödegaard
99009a11ed Graphite: added divideSeries function, #177 2014-09-11 08:03:00 +02:00
Torkel Ödegaard
2150bbf191 removed console.log from templateValuesSrv 2014-09-10 13:35:54 +02:00
Torkel Ödegaard
6f8cb743b5 Fixed default welcome to grafana dashboard, rows were not marked as editable 2014-09-10 11:53:58 +02:00
Torkel Ödegaard
682d2a1675 Dashboard: time range can now be read from URL parameters, will override dashboard saved time range, Closes #787, Closes #761 2014-09-10 10:46:04 +02:00
Torkel Ödegaard
6022784e42 InfluxDB: support for basic authorization (PR #782) 2014-09-10 09:08:25 +02:00
Torkel Ödegaard
4d4478d969 Added PR #785 to changelog 2014-09-10 09:07:14 +02:00
Ed Dawley
c0935c84ee Fixing some grunt errors with the elasticsearch grammar changes 2014-09-09 15:54:05 -04:00
Ed Dawley
17e040abe4 The elasticsearch datasource will now better handle language specifics when making the search partial (ie for search as you type). This means the search field will now support significantly more complex searches such as:
title:foo AND title:bar OR baz
    title:mysql AND [3306 TO 3308]
    web~
    title:foo AND -bar
2014-09-09 15:17:13 -04:00
Ed Dawley
6152a5e3c2 Adding in global search id counter so that async search responses can be discarded if a newer search is being processed. This prevents older search results from clobbering a newer search that happened to complete faster. 2014-09-09 15:16:47 -04:00
Daniel Shir
4558486cbd Added basic authorization for influxdb if needed 2014-09-09 15:23:40 +03:00
Torkel Ödegaard
3df592c702 Dashboard: elasticsearch dashboard storage now slugifies urls, #781 2014-09-09 13:42:46 +02:00
Torkel Ödegaard
05fabc73c2 Dashboard: elasticsearch dashboard storage now slugifies urls, #781 2014-09-09 13:04:07 +02:00
Torkel Ödegaard
e949761107 Made unsaved changes service ignore template variable options and selection changes 2014-09-09 11:40:37 +02:00
Torkel Ödegaard
4311a20c5f Fixed issue with editing text panel, removed a function from dashboard controller that I though was not used, turned out it was 2014-09-09 11:35:29 +02:00
Torkel Ödegaard
1440d1a147 Fix when changing templated vars, should update child template vars All value 2014-09-09 11:30:00 +02:00
Torkel Ödegaard
4b170ca9a3 Corrected error handling for influxdb datasource when loading/deleting dashboard 2014-09-09 11:14:57 +02:00
Torkel Ödegaard
d6e844c67c Fixes for opentsdb, (broken during 1.8 development) 2014-09-09 10:29:59 +02:00
Torkel Ödegaard
71a307270a Fixed text color in json text area for white theme, #735 2014-09-09 09:16:00 +02:00
Torkel Ödegaard
0f88b470e8 Fix for elasticsearch annotations when timestamp is a field and not in source, Fixes #777 2014-09-09 08:50:01 +02:00
Torkel Ödegaard
4798aa4789 Fixes to requirejs build task to include all modules, Fixes #779 2014-09-09 08:24:04 +02:00
Torkel Ödegaard
a9d96ccc8c Fixed ids for panels in default.json welcome to grafana dashboard 2014-09-08 18:03:10 +02:00
Torkel Ödegaard
e0c9ddbfba Worked on variable initilization and sync to from url, #772 2014-09-08 11:03:14 +02:00
Torkel Ödegaard
bbc5dae1d2 Working on better handling of variables and url init and state 2014-09-07 11:55:26 +02:00
Torkel Ödegaard
9e7c55728f small cleanup of unused code 2014-09-06 18:05:54 +02:00
Torkel Ödegaard
a6fa01f89b POC of panel edit menu 2014-09-06 14:05:07 +02:00
Torkel Ödegaard
6c71754e51 Changed template variable typeahead/autocomplete list limit from 10 to 1000, Fixes #767, Fixes #768 2014-09-06 10:12:28 +02:00
Torkel Ödegaard
e729b3734d Fix for selecting template variable value from typeahead using enter key, Closes #765 2014-09-06 10:05:58 +02:00
Torkel Ödegaard
6337c77532 Rename of edit label on graph panel 2014-09-06 09:49:21 +02:00
Torkel Ödegaard
fb08b71884 Small fix to graphite target controller to still revert to text box for expressions with multiple series that do not use a series reference 2014-09-05 17:44:54 +02:00
Torkel Ödegaard
d749549135 Templating: Full support for InfluxDB, filter by part of series names, extract series substrings, nested queries, multipe where clauses! Closes #613 2014-09-05 15:46:29 +02:00
Torkel Ödegaard
58a2ab4fbd Templating: Can now use template variables in panel titles, Closes #312 2014-09-05 15:17:19 +02:00
Torkel Ödegaard
cc96cfe0c7 Templating: Ability to use template variables for function parameters via custom variable type, can be used as parameter for movingAverage or scaleToSeconds for example, Closes #262 2014-09-05 14:03:36 +02:00
Torkel Ödegaard
656b3e53a8 Templating: Interval variable type for time intervals summarize/group by parameter, included auto option, and auto step counts option.
Closes #243
2014-09-05 13:31:34 +02:00
Torkel Ödegaard
4e5dcafa1b working on auto interval template variable support 2014-09-05 12:07:48 +02:00
Torkel Ödegaard
afc8380f23 Work on getting template variables to work well with functions that take integers, #262 2014-09-05 09:11:50 +02:00
Torkel Ödegaard
0319051891 Extend template variable syntax to include , Closes #760 2014-09-05 08:26:50 +02:00
Torkel Ödegaard
4805a3bc23 Merge remote-tracking branch 'oss/template_variable_syntax' 2014-09-05 07:06:00 +02:00
Torkel Ödegaard
dc63f0ddd0 Fixed so white theme looks good with new search and editor panes, Closes #735, and other small fixes and polish 2014-09-05 07:02:59 +02:00
Torkel Ödegaard
6ff188e4d9 test for adding syntax in addition to [[variable]] 2014-09-04 17:34:36 +02:00
Torkel Ödegaard
44edaad19d Fixed scroll issue with firefox, Fixes #754 2014-09-04 15:25:59 +02:00
Torkel Ödegaard
5304221e46 fixed spelling in changelog concerning InfluxDB breaking changes 2014-09-04 15:09:07 +02:00
Torkel Ödegaard
c6b1fe5349 updated change log with info about InfluxDB breaking changes, and fixes for stacked series and missing values, Fixes #534, Closes #743, Fixes #673,Fixes #674, Closes #756 2014-09-04 14:57:50 +02:00
Torkel Ödegaard
80574334cf Changed variable replacement works for InfluxDB, now , and 2014-09-04 14:41:27 +02:00
Torkel Ödegaard
dd4eaa0758 fixes to target segment markup 2014-09-04 14:17:05 +02:00
Torkel Ödegaard
93550e9ea5 Work on fixing stacking issues with InfluxdB, added fill(0) and fill(null) option to InfluxDB query editor, also a panel wide group by time option that supports setting a low limit, Fixes issues #673, #674, #534, #743 2014-09-04 14:08:31 +02:00
Torkel Ödegaard
3157fc651d Fixed dashboard import view, did not hide search results 2014-09-04 09:58:08 +02:00
Torkel Ödegaard
dd4f27e3fa Fixed issue where a metric request error would set panel error flag, which would cause unsaved changes service to detect change, and prompt the unsaved changes warning. The panel error state is now moved to the panelMeta object that is not part of the dashboard / panel model, Closes #745 2014-09-04 09:44:42 +02:00
Torkel Ödegaard
455e80513b Fixes delete link in search result, broken after recent changes to search results, Closes #749 2014-09-04 08:56:50 +02:00
Torkel Ödegaard
65af872ec6 Small fix to graphiteDatasource and sending cacheTimeout undefined, reintroduced this bug yesterday, added unit test so it should not appear again 2014-09-03 16:48:48 +02:00
Torkel Ödegaard
917cd35005 Dashboard: View dashboard json, edit/update any panel using json editor, makes it possible to quickly copy a graph from one dashboard to another.
Closes #304
2014-09-03 11:15:44 +02:00
Torkel Ödegaard
b989183fce Removed collapse row button, added to row menu, made small change to text pannel to allow smaller height, Closes #727 2014-09-03 09:52:36 +02:00
Torkel Ödegaard
0845d5d451 Removed configure row button when row is collapsed 2014-09-03 09:33:32 +02:00
Torkel Ödegaard
f002ef105e Small fix to influxdb query builder, should update raw query after building query 2014-09-03 09:20:39 +02:00
Torkel Ödegaard
3d202c2ef9 Fixed small issue where dashboard search did not work after loading dashboard and it does not exist, now shows a valid dashboard 2014-09-03 09:12:59 +02:00
Torkel Ödegaard
953eec7326 Fixes and polish for the graphite query editor, #117 2014-09-03 08:53:08 +02:00
Torkel Ödegaard
c3956b4d6f fixed jshint warning 2014-09-03 07:58:00 +02:00
Torkel Ödegaard
d2421bb216 Added better match when using graphite function autocomplete, hit tab key and the first match will be used, you no longer need to use the down arrow to select the typeahead match you want, just hit tab key 2014-09-03 07:41:43 +02:00
Torkel Ödegaard
afdc19ce9d Updated sumSeries, averageSeries to support other series reference arguments, #117 2014-09-03 07:35:14 +02:00
Torkel Ödegaard
4a9380cc95 added limit checks to up/down arrow key selection of search results 2014-09-03 07:24:28 +02:00
Torkel Ödegaard
9f60745e57 Graphite: Graphite query builder can now handle functions that multiple series as arguments! #117 2014-09-02 20:59:54 +02:00
Torkel Ödegaard
666d640216 Graphite: Metric node/segment selection is now a textbox with autocomplete dropdown, allow for custom glob expression for single node segment without enter text editor mode, Closes #281 2014-09-02 12:55:45 +02:00
Torkel Ödegaard
cb479d737b Graphite: Fix for nonNegativeDerivative function, now possible to not include optional first parameter maxValue, Closes #702 2014-09-02 07:58:29 +02:00
Torkel Ödegaard
4ee455fad2 Fixed failing influxdb query builder unit test 2014-09-02 07:21:41 +02:00
Torkel Ödegaard
2da04e72f5 More progress on influxdb query editor, templating, refactoring, unit tests, #740, #507, #586 2014-09-02 07:05:36 +02:00
Torkel Ödegaard
141ea7ba91 More work InfluxDB templated queries and required changes to editor and datasource 2014-09-01 16:55:54 +02:00
Torkel Ödegaard
5ae0239c26 small UI changes to InfluxDB query editor, made each query two lines to give more space to series name 2014-09-01 13:40:34 +02:00
Torkel Ödegaard
2dc4434a49 Progress on influxdb and templated queries/variables, #613 2014-09-01 11:13:18 +02:00
Torkel Ödegaard
39c068bd53 Graph: Fix for tooltip current value decimal precision when 'none' axis format was selected, Closes #733 2014-08-29 12:54:42 +02:00
Torkel Ödegaard
b26dfd8246 Updated changelog with progress on filtering/template overhaul, and UI change 2014-08-29 12:45:58 +02:00
Torkel Ödegaard
3185db9609 new template system is starting to work 100%, not all features are in, like regex selection, influxdb support, and other stuff 2014-08-29 12:34:04 +02:00
Torkel Ödegaard
61a618e473 fixes to templating 2014-08-29 10:17:00 +02:00
Torkel Ödegaard
c4a4ecfc81 Merge branch 'master' into filtering_overhaul
Conflicts:
	src/app/controllers/dashboardNavCtrl.js
2014-08-29 10:04:30 +02:00
Torkel Ödegaard
f9b0ce0f75 Fixes to annotations editor 2014-08-29 09:59:18 +02:00
Torkel Ödegaard
20607c00b1 Fixed playlist pane not showing after modal removal change 2014-08-29 08:44:38 +02:00
Torkel Ödegaard
12e2bf2f85 Trying to restore broken features and some polishing 2014-08-28 16:44:16 +02:00
Torkel Ödegaard
685a2fec6c trying to get new templating / filtering to work 2014-08-28 16:03:13 +02:00
Torkel Ödegaard
f9cd4a4470 More work on templating, added an embry of a dashboard json edit view 2014-08-28 12:44:01 +02:00
Torkel Ödegaard
b761aad903 More work on filter/templating overhaul 2014-08-27 21:47:41 +02:00
Torkel Ödegaard
9ee4fcb36c continued large refactoring of filterSrv, timeSrv and templating 2014-08-27 17:58:49 +02:00
Torkel Ödegaard
1929490deb Renamed filterSrv to timeSrv and made it a service again 2014-08-27 16:29:48 +02:00
Torkel Ödegaard
bb3b31829f Progress on template editor & new templating features 2014-08-27 15:54:30 +02:00
Torkel Ödegaard
e0a58dd1fe More work on template editor 2014-08-27 10:41:27 +02:00
Torkel Ödegaard
7d6e04ac77 Small fixes to dasheditor and firefox fixes for search 2014-08-27 09:01:50 +02:00
Torkel Ödegaard
6502cff8fe Moved search results from fixed dropdown to edit pane 2014-08-26 16:42:15 +02:00
Torkel Ödegaard
fdffb03eba Css polish and tweaks 2014-08-26 15:02:25 +02:00
Torkel Ödegaard
d4d3ae7530 Dashboard: Fix for zoom out causing right hand to range to be set in the future. Closes #724 2014-08-26 14:42:32 +02:00
Torkel Ödegaard
647feb7b33 Progress on new filter/templating editor 2014-08-26 14:17:46 +02:00
Torkel Ödegaard
625781c7f4 Merge branch 'master' into filtering_overhaul 2014-08-26 11:18:30 +02:00
Torkel Ödegaard
02ef6c4e07 Merge branch 'master' of github.com:grafana/grafana 2014-08-26 11:18:08 +02:00
Torkel Ödegaard
43eba6cc31 Dashboard: fix for hideControls setting not used/initlaized on dashboard load, Closes #723 2014-08-26 11:17:56 +02:00
Torkel Ödegaard
3775991ac8 Modals to edit pane work almost done, need to work on light theme 2014-08-26 11:12:26 +02:00
Torkel Ödegaard
08d2492839 tweaks to edit & tabs look, removed add row from dasheditor 2014-08-26 10:49:09 +02:00
Torkel Ödegaard
d0d0e8349f moved custom timepicker from modal to edit pane 2014-08-26 10:16:21 +02:00
Torkel Ödegaard
1a97f79d54 changed playlist modal to edit pane 2014-08-26 09:46:15 +02:00
Torkel Ödegaard
9fc6c4888f converting more modals to edit panels 2014-08-26 09:32:30 +02:00
Torkel Ödegaard
f2de18508a More work on removing modals 2014-08-26 07:27:43 +02:00
Torkel Ödegaard
6342571afe Trying get rid of modals, new better design for dashboard settings and modals 2014-08-25 22:39:40 +02:00
Torkel Ödegaard
00e5bb61fc Trying out an alternative to modals 2014-08-25 17:27:19 +02:00
Torkel Ödegaard
b506e7c267 fixed submenu in fullscreen mode 2014-08-25 16:44:33 +02:00
Torkel Ödegaard
061d1262d4 Small html markup/css simplification 2014-08-25 16:14:47 +02:00
Torkel Ödegaard
8b3c89e267 Starting work on new templating editor 2014-08-25 15:55:42 +02:00
Torkel Ödegaard
c634ee81fc Refactoring the pulldown (filtering/annotations), changing the ui slightly 2014-08-25 15:36:44 +02:00
Torkel Ödegaard
6969a4121c removing pulldowns and simplifying submenu controls code 2014-08-25 13:31:31 +02:00
Torkel Ödegaard
4f8b2ad245 began work on filtering overhaul 2014-08-25 12:55:42 +02:00
Torkel Ödegaard
03353cb652 Merge branch 'famousgarkin-master' 2014-08-24 14:46:50 +02:00
Torkel Ödegaard
6f80862517 Dashboard: new config.js option to change/remove window title prefix from 'Grafana -' to anything, PR #685 2014-08-24 14:46:13 +02:00
Torkel Ödegaard
edd8d63caf Merge branch 'master' of github.com:famousgarkin/grafana into famousgarkin-master 2014-08-24 14:29:35 +02:00
Torkel Ödegaard
ffbdea78ee Fix for plot dimension error when resizing window 2014-08-23 20:23:33 +02:00
Torkel Ödegaard
47a20e6a2f Dashboard: fix for adding rows from dashboard settings modal, Closes #699 2014-08-23 10:45:07 +02:00
Torkel Ödegaard
c00384ad06 work on account registration 2014-08-22 18:05:51 +02:00
Torkel Ödegaard
31fe471da5 working on account registration and more 2014-08-22 18:05:37 +02:00
Torkel Ödegaard
c684b1ddab dashboard load/save work and began work on register 2014-08-22 15:32:42 +02:00
Torkel Ödegaard
477f66f56b dashobard load/save work, and began register view 2014-08-22 15:32:20 +02:00
Torkel Ödegaard
359bca0634 save/load dashboard update 2014-08-22 13:25:22 +02:00
Torkel Ödegaard
8a80623d0c Merged dashboard tag colors feature branch, updated changelog #634 2014-08-22 09:40:11 +02:00
Torkel Ödegaard
adbe8142b6 Merge branch 'dashboard_tag_colors' 2014-08-22 09:34:19 +02:00
Torkel Ödegaard
3579a18da8 Css fix for panel-error position 2014-08-22 09:34:05 +02:00
Torkel Ödegaard
36882ea2a4 More work on dashboard tag colors 2014-08-22 09:04:28 +02:00
Torkel Ödegaard
3fec2cdfd6 Merge branch 'master' into dashboard_tag_colors 2014-08-22 07:14:19 +02:00
Torkel Ödegaard
07d8b542bf working on rethinkdb stuff 2014-08-21 22:09:48 +02:00
Torkel Ödegaard
06de80f2a7 updated 2014-08-21 22:09:26 +02:00
Torkel Ödegaard
ef351bb9a3 Merge branch 'master' of github.com:torkelo/grafana-private into pro 2014-08-21 22:01:32 +02:00
Torkel Ödegaard
28de5cbd97 Merge branch 'master' of github.com:grafana/grafana 2014-08-21 21:59:36 +02:00
Torkel Ödegaard
39cdf85788 small refactoring for search result and dashboard id/title handling 2014-08-21 21:59:23 +02:00
Torkel Ödegaard
37e19cee20 fixed jshint error 2014-08-21 11:18:49 +02:00
Torkel Ödegaard
b39fbff8fa Merge remote-tracking branch 'origin/pro' into pro
Conflicts:
	src/test/test-main.js
2014-08-21 11:17:44 +02:00
Torkel Ödegaard
5ff15f27b7 Merge 2014-08-21 11:16:22 +02:00
Torkel Ödegaard
baf99e8650 Merge branch 'master' of github.com:torkelo/grafana-private into pro
Conflicts:
	src/test/test-main.js
2014-08-21 11:16:08 +02:00
Torkel Odegaard
7c3046e011 Fix for reloadOnSearch missing on all dashboard routes, caused dashboard to be reloaded when entering/exiting edit mode (settings were lost), related to recent fullscreen/edit state present in url, #672, #425 2014-08-21 10:36:18 +02:00
Torkel Ödegaard
1bc8526640 Reverted change, default edit tab should be metrics tab 2014-08-21 09:29:56 +02:00
Torkel Ödegaard
0795af8d42 Fix for search result list and double link to dashboard that caused navigation start recursion when unsaved changed dialog was displayed 2014-08-21 09:28:51 +02:00
Torkel Ödegaard
bd7c045b1c Small fix for dashboard settings dialog controls tab was empty 2014-08-21 09:01:04 +02:00
Torkel Ödegaard
c6812f569f Small js warning fix for firefox 2014-08-21 08:42:09 +02:00
Torkel Ödegaard
17ffb167e2 Small fixes for firefox 2014-08-20 22:34:51 +02:00
Torkel Ödegaard
019d077f5a Added missing max-height to search results container 2014-08-20 19:56:32 +02:00
Torkel Ödegaard
c000f438ae added unit tests for grid thresholds 2014-08-20 15:03:10 +02:00
Torkel Ödegaard
c0d7ddf1fb Updated changelog with new display styles per series option feature, Closes #425, Closes #700 2014-08-20 12:11:14 +02:00
Torkel Ödegaard
5bf794e24e Merge branch 'series_style_overrides' 2014-08-20 11:48:13 +02:00
Torkel Ödegaard
a9cfb160c9 Added typeahead to series overrides, #425 2014-08-20 11:48:00 +02:00
Torkel Ödegaard
468c9a9061 Fix for zindex override removal, should restore series order 2014-08-20 11:31:40 +02:00
Torkel Ödegaard
da1279aa5b Added zindex per series override option, #425 2014-08-20 10:50:26 +02:00
Torkel Ödegaard
3ec053bea7 Moved series override code to TimeSeries 2014-08-20 10:27:30 +02:00
Torkel Ödegaard
b2f9f81eaf Moved yaxis override from aliasYAxis map to the new seriesOverride array 2014-08-20 09:31:22 +02:00
Torkel Ödegaard
939e957fda Made regex match work for per series overrides, #425, #700 2014-08-20 08:35:17 +02:00
Torkel Ödegaard
062fe72030 More options can now be set on pre series basis, this is awesome! 2014-08-19 17:24:37 +02:00
Torkel Ödegaard
cdcbb872d5 options per series is starting to work nicely 2014-08-19 16:57:33 +02:00
Torkel Ödegaard
048763053c Began work on applying per series options to flot options 2014-08-19 16:22:27 +02:00
Torkel Ödegaard
c6489d9b01 Lots of progress on per series overrides 2014-08-19 15:22:03 +02:00
Torkel Ödegaard
299053f2d5 Fix for utc in timepicker, Closes #713 2014-08-19 11:12:48 +02:00
Torkel Ödegaard
937ac84538 Began work on per series style overrides, #425 2014-08-18 21:48:01 +02:00
Torkel Ödegaard
5c0d1355a5 Second take on dashboard tags search result colors 2014-08-18 19:33:38 +02:00
Torkel Ödegaard
a64604de6b UI improvements to search result list (larger click are for dashboard title link, plus UI look polish), Closes #709 2014-08-18 16:38:04 +02:00
Torkel Ödegaard
1a3dac0c17 Fix for timepicker dates and tooltip when UTC timzone is selected,
custom date modal is still local time, Closes #277
2014-08-18 13:43:26 +02:00
Torkel Ödegaard
ffd73e8bfb Fix for graphite queries with glob syntax ([1-9] and ?) that made
the graphite parser / query editor bail and fallback to text edit mode.
2014-08-18 12:17:48 +02:00
Torkel Ödegaard
27c536b1a1 Small fix to 'none' axis formats and zero value when axis tickDecimals is high, Closes #707 2014-08-18 09:03:25 +02:00
Torkel Ödegaard
631c7adf12 updated 2014-08-17 12:26:00 +02:00
Torkel Ödegaard
d8dca20332 updated 2014-08-17 12:25:37 +02:00
Torkel Ödegaard
dc5973a0f3 small css fix for alignment of legend values when shown in table style 2014-08-17 11:53:58 +02:00
Torkel Ödegaard
efed13b9fe Work on login and sidemenu 2014-08-16 21:54:26 +02:00
Torkel Ödegaard
34ab1e529b Lots of work on the side menu 2014-08-16 21:54:05 +02:00
Torkel Ödegaard
b812b1c579 Fixed link to playlist docs in readme.md 2014-08-16 19:02:50 +02:00
Torkel Ödegaard
c892d9d6f6 Merge remote-tracking branch 'origin/master' into pro 2014-08-16 13:15:02 +02:00
Torkel Ödegaard
b89480a284 refactored use of localStorage 2014-08-16 13:13:26 +02:00
Torkel Ödegaard
9951c3825e began work on pro side menu 2014-08-16 10:14:31 +02:00
Torkel Ödegaard
9ac1f6b26b Merge remote-tracking branch 'origin/move_stuff' into pro 2014-08-16 08:56:19 +02:00
Torkel Ödegaard
dac4954215 merged with oss 2014-08-16 08:56:02 +02:00
Torkel Ödegaard
5846c71095 Changed name of some partials and controllers 2014-08-16 08:55:14 +02:00
Torkel Ödegaard
142f081d1e fixed small issue with the recent change to the 'none' axis format,
Closes #703
2014-08-15 21:31:53 +02:00
Torkel Ödegaard
ec2b4f584c some initial work on making it easy to add a custom datasource without modifing the original source, #701, #553 2014-08-15 19:12:25 +02:00
Torkel Ödegaard
88d991ef45 Another angular binding/watcher optimization 2014-08-15 17:23:27 +02:00
Torkel Ödegaard
dc382a6df7 Drag drop binding expression watcher was expensive, removed watcher after first eval, seems to still work 2014-08-15 13:35:17 +02:00
Torkel Ödegaard
c6e57d64d7 moved binding expression for panel width to directive 2014-08-15 13:19:11 +02:00
Torkel Ödegaard
dc3cd430c8 moved binding expression in panels to directive and watchGroup 2014-08-15 12:57:12 +02:00
Torkel Ödegaard
9848600335 Changed panel error icon from ng-show to ng-if 2014-08-15 12:09:04 +02:00
Torkel Ödegaard
cd79b73cb0 moved an expensive binding expression into a directive and a groupWatch 2014-08-15 11:15:24 +02:00
Torkel Ödegaard
21aa1b43fd Save dropdown and search bindings and scope is now not loaded on dashboard load, small performance improvement 2014-08-15 09:35:07 +02:00
Torkel Ödegaard
2f3a96f7a7 Removed add-panel tab from row editor, only add panels from the row menu now, do not want to ways to do the same thing 2014-08-15 08:46:32 +02:00
Torkel Ödegaard
b761dcde45 Switch from watch to watchCollection for bodyclass directive 2014-08-15 08:14:15 +02:00
Torkel Ödegaard
b6cdb0f885 Moved some expensive bindings from timepicker to controller 2014-08-15 08:02:16 +02:00
Torkel Ödegaard
472969ae2a Merge branch 'master' of github.com:grafana/grafana 2014-08-14 22:32:17 +02:00
Torkel Ödegaard
9e3514a993 More small performance tweaks, trying to clean up watcher & scope counts 2014-08-14 22:30:19 +02:00
Torkel Ödegaard
aee3ddd06a Simplified panel bootstrapping, limiting digest cycles during dashboard boot 2014-08-14 15:32:15 +02:00
Torkel Ödegaard
9558d404fa Merge pull request #698 from Topface/http-update
Checking for new version over https
2014-08-14 12:39:54 +02:00
Torkel Ödegaard
0ca6b67132 Added some performance profiling code 2014-08-14 12:26:06 +02:00
Torkel Ödegaard
9390b1eef5 Small cleanup of dashboard partial, removed unused stuff 2014-08-14 12:15:46 +02:00
Ian Babrou
0198167b27 checking for new version over https 2014-08-14 14:13:03 +04:00
Torkel Ödegaard
83e9bc4816 Graph: Fix for axis format none broken for numbers in exponential notation, Closes #696 2014-08-14 12:05:29 +02:00
Torkel Ödegaard
87bf6b3800 Updated changelog and added fix for #695 2014-08-14 10:29:47 +02:00
Torkel Ödegaard
7b3df02640 Performance enhancements 2014-08-13 21:26:33 +02:00
Torkel Ödegaard
499246abae Tech: upgraded jquery from 1.8.0 to 2.1.1, Closes #694 2014-08-13 19:51:27 +02:00
Torkel Ödegaard
71f78cc895 removed comments 2014-08-13 19:26:53 +02:00
Torkel Ödegaard
5896eee693 Dashboard: tooltip fixes for flickering tooltips that sometimes do now want to show on hover, and for tooltips that get stuck after exiting modal, Closes #691 2014-08-13 19:11:46 +02:00
Torkel Ödegaard
ce6b60653c Updated changelog with #672 2014-08-13 17:23:29 +02:00
Torkel Ödegaard
2b865e3505 Merge branch 'panel_id_permalink' 2014-08-13 17:20:59 +02:00
Torkel Ödegaard
dee0e5fce7 final fixes for fullscreen url state, #672 2014-08-13 17:20:54 +02:00
Torkel Ödegaard
56269758c4 refactoring of panel manipulation, moved to dashboard model 2014-08-13 16:35:34 +02:00
Torkel Ödegaard
436f6bda3e Fixed unit tests for dashboardViewStateSrv 2014-08-13 15:17:13 +02:00
Torkel Ödegaard
4d1102db0b Panel edit state is working pretty good now, #672 2014-08-13 15:02:57 +02:00
Torkel Ödegaard
4987a2158e Lots of complicated code for dealing with panel state 2014-08-13 14:22:21 +02:00
Torkel Ödegaard
435a5a67bc Refactoring fullscreen / edit handling 2014-08-13 12:16:50 +02:00
Torkel Ödegaard
fc686ca618 Fullscreen & edit state persisted to url is nearing completion, refactored fullscreen state management to a special dashboardViewState object, Issue #672 2014-08-13 10:07:32 +02:00
Torkel Ödegaard
ec99096d52 experimenting with url and dashboard state 2014-08-13 07:47:36 +02:00
Torkel Ödegaard
9e30599f1f rename backend to pkg 2014-08-12 20:45:41 +02:00
Torkel Ödegaard
472e1c6d8e fixed tests 2014-08-12 20:15:03 +02:00
Torkel Ödegaard
46edd6008f merge sync oss 2014-08-12 20:06:33 +02:00
Torkel Ödegaard
68e520fa2d small css tweak to legend and padding between edit tabs 2014-08-12 19:59:20 +02:00
Torkel Ödegaard
d46e612cb1 Working on linking to panels, #576, #672 2014-08-12 18:21:48 +02:00
Torkel Ödegaard
e7ce371ee8 working on login && auth 2014-08-12 15:07:20 +02:00
Torkel Ödegaard
bfe1ef0733 worked on login view 2014-08-12 15:06:54 +02:00
Torkel Ödegaard
56d449b2ce updated 2014-08-12 12:20:15 +02:00
Torkel Ödegaard
c690d4aae8 added pro routes 2014-08-12 12:19:33 +02:00
Torkel Ödegaard
4966b10a0f pro changes 2014-08-12 12:19:15 +02:00
Torkel Ödegaard
c48df8522a updated readme.md again 2014-08-12 09:24:58 +02:00
Torkel Ödegaard
b0a2c26b22 updated readme.md with a run from master section 2014-08-12 09:23:25 +02:00
Torkel Ödegaard
24579d86d2 updated 2014-08-12 07:25:02 +02:00
Torkel Ödegaard
71573fb5a0 restructing api code 2014-08-11 20:18:46 +02:00
Torkel Ödegaard
f865da6d6a removed generated css that came back after merge 2014-08-11 18:52:34 +02:00
Torkel Ödegaard
3a5f718da8 updated 2014-08-11 16:37:44 +02:00
Torkel Ödegaard
8699dec571 fixed jshint issues 2014-08-11 16:37:31 +02:00
Torkel Ödegaard
6f0c6281e7 Merge remote-tracking branch 'origin/master' into pro 2014-08-11 16:09:40 +02:00
Torkel Ödegaard
58e4dc1b6c updated readme with correct coveralls badge 2014-08-11 16:03:27 +02:00
Torkel Ödegaard
17c03bed21 Added some unit tests for RowCtrl 2014-08-11 15:59:03 +02:00
Torkel Ödegaard
4bfc5355db removed sublime project 2014-08-11 15:32:21 +02:00
Torkel Ödegaard
37b3b1fc3a Merge remote-tracking branch 'origin/master' into pro 2014-08-11 15:30:45 +02:00
Torkel Ödegaard
d865618051 Dashboard: Row option to display row title even when the row is visible, Closes #578 2014-08-11 15:25:36 +02:00
Torkel Ödegaard
a995857cca changed placement of panel error tooltip to the right of icon, works better in when in edit mode 2014-08-11 13:47:58 +02:00
Torkel Ödegaard
fdbdebac32 Merge branch 'master' of github.com:grafana/grafana 2014-08-11 13:44:11 +02:00
Torkel Ödegaard
a242c40b23 Merge branch '1.7.x' 2014-08-11 13:43:05 +02:00
Torkel Ödegaard
f82b84eac7 updated changelog 2014-08-11 13:42:39 +02:00
Torkel Ödegaard
70be333691 Last miniute fix for issue in influxdb http request calling 2014-08-11 13:39:02 +02:00
Torkel Ödegaard
3d9a4dcbf3 Merge branch '1.7.x'
Conflicts:
	src/css/bootstrap.dark.min.css
	src/css/bootstrap.light.min.css
	src/css/default.min.css
2014-08-11 13:35:15 +02:00
Torkel Ödegaard
577efbf0c2 fixed changelog issue link 2014-08-11 12:49:17 +02:00
Torkel Ödegaard
a3fca638ee updated version to 1.7.0 (removed rc1 pre-release tag) 2014-08-11 12:23:00 +02:00
Torkel Ödegaard
027855f891 Small fix for light theme 2014-08-11 12:16:19 +02:00
Torkel Ödegaard
b9b04fd932 Dashboard: Panel error are less intrusive, panel error bar replaced with small indicator, hover for short details, click to open inspector, Closes #681 2014-08-11 12:11:24 +02:00
unknown
2b1dcaf5e3 added global page title prefix setting 2014-08-11 11:25:30 +02:00
Torkel Ödegaard
9e32a5613d Merge pull request #682 from PeterDaveHello/patch-1
Use svg instead of png to get better image quality
2014-08-11 11:18:05 +02:00
Torkel Ödegaard
61b43a0828 Merge pull request #683 from PeterDaveHello/patch-2
make CI build faster
2014-08-11 11:17:14 +02:00
Peter Dave Hello
7fc1fed91e make CI build faster 2014-08-11 17:03:17 +08:00
Peter Dave Hello
1fd97f8732 Use svg instead of png to get better image quality 2014-08-11 16:46:20 +08:00
Torkel Ödegaard
aa03de8e52 More work on integrated console, with request details 2014-08-10 21:25:24 +02:00
Torkel Ödegaard
eb9a7267bd began work on inspection console to visualize metric requests, and other useful troubleshooting info and inspection 2014-08-10 14:35:56 +02:00
Torkel Ödegaard
21b7c6a2c0 Moved css files, removed generated css files from source control, consolidated (concat) css more, now only two css files, dark and light 2014-08-10 09:46:55 +02:00
Torkel Ödegaard
4cd53ce119 Merge branch 'cleanup-generated-files' of github.com:clkao/grafana into clkao-cleanup-generated-files 2014-08-10 09:23:44 +02:00
Torkel Ödegaard
e2283e53b6 Merge branch 'master' into develop 2014-08-10 09:12:18 +02:00
Chia-liang Kao
d51d5af992 Cleanup legend value by using css content 2014-08-10 09:09:45 +02:00
Torkel Ödegaard
b98a8ee83a updated changelog for PR #666, Closes #660 2014-08-10 09:09:45 +02:00
Christophe Furmaniak
21cf1f6c47 fix #660 by checking if options is undefined
- a complete fix with a consistent support of alias in all use cases is not obvious (see #660 for explanations)
2014-08-10 09:09:45 +02:00
Torkel Ödegaard
918ea5d12f Annotation: filter field is not interpreting in elasticsearch query, Fixes #661 2014-08-10 09:09:45 +02:00
Torkel Ödegaard
3b7551e1e4 added coveralls badge 2014-08-10 09:09:45 +02:00
Torkel Ödegaard
5dbc0aedcc General: Fix for refresh icon in IE browsers, Fixes #657 2014-08-10 09:09:45 +02:00
Chia-liang Kao
8819d559b7 move vendor css intor appropriate places and remove generated files from version control 2014-08-10 02:21:05 +08:00
Torkel Ödegaard
448a5c00fd Merge pull request #669 from clkao/release-lodash
Fix release build rules following 23c9f97 and #659
2014-08-09 13:08:42 +02:00
Chia-liang Kao
8194c62f4e Fix release build rules following 23c9f97 and #659 2014-08-09 18:40:40 +08:00
Torkel Ödegaard
e75debbf81 Fixes to text panel, and alert related to angularjs upgrade 2014-08-09 12:18:21 +02:00
Torkel Ödegaard
380f707285 workin on png rendering 2014-08-09 11:57:54 +02:00
Torkel Ödegaard
1bc277fd87 Merge branch 'develop' into pro 2014-08-09 10:24:17 +02:00
Torkel Ödegaard
5b475a05ef Added another unit test for influxdb datasource, fixed angular dragdrop/mocks file mixup 2014-08-09 10:02:47 +02:00
Torkel Ödegaard
f69dcf38ef added unit test for influxdb query 2014-08-08 17:33:16 +02:00
Torkel Ödegaard
c669f8c612 working on rendering panel with phantomjs 2014-08-08 15:53:31 +02:00
Torkel Ödegaard
966ba97b2c updated changelog for PR #666, Closes #660 2014-08-08 15:24:10 +02:00
Christophe Furmaniak
675688cb80 fix #660 by checking if options is undefined
- a complete fix with a consistent support of alias in all use cases is not obvious (see #660 for explanations)
2014-08-08 14:58:03 +02:00
Torkel Ödegaard
f068b2c1d3 Merge remote-tracking branch 'origin/overview' into pro 2014-08-08 14:37:24 +02:00
Torkel Ödegaard
3dd383ba11 solo panel work 2014-08-08 14:36:13 +02:00
Torkel Ödegaard
3a0983d8bf Merge branch 'develop' into overview 2014-08-08 14:11:11 +02:00
Torkel Ödegaard
59c7edfd90 fixed unit test that broke after moving colors array 2014-08-08 14:10:35 +02:00
Torkel Ödegaard
660fbfd73c Moved colors array away from dash controller 2014-08-08 14:03:05 +02:00
Torkel Ödegaard
bc7ef28644 Merge branch 'develop' into overview
Conflicts:
	src/test/test-main.js
2014-08-08 13:48:39 +02:00
Torkel Ödegaard
7b011c1d96 Changed name of dashboard service to dashboardSrv 2014-08-08 13:45:52 +02:00
Torkel Ödegaard
a0780ce48a Began work on solo panel 2014-08-08 13:37:51 +02:00
Torkel Ödegaard
8154b4f60d search and save are 'working', barely 2014-08-08 12:35:15 +02:00
Torkel Ödegaard
91a6ae756f updated grafana datasource 2014-08-08 12:34:28 +02:00
Torkel Ödegaard
3fffd08ae4 Annotation: filter field is not interpreting in elasticsearch query, Fixes #661 2014-08-08 07:19:03 +02:00
Torkel Ödegaard
abc8077a96 added some unit tests for graph panel controller 2014-08-07 18:17:26 +02:00
Torkel Ödegaard
eb6099a93f Began work on pro modification 2014-08-07 16:04:54 +02:00
Torkel Ödegaard
5a125c7fe5 added coveralls badge 2014-08-07 15:05:37 +02:00
Torkel Ödegaard
02fb2baf62 Added code coverage, and sending reports to coveralls 2014-08-07 14:58:57 +02:00
Torkel Ödegaard
23c9f973cc Switch from underscore to lodash, #659 2014-08-07 14:35:28 +02:00
Torkel Ödegaard
db90fa71d4 General: Fix for refresh icon in IE browsers, Fixes #657 2014-08-07 14:16:54 +02:00
Torkel Ödegaard
c416b09089 more work on overview panel 2014-08-07 14:09:07 +02:00
Torkel Ödegaard
f144593c06 Merge branch 'develop' into overview 2014-08-07 13:45:01 +02:00
Torkel Ödegaard
c3a6ae1622 added more graphite target controller tests 2014-08-07 13:44:09 +02:00
Torkel Ödegaard
76aab2a2ac added graphiteTargetCtrl specs 2014-08-07 10:42:05 +02:00
Torkel Ödegaard
5337756792 working on overview panel and unit tests 2014-08-07 10:12:31 +02:00
Torkel Ödegaard
8ed4859bb5 Merge branch 'develop' into overview 2014-08-07 09:01:24 +02:00
Torkel Ödegaard
a02effc32e Merge branch 'master' into develop 2014-08-07 09:01:09 +02:00
Torkel Ödegaard
965c1f0353 Chart: Possible fix for stuck tooltip (annotation or time series point hover tooltip would not disappear), Fixes #450 2014-08-07 09:00:52 +02:00
Torkel Ödegaard
e7086cf6df Timepicker: Fix for setting custom To date with low refresh interval, Fixes #652 2014-08-07 07:58:14 +02:00
Torkel Ödegaard
af073dad46 Fix for auto refresh not being started after loading dashboard, Fixes #655 2014-08-07 07:20:56 +02:00
Torkel Ödegaard
1e7beffafd more unit test work 2014-08-06 19:33:38 +02:00
Torkel Ödegaard
c2c16b6bd2 Merge branch 'develop' into overview 2014-08-06 17:26:52 +02:00
Torkel Ödegaard
b79e8b8130 fixed jshint error in test-main 2014-08-06 16:11:17 +02:00
Torkel Ödegaard
72e5a40e7e began work on overview panel 2014-08-06 16:09:26 +02:00
Torkel Ödegaard
3b25200868 Refactoring base panel features, trying to get controller unit tests to work 2014-08-06 16:00:43 +02:00
Torkel Ödegaard
3985e52a3a Fixed unit tests broken after angular 1.3 upgrade 2014-08-06 10:53:45 +02:00
Torkel Ödegaard
fee44d83c8 Small timepicker angular binding perf improvement 2014-08-06 10:39:27 +02:00
Torkel Ödegaard
d70c81f03b more angular 1.3 upgrade fixes 2014-08-06 09:10:18 +02:00
Torkel Ödegaard
387ec89b95 more angular 1.3 upgrade changes 2014-08-06 09:05:03 +02:00
Torkel Ödegaard
60dd68490c working on angular upgrade 2014-08-06 08:16:54 +02:00
Torkel Ödegaard
378e55ed0c small changelog update 2014-08-05 15:37:09 +02:00
Torkel Ödegaard
16900ad421 Small fixes for 1.7 release 2014-08-05 13:22:54 +02:00
Torkel Ödegaard
0bf1e8f252 Readme fixes 2014-08-05 12:29:58 +02:00
Torkel Ödegaard
0aa5505d7f Updated readme, and other small changes for 1.7.0-rc1 release 2014-08-05 12:27:03 +02:00
Torkel Ödegaard
60f68abd31 Dashboard schema simplifications, moved schema updates to dashboard model creation, removes irritating 'unsaved changes' dialogs that show for dashboard schema changes, Closes #532 2014-08-05 10:15:51 +02:00
Torkel Ödegaard
0a677449dc Fixed issue in dashboard settings modal and timepicker options 2014-08-04 15:52:41 +02:00
Torkel Ödegaard
6e9723325f Fixed issue span set to zero. Removed zero option from row editor. Closes #645 2014-08-04 12:26:53 +02:00
Torkel Ödegaard
e9a046e74d Small annotation fix when leaving edit mode and having series hidden 2014-08-04 07:18:26 +02:00
Torkel Ödegaard
44f0c749d5 Fix for InfluxDB temp dashboards, seperate series name prefix so they do not show up in dashboard search, #633 2014-08-03 12:20:42 +02:00
Torkel Ödegaard
082d2c739e updated changelog with #641 change 2014-08-03 12:12:38 +02:00
Torkel Ödegaard
6354b1aec0 Merge branch 'jordanrinke-master' 2014-08-03 12:08:17 +02:00
Torkel Ödegaard
512dbf1980 Refactoring temp dashboard settings, and handling, moved from dashboard to config.js, defaults are enabled, and ttl of 30 days, #641, #638 2014-08-03 12:07:50 +02:00
Torkel Ödegaard
ed491b0caf Merge branch 'master' of github.com:jordanrinke/grafana into jordanrinke-master 2014-08-01 15:29:29 +02:00
Torkel Ödegaard
d6814587ad Update changelog and config sample 2014-08-01 11:34:57 +02:00
Torkel Ödegaard
586399a814 Graphite: Fix for graphite expressions parser failure when metric expressions starts with curly brace segment, Fixes #528 2014-08-01 09:28:57 +02:00
Torkel Ödegaard
867186fd66 Filtering: Fix for nested filters, changing a child filter could result in infinite recursion in some cases, Fixes #628 2014-08-01 08:54:22 +02:00
Jordan Rinke
48c18ee8d1 fixed 2 coding errors noted by travis 2014-07-31 13:48:28 -07:00
Jordan Rinke
f5d5d9a504 fixed 2 coding errors noted by travis 2014-07-31 13:45:17 -07:00
Jordan Rinke
f958924b79 added saving and showing temp searches also trailing comman in default.json was causing the default to fail to load for me, #633 2014-07-31 12:37:35 -07:00
Torkel Ödegaard
67582aaee4 cleanup of 'loader' settings, removed loader.save_elasticsearch, loader.load_elasticsearch. Save/Load is default enabled and will use any datasource marked with grafanaDB: true property 2014-07-31 14:20:53 +02:00
Torkel Ödegaard
8ebe260628 Added support for deleting dashboards to influxdb datasource, #633 2014-07-31 12:39:49 +02:00
Torkel Ödegaard
a6d2590834 Merge PR #618 2014-07-31 12:28:11 +02:00
Torkel Ödegaard
923cd045cd Changed opentsdb metric option chartLabel to Alias to better conform to grafana naming, updated changelog with PR #618 info 2014-07-31 12:27:49 +02:00
Torkel Ödegaard
f64bcf0d08 Merge branch 'master' of github.com:heldr/grafana into heldr-master 2014-07-31 12:16:07 +02:00
Torkel Ödegaard
c48b6e23eb Updated changelog with PR #626 2014-07-31 11:22:20 +02:00
Torkel Ödegaard
b2eabda5b6 Merge branch 'master' of github.com:kamaradclimber/grafana into kamaradclimber-master 2014-07-31 11:17:08 +02:00
Torkel Ödegaard
305e12be1d Updated changelog and config.sample.js with info about #633 2014-07-31 11:11:33 +02:00
Torkel Ödegaard
30ad784d95 Changed dashboard urls from /dashboard/elasticsearch/<title> to dashboard/db/<title>, old urls will still work 2014-07-31 11:06:02 +02:00
Torkel Ödegaard
7be7b07c19 Changed search result model to be more datasource agnostic 2014-07-31 10:54:36 +02:00
Torkel Ödegaard
88c46f4612 Merge branch 'influxdb_dashstore' 2014-07-31 10:37:17 +02:00
Torkel Ödegaard
1c1b9b5c9d InfluxDB: save/load and search works, tag facets still to be done, but is not critical, #633 2014-07-31 10:36:45 +02:00
Gregoire Seux
f5f3256824 Downscale y axis to more precise unit
y axis unit is already upscaled automatically, this commit adds
automatic downscale.
It also fixes the number of decimals displayed (0 -> decimals)
2014-07-31 09:40:23 +02:00
Torkel Ödegaard
d056b1f1e1 Search: max_results config.js option & scroll in search results (To show more or all dashboards), Closes #631 2014-07-31 09:17:37 +02:00
Torkel Ödegaard
c86a30921f Save/load dashboard from/to influxdb works, #633 2014-07-30 15:38:09 +02:00
Torkel Ödegaard
14f09e3787 Added filtering support for graphite events/metrics, Closes #402 2014-07-30 13:09:23 +02:00
Torkel Ödegaard
d2a342a94e Merge branch 'elastic_annotations'
Conflicts:
	src/css/bootstrap.dark.min.css
	src/css/bootstrap.light.min.css
	src/css/default.min.css
2014-07-30 11:36:47 +02:00
Torkel Ödegaard
c61e4c02bd further work on unifying datasources, #630 2014-07-30 11:34:09 +02:00
Torkel Ödegaard
b8ce61ae45 General architectural changes around datasources, unifying dashboard loading behind datasource abstraction, #630 2014-07-30 10:52:02 +02:00
Torkel Ödegaard
5a25b0885c added datasource filtering based on datasource abilities 2014-07-30 08:34:58 +02:00
Torkel Ödegaard
337cbb2844 Ctrl+H (hide controls) issue introduced in recent commit, Closes #625 2014-07-29 17:50:09 +02:00
Torkel Ödegaard
fa3b84a615 Elastic search annotations are working, need to refactor and unify datasource abstraction more, #201 2014-07-29 17:24:42 +02:00
Torkel Ödegaard
4e47447dec began work on ES annotation datasource, #201 2014-07-29 11:26:05 +02:00
Torkel Ödegaard
a1772d26b5 New global option in config.js to specify admin password (useful to hinder some users from accidentally making changes), Closes #606 2014-07-29 09:45:07 +02:00
Torkel Ödegaard
77e5e75b2f Fixed ngmin build issue introduced in route refactoring, Fixes #622 2014-07-29 08:13:23 +02:00
Torkel Ödegaard
77bfd85e9e Changed all kibana words to grafana 2014-07-28 18:11:52 +02:00
Torkel Ödegaard
272ea9fe17 Added global datasource config option cacheTimeout for graphite datasource, #266 2014-07-28 17:54:32 +02:00
Torkel Ödegaard
8aed1aa634 Fix for cacheTimeout undefined value, #266 2014-07-28 17:01:48 +02:00
Torkel Ödegaard
2bec41b80e Graphite: new option available in metrics view to set cacheTimeout, will override default memcache timeout, Closes #266 2014-07-28 15:01:00 +02:00
Torkel Ödegaard
38633b6db4 Merge branch 'develop' 2014-07-28 12:41:51 +02:00
Torkel Odegaard
e62dc00d7b Fix for build issues on windows, Fixes #574 2014-07-28 11:08:19 +02:00
Torkel Ödegaard
f619fc3e7e merge with master 2014-07-25 12:37:39 +02:00
Torkel Ödegaard
6c7d74c43b updated changelog with PR #604 2014-07-25 12:36:23 +02:00
Torkel Ödegaard
268cead331 Merge pull request #604 from floored1585/add_bps
Adding bps unit type for network gear
2014-07-25 12:30:13 +02:00
Torkel Ödegaard
70521f0756 InfluxDB: support for InfluxDB v0.8 'list series' response schema, Fixes #610 2014-07-25 12:14:15 +02:00
Helder Santana
1f283d93ca add opentsdb chart label field 2014-07-23 14:19:21 -04:00
Torkel Ödegaard
7dc422887c Merge pull request #615 from lathan/english_syntax
english syntax fix
2014-07-23 13:36:34 +02:00
Torkel Ödegaard
7dea0dcfc4 Merge pull request #616 from guequierre/master
'list series' instead of 'select * from /.*/ limit 1'
2014-07-23 13:34:51 +02:00
guequierre
ab11604bfb 'list series' instead of 'select * from /.*/ limit 1'
'list series' response is much faster than 'select * from /.*/ limit 1' for the auto-complete option. Especially noticeable on large datasets.
2014-07-23 12:37:11 +02:00
George Angelopoulos
0e8c026854 english syntax fix
Add a comma to clearly separate the two clauses of the conditional sentence.
Otherwise, it's unclear whether it is referring to "the panel below" or
"the panel below the browser".
2014-07-23 12:47:52 +03:00
Torkel Ödegaard
3b1cc1cc34 removed old timezoneOffset setting 2014-07-22 08:56:12 +02:00
Torkel Ödegaard
85a8f2f147 another small fix for timezone and annotations, #611 2014-07-21 18:52:19 +02:00
Torkel Ödegaard
37c43199ca Fix for annotations hover tooltip and timestamp when timezone set to utc, Fixes #611, #394 2014-07-21 18:49:30 +02:00
Torkel Ödegaard
f22fcc2e59 updated changelog 2014-07-20 18:12:54 +02:00
Torkel Ödegaard
05d7d58cd5 Merge branch 'master' into develop 2014-07-20 18:09:01 +02:00
Torkel Ödegaard
10e89f6802 small tweek to plot hover and annotation hover tooltip css 2014-07-20 18:08:05 +02:00
Torkel Ödegaard
551b802d89 Annotation datasource redesign is done, Closes #608 2014-07-20 16:32:09 +02:00
Torkel Ödegaard
5ae8607771 Fixed dashboard import, broken by dashboard loading redesign #609 2014-07-19 19:06:28 +02:00
Torkel Ödegaard
7b47f40979 better formating of changelog 2014-07-19 18:41:25 +02:00
Torkel Ödegaard
a9a76b9010 annotation redesign is almost done, #608 2014-07-19 13:16:47 +02:00
Torkel Ödegaard
cf68725c89 influxdb annotation column mapping is working 2014-07-18 19:19:30 +02:00
Ian Clark
989d703d1d Adding bps unit type for network gear 2014-07-17 16:52:12 -07:00
Torkel Ödegaard
cf2ef0955d influxdb annotations working, need to figure out how to know which columns to use for title, tags, and data 2014-07-17 10:24:30 +02:00
Torkel Ödegaard
2fe3b0de55 influxdb annoations starting to work 2014-07-16 18:51:51 +02:00
Torkel Ödegaard
b47047a91d Merge branch 'master' into annotations_redesign 2014-07-16 13:18:21 +02:00
Torkel Ödegaard
1c56ac7e48 changed css concat order 2014-07-16 13:17:55 +02:00
Torkel Ödegaard
47fb553d38 Merge pull request #593 from Kixeye/master-fixfilterqueries
influxdbDatasource.js - fix find query
2014-07-16 07:47:24 +02:00
Dave Ertel
bd6362f09f influxdbDatasource.js - fix find query 2014-07-16 14:03:44 +10:00
Torkel Ödegaard
9cc735bdf2 fixed small css bug with the 'no datapoints' warning introduced by legends makeover 2014-07-15 16:57:23 +02:00
Torkel Ödegaard
f5d992f609 InfluxDB: Support for alias & alias patterns when using raw query mode, #584 2014-07-15 16:46:17 +02:00
Torkel Ödegaard
25407fb5f0 updated readme.md 2014-07-15 11:32:03 +02:00
Torkel Ödegaard
9eb9bd8488 moved annotations graphite query to graphite datasource 2014-07-14 18:19:41 +02:00
Torkel Ödegaard
7d6eafb2f2 Merge branch 'dashboard_loading_refactoring' into annotations_redesign 2014-07-14 17:28:19 +02:00
Torkel Ödegaard
bfdf25a162 Merge branch 'master' into dashboard_loading_refactoring 2014-07-14 17:28:00 +02:00
Torkel Ödegaard
6e0e6f5ec4 updated changelog with PR #581 2014-07-14 17:26:16 +02:00
Torkel Ödegaard
dce8b15937 Merge branch 'feature/influxdb-expose-continuous-query-in-series' of github.com:mavimo/grafana into mavimo-feature/influxdb-expose-continuous-query-in-series 2014-07-14 17:20:28 +02:00
Marco Vito Moscaritolo
25e2e07631 ADd contiuous query in series results. 2014-07-13 19:57:09 +02:00
Torkel Ödegaard
b5fb8b6d82 fixed jscs errors 2014-07-13 15:15:10 +02:00
Torkel Ödegaard
171c5aa50c began work on annotations redesign to easier support more annotation sources, #133, #394, #403 2014-07-13 15:01:20 +02:00
Torkel Ödegaard
b5d378c425 Merge branch 'master' into dashboard_loading_refactoring 2014-07-13 12:51:22 +02:00
Torkel Ödegaard
145d65fd60 removed commented out html in graph module 2014-07-13 12:49:54 +02:00
Torkel Ödegaard
5c78fe1070 fixed jshint error 2014-07-08 08:36:59 +02:00
Torkel Ödegaard
31b1203317 fixed failing unit test 2014-07-07 19:04:22 +02:00
Torkel Ödegaard
eaa200a766 Fix for Max legend value when max value is zero (Issue #460) 2014-07-04 11:50:11 +02:00
Torkel Ödegaard
f422c84414 extra fix for percent sign in aliases and plothover, #506 2014-07-03 16:28:38 +02:00
Torkel Ödegaard
4562f31b6b merged with master 2014-07-03 16:25:07 +02:00
Torkel Ödegaard
6911e184f9 New legend display option 'Right side', will show legend to the right of the graph (Closes #556) 2014-07-03 12:38:20 +02:00
Torkel Ödegaard
9627212510 fixed failing unit test 2014-07-03 09:30:44 +02:00
Torkel Ödegaard
0fc8c4e071 small changes to influxdb aliasing, and help text, #525 2014-07-03 09:27:11 +02:00
Torkel Ödegaard
6c93dc6a4c Some changes to influxdb alias pattern expansions, removed as it was to confusion, added help text to influxdb metric editor view, need to polish a litle more, #525 2014-07-02 15:50:57 +02:00
Torkel Ödegaard
1dbbfbbba6 Enhanced InfluxDB series aliasing (legend names) with pattern replacements (Issue #525) 2014-07-02 15:21:29 +02:00
Torkel Ödegaard
88ab36c45b added y2 text after right y axis series, when legend is in table display mode #136 2014-07-02 13:00:33 +02:00
Torkel Ödegaard
14247ddabb New legend display option 'Align as table' (Issue #136) 2014-07-02 12:13:42 +02:00
Torkel Ödegaard
fd8561ac55 added missing file from last commit 2014-07-01 20:01:56 +02:00
Torkel Ödegaard
e1e6ba36ca Refactoring influxdb datasource, split out response handling 2014-07-01 15:55:56 +02:00
Torkel Ödegaard
435a50de4b Merge pull request #550 from Fuitad/master
Fixed invalid references to grid.min and grid.max in function render_panel_as_graphite_png()
2014-06-30 20:45:36 +02:00
Pierre-Luc Brunet
93b2b9b7b0 Fixed invalid references to grid.min and grid.max in function render_panel_as_graphite_png() 2014-06-30 12:13:39 -04:00
Torkel Ödegaard
faa5199a9a removed gist loading/saving 2014-06-30 09:46:34 +02:00
Torkel Ödegaard
5768d7a247 Merge branch 'master' into dashboard_loading_refactoring
Conflicts:
	src/app/partials/dashboard.html
	src/app/partials/dasheditor.html
	src/app/services/graphite/graphiteDatasource.js
2014-06-30 09:21:16 +02:00
Torkel Ödegaard
d9f2fca66d Merge branch 'dashboard_loading_refactoring' of github.com:torkelo/grafana-private into dashboard_loading_refactoring 2014-06-30 09:20:07 +02:00
Torkel Ödegaard
91b48258f0 Refactoring PR #511, Allow filter notation [[..]] in text panels 2014-06-30 09:10:32 +02:00
Torkel Ödegaard
2ac7b9dabf Merge branch 'master' of github.com:Akeru/grafana into Akeru-master 2014-06-30 08:05:48 +02:00
Torkel Ödegaard
505f0f65d0 updated change log with PR #545 2014-06-30 07:56:35 +02:00
Torkel Ödegaard
8262a8dea2 Merge pull request #545 from Akeru/fix-format
Fix formatting negative values
2014-06-30 07:32:11 +02:00
Torkel Ödegaard
406286b970 Merge pull request #544 from Akeru/diffseries
Add diffSeries function support
2014-06-30 07:29:44 +02:00
Akeru
6346f835af Fix formatting negative values 2014-06-27 15:37:11 +02:00
Akeru
73fc437c7d Add diffSeries function support 2014-06-27 15:24:06 +02:00
Torkel Ödegaard
af66739207 Merge pull request #543 from Akeru/html-fix
Fix HTML code
2014-06-27 14:03:56 +02:00
Akeru
65bb6a8b73 Fix HTML code 2014-06-27 13:52:43 +02:00
Torkel Ödegaard
8bda5aa2a7 Merge pull request #539 from looztra/opentsdb-fix-tag-display
Display tag values whenever a tag is part of the query (opentsdb)
2014-06-26 06:59:23 +02:00
Christophe Furmaniak
dd2b43dc73 Display tag values whenever a tag is part of the query (opentsdb datasource) 2014-06-25 23:56:25 +02:00
Torkel Ödegaard
c925014bb5 Use unix epoch for Graphite from/to for absolute time ranges, #536 2014-06-25 10:09:19 -04:00
Torkel Ödegaard
32b11b104f updated version to 1.6.1 2014-06-24 15:06:51 +02:00
Torkel Ödegaard
e25a73f9af updated default dashboard info text 2014-06-24 13:57:46 +02:00
Torkel Ödegaard
15c1b48b25 merged with master 2014-06-22 19:01:04 +02:00
Torkel Ödegaard
d14a86069a Auto-refresh caused 2 refreshes (and hence mulitple queries) each time (at least in firefox) (Fixes #342) 2014-06-22 18:51:27 +02:00
Torkel Ödegaard
186f753aec style changing now works again 2014-06-22 18:21:38 +02:00
Torkel Ödegaard
f180707b6f Merge branch 'master' into dashboard_loading_refactoring 2014-06-22 18:04:37 +02:00
Torkel Ödegaard
9a53779b6c Default property that marks which datasource is default in config.js is now optional (Fixes #526) 2014-06-22 18:02:43 +02:00
Torkel Ödegaard
551771c6cf ixed influxdb issue with raw query that caused wrong value column detection (Fixes #504) 2014-06-22 12:01:41 +02:00
Torkel Ödegaard
a3aca0bae4 restored influxdb series naming default to series.value_func 2014-06-22 11:53:58 +02:00
Torkel Ödegaard
ed0c71fa56 Series names and column name typeahead cache fix (Fixes #522) 2014-06-22 11:27:36 +02:00
Torkel Ödegaard
574ecdb512 fixed column typehead, introduced in PR #500 2014-06-22 11:27:36 +02:00
Torkel Ödegaard
7848a35941 Merge pull request #524 from acedrew/master
Added nginx config examples to docs.
2014-06-21 22:07:04 +02:00
Andrew Rodgers
dfe0314ba0 Added nginx config examples for CORS headers, and CORS selective reflection 2014-06-21 16:17:45 +00:00
Andrew Rodgers
4618ef0cbf Merge branch 'docs-improvement'
Added nginx config examples, including CORS header reflection.
2014-06-21 16:11:53 +00:00
Andrew Rodgers
bb281649fc prepare for master branch after all sorts of git shenanigans 2014-06-21 16:11:36 +00:00
Torkel Ödegaard
012ffcf6f6 Bug in when using % sign in legends (aliases), fixed by removing url decoding of metric names (Fixes #506) 2014-06-21 17:27:57 +02:00
Torkel Ödegaard
bef61cf019 Ability to set y min/max for right y-axis (RR #519, Closes #360) 2014-06-21 17:18:24 +02:00
Andrew Rodgers
5ce6464461 Revert "added nginx conf examples for graphite CORS configuration"
This reverts commit c37496f2b0.
2014-06-20 03:01:13 +00:00
Andrew Rodgers
a0c3f99d80 Revert "updated nginx conf examples for graphite CORS configuration"
This reverts commit be03f6adb6.
2014-06-20 03:00:50 +00:00
Andrew Rodgers
f6ba577cf4 Revert "updated nginx conf examples for graphite CORS configuration"
This reverts commit 9edaa407f2.
2014-06-20 03:00:31 +00:00
Andrew Rodgers
6ef03b7c6c Revert "Revert "Added left and right min and max for y-axis""
This reverts commit 05303dab45.
2014-06-20 02:59:52 +00:00
Andrew Rodgers
05303dab45 Revert "Added left and right min and max for y-axis"
This reverts commit 8743ba2886.
2014-06-20 02:54:34 +00:00
Andrew Rodgers
9edaa407f2 updated nginx conf examples for graphite CORS configuration 2014-06-20 02:44:45 +00:00
Andrew Rodgers
be03f6adb6 updated nginx conf examples for graphite CORS configuration 2014-06-20 02:42:18 +00:00
Andrew Rodgers
c37496f2b0 added nginx conf examples for graphite CORS configuration 2014-06-20 02:40:01 +00:00
Andrew Rodgers
8743ba2886 Added left and right min and max for y-axis 2014-06-19 21:49:49 +00:00
Akeru
c100054d68 Allow [[..]] filter notation in all text panels
Based on #408 with fixed filter service method. Supports html, text and
markdown panels.
2014-06-18 17:28:40 +02:00
Torkel Ödegaard
2fbb87e17a fix jshint and updated changelog with PR #500 2014-06-17 18:09:10 +02:00
Pauly Myjavec
1eadf52f5e Fixes regex InfluxDB queries intoduced in 1.6.0
Do not encapsulate regex with quotes in query string
Fix the way series names are displayed, do not use column name but
rather series names
2014-06-17 22:38:52 +10:00
Torkel Ödegaard
810f46c450 updated karma dependencies in package.json 2014-06-16 12:40:41 +02:00
Torkel Ödegaard
393dfd1e96 changed version to 1.6.0 2014-06-16 12:24:04 +02:00
Torkel Ödegaard
011e95b331 Graphite query lexer change, can now handle regex parameters for aliasSub function (Fixes #126) 2014-06-16 08:14:34 +02:00
Torkel Ödegaard
9f3681642a Merge branch 'dashboard_loading_refactoring' of github.com:torkelo/grafana-private into dashboard_loading_refactoring 2014-06-14 14:55:29 +02:00
Torkel Ödegaard
a4ca679b65 Merge branch 'master' of github.com:torkelo/grafana-private into dashboard_loading_refactoring 2014-06-14 14:54:55 +02:00
Torkel Ödegaard
d198095d7a Merge branch 'master' into dashboard_loading_refactoring 2014-06-14 14:51:09 +02:00
Torkel Ödegaard
da451d013a Refactoring and rewrite parts of influxdb group by feature from PR #441 2014-06-14 14:40:22 +02:00
Torkel Ödegaard
d18244a8a1 removed commented out sections of the opentsdb datasource 2014-06-14 11:53:16 +02:00
Torkel Ödegaard
6214872e0c Merge branch 'master' of github.com:grafana/grafana 2014-06-14 11:39:44 +02:00
Torkel Ödegaard
6885cea0fd Improvement and polish to the OpenTSDB query editor (Issue #492) 2014-06-14 11:38:27 +02:00
Torkel Ödegaard
438455bc8c finally removed elasticjs library 2014-06-13 13:58:34 +02:00
Torkel Ödegaard
7914f65f68 removed redundant load/save options 2014-06-13 13:50:09 +02:00
Torkel Ödegaard
d0b79ad335 now dashboard deleting works 2014-06-12 17:40:37 +02:00
Torkel Ödegaard
7dc4484f6a Renamed dashboard service to dashboardModel, fixed saving default dashboard feature 2014-06-12 17:03:52 +02:00
Torkel Ödegaard
257ea391da fixed issues with unsaved changes srv 2014-06-12 16:35:58 +02:00
Torkel Ödegaard
4c64bcfae7 keyboard binding now work again 2014-06-12 13:37:40 +02:00
Torkel Ödegaard
99d2f537c2 sharing temp dashboard is now working again 2014-06-11 20:22:05 +02:00
Torkel Ödegaard
6c32365e00 more work on refactoring ES usage 2014-06-11 08:19:52 +02:00
Torkel Ödegaard
95925aafb1 removed dependence on elasticsearch js client from search, will try to remove this depdence in other places and just use $http, elasticsearch js client is to big and does not provide enough value 2014-06-11 08:11:13 +02:00
Torkel Ödegaard
77bfaa4245 fixed default dashboard json editable flag, accidentally set to to false 2014-06-11 08:07:18 +02:00
Torkel Ödegaard
0a3d4a5ab0 elasticsearch saving does now work, still have to do ttl and temp dashboard 2014-06-10 21:32:38 +02:00
Torkel Ödegaard
e8c11251de fix for build step that replaces @grafanaVersion@ with correct version string 2014-06-09 16:59:53 +02:00
Torkel Ödegaard
87a8b1b3f5 small fix to config.sample.js 2014-06-09 13:33:30 +02:00
Torkel Ödegaard
2328c60d12 small refactoring progress 2014-06-08 20:46:30 +02:00
Torkel Ödegaard
61cd5cf4e6 fixed jshint and jscs checks 2014-06-08 16:09:36 +02:00
Torkel Ödegaard
1eb9efe2d5 fixing broken things 2014-06-08 16:08:12 +02:00
Torkel Ödegaard
d5882f2efe ES and file loading is working 2014-06-08 15:28:50 +02:00
Torkel Ödegaard
5f3991127b refactoring progress 2014-06-08 14:40:44 +02:00
Torkel Ödegaard
c5d2590293 removed unused code 2014-06-08 13:00:59 +02:00
Torkel Ödegaard
b995dc54f1 further refactoring 2014-06-07 21:00:05 +02:00
Torkel Ödegaard
79404e754e started on some big refactoring of how the app starts and how dashboard object is loaded, created. This should make it easier to add other dashboard storage backends and other views 2014-06-07 19:43:15 +02:00
Torkel Ödegaard
92318d5804 small fix for click on row menu submenus 2014-06-07 09:05:30 +02:00
Torkel Ödegaard
191f9daf4d update changelog 2014-06-07 08:16:34 +02:00
Torkel Ödegaard
b67280f0d4 Merge pull request #476 from lyrixx/axis-s-week
Format seconds metric by week if needed
2014-06-07 07:06:53 +02:00
Torkel Ödegaard
ce8bdabab8 Adding JSCS (javascript style checker) 2014-06-07 07:05:42 +02:00
Grégoire Pineau
b40af07103 Format seconds metric by week if needed 2014-06-07 02:06:34 +02:00
Torkel Ödegaard
f3698cd625 Cleanup of config.sample.js, removed graphiteUrl setting, it will still work for next release 2014-06-06 23:33:33 +02:00
Clicky
c928618d1a Formatting. 2014-06-06 11:59:02 -07:00
Clicky
3cc83ced93 Merge branch 'master' into add-influx-group-by
Conflicts:
	.gitignore
	src/app/partials/influxdb/editor.html
	src/app/services/influxdb/influxdbDatasource.js
2014-06-06 11:52:02 -07:00
Torkel Ödegaard
0ad4f3b85e Row editing and adding new panel is now a lot quicker and easier with the new row menu (Issue #475) 2014-06-06 18:30:15 +02:00
Torkel Ödegaard
2d061ce45a changed default row height to 250px 2014-06-06 16:05:56 +02:00
Torkel Ödegaard
6e2348d2b1 renamed graphite panel to graph 2014-06-06 16:03:39 +02:00
Torkel Ödegaard
525c4d529e cleanup, removal of unused code 2014-06-06 15:51:49 +02:00
Torkel Ödegaard
ea84149c87 Fix for exclusive series toggling (hold down CTRL, SHIFT or META key) and left click a series for exclusive toggling
CTRL does not work on MAC OSX but SHIFT or META should (depending on browser) (Closes #350, Fixes #472)
2014-06-06 11:23:17 +02:00
Torkel Ödegaard
af1855601b Improvement to InfluxDB query editor and function/value column selection, more space efficient, Closes #473 2014-06-06 10:56:38 +02:00
Torkel Ödegaard
1409065005 Merge branch 'master' into mavimo-feature/influxdb-filters 2014-06-06 08:59:06 +02:00
Torkel Ödegaard
623019ee56 Merge branch 'master' of github.com:grafana/grafana 2014-06-06 08:58:24 +02:00
Torkel Ödegaard
740d477801 added a little padding for metric target editor rows, making tthem sligly heigher 2014-06-06 08:58:14 +02:00
Torkel Ödegaard
c2b8f21fd9 small changes to PR #327, Partial support for url encoded metric names when using graphite datasource 2014-06-05 20:50:14 -07:00
Torkel Ödegaard
442ed87cfa Merge branch 'urldecode' of github.com:axe-felix/grafana into axe-felix-urldecode 2014-06-05 20:17:11 -07:00
Torkel Ödegaard
c48b3ded2f Fix for graphite function selection menu that some times draws outside screen. It now displays upward (Fixes #293) 2014-06-03 19:07:59 -07:00
Torkel Ödegaard
5bed5b9870 Fixing PR for influxdb filters 2014-06-03 21:23:42 +02:00
Torkel Ödegaard
2a261a32e2 Merge branch 'feature/influxdb-filters' of github.com:mavimo/grafana into mavimo-feature/influxdb-filters 2014-06-03 21:06:36 +02:00
Torkel Ödegaard
7137a9986f Fix to series toggling bug that caused annotations to be hidden when toggling (hiding) series. Fixes #328 2014-06-03 06:28:16 -07:00
Torkel Ödegaard
4ce386c6dd updated changelog - merge 2014-06-03 06:10:32 -07:00
Torkel Ödegaard
8911da8380 updated changelog 2014-06-03 06:08:42 -07:00
Torkel Ödegaard
a3384d514f Merge pull request #461 from tmonk42/isNonNull
add graphite function isNonNull
2014-06-03 06:05:32 +02:00
Haneysmith, Nathan
b38f6e8062 add graphite function isNonNull 2014-06-02 16:01:42 -07:00
Clicky
6c006d0a78 Don't retry on http status codes >= 300
These status codes are likely to be to be unretryable errors coming from
influx (most likely bad queries)
2014-06-02 13:15:10 -07:00
Torkel Ödegaard
0f7a55d031 improved asset (css/js) build pipeline, added revision to css and js. Will remove issues related to the browser cache when upgrading grafana and improve load performance (Fixes #418) 2014-06-02 20:29:30 +02:00
Torkel Ödegaard
62af77979b Legend Current value did not display when value was zero, Fixes #460 2014-06-02 19:29:59 +02:00
Torkel Ödegaard
384687e19b Added parameter to keepLastValue graphite function definition (default 100), Closes #459 2014-06-02 19:17:05 +02:00
Torkel Ödegaard
f799ded434 worked on css and js asset reving, and angular partial precaching, still need to fix panel module.html, issue #418 2014-06-01 16:57:59 +02:00
Torkel Ödegaard
d499f4e0d0 build system changes 2014-05-31 15:32:00 +02:00
Torkel Ödegaard
fc7b4df98a working on angular partials pre caching, reving 2014-05-31 15:20:12 +02:00
Torkel Ödegaard
3f9a8ecc7e Merge branch 'master' of github.com:grafana/grafana 2014-05-31 12:28:55 +02:00
Torkel Ödegaard
71a801bbb7 updated changelog 2014-05-31 11:54:43 +02:00
Torkel Ödegaard
f333ef803a Merge pull request #455 from casa87/patch-1
influxdb:difference feature
2014-05-31 10:33:08 +02:00
Torkel Ödegaard
36b1dce7e4 trying to get css, and js build file revisioning working 2014-05-31 00:22:49 -07:00
Torkel Ödegaard
877ef36bc7 added css concat task 2014-05-30 22:46:39 -07:00
casa87
6ce242df4d Fix line length 2014-05-30 16:01:25 -07:00
casa87
9640f0251c influxdb:difference feature
Add support for the difference query from InfluxDB
2014-05-30 14:40:43 -07:00
Torkel Ödegaard
53846a15de fixed issue with influxdb datasource introduced in recent filterSrv refactoring 2014-05-29 22:17:01 -07:00
Torkel Ödegaard
1e4ff1e774 Added config setting for default playlist timespan 2014-05-29 21:05:49 -07:00
Torkel Ödegaard
0f40e06d93 Merge branch 'timespanconfig' of github.com:rmca/grafana into rmca-timespanconfig 2014-05-29 20:53:51 -07:00
Torkel Odegaard
86b204ac08 fixed failing unit test 2014-05-27 20:13:49 +02:00
Torkel Ödegaard
8cd5a9963f Fixes for filter option loading and nested filters. Fixes #447, Fixes #412 2014-05-27 19:21:21 +02:00
Torkel Ödegaard
df796e32eb fixed issue with filtersrv refactoring and removing filter parameter 2014-05-27 18:29:14 +02:00
Torkel Ödegaard
e2dae1f484 cleanup of unused code, small style changes 2014-05-27 18:18:05 +02:00
Torkel Ödegaard
8ca06e11de refactoring unsavedChangesSrv and who now owns original 2014-05-27 17:17:12 +02:00
Torkel Ödegaard
9f548b9dee filterSrv refactoring fixes 2014-05-27 16:39:16 +02:00
rob
31c75886c3 Making the default playlist timespan configurable. 2014-05-26 13:12:26 +01:00
Torkel Ödegaard
3e24a87ead trying to get this PR working. a lot has changed and is broken 2014-05-25 21:03:53 +02:00
Torkel Ödegaard
992bcccee9 Merge branch 'master' into Tetha-hkraemer-filtersrv-object-refactoring 2014-05-25 19:08:28 +02:00
Torkel Ödegaard
02bf5f9a58 updated changelog with PR #390, special characters in series names (influxdb) 2014-05-25 17:04:51 +02:00
Torkel Ödegaard
adaf9cbc90 merge PR #390 2014-05-25 17:00:51 +02:00
Clicky
f9ede4bae9 Check for negative return 2014-05-23 11:46:36 -07:00
Clicky
1fe9132761 Cleanup from jshint 2014-05-22 23:14:43 -07:00
Clicky
fe89c101df Add tooltip messages to icons in query editor. 2014-05-22 20:12:59 -07:00
Clicky
6cc7f012d8 Cleanup the influx query parsing 2014-05-22 20:09:02 -07:00
Clicky
3b82ac00d8 Fix typos in condition names 2014-05-22 18:18:22 -07:00
Clicky
9b4c64298b Hookup additional group by into UI
Allow additional group by fields to be specified without writing a full
on influx query by hand.
2014-05-22 18:11:04 -07:00
Clicky
4a4708e3fd Fix single line naming 2014-05-22 16:52:34 -07:00
Clicky
f231af07f9 Parse additional group by columns from a raw query
This needs some further polishing but now parse out additional group by
columns from a raw query, although it really only supports one
additional column.
2014-05-22 16:08:25 -07:00
Clicky
3da1c27692 Proof of concept of multiple groups using "host"
Initial test to make sure this plan works using a predefined alternate
group by. Now to actually figure this out based on the query and add
some UI for it.
2014-05-22 15:20:10 -07:00
Torkel Ödegaard
beca72cc40 filterSrv refactoring cleanup and testing 2014-05-20 16:18:24 +02:00
Torkel Ödegaard
5ea07d0f07 Merge branch 'hkraemer-filtersrv-object-refactoring' of github.com:Tetha/grafana into Tetha-hkraemer-filtersrv-object-refactoring 2014-05-20 15:45:46 +02:00
Harald Kraemer
674390dfa2 Fixed unsaved changes alerting about timechanges only. 2014-05-20 12:40:56 +02:00
Torkel Ödegaard
e47994013a updated changelog with PR #427 2014-05-20 12:04:23 +02:00
Torkel Ödegaard
6bbf2ff876 Merge pull request #427 from jippi/add-second-axis
Add seconds as a new axis formatter
2014-05-20 03:00:31 -07:00
Christian Winther
f7f567adc8 Add seconds as a new axis formatter 2014-05-20 08:55:19 +00:00
Harald Kraemer
e737b51e9d Removed 2 console.logs 2014-05-20 10:24:03 +02:00
Harald Kraemer
6f2dd2e2a5 Fixed an old method name 2014-05-20 10:23:49 +02:00
Harald Kraemer
36b44d6971 Moved init calls to setup method 2014-05-20 10:23:36 +02:00
Harald Kraemer
dcea2c5f4e Fixed last test + a mistake in other tests setup
- filterSrv expects the parameter to init to be the actual
   dashboard object (I'll depend on that later on), so
   I had to pass dashboard.current in there, instead of
   dashboard
 - in the last test, the problem was exactly that again.
2014-05-20 10:00:15 +02:00
Harald Kraemer
ed76d718cd Fixed setTime should disable refresh test
- init with dashboard mock
2014-05-20 09:56:50 +02:00
Harald Kraemer
00e1a1c442 Fixed timerange parsed = true test
- had to call init with dashboard mock
2014-05-20 09:54:07 +02:00
Harald Kraemer
f2b9ea1034 Fixed timerange unparsed
- had to call init with the dashboard mock, since this checks
   dashboard.refresh (need to look at that sometime)
2014-05-20 09:52:55 +02:00
Harald Kraemer
1cbc352c6c Fixed (filter->template)OptionSelected test
- small misunderstanding on my part, fixed the API in the filterSrv back
- renames to match my renames
- init script has to be called or fundefined things happen
2014-05-20 09:48:36 +02:00
Harald Kraemer
51b70a7884 Fixed init-test.
Mostly renames, new init semantic and I forgot to call
updateTemplateParams in addTemplateParameter
2014-05-20 09:43:57 +02:00
Harald Kraemer
d04f2d5e2b Renamed most filter-related things in filterSrv to template.
After all, we are using the function "template" to apply some
data we pull from the URL or other situations in order to call
a function called template. Hence, filtering doesn't make sense
as a term here.
2014-05-20 09:27:54 +02:00
Harald Kraemer
b1c9d5fd4a Warnings in filterSrv 2014-05-19 17:05:53 +02:00
Harald Kraemer
4b8b961705 Warnings in dashboardKeybindings.js 2014-05-19 17:04:59 +02:00
Harald Kraemer
2e26130d96 Warnings in graphiteTarget.js 2014-05-19 17:02:06 +02:00
Harald Kraemer
63c75f714f Warnings in dash.js 2014-05-19 17:01:09 +02:00
Harald Kraemer
03095dfa74 Changed filterSrv singleton into object in scope.
This rework isn't entirely complete here, I haven't
checked the tests yet and I didn't really test anything
furthermore yet, so bear with this commit breaking things.

Besides that, the goal of this commit was to rework the
filterSrv singleton into a factory, so we move the filterSrv
instance around via the scope. This should be a better solution
than the current situation, because services shouldn't contain
model data - the scope should.
This will eventually straighten out control flow between dashboard,
filters and so on, and allow us to leverage angularJS mechanics more.
The latter has already started, since I could rework a bit of the
existing event infrastructure to watches on times.
2014-05-19 15:31:30 +02:00
Harald Kraemer
f70bf61ff6 Added vim swp files to gitignore 2014-05-15 15:07:03 +02:00
Harald Kraemer
4a362704fd Moved dashboard keybinding setup to own service.
The goal is to split up the situation between the dashboard
controller and the current dashboard service. I want to be
able to use the routing in order to select various dashboard
controllers, so I can extend the current scripting
mechanism by implementing new dashboard controllers.

However, to do this in a non-insane way, I need to move as
much functionality as possible into services, so the individual
controllers just need to throw the right set of services
together and add a bit of loading logic.
2014-05-15 15:04:23 +02:00
Harald Kraemer
2c43fdc409 Merge branch 'master' of github.com:Tetha/grafana 2014-05-15 13:17:03 +02:00
Torkel Ödegaard
2a6a3a3af5 updated changelog 2014-05-13 20:20:28 +02:00
Torkel Ödegaard
d8e2192179 Updated version to 1.5.4 2014-05-13 19:08:46 +02:00
Torkel Ödegaard
cfc5fa87d0 Merge branch 'gridmin' of github.com:kamaradclimber/grafana into kamaradclimber-gridmin 2014-05-10 01:56:27 +02:00
Torkel Ödegaard
5ad95a1c3e Merge branch 'influxdb' of github.com:pmenglund/grafana into pmenglund-influxdb 2014-05-10 01:41:25 +02:00
Torkel Ödegaard
de8d456089 Merge branch 'master' of github.com:torkelo/grafana 2014-05-10 01:40:23 +02:00
Torkel Ödegaard
07610a5f92 small change to influxdb template to support older versions of influxdb 2014-05-10 01:40:08 +02:00
felixbarnsteiner
5d6998cf0b url decode metric names #327 2014-05-09 11:18:18 +02:00
Torkel Ödegaard
21b96068e4 Merge pull request #382 from ktoso/nanos-formatting
Added nanosecond y-scale formatting
2014-05-06 09:50:34 -07:00
Stefan Majer
c9df61c43c Quote timeseries names to be able to have special character such as @ in a seriename. 2014-05-06 08:42:49 +02:00
Stefan Majer
c1266abb98 Quote timeseries names to be able to have special character such as @ in a seriename. 2014-05-06 08:38:09 +02:00
Martin Englund
9dfb03aa0f use the influxdb built in time precision 2014-05-05 22:45:15 -07:00
Gregoire Seux
3a35dee0e3 Default to auto scaling for grid min setting
fixes #226
2014-05-05 09:33:45 +02:00
Torkel Ödegaard
f4568ef589 trying to get more unit tests working 2014-05-03 17:00:48 +02:00
Konrad 'ktoso' Malawski
f80871ce7e Added nanosecond y-scale formatting 2014-05-03 16:26:28 +02:00
Torkel Ödegaard
8fe4422d21 updated readme.md with new grafana organization urls 2014-05-01 15:00:56 +02:00
Torkel Ödegaard
c19fafa581 Improvement to series toggling, CTRL+MouseClick on series name will now hide all others (Closes #350) 2014-05-01 11:18:23 +02:00
Marco Vito Moscaritolo
cc43f15eab InfluxDB Filters: added filter to queries. 2014-05-01 00:44:42 +02:00
Marco Vito Moscaritolo
bfecb04697 InfluxDB Filters: added function to generate filter list. 2014-05-01 00:43:34 +02:00
Harald Kraemer
52e1f5273c Extracted multi-graphite query function, fixed loadRecursive
The new function in metricKeys generalizes what my loadAll
from the previous commit did, it takes a request and a
callback. The request is executed on each graphite installation
and the callback is executed for each result. This makes
implementing loadAll and loadRecursive almost as simple as
it was.
2014-04-30 13:13:51 +02:00
Torkel Ödegaard
2b5e974132 updated changelog with PR #369 2014-04-30 10:37:50 +02:00
Torkel Ödegaard
e3d7e3c195 Merge pull request #369 from jbripley/influxdb-columnname-escape
Change InfluxDB SQL generation template to wrap column names in quoutes
2014-04-30 10:33:47 +02:00
Joakim Bodin
11446b3e53 Change InfluxDB SQL generation template to wrap column names in quoutes
Since column names can contain dots or dashes, which will give syntax errors from InfluxDB API, unless wrapped in quoutes
2014-04-30 10:22:22 +02:00
Harald Kraemer
637c720de5 Modified metricKeys to handle multiple graphite sources.
This wasn't all too hard to change, I mostly changed the
single http get to multiple http gets, one for each data
source of type graphite.

It's still not a good idea to call this on the web
frontend, since the whole thing was working for about
20 - 30 minutes when I clicked it, so I'm not
committing my changes to settings.js or the view itself.
2014-04-30 09:40:06 +02:00
Torkel Ödegaard
0dae8f9977 removed unused function 'endsWithWildcard', fixes jshint error 2014-04-28 20:08:25 +02:00
Torkel Ödegaard
9c5674a076 Fixes to filters and the 'All' option. It now never uses '*' as value, but all options in a {node1, node2, node3} expression (Closes #228, Closes #359) 2014-04-28 19:58:25 +02:00
Torkel Ödegaard
35368442ec Merge pull request #356 from Tetha/master
Fixed an exception when adding a graphite function.
2014-04-28 12:09:49 +02:00
Torkel Ödegaard
035b5163fb Merge branch 'unsaved_changes_warning' (Closes #324) 2014-04-27 12:28:57 +02:00
Torkel Ödegaard
a1d5e26f6b Added onbeforeunload check to unsaved changes warning feature 2014-04-27 12:27:06 +02:00
Torkel Ödegaard
bdd2c9d033 More work on unsaved changes warning (Issue #324) 2014-04-27 12:22:38 +02:00
Torkel Ödegaard
8ad00faebc small progress on unsaved changes warning 2014-04-25 16:50:35 +02:00
Harald Kraemer
061bfffd4d Fixed an exception when adding a graphite function.
The error was that funcDef is just a string parsed from an event
like onMouseDown or something like that. This event is turned
into a function instance, and the function instance has
expected parameters and so forth. However, the number of
parameters was actually checked on the funcDef.
2014-04-25 16:48:17 +02:00
Torkel Ödegaard
bfb2376aa3 working on unsaved changes warning 2014-04-25 15:23:17 +02:00
Torkel Ödegaard
9e4656e43f New config setting for graphite datasource to control if json render request is POST or GET (Closes #345) 2014-04-24 17:58:34 +02:00
Torkel Ödegaard
c26926148c began work on unsaved changes warning when changing dashboard, Issue #324 2014-04-23 21:16:53 +02:00
Torkel Ödegaard
827e1846a8 Closes #333, New version availability check will now checks http://grafanarel.s3.amazonaws.com/latest.json if there is a new version. And the link now points to http://grafana.org/download 2014-04-23 09:05:10 +02:00
Torkel Ödegaard
2f58aa280c Review and small refactoring of PR #331 2014-04-22 13:08:14 +02:00
Torkel Ödegaard
66db99faf8 Merge branch 'feature/influxdb-add-where-conditions' of github.com:mavimo/grafana into mavimo-feature/influxdb-add-where-conditions 2014-04-22 12:38:15 +02:00
Torkel Ödegaard
0efafc50dc Increased resolution for graphite datapoints (maxDataPoints), now equal to panel pixel width. (Closes #5) 2014-04-22 12:01:51 +02:00
Marco Vito Moscaritolo
595aab4edf removed unrequired variable (error on merge from master) 2014-04-21 18:14:30 +02:00
Marco Vito Moscaritolo
02696c8bca better variable naming 2014-04-21 18:13:05 +02:00
Marco Vito Moscaritolo
01f3d728ef Added labels per series management 2014-04-21 18:07:55 +02:00
Marco Vito Moscaritolo
bba76cac4d Added conditions management 2014-04-21 18:07:24 +02:00
Marco Vito Moscaritolo
72ab721f22 Added where condiction operators 2014-04-21 18:06:13 +02:00
Marco Vito Moscaritolo
f98db943a5 Merge branch 'master' into feature/influxdb-add-where-conditions
Conflicts:
	src/app/partials/influxdb/editor.html
	src/app/services/influxdb/influxdbDatasource.js
2014-04-21 16:32:05 +02:00
Marco Vito Moscaritolo
f122da58c1 added support to coustom where conditions 2014-04-21 16:20:08 +02:00
Torkel Ödegaard
125db1777a influxdb editor: rawquery text input, changed from fixed pixel width to span10 class 2014-04-20 14:17:25 +02:00
Torkel Ödegaard
c592db4024 Merge branch 'influxdb-updates' of github.com:influxdb/grafana into influxdb-influxdb-updates 2014-04-20 13:59:31 +02:00
Torkel Ödegaard
02af2dbe73 Added rounding for graphites from and to time range filters
for very short absolute ranges (Fixes #320)
2014-04-18 16:06:55 +02:00
Torkel Ödegaard
b1bd04566e updated changelog 2014-04-17 22:36:12 +02:00
Torkel Odegaard
15288b0e84 version bump to 1.5.3 2014-04-17 22:27:19 +02:00
Torkel Ödegaard
dfaa529fa3 updated readme 2014-04-17 14:33:09 +02:00
Torkel Ödegaard
ef54bb1b7c Merge pull request #323 from magicrobotmonkey/slideshow_leak
unbind resize event during slideshow
2014-04-17 09:52:48 +02:00
Todd Persen
b3e459863e Add support for multiple hosts (with retries) and raw queries. 2014-04-16 09:54:25 -04:00
Aaron Bassett
ada56ea8ce unbind resize event during slideshow 2014-04-16 09:52:29 -04:00
Torkel Ödegaard
8ca589cdf5 Support for async scripted dashboards, and accesss to jquery, window & document, Closes #274) 2014-04-16 14:57:35 +02:00
Torkel Odegaard
390c4eed7e Revert "Merge pull request #310 from roidelapluie/master"
This reverts commit 9fc93e285c, reversing
changes made to 30bf838065.
2014-04-15 19:56:35 +02:00
Torkel Ödegaard
9fc93e285c Merge pull request #310 from roidelapluie/master
Reload filters when loading page
2014-04-15 19:50:46 +02:00
Julien Pivotto
1f417f0606 Reload filters when loading page
This commit refreshes the dynamic filters when loading page.
2014-04-14 14:47:39 +02:00
Torkel Ödegaard
30bf838065 added smartSummarize graphite function definition 2014-04-14 08:17:42 +02:00
Torkel Ödegaard
0019101f0e clarified timezoneOffset setting 2014-04-13 15:01:06 +02:00
Torkel Ödegaard
75b2e383c2 Merge branch 'auto_tz' of github.com:magicrobotmonkey/grafana into magicrobotmonkey-auto_tz 2014-04-13 13:45:08 +02:00
Torkel Ödegaard
b5830e0cde Merge pull request #307 from awilliams/patch-1
Fixes documentation typo
2014-04-11 16:33:35 +02:00
Adam Williams
e9dcf0e00b Fixes documentation typo 2014-04-11 15:22:20 +02:00
Torkel Ödegaard
ccd5c01d91 Merge pull request #306 from cruatta/master
Grafana needs hideLegend=false in graphite urls when show legend is selected for Graphite PNG
2014-04-11 11:25:30 +02:00
Cameron Ruatta
2ea3f7a558 Changing behavior to always obey the show legend option in grafana. without hideLegend=false, grafana defaults to the graphite behavior of hiding the legend at (default 10) X number of series. Also should be checking scope.panel.legend.show. 2014-04-10 14:10:29 -07:00
Torkel Ödegaard
993a2daccc fixed failing unit test, added 2 more for setTime & auto refresh behavior 2014-04-10 12:44:19 +02:00
Torkel Ödegaard
541baac49e Closes #282, Disable auto refresh zooming in (every time you change to an absolute time range), refresh will be restored when you change time range back to relative 2014-04-10 12:28:06 +02:00
Torkel Ödegaard
d69b04e9ed Closes #294, Browser page title is now Grafana - {{dashboard title}} 2014-04-10 12:12:15 +02:00
Torkel Ödegaard
78fab41310 Merge pull request #303 from jaimegago/master
Update README.md
2014-04-10 08:58:36 +02:00
Jaime Gago
4502ed068d Update README.md
Caveat about using "*" in CORS
2014-04-09 12:56:31 -07:00
Torkel Ödegaard
5495e0f96a Fixes #302, year dates in changelog was 2013, now corrected to 2014, thx LordFPL for spotting this 2014-04-09 12:36:35 +02:00
Torkel Ödegaard
60a8fe31f1 Fixes #297, filter remove fix 2014-04-08 20:51:26 +02:00
Torkel Ödegaard
93ab2a93d4 updated changelog 2014-04-08 20:51:26 +02:00
Aaron Bassett
688c21cd94 added little workraround for graphites timezones/DST failures 2014-04-08 09:56:00 -04:00
Torkel Ödegaard
39e19fdfba Merge pull request #295 from jaimegago/master
Update dashLoader.js
2014-04-07 14:21:40 -04:00
Jaime Gago
5525ccc409 Update dashLoader.js
Remove "Kibana" left overs in dashboard alerts
2014-04-07 11:13:18 -07:00
Torkel Ödegaard
db9949d403 Fixes #291, row height correction bug fixed 2014-04-07 08:33:52 +02:00
Torkel Ödegaard
f36d91336a Fixes #289, PanelBaseCtrl needs to specify inject dependency annotations as it doesnt follow regular angular controller syntax, ngmin grunt task misses it 2014-04-06 12:44:00 +02:00
Torkel Ödegaard
da13de6af5 fixed failing unit test 2014-04-06 11:07:22 +02:00
Torkel Ödegaard
4029dc3165 Added jshint file for unit tests, and grunt task to verify test syntax. 2014-04-06 10:47:14 +02:00
Torkel Ödegaard
6795383461 Fixes #106. Css fix for Firefox and using top menu dropdowns in panel fullscren / edit mode 2014-04-06 09:53:07 +02:00
Torkel Ödegaard
305d5c5aa9 Fixes #189, correction to ms axis formater, now formats days correctly 2014-04-06 09:17:43 +02:00
Torkel Ödegaard
49492e7bca Removed panel title hide feature I added yesterday, could not get it right right now. 2014-04-06 09:17:43 +02:00
Torkel Odegaard
bd0e96f166 small fix: (lowercase) file name tp panelBaseCtrl 2014-04-05 21:37:03 +02:00
Torkel Ödegaard
2e7b145a81 css fix for legend color selector popover 2014-04-05 19:29:14 +02:00
Torkel Ödegaard
6f114b17d6 Closes ##278, improvements in row height matching, refactorings of base kibana panel features into PanelBaseCtrl 2014-04-05 19:22:24 +02:00
Torkel Ödegaard
5cd73cea4b small code cleanup in grafanaGraph 2014-04-05 19:22:23 +02:00
Torkel Ödegaard
347f6aed3f small code cleanup in grafanaGraph 2014-04-05 19:22:23 +02:00
Torkel Ödegaard
24ea23ce83 Merge pull request #283 from ragzilla/master
use influxdb aliases to distinguish between multiple columns
2014-04-05 10:15:25 -04:00
Torkel Ödegaard
5cb4cfcdd2 Closes #265, Graphite errors are now easier to troubleshoot with the new inspector! 2014-04-05 16:04:49 +02:00
Torkel Ödegaard
58ef61a0bb working on inspector 2014-04-05 13:26:48 +02:00
Matt Addison
58a494f33f fix for jslint maxlen 2014-04-04 13:58:23 -04:00
Matt Addison
c97213f177 use influxdb aliases to distinguish between multiple columns in a single series 2014-04-03 22:49:10 -04:00
Torkel Ödegaard
a9abd2ff5c began work in inspector feature for easy troubleshooting, Issue #265 2014-04-03 22:22:38 +02:00
Torkel Ödegaard
8cba594070 Merge branch 'master' of github.com:nikicat/grafana into nikicat-master 2014-04-03 12:45:08 +02:00
Torkel Ödegaard
f2c9cc17df #Closes #269, changed byte and bit formats to conform with IEC standard symbols, like Kib, Mib for bits, and KiB, MiB, GiB for bytes 2014-04-03 12:42:50 +02:00
Torkel Ödegaard
1a34c2eee3 Merge pull request #280 from syepes/add_functions_v2
Add rangeOfSeries,sortByTotal,removeAbove*,removeBelow*
2014-04-03 02:48:11 -04:00
Nikolay Bryskin
a1632e4874 identation fixed 2014-04-03 02:38:01 +04:00
Sebastian YEPES
9534fccebf Add rangeOfSeries,sortByTotal,removeAbove*,removeBelow* 2014-04-03 00:37:02 +02:00
Nikolay Bryskin
ae9d9ea284 import from graphite: set correct datasource for panel 2014-04-03 02:11:58 +04:00
Nikolay Bryskin
8ea4351797 import from non-default dashboard support 2014-04-03 01:35:49 +04:00
Torkel Odegaard
34a18514b6 Fixes #271, renamed Export schema to Export dashboard 2014-04-01 21:42:05 +02:00
Torkel Ödegaard
7248358ac1 Merge pull request #268 from ImmobilienScout24/feature/linebreak_in_annotations_tooltip
replace linebreaks with <br/> in data section of tooltip.
2014-04-01 09:18:28 -04:00
Jan Gaedicke
9e1e7be574 replace linebreaks with <br/> in data section of tooltip. 2014-04-01 15:14:15 +02:00
Torkel Ödegaard
18e0a60b9e Fixes 267, Functions without params (like integral) now causes graph to update correctly 2014-04-01 12:39:05 +02:00
Torkel Ödegaard
c727863616 Merge pull request #255 from bobrik/patch-1
Fixed installation instructions for config.js
2014-03-31 12:40:46 -04:00
Torkel Ödegaard
75fc0c7017 Merge pull request #256 from bobrik/undefined-length-fix
Fixed annoying undefined length error
2014-03-31 12:35:38 -04:00
Ian Babrou
e3b046aecf fixed annoying undefined length error 2014-03-31 18:53:43 +04:00
Ian Babrou
046f80b9f2 Fixed installation instructions for config.js
Because you cannot edit the file which does not even exist.
2014-03-31 18:22:55 +04:00
Torkel Ödegaard
b1b54740f4 Merge branch 'html_unsafe' of github.com:bruce-lyft/grafana into bruce-lyft-html_unsafe 2014-03-30 16:41:50 +02:00
Torkel Ödegaard
0c1bc378ba updated changelog 2014-03-30 16:40:54 +02:00
Torkel Ödegaard
d067b69d20 Fixes #251, text panel change is now updating panel correctly. Changed button text from Cancel to Close 2014-03-30 15:00:09 +02:00
Torkel Ödegaard
ba928e18bf Merge pull request #245 from magicrobotmonkey/add_functions
Add transformNull, minSeries and maxSeries
2014-03-29 05:00:41 -04:00
Torkel Ödegaard
2d89cb0978 Merge pull request #248 from syepes/add_functions
Add functions: sortByMaxima,sortByMinima,limit,mostDeviant,movingMedian,stdev
2014-03-29 04:59:50 -04:00
Sebastian YEPES
c7c88902bd Add sortByMaxima,sortByMinima,limit,mostDeviant,movingMedian,stdev 2014-03-28 22:23:33 +01:00
Aaron Bassett
8d7669bc08 added min and max 2014-03-28 09:12:25 -04:00
Aaron Bassett
1cff3a6751 add transformNull 2014-03-28 09:12:20 -04:00
Torkel Ödegaard
6100336b2a Merge pull request #237 from maage/some-graphite-func-definitions
Some graphite func definitions
2014-03-27 10:18:36 -04:00
Torkel Ödegaard
da7455f859 Merge pull request #238 from maage/bits-y-axis-format
Fixes #148 add bits format for Y-Axis
2014-03-27 10:17:01 -04:00
Markus Linnala
5ec525a430 add bits format for Y-Axis 2014-03-27 15:58:04 +02:00
Markus Linnala
863e58a8e7 add support for graphite functions: maximumAbove maximumBelow minimumAbove 2014-03-27 15:18:01 +02:00
Markus Linnala
e441e97030 add support for graphite func substr 2014-03-27 15:17:51 +02:00
Markus Linnala
2b0152f6f4 add support for graphite func consolidateBy 2014-03-27 15:17:46 +02:00
Bruce Sherrod
eb20c5bb43 make html-unsafe for text/html panels 2014-03-26 12:00:08 -07:00
Bruce Sherrod
89c8547820 Merge branch 'master' of github.com:bruce-lyft/grafana 2014-03-26 11:52:00 -07:00
Torkel Ödegaard
5087cd2b19 Fixes #225, grid min not sent to graphite png renderer when set to 0 2014-03-26 11:51:52 -07:00
Torkel Ödegaard
06e9256050 Closes #209, sub folder with project name and version suffix in release zip files 2014-03-26 11:51:52 -07:00
Torkel Ödegaard
8aff6f50db Fixes #223, float arguments to functions like scale should now work as expected 2014-03-26 11:51:52 -07:00
Torkel Ödegaard
b2aca66e2d aliasByNode support for second node param, Closes #167 2014-03-26 11:51:52 -07:00
Marco Vito Moscaritolo
add61cf783 Moved function definition out of template. 2014-03-26 11:51:52 -07:00
Marco Vito Moscaritolo
a549bd73f9 Added more query function in InfluxDB 2014-03-26 11:51:51 -07:00
Torkel Ödegaard
f849b8cd4b fixed build issues with last commit (spec file syntax error) 2014-03-26 11:51:51 -07:00
Torkel Ödegaard
d8cf427425 more work on filterSrv unit tests 2014-03-26 11:51:51 -07:00
Torkel Ödegaard
517ac3f111 added unit tests for filterSrv 2014-03-26 11:51:51 -07:00
Jaime Gago
43f1cfba5a Fix a "kibana" leftover in comments 2014-03-26 11:51:51 -07:00
Torkel Ödegaard
dd18b6c836 Adds support to have filters inside filters, (nested templated segments), Closes #128 2014-03-26 11:51:51 -07:00
Bruce Sherrod
d8b86a899d Merge remote-tracking branch 'remotes/torkelo/master' 2014-03-24 12:35:12 -07:00
Torkel Ödegaard
ed9e336c51 Fixes #225, grid min not sent to graphite png renderer when set to 0 2014-03-24 13:17:27 +01:00
Torkel Ödegaard
94fea502b9 Closes #209, sub folder with project name and version suffix in release zip files 2014-03-24 12:51:49 +01:00
Torkel Ödegaard
1e79e39161 Fixes #223, float arguments to functions like scale should now work as expected 2014-03-24 12:20:28 +01:00
Torkel Ödegaard
6f9c2211fa aliasByNode support for second node param, Closes #167 2014-03-24 09:57:03 +01:00
Torkel Ödegaard
2e1e7462dc Merge pull request #218 from mavimo/feature/influx-query-functions
[InfluxDB] Added more query functions
2014-03-23 16:08:34 -04:00
Marco Vito Moscaritolo
6fb36acc9a Moved function definition out of template. 2014-03-23 20:20:18 +01:00
Marco Vito Moscaritolo
f35baffbef Added more query function in InfluxDB 2014-03-23 18:52:56 +01:00
Torkel Ödegaard
69b9189220 fixed build issues with last commit (spec file syntax error) 2014-03-23 16:04:21 +01:00
Torkel Ödegaard
06fe572113 more work on filterSrv unit tests 2014-03-23 07:03:43 +01:00
Torkel Ödegaard
dfd1d09641 added unit tests for filterSrv 2014-03-23 07:03:43 +01:00
Bruce Sherrod
6d981afcbc Merge branch 'master' of github.com:bruce-lyft/grafana 2014-03-19 13:38:08 -07:00
Bruce Sherrod
f90db0ed50 make html-unsafe for text/html panels 2014-03-19 13:37:29 -07:00
Bruce Sherrod
9894023177 make html-unsafe for text/html panels 2014-03-19 13:36:52 -07:00
Torkel Ödegaard
5ac6d28abf Merge pull request #213 from jaimegago/master
Fix a "kibana" leftover in comments
2014-03-19 06:05:55 +01:00
Jaime Gago
b813f48a7e Fix a "kibana" leftover in comments 2014-03-18 17:53:57 -07:00
Torkel Ödegaard
a3b4e40982 Adds support to have filters inside filters, (nested templated segments), Closes #128 2014-03-18 21:08:51 +01:00
Torkel Ödegaard
0c42b9a68e Merge pull request #212 from andrewmichaelsmith/log_func
Add logarithmic scale function
2014-03-18 21:08:31 +01:00
Andy Smith
48d3317136 Add logarithmic scale function 2014-03-18 19:36:31 +00:00
Matt Page
30b62e172d Add an OpenTSDB datasource.
This adds support for querying OpenTSDB for metric data.
2014-03-18 12:21:40 -07:00
Torkel Ödegaard
5a0fa8c09f added phantomjs karma test to run in travis 2014-03-18 20:04:04 +01:00
Torkel Ödegaard
0a6b393b35 fixed karama tests 2014-03-18 19:27:42 +01:00
Torkel Ödegaard
dadae53e51 Merge branch 'master' of github.com:torkelo/grafana 2014-03-17 17:25:21 +01:00
Torkel Ödegaard
c22c4b864c fixed string replace issue that caused problems, this removes build cache busting in requirejs, will need to fix that later 2014-03-17 17:24:38 +01:00
Torkel Ödegaard
aa27c13b20 Merge pull request #208 from fstern/master
Added graphite functions: nPercentile and keepLastValue
2014-03-17 11:31:06 +01:00
Bruno Renié
50771b0762 Workaround a behavior modification probably in grunt-string-replace 2014-03-16 20:50:15 +01:00
Torkel Ödegaard
336cf768d8 Merge pull request #194 from danharvey/add-hitcount-function
Added hitcount Transform function.
2014-03-12 09:57:47 +01:00
Dan Harvey
a76d9b87f0 Improved markdown formatting in the contributing page. 2014-03-12 08:23:28 +00:00
Dan Harvey
5794fc533f Added hitcount Transform function. 2014-03-11 18:43:55 +00:00
Torkel Ödegaard
9ebf769b4d Fixes #191, update graph after adding new function and not changing default value 2014-03-11 13:00:28 +01:00
Falk Stern
2ea21e1f96 Added nPercentile and keepLastValue 2014-03-11 12:06:30 +01:00
Torkel Ödegaard
b396563235 Merge pull request #185 from nikicat/master
added graphite functions: percentileOfSeries, sumSeriesWithWildcards, averageSeriesWithWildcards
2014-03-10 14:17:15 +01:00
Nikolay Bryskin
c5b992e330 added graphite functions: percentileOfSeries, sumSeriesWithWildcards, averageSeriesWithWildcards 2014-03-10 17:04:34 +04:00
Torkel Ödegaard
ec6fae9e65 Merge pull request #183 from merc1031/master
round up maxDataPoints to nearest integer in request. graphite 0.9.x and...
2014-03-10 11:11:24 +01:00
Leonidas Loucas
7f5c6ca18d round up maxDataPoints to nearest integer in request. graphite 0.9.x and 0.9.12 seem to treat decimal maxDataPoints badly returning enourmous amounts of data 2014-03-10 02:50:11 -07:00
Torkel Odegaard
9de60a9a7c updated readme and changelog 2014-03-09 19:12:02 +01:00
Torkel Odegaard
3f64f5a5fc updated readme and version bump 2014-03-09 18:02:04 +01:00
Torkel Ödegaard
7b036cbe3c Merge branch 'playlist' Closes #36 2014-03-08 16:27:26 +01:00
Torkel Ödegaard
5100834156 worked on favorites feature and dashboard playlist, #36 2014-03-08 16:27:01 +01:00
Torkel Ödegaard
a387d48b48 began work on dashboard playlist feature, #36 2014-03-07 19:24:45 +01:00
Torkel Ödegaard
adfa341d6e Merge branch 'new_func_editor' 2014-03-07 15:07:11 +01:00
Torkel Ödegaard
0b03ca158b final touches to aliasByNode automatic stuff 2014-03-07 15:07:02 +01:00
Torkel Ödegaard
d9e6fcd730 move func left right, remove, and link to graphite docs works 2014-03-07 13:43:44 +01:00
Torkel Ödegaard
feb20243e5 added func controls 2014-03-07 13:14:41 +01:00
Torkel Ödegaard
e3e6f511e7 focus first input param after adding function 2014-03-07 09:42:07 +01:00
Torkel Ödegaard
293a2db369 func editor is almost done 2014-03-06 22:08:41 +01:00
Semir Patel
1c72e0c40c Support graphite identifiers with embedded colons. i.e. host:twiggy.servlet:home.method:GET.user:loggedin.50th 2014-03-06 11:37:33 -08:00
Torkel Ödegaard
3e6a4362ee Merge branch 'master' into new_func_editor 2014-03-05 18:57:26 +01:00
Torkel Ödegaard
3b327bab8f Fixes to maxDataPoints / resolution and time axis formats 2014-03-05 18:37:51 +01:00
Torkel Ödegaard
a50b594aac added changelog and contributing docs 2014-03-05 13:02:33 +01:00
Torkel Ödegaard
e186c9b8bc experimenting with new func editor 2014-03-05 12:46:27 +01:00
Torkel Ödegaard
a5502a3751 added typeahead to column for influxdb, #103 2014-03-05 12:43:58 +01:00
Torkel Ödegaard
bd0f694f6a small refactoring and jshint fix for datasourceFactory func 2014-03-04 22:01:25 +01:00
Torkel Ödegaard
c018b4bd6e fix for influxdb as default datasource, #103 2014-03-04 21:49:06 +01:00
Torkel Ödegaard
2be71c577c Closes #164, typeahead / autocomplete for adding graphite functions to a target expression 2014-03-04 18:50:47 +01:00
Torkel Ödegaard
238de4d8b4 Merge pull request #162 from nixfloyd/master
Added currentAbove/Below, highestMax functions.
2014-03-04 09:57:18 +01:00
Lucian Grosu
6664890381 Added currentAbove/Below, highestMax functions. 2014-03-04 09:40:15 +01:00
Torkel Ödegaard
5221db5aa6 restored influxdb listSeries function 2014-03-03 08:39:05 +01:00
Torkel Ödegaard
1e6d998a9c fixed path to influxdb editor, #103 2014-03-03 06:53:50 +01:00
Torkel Ödegaard
da62a5653a added typeahead / autocomplete to influxdb series name, #103 2014-03-02 18:24:15 +01:00
Torkel Ödegaard
125ff957f5 Merge branch 'influxdb' Issue #103, influxdb support ready for testing and feedback 2014-03-02 13:27:02 +01:00
Torkel Ödegaard
73dcd9e11a improvement to bar width 2014-03-02 13:26:08 +01:00
Torkel Ödegaard
50fd5512d6 more work on influxdb datasource, query editor, and refactoring 2014-03-02 10:41:16 +01:00
Torkel Ödegaard
291dd9bd48 absolute time ranges (zoom in) works with influxdb 2014-03-01 15:38:00 +01:00
Torkel Ödegaard
549eeeb29d progress on influxdb datasource and target editor 2014-03-01 12:02:55 +01:00
Torkel Ödegaard
6d59d21770 Merge pull request #154 from jmhobbs/master
Fix variable name for graphite basic auth.
2014-02-28 20:30:02 +01:00
John Hobbs
2ee1063485 Fix variable name for graphite basic auth. 2014-02-28 13:16:24 -06:00
Torkel Ödegaard
75bec29dbc moving stuff out of graphite panel and into kibanaPanel 2014-02-28 16:40:32 +01:00
Torkel Ödegaard
20bc1afec8 more refactoring and moving stuff outof graphite panel 2014-02-28 08:02:20 +01:00
Torkel Ödegaard
e3f56f2645 refactoring of graphite panel to be more datasource agnostic, start of experimental influxdb support 2014-02-27 21:46:06 +01:00
Torkel Ödegaard
ed2770e380 Merge branch 'master' into refactoring_graphite_panel 2014-02-27 20:10:29 +01:00
Torkel Ödegaard
bb6d8ec99f Merge pull request #150 from jippi/better-ms-formatting
allow hour, day, week and year time rounding
2014-02-27 18:27:42 +01:00
Christian Winther
ddb81de58b allow hour, day, week and year time rounding 2014-02-27 15:01:03 +00:00
Torkel Ödegaard
cf9a8a15cd refactoring graphite panel 2014-02-27 08:33:53 +01:00
Torkel Odegaard
c4219ba0ad Refactoring time formats, Closes #142 2014-02-26 19:46:58 +01:00
Khushil Dep
47e54b2399 typo fix 2014-02-26 19:46:58 +01:00
Khushil Dep
215fe16341 fix jslint issues 2014-02-26 19:46:58 +01:00
Khushil Dep
218d481209 Add the ability to set microseconds to the Y-Axis on graphs. 2014-02-26 19:46:57 +01:00
Torkel Ödegaard
78f4a83d05 Merge pull request #145 from nixfloyd/master
Added highestAverage / lowestAverage
2014-02-26 16:56:26 +01:00
Lucian Grosu
733181a6b8 Added highestAverage / lowestAverage 2014-02-26 12:37:16 +01:00
Torkel Ödegaard
d79dcb952d Refactoring pull request for basic auth improvement 2014-02-26 08:50:46 +01:00
Theral Mackey
bb64e812d8 Bugfix for Basic Auth: strip auth from url before using
This fixes the Basic Auth not working issue (issue#16) further, by
removing the auth string from the URL before grafana attempts to use
it. Some js doesn't handle it properly and tries to include the auth
string in dns lookups(?), so the request never even hits the graphite
server when an auth string is present.
2014-02-26 08:50:45 +01:00
Torkel Odegaard
9a324e35a4 added small text to show when no datapoints are returned and when datapoints returned from graphite are outside timerange (can happen when timezone mismatch) #143 2014-02-26 08:31:04 +01:00
Torkel Odegaard
605888bb78 finished refactoring of GraphiteDatasource to angular service and fixed jshint errors 2014-02-25 21:31:30 +01:00
Torkel Ödegaard
ef69d692ef Time is now sent in utc when time correction is set to utc #143 2014-02-25 17:48:13 +01:00
Torkel Ödegaard
a54f05e287 Merge pull request #140 from nixfloyd/master
Added the 'stacked' and 'lowestCurrent' functions
2014-02-25 13:09:34 +01:00
Lucian Grosu
4b0cd0776d Added the 'stacked' and 'lowestCurrent' functions 2014-02-25 12:21:56 +01:00
Torkel Ödegaard
4b75d67732 Fixes #135, show seconds in x-axis when zooming in for short time ranges 2014-02-25 07:33:27 +01:00
Torkel Ödegaard
1ca61a948e Fixes #138, Ignore graphite metric annotations with zero values 2014-02-24 16:50:10 +01:00
Torkel Ödegaard
e13c81e25b Merge pull request #137 from razitz/master
added exclude function
2014-02-24 09:04:58 +01:00
Raz
b69652fc0c added exclude function 2014-02-24 10:01:58 +02:00
Torkel Odegaard
0949b7ec0a fixed jshint error 2014-02-23 19:45:40 +01:00
Torkel Ödegaard
75683c423d Closes #123, you can now specify template (ie filter) values in url. ?fillterName=filterValue 2014-02-23 19:34:33 +01:00
Torkel Ödegaard
3f2c69aea3 Merge pull request #131 from nikicat/master
added movingAverage function
2014-02-21 20:06:22 +01:00
Nikolay Bryskin
9adc3941b9 added movingAverage function 2014-02-21 21:37:23 +04:00
1564 changed files with 451471 additions and 68732 deletions

3
.bowerrc Normal file
View File

@@ -0,0 +1,3 @@
{
"directory": "public/vendor/"
}

17
.bra.toml Normal file
View File

@@ -0,0 +1,17 @@
[run]
init_cmds = [
["go", "build", "-o", "./bin/grafana-server"],
["./bin/grafana-server"]
]
watch_all = true
watch_dirs = [
"$WORKDIR/pkg",
"$WORKDIR/public/views",
"$WORKDIR/conf",
]
watch_exts = [".go", "conf/*"]
build_delay = 1500
cmds = [
["go", "build", "-o", "./bin/grafana-server"],
["./bin/grafana-server"]
]

32
.gitignore vendored
View File

@@ -1,6 +1,30 @@
node_modules
coverage/
.aws-config.json
dist
web.config
config.js
*.sublime-workspace
awsconfig
/dist
/tmp
docs/AWS_S3_BUCKET
docs/GIT_BRANCH
docs/VERSION
docs/GITCOMMIT
docs/changed-files
docs/changed-files
# locally required config files
public/css/*.min.css
# Editor junk
*.sublime-workspace
*.swp
.idea/
*.iml
/data/*
/bin/*
conf/custom.ini
fig.yml
profile.cov

7
.hooks/pre-commit Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
test -z "$(gofmt -s -l . | grep -v Godeps/_workspace/src/ | tee /dev/stderr)"
if [ $? -gt 0 ]; then
echo "Some files aren't formatted, please run 'go fmt ./pkg/...' to format your source code before committing"
exit 1
fi

13
.jscs.json Normal file
View File

@@ -0,0 +1,13 @@
{
"disallowImplicitTypeConversion": ["string"],
"disallowKeywords": ["with"],
"disallowMultipleLineBreaks": true,
"disallowMixedSpacesAndTabs": true,
"disallowTrailingWhitespace": true,
"requireSpacesInFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInsideArrayBrackets": true,
"disallowSpacesInsideParentheses": true,
"validateIndentation": 2
}

21
.jsfmtrc Normal file
View File

@@ -0,0 +1,21 @@
{
"preset" : "default",
"lineBreak" : {
"before" : {
"VariableDeclarationWithoutInit" : 0,
},
"after": {
"AssignmentOperator": -1,
"ArgumentListArrayExpression": ">=1"
}
},
"whiteSpace" : {
"before" : {
},
"after" : {
}
}
}

View File

@@ -18,12 +18,12 @@
"noempty": true,
"undef": true,
"boss": true,
"trailing": false,
"trailing": true,
"laxbreak": true,
"laxcomma": true,
"sub": true,
"unused": true,
"maxdepth": 5,
"maxlen": 140,
"globals": {

View File

@@ -1,5 +0,0 @@
language: node_js
node_js:
- "0.10"
before_script:
- npm install -g grunt-cli

566
CHANGELOG.md Normal file
View File

@@ -0,0 +1,566 @@
# 2.1.0 (2015-08-04)
**Data sources**
- [Issue #1525](https://github.com/grafana/grafana/issues/1525). InfluxDB: Full support for InfluxDB 0.9 with new adapted query editor
- [Issue #2191](https://github.com/grafana/grafana/issues/2191). KariosDB: Grafana now ships with a KariosDB data source plugin, thx @masaori335
- [Issue #1177](https://github.com/grafana/grafana/issues/1177). OpenTSDB: Limit tags by metric, OpenTSDB config option tsd.core.meta.enable_realtime_ts must enabled for OpenTSDB lookup api
- [Issue #1250](https://github.com/grafana/grafana/issues/1250). OpenTSDB: Support for template variable values lookup queries
**New dashboard features**
- [Issue #1144](https://github.com/grafana/grafana/issues/1144). Templating: You can now select multiple template variables values at the same time.
- [Issue #1922](https://github.com/grafana/grafana/issues/1922). Templating: Specify multiple variable values via URL params.
- [Issue #1888](https://github.com/grafana/grafana/issues/1144). Templating: Repeat panel or row for each selected template variable value
- [Issue #1888](https://github.com/grafana/grafana/issues/1944). Dashboard: Custom Navigation links & dynamic links to related dashboards
- [Issue #590](https://github.com/grafana/grafana/issues/590). Graph: Define series color using regex rule
- [Issue #2162](https://github.com/grafana/grafana/issues/2162). Graph: New series style override, negative-y transform and stack groups
- [Issue #2096](https://github.com/grafana/grafana/issues/2096). Dashboard list panel: Now supports search by multiple tags
- [Issue #2203](https://github.com/grafana/grafana/issues/2203). Singlestat: Now support string values
**User or Organization admin**
- [Issue #1899](https://github.com/grafana/grafana/issues/1899). Organization: You can now update the organization user role directly (without removing and readding the organization user).
- [Issue #2088](https://github.com/grafana/grafana/issues/2088). Roles: New user role `Read Only Editor` that replaces the old `Viewer` role behavior
**Backend**
- [Issue #2218](https://github.com/grafana/grafana/issues/2218). Auth: You can now authenicate against api with username / password using basic auth
- [Issue #2095](https://github.com/grafana/grafana/issues/2095). Search: Search now supports filtering by multiple dashboard tags
- [Issue #1905](https://github.com/grafana/grafana/issues/1905). Github OAuth: You can now configure a Github team membership requirement, thx @dewski
- [Issue #2052](https://github.com/grafana/grafana/issues/2052). Github OAuth: You can now configure a Github organization requirement, thx @indrekj
- [Issue #1891](https://github.com/grafana/grafana/issues/1891). Security: New config option to disable the use of gravatar for profile images
- [Issue #1921](https://github.com/grafana/grafana/issues/1921). Auth: Support for user authentication via reverse proxy header (like X-Authenticated-User, or X-WEBAUTH-USER)
- [Issue #960](https://github.com/grafana/grafana/issues/960). Search: Backend can now index a folder with json files, will be available in search (saving back to folder is not supported, this feature is meant for static generated json dashboards)
**Breaking changes**
- [Issue #1826](https://github.com/grafana/grafana/issues/1826). User role 'Viewer' are now prohibited from entering edit mode (and doing other transient dashboard edits). A new role `Read Only Editor` will replace the old Viewer behavior
- [Issue #1928](https://github.com/grafana/grafana/issues/1928). HTTP API: GET /api/dashboards/db/:slug response changed property `model` to `dashboard` to match the POST request nameing
- Backend render URL changed from `/render/dashboard/solo` `render/dashboard-solo/` (in order to have consistent dashboard url `/dashboard/:type/:slug`)
- Search HTTP API response has changed (simplified), tags list moved to seperate HTTP resource URI
- Datasource HTTP api breaking change, ADD datasource is now POST /api/datasources/, update is now PUT /api/datasources/:id
**Fixes**
- [Issue #2185](https://github.com/grafana/grafana/issues/2185). Graph: fixed PNG rendering of panels with legend table to the right
- [Issue #2163](https://github.com/grafana/grafana/issues/2163). Backend: Load dashboards with capital letters in the dashboard url slug (url id)
# 2.0.3 (unreleased - 2.0.x branch)
**Fixes**
- [Issue #1872](https://github.com/grafana/grafana/issues/1872). Firefox/IE issue, invisible text in dashboard search fixed
- [Issue #1857](https://github.com/grafana/grafana/issues/1857). /api/login/ping Fix for issue when behind reverse proxy and subpath
- [Issue #1863](https://github.com/grafana/grafana/issues/1863). MySQL: Dashboard.data column type changed to mediumtext (sql migration added)
# 2.0.2 (2015-04-22)
**Fixes**
- [Issue #1832](https://github.com/grafana/grafana/issues/1832). Graph Panel + Legend Table mode: Many series casued zero height graph, now legend will never reduce the height of the graph below 50% of row height.
- [Issue #1846](https://github.com/grafana/grafana/issues/1846). Snapshots: Fixed issue with snapshoting dashboards with an interval template variable
- [Issue #1848](https://github.com/grafana/grafana/issues/1848). Panel timeshift: You can now use panel timeshift without a relative time override
# 2.0.1 (2015-04-20)
**Fixes**
- [Issue #1784](https://github.com/grafana/grafana/issues/1784). Data source proxy: Fixed issue with using data source proxy when grafana is behind nginx suburl
- [Issue #1749](https://github.com/grafana/grafana/issues/1749). Graph Panel: Table legends are now visible when rendered to PNG
- [Issue #1786](https://github.com/grafana/grafana/issues/1786). Graph Panel: Legend in table mode now aligns, graph area is reduced depending on how many series
- [Issue #1734](https://github.com/grafana/grafana/issues/1734). Support for unicode / international characters in dashboard title (improved slugify)
- [Issue #1782](https://github.com/grafana/grafana/issues/1782). Github OAuth: Now works with Github for Enterprise, thanks @williamjoy
- [Issue #1780](https://github.com/grafana/grafana/issues/1780). Dashboard snapshot: Should not require login to view snapshot, Fixes #1780
# 2.0.0-Beta3 (2015-04-12)
**RPM / DEB Package changes (to follow HFS)**
- binary name changed to grafana-server
- does not install to `/opt/grafana` any more, installs to `/usr/share/grafana`
- binary to `/usr/sbin/grafana-server`
- init.d script improvements, renamed to `/etc/init.d/grafana-server`
- added default file with environment variables,
- `/etc/default/grafana-server` (deb/ubuntu)
- `/etc/sysconfig/grafana-server` (centos/redhat)
- added systemd service file, tested on debian jessie and centos7
- config file in same location `/etc/grafana/grafana.ini` (now complete config file but with every setting commented out)
- data directory (where sqlite3) file is stored is now by default `/var/lib/grafana`
- no symlinking current to versions anymore
- For more info see [Issue #1758](https://github.com/grafana/grafana/issues/1758).
**Config breaking change (setting rename)**
- `[log] root_path` has changed to `[paths] logs`
# 2.0.0-Beta2 (...)
**Enhancements**
- [Issue #1701](https://github.com/grafana/grafana/issues/1701). Share modal: Override UI theme via URL param for Share link, rendered panel, or embedded panel
- [Issue #1660](https://github.com/grafana/grafana/issues/1660). OAuth: Specify allowed email address domains for google or and github oauth logins
**Fixes**
- [Issue #1649](https://github.com/grafana/grafana/issues/1649). HTTP API: grafana /render calls nows with api keys
- [Issue #1667](https://github.com/grafana/grafana/issues/1667). Datasource proxy & session timeout fix (casued 401 Unauthorized error after a while)
- [Issue #1707](https://github.com/grafana/grafana/issues/1707). Unsaved changes: Do not show for snapshots, scripted and file based dashboards
- [Issue #1703](https://github.com/grafana/grafana/issues/1703). Unsaved changes: Do not show for users with role `Viewer`
- [Issue #1675](https://github.com/grafana/grafana/issues/1675). Data source proxy: Fixed issue with Gzip enabled and data source proxy
- [Issue #1681](https://github.com/grafana/grafana/issues/1681). MySQL session: fixed problem using mysql as session store
- [Issue #1671](https://github.com/grafana/grafana/issues/1671). Data sources: Fixed issue with changing default data source (should not require full page load to take effect, now fixed)
- [Issue #1685](https://github.com/grafana/grafana/issues/1685). Search: Dashboard results should be sorted alphabetically
- [Issue #1673](https://github.com/grafana/grafana/issues/1673). Basic auth: Fixed issue when using basic auth proxy infront of Grafana
# 2.0.0-Beta1 (2015-03-30)
**New features**
- [Issue #1623](https://github.com/grafana/grafana/issues/1623). Share Dashboard: Dashboard snapshot sharing (dash and data snapshot), save to local or save to public snapshot dashboard snapshots.raintank.io site
- [Issue #1622](https://github.com/grafana/grafana/issues/1622). Share Panel: The share modal now has an embed option, gives you an iframe that you can use to embedd a single graph on another web site
- [Issue #718](https://github.com/grafana/grafana/issues/718). 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
- [Issue #1331](https://github.com/grafana/grafana/issues/1331). Graph & Singlestat: New axis/unit format selector and more units (kbytes, Joule, Watt, eV), and new design for graph axis & grid tab and single stat options tab views
- [Issue #1241](https://github.com/grafana/grafana/issues/1242). Timepicker: New option in timepicker (under dashboard settings), to change ``now`` to be for example ``now-1m``, usefull when you want to ignore last minute because it contains incomplete data
- [Issue #171](https://github.com/grafana/grafana/issues/171). Panel: Different time periods, panels can override dashboard relative time and/or add a time shift
- [Issue #1488](https://github.com/grafana/grafana/issues/1488). Dashboard: Clone dashboard / Save as
- [Issue #1458](https://github.com/grafana/grafana/issues/1458). User: persisted user option for dark or light theme (no longer an option on a dashboard)
- [Issue #452](https://github.com/grafana/grafana/issues/452). Graph: Adds logarithmic scale option for base 10, base 16 and base 1024
**Enhancements**
- [Issue #1366](https://github.com/grafana/grafana/issues/1366). Graph & Singlestat: Support for additional units, Fahrenheit (°F) and Celsius (°C), Humidity (%H), kW, watt-hour (Wh), kilowatt-hour (kWh), velocities (m/s, km/h, mpg, knot)
- [Issue #978](https://github.com/grafana/grafana/issues/978). Graph: Shared tooltip improvement, can now support metrics of different resolution/intervals
- [Issue #1297](https://github.com/grafana/grafana/issues/1297). Graphite: Added cumulative and minimumBelow graphite functions
- [Issue #1296](https://github.com/grafana/grafana/issues/1296). InfluxDB: Auto escape column names with special characters. Thanks @steven-aerts
- [Issue #1321](https://github.com/grafana/grafana/issues/1321). SingleStatPanel: You can now use template variables in pre & postfix
- [Issue #599](https://github.com/grafana/grafana/issues/599). Graph: Added right y axis label setting and graph support
- [Issue #1253](https://github.com/grafana/grafana/issues/1253). Graph & Singlestat: Users can now set decimal precision for legend and tooltips (override auto precision)
- [Issue #1255](https://github.com/grafana/grafana/issues/1255). Templating: Dashboard will now wait to load until all template variables that have refresh on load set or are initialized via url to be fully loaded and so all variables are in valid state before panels start issuing metric requests.
- [Issue #1344](https://github.com/grafana/grafana/issues/1344). OpenTSDB: Alias patterns (reference tag values), syntax is: $tag_tagname or [[tag_tagname]]
**Fixes**
- [Issue #1298](https://github.com/grafana/grafana/issues/1298). InfluxDB: Fix handling of empty array in templating variable query
- [Issue #1309](https://github.com/grafana/grafana/issues/1309). Graph: Fixed issue when using zero as a grid threshold
- [Issue #1345](https://github.com/grafana/grafana/issues/1345). UI: Fixed position of confirm modal when scrolled down
- [Issue #1372](https://github.com/grafana/grafana/issues/1372). Graphite: Fix for nested complex queries, where a query references a query that references another query (ie the #[A-Z] syntax)
- [Issue #1363](https://github.com/grafana/grafana/issues/1363). Templating: Fix to allow custom template variables to contain white space, now only splits on ','
- [Issue #1359](https://github.com/grafana/grafana/issues/1359). Graph: Fix for all series tooltip showing series with all null values when ``Hide Empty`` option is enabled
- [Issue #1497](https://github.com/grafana/grafana/issues/1497). Dashboard: Fixed memory leak when switching dashboards
**Changes**
- Dashboard title change & save will no longer create a new dashboard, it will just change the title.
**OpenTSDB breaking change**
- [Issue #1438](https://github.com/grafana/grafana/issues/1438). OpenTSDB: Automatic downsample interval passed to OpenTSDB (depends on timespan and graph width)
- NOTICE, Downsampling is now enabled by default, so if you have not picked a downsample aggregator in your metric query do so or your graphs will be missleading
- This will make Grafana a lot quicker for OpenTSDB users when viewing large time spans without having to change the downsample interval manually.
**Tech**
- [Issue #1311](https://github.com/grafana/grafana/issues/1311). Tech: Updated Font-Awesome from 3.2 to 4.2
# 1.9.1 (2014-12-29)
**Enhancements**
- [Issue #1028](https://github.com/grafana/grafana/issues/1028). Graph: New legend option ``hideEmtpy`` to hide series with only null values from legend
- [Issue #1242](https://github.com/grafana/grafana/issues/1242). OpenTSDB: Downsample query field now supports interval template variable
- [Issue #1126](https://github.com/grafana/grafana/issues/1126). InfluxDB: Support more than 10 series name segments when using alias ``$number`` patterns
**Fixes**
- [Issue #1251](https://github.com/grafana/grafana/issues/1251). Graph: Fix for y axis and scaled units (GiB etc) caused rounding, for example 400 GiB instead of 378 GiB
- [Issue #1199](https://github.com/grafana/grafana/issues/1199). Graph: fix for series tooltip when one series is hidden/disabled
- [Issue #1207](https://github.com/grafana/grafana/issues/1207). Graphite: movingAverage / movingMedian parameter type impovement, now handles int and interval parameter
# 1.9.0 (2014-12-02)
**Enhancements**
- [Issue #1130](https://github.com/grafana/grafana/issues/1130). SinglestatPanel: Added null point handling, and value to text mapping
**Fixes**
- [Issue #1087](https://github.com/grafana/grafana/issues/1087). Panel: Fixed IE9 crash due to angular drag drop
- [Issue #1093](https://github.com/grafana/grafana/issues/1093). SingleStatPanel: Fixed position for drilldown link tooltip when dashboard requires scrolling
- [Issue #1095](https://github.com/grafana/grafana/issues/1095). DrilldownLink: template variables in params property was not interpolated
- [Issue #1114](https://github.com/grafana/grafana/issues/1114). Graphite: Lexer fix, allow equal sign (=) in metric paths
- [Issue #1136](https://github.com/grafana/grafana/issues/1136). Graph: Fix to legend value Max and negative values
- [Issue #1150](https://github.com/grafana/grafana/issues/1150). SinglestatPanel: Fixed absolute drilldown link issue
- [Issue #1123](https://github.com/grafana/grafana/issues/1123). Firefox: Workaround for Firefox bug, casued input text fields to not be selectable and not have placeable cursor
- [Issue #1108](https://github.com/grafana/grafana/issues/1108). Graph: Fix for tooltip series order when series draw order was changed with zindex property
# 1.9.0-rc1 (2014-11-17)
**UI Improvements**
- [Issue #770](https://github.com/grafana/grafana/issues/770). UI: Panel dropdown menu replaced with a new panel menu
**Graph**
- [Issue #877](https://github.com/grafana/grafana/issues/877). Graph: Smart auto decimal precision when using scaled unit formats
- [Issue #850](https://github.com/grafana/grafana/issues/850). Graph: Shared tooltip that shows multiple series & crosshair line, thx @toni-moreno
- [Issue #940](https://github.com/grafana/grafana/issues/940). Graph: New series style override option "Fill below to", useful to visualize max & min as a shadow for the mean
- [Issue #1030](https://github.com/grafana/grafana/issues/1030). Graph: Legend table display/look changed, now includes column headers for min/max/avg, and full width (unless on right side)
- [Issue #861](https://github.com/grafana/grafana/issues/861). Graph: Export graph time series data as csv file
**New Panels**
- [Issue #951](https://github.com/grafana/grafana/issues/951). SingleStat: New singlestat panel
**Misc**
- [Issue #864](https://github.com/grafana/grafana/issues/846). Panel: Share panel feature, get a link to panel with the current time range
- [Issue #938](https://github.com/grafana/grafana/issues/938). Panel: Plugin panels now reside outside of app/panels directory
- [Issue #952](https://github.com/grafana/grafana/issues/952). Help: Shortcut "?" to open help modal with list of all shortcuts
- [Issue #991](https://github.com/grafana/grafana/issues/991). ScriptedDashboard: datasource services are now available in scripted dashboards, you can query datasource for metric keys, generate dashboards, and even save them in a scripted dashboard (see scripted_gen_and_save.js for example)
- [Issue #1041](https://github.com/grafana/grafana/issues/1041). Panel: All panels can now have links to other dashboards or absolute links, these links are available in the panel menu.
**Changes**
- [Issue #1007](https://github.com/grafana/grafana/issues/1007). Graph: Series hide/show toggle changed to be default exclusive, so clicking on a series name will show only that series. (SHIFT or meta)+click will toggle hide/show.
**OpenTSDB**
- [Issue #930](https://github.com/grafana/grafana/issues/930). OpenTSDB: Adding counter max and counter reset value to open tsdb query editor, thx @rsimiciuc
- [Issue #917](https://github.com/grafana/grafana/issues/917). OpenTSDB: Templating support for OpenTSDB series name and tags, thx @mchataigner
**InfluxDB**
- [Issue #714](https://github.com/grafana/grafana/issues/714). InfluxDB: Support for sub second resolution graphs
**Fixes**
- [Issue #925](https://github.com/grafana/grafana/issues/925). Graph: bar width calculation fix for some edge cases (bars would render on top of each other)
- [Issue #505](https://github.com/grafana/grafana/issues/505). Graph: fix for second y axis tick unit labels wrapping on the next line
- [Issue #987](https://github.com/grafana/grafana/issues/987). Dashboard: Collapsed rows became invisible when hide controls was enabled
=======
# 1.8.1 (2014-09-30)
**Fixes**
- [Issue #855](https://github.com/grafana/grafana/issues/855). Graph: Fix for scroll issue in graph edit mode when dropdown goes below screen
- [Issue #847](https://github.com/grafana/grafana/issues/847). Graph: Fix for series draw order not being the same after hiding/unhiding series
- [Issue #851](https://github.com/grafana/grafana/issues/851). Annotations: Fix for annotations not reloaded when switching between 2 dashboards with annotations
- [Issue #846](https://github.com/grafana/grafana/issues/846). Edit panes: Issue when open row or json editor when scrolled down the page, unable to scroll and you did not see editor
- [Issue #840](https://github.com/grafana/grafana/issues/840). Import: Fixes to import from json file and import from graphite. Issues was lingering state from previous dashboard.
- [Issue #859](https://github.com/grafana/grafana/issues/859). InfluxDB: Fix for bug when saving dashboard where title is the same as slugified url id
- [Issue #852](https://github.com/grafana/grafana/issues/852). White theme: Fixes for hidden series legend text and disabled annotations color
# 1.8.0 (2014-09-22)
Read this [blog post](http://grafana.org/blog/2014/09/11/grafana-1-8-0-rc1-released.html) for an overview of all improvements.
**Fixes**
- [Issue #802](https://github.com/grafana/grafana/issues/802). Annotations: Fix when using InfluxDB datasource
- [Issue #795](https://github.com/grafana/grafana/issues/795). Chrome: Fix for display issue in chrome beta & chrome canary when entering edit mode
- [Issue #818](https://github.com/grafana/grafana/issues/818). Graph: Added percent y-axis format
- [Issue #828](https://github.com/grafana/grafana/issues/828). Elasticsearch: saving new dashboard with title equal to slugified url would cause it to deleted.
- [Issue #830](https://github.com/grafana/grafana/issues/830). Annotations: Fix for elasticsearch annotations and mapping nested fields
# 1.8.0-RC1 (2014-09-12)
**UI polish / changes**
- [Issue #725](https://github.com/grafana/grafana/issues/725). UI: All modal editors are removed and replaced by an edit pane under menu. The look of editors is also updated and polished. Search dropdown is also shown as pane under menu and has seen some UI polish.
**Filtering/Templating feature overhaul**
- Filtering renamed to Templating, and filter items to variables
- Filter editing has gotten its own edit pane with much improved UI and options
- [Issue #296](https://github.com/grafana/grafana/issues/296). Templating: Can now retrieve variable values from a non-default data source
- [Issue #219](https://github.com/grafana/grafana/issues/219). Templating: Template variable value selection is now a typeahead autocomplete dropdown
- [Issue #760](https://github.com/grafana/grafana/issues/760). Templating: Extend template variable syntax to include $variable syntax replacement
- [Issue #234](https://github.com/grafana/grafana/issues/234). Templating: Interval variable type for time intervals summarize/group by parameter, included "auto" option, and auto step counts option.
- [Issue #262](https://github.com/grafana/grafana/issues/262). Templating: Ability to use template variables for function parameters via custom variable type, can be used as parameter for movingAverage or scaleToSeconds for example
- [Issue #312](https://github.com/grafana/grafana/issues/312). Templating: Can now use template variables in panel titles
- [Issue #613](https://github.com/grafana/grafana/issues/613). Templating: Full support for InfluxDB, filter by part of series names, extract series substrings, nested queries, multipe where clauses!
- Template variables can be initialized from url, with var-my_varname=value, breaking change, before it was just my_varname.
- Templating and url state sync has some issues that are not solved for this release, see [Issue #772](https://github.com/grafana/grafana/issues/772) for more details.
**InfluxDB Breaking changes**
- To better support templating, fill(0) and group by time low limit some changes has been made to the editor and query model schema
- Currently some of these changes are breaking
- If you used custom condition filter you need to open the graph in edit mode, the editor will update the schema, and the queries should work again
- If you used a raw query you need to remove the time filter and replace it with $timeFilter (this is done automatically when you switch from query editor to raw query, but old raw queries needs to updated)
- If you used group by and later removed the group by the graph could break, open in editor and should correct it
- InfluxDB annotation queries that used [[timeFilter]] should be updated to use $timeFilter syntax instead
- Might write an upgrade tool to update dashboards automatically, but right now master (1.8) includes the above breaking changes
**InfluxDB query editor enhancements**
- [Issue #756](https://github.com/grafana/grafana/issues/756). InfluxDB: Add option for fill(0) and fill(null), integrated help in editor for why this option is important when stacking series
- [Issue #743](https://github.com/grafana/grafana/issues/743). InfluxDB: A group by time option for all queries in graph panel that supports a low limit for auto group by time, very important for stacking and fill(0)
- The above to enhancements solves the problems associated with stacked bars and lines when points are missing, these issues are solved:
- [Issue #673](https://github.com/grafana/grafana/issues/673). InfluxDB: stacked bars missing intermediate data points, unless lines also enabled
- [Issue #674](https://github.com/grafana/grafana/issues/674). InfluxDB: stacked chart ignoring series without latest values
- [Issue #534](https://github.com/grafana/grafana/issues/534). InfluxDB: No order in stacked bars mode
**New features and improvements**
- [Issue #117](https://github.com/grafana/grafana/issues/117). Graphite: Graphite query builder can now handle functions that multiple series as arguments!
- [Issue #281](https://github.com/grafana/grafana/issues/281). Graphite: Metric node/segment selection is now a textbox with autocomplete dropdown, allow for custom glob expression for single node segment without entering text editor mode.
- [Issue #304](https://github.com/grafana/grafana/issues/304). Dashboard: View dashboard json, edit/update any panel using json editor, makes it possible to quickly copy a graph from one dashboard to another.
- [Issue #578](https://github.com/grafana/grafana/issues/578). Dashboard: Row option to display row title even when the row is visible
- [Issue #672](https://github.com/grafana/grafana/issues/672). Dashboard: panel fullscreen & edit state is present in url, can now link to graph in edit & fullscreen mode.
- [Issue #709](https://github.com/grafana/grafana/issues/709). Dashboard: Small UI look polish to search results, made dashboard title link are larger
- [Issue #425](https://github.com/grafana/grafana/issues/425). Graph: New section in 'Display Styles' tab to override any display setting on per series bases (mix and match lines, bars, points, fill, stack, line width etc)
- [Issue #634](https://github.com/grafana/grafana/issues/634). Dashboard: Dashboard tags now in different colors (from fixed palette) determined by tag name.
- [Issue #685](https://github.com/grafana/grafana/issues/685). Dashboard: New config.js option to change/remove window title prefix.
- [Issue #781](https://github.com/grafana/grafana/issues/781). Dashboard: Title URL is now slugified for greater URL readability, works with both ES & InfluxDB storage, is backward compatible
- [Issue #785](https://github.com/grafana/grafana/issues/785). Elasticsearch: Support for full elasticsearch lucene search grammar when searching for dashboards, better async search
- [Issue #787](https://github.com/grafana/grafana/issues/787). Dashboard: time range can now be read from URL parameters, will override dashboard saved time range
**Fixes**
- [Issue #696](https://github.com/grafana/grafana/issues/696). Graph: Fix for y-axis format 'none' when values are in scientific notation (ex 2.3e-13)
- [Issue #733](https://github.com/grafana/grafana/issues/733). Graph: Fix for tooltip current value decimal precision when 'none' axis format was selected
- [Issue #697](https://github.com/grafana/grafana/issues/697). Graphite: Fix for Glob syntax in graphite queries ([1-9] and ?) that made the query editor / parser bail and fallback to a text box.
- [Issue #702](https://github.com/grafana/grafana/issues/702). Graphite: Fix for nonNegativeDerivative function, now possible to not include optional first parameter maxValue
- [Issue #277](https://github.com/grafana/grafana/issues/277). Dashboard: Fix for timepicker date & tooltip when UTC timezone selected.
- [Issue #699](https://github.com/grafana/grafana/issues/699). Dashboard: Fix for bug when adding rows from dashboard settings dialog.
- [Issue #723](https://github.com/grafana/grafana/issues/723). Dashboard: Fix for hide controls setting not used/initialized on dashboard load
- [Issue #724](https://github.com/grafana/grafana/issues/724). Dashboard: Fix for zoom out causing right hand "to" range to be set in the future.
**Tech**
- Upgraded from angularjs 1.1.5 to 1.3 beta 17;
- Switch from underscore to lodash
- helpers to easily unit test angularjs controllers and services
- Test coverage through coveralls
- Upgrade from jquery 1.8.0 to 2.1.1 (**Removes support for IE7 & IE8**)
# 1.7.1 (unreleased)
**Fixes**
- [Issue #691](https://github.com/grafana/grafana/issues/691). Dashboard: Tooltip fixes, sometimes they would not show, and sometimes they would get stuck.
- [Issue #695](https://github.com/grafana/grafana/issues/695). Dashboard: Tooltip on goto home menu icon would get stuck after clicking on it
# 1.7.0 (2014-08-11)
**Fixes**
- [Issue #652](https://github.com/grafana/grafana/issues/652). Timepicker: Entering custom date range impossible when refresh is low (now is constantly reset)
- [Issue #450](https://github.com/grafana/grafana/issues/450). Graph: Tooltip does not disappear sometimes and would get stuck
- [Issue #655](https://github.com/grafana/grafana/issues/655). General: Auto refresh not initiated / started after dashboard loading
- [Issue #657](https://github.com/grafana/grafana/issues/657). General: Fix for refresh icon in IE browsers
- [Issue #661](https://github.com/grafana/grafana/issues/661). Annotations: Elasticsearch querystring with filter template replacements was not interpolated
- [Issue #660](https://github.com/grafana/grafana/issues/660). OpenTSDB: fix opentsdb queries that returned more than one series
**Change**
- [Issue #681](https://github.com/grafana/grafana/issues/681). Dashboard: The panel error bar has been replaced with a small error indicator, this indicator does not change panel height and is a lot less intrusive. Hover over it for short details, click on it for more details.
# 1.7.0-rc1 (2014-08-05)
**New features or improvements**
- [Issue #581](https://github.com/grafana/grafana/issues/581). InfluxDB: Add continuous query in series results (series typeahead).
- [Issue #584](https://github.com/grafana/grafana/issues/584). InfluxDB: Support for alias & alias patterns when using raw query mode
- [Issue #394](https://github.com/grafana/grafana/issues/394). InfluxDB: Annotation support
- [Issue #633](https://github.com/grafana/grafana/issues/633). InfluxDB: InfluxDB can now act as a datastore for dashboards
- [Issue #610](https://github.com/grafana/grafana/issues/610). InfluxDB: Support for InfluxdB v0.8 list series response schemea (series typeahead)
- [Issue #525](https://github.com/grafana/grafana/issues/525). InfluxDB: Enhanced series aliasing (legend names) with pattern replacements
- [Issue #266](https://github.com/grafana/grafana/issues/266). Graphite: New option cacheTimeout to override graphite default memcache timeout
- [Issue #606](https://github.com/grafana/grafana/issues/606). General: New global option in config.js to specify admin password (useful to hinder users from accidentally make changes)
- [Issue #201](https://github.com/grafana/grafana/issues/201). Annotations: Elasticsearch datasource support for events
- [Issue #344](https://github.com/grafana/grafana/issues/344). Annotations: Annotations can now be fetched from non default datasources
- [Issue #631](https://github.com/grafana/grafana/issues/631). Search: max_results config.js option & scroll in search results (To show more or all dashboards)
- [Issue #511](https://github.com/grafana/grafana/issues/511). Text panel: Allow [[..]] filter notation in all text panels (markdown/html/text)
- [Issue #136](https://github.com/grafana/grafana/issues/136). Graph: New legend display option "Align as table"
- [Issue #556](https://github.com/grafana/grafana/issues/556). Graph: New legend display option "Right side", will show legend to the right of the graph
- [Issue #604](https://github.com/grafana/grafana/issues/604). Graph: New axis format, 'bps' (SI unit in steps of 1000) useful for network gear metics
- [Issue #626](https://github.com/grafana/grafana/issues/626). Graph: Downscale y axis to more precise unit, value of 0.1 for seconds format will be formated as 100 ms. Thanks @kamaradclimber
- [Issue #618](https://github.com/grafana/grafana/issues/618). OpenTSDB: Series alias option to override metric name returned from opentsdb. Thanks @heldr
**Documentation**
- [Issue #635](https://github.com/grafana/grafana/issues/635). Docs for features and changes in v1.7, new troubleshooting guide, new Getting started guide, improved install & config guide.
**Changes**
- [Issue #536](https://github.com/grafana/grafana/issues/536). Graphite: Use unix epoch for Graphite from/to for absolute time ranges
- [Issue #641](https://github.com/grafana/grafana/issues/536). General: Dashboard save temp copy feature settings moved from dashboard to config.js, default is enabled, and ttl to 30 days
- [Issue #532](https://github.com/grafana/grafana/issues/532). Schema: Dashboard schema changes, "Unsaved changes" should not appear for schema changes. All changes are backward compatible with old schema.
**Fixes**
- [Issue #545](https://github.com/grafana/grafana/issues/545). Graph: Fix formatting negative values (axis formats, legend values)
- [Issue #460](https://github.com/grafana/grafana/issues/460). Graph: fix for max legend value when max value is zero
- [Issue #628](https://github.com/grafana/grafana/issues/628). Filtering: Fix for nested filters, changing a child filter could result in infinite recursion in some cases
- [Issue #528](https://github.com/grafana/grafana/issues/528). Graphite: Fix for graphite expressions parser failure when metric expressions starts with curly brace segment
# 1.6.1 (2014-06-24)
**New features or improvements**
- [Issue #360](https://github.com/grafana/grafana/issues/360). Ability to set y min/max for right y-axis (RR #519)
**Fixes**
- [Issue #500](https://github.com/grafana/grafana/issues/360). Fixes regex InfluxDB queries intoduced in 1.6.0
- [Issue #506](https://github.com/grafana/grafana/issues/506). Bug in when using % sign in legends (aliases), fixed by removing url decoding of metric names
- [Issue #522](https://github.com/grafana/grafana/issues/522). Series names and column name typeahead cache fix
- [Issue #504](https://github.com/grafana/grafana/issues/504). Fixed influxdb issue with raw query that caused wrong value column detection
- [Issue #526](https://github.com/grafana/grafana/issues/526). Default property that marks which datasource is default in config.js is now optional
- [Issue #342](https://github.com/grafana/grafana/issues/342). Auto-refresh caused 2 refreshes (and hence mulitple queries) each time (at least in firefox)
# 1.6.0 (2014-06-16)
#### New features or improvements
- [Issue #427](https://github.com/grafana/grafana/issues/427). New Y-axis formater for metric values that represent seconds, Thanks @jippi
- [Issue #390](https://github.com/grafana/grafana/issues/390). Allow special characters in serie names (influxdb datasource), Thanks @majst01
- [Issue #428](https://github.com/grafana/grafana/issues/428). Refactoring of filterSrv, Thanks @Tetha
- [Issue #445](https://github.com/grafana/grafana/issues/445). New config for playlist feature. Set playlist_timespan to set default playlist interval, Thanks @rmca
- [Issue #461](https://github.com/grafana/grafana/issues/461). New graphite function definition added isNonNull, Thanks @tmonk42
- [Issue #455](https://github.com/grafana/grafana/issues/455). New InfluxDB function difference add to function dropdown
- [Issue #459](https://github.com/grafana/grafana/issues/459). Added parameter to keepLastValue graphite function definition (default 100)
[Issue #418](https://github.com/grafana/grafana/issues/418). to the browser cache when upgrading grafana and improve load performance
- [Issue #327](https://github.com/grafana/grafana/issues/327). Partial support for url encoded metrics when using Graphite datasource. Thanks @axe-felix
- [Issue #473](https://github.com/grafana/grafana/issues/473). Improvement to InfluxDB query editor and function/value column selection
- [Issue #375](https://github.com/grafana/grafana/issues/375). Initial support for filtering (templated queries) for InfluxDB. Thanks @mavimo
- [Issue #475](https://github.com/grafana/grafana/issues/475). Row editing and adding new panel is now a lot quicker and easier with the new row menu
- [Issue #211](https://github.com/grafana/grafana/issues/211). New datasource! Initial support for OpenTSDB, Thanks @mpage
- [Issue #492](https://github.com/grafana/grafana/issues/492). Improvement and polish to the OpenTSDB query editor
- [Issue #441](https://github.com/grafana/grafana/issues/441). Influxdb group by support, Thanks @piis3
- improved asset (css/js) build pipeline, added revision to css and js. Will remove issues related
#### Changes
- [Issue #475](https://github.com/grafana/grafana/issues/475). Add panel icon and Row edit button is replaced by the Row edit menu
- New graphs now have a default empty query
- Add Row button now creates a row with default height of 250px (no longer opens dashboard settings modal)
- Clean up of config.sample.js, graphiteUrl removed (still works, but depricated, removed in future)
Use datasources config instead. panel_names removed from config.js. Use plugins.panels to add custom panels
- Graphite panel is now renamed graph (Existing dashboards will still work)
#### Fixes
- [Issue #126](https://github.com/grafana/grafana/issues/126). Graphite query lexer change, can now handle regex parameters for aliasSub function
- [Issue #447](https://github.com/grafana/grafana/issues/447). Filter option loading when having muliple nested filters now works better. Options are now reloaded correctly and there are no multiple renders/refresh inbetween.
- [Issue #412](https://github.com/grafana/grafana/issues/412). After a filter option is changed and a nested template param is reloaded, if the current value exists after the options are reloaded the current selected value is kept.
- [Issue #460](https://github.com/grafana/grafana/issues/460). Legend Current value did not display when value was zero
- [Issue #328](https://github.com/grafana/grafana/issues/328). Fix to series toggling bug that caused annotations to be hidden when toggling/hiding series.
- [Issue #293](https://github.com/grafana/grafana/issues/293). Fix for graphite function selection menu that some times draws outside screen. It now displays upward
- [Issue #350](https://github.com/grafana/grafana/issues/350). Fix for exclusive series toggling (hold down CTRL, SHIFT or META key) and left click a series for exclusive toggling
- [Issue #472](https://github.com/grafana/grafana/issues/472). CTRL does not work on MAC OSX but SHIFT or META should (depending on browser)
# 1.5.4 (2014-05-13)
### New features and improvements
- InfluxDB enhancement: support for multiple hosts (with retries) and raw queries ([Issue #318](https://github.com/grafana/grafana/issues/318), thx @toddboom)
- Added rounding for graphites from and to time range filters
for very short absolute ranges ([Issue #320](https://github.com/grafana/grafana/issues/320))
- Increased resolution for graphite datapoints (maxDataPoints), now equal to panel pixel width. ([Issue #5](https://github.com/grafana/grafana/issues/5))
- Improvement to influxdb query editor, can now add where clause and alias ([Issue #331](https://github.com/grafana/grafana/issues/331), thanks @mavimo)
- New config setting for graphite datasource to control if json render request is POST or GET ([Issue #345](https://github.com/grafana/grafana/issues/345))
- Unsaved changes warning feature ([Issue #324](https://github.com/grafana/grafana/issues/324))
- Improvement to series toggling, CTRL+MouseClick on series name will now hide all others ([Issue #350](https://github.com/grafana/grafana/issues/350))
### Changes
- Graph default setting for Y-Min changed from zero to auto scalling (will not effect existing dashboards). ([Issue #386](https://github.com/grafana/grafana/issues/386)) - thx @kamaradclimber
### Fixes
- Fixes to filters and "All" option. It now never uses "*" as value, but all options in a {node1, node2, node3} expression ([Issue #228](https://github.com/grafana/grafana/issues/228), #359)
- Fix for InfluxDB query generation with columns containing dots or dashes ([Issue #369](https://github.com/grafana/grafana/issues/369), #348) - Thanks to @jbripley
# 1.5.3 (2014-04-17)
- Add support for async scripted dashboards ([Issue #274](https://github.com/grafana/grafana/issues/274))
- Text panel now accepts html (for links to other dashboards, etc) ([Issue #236](https://github.com/grafana/grafana/issues/236))
- Fix for Text panel, now changes take effect directly ([Issue #251](https://github.com/grafana/grafana/issues/251))
- Fix when adding functions without params that did not cause graph to update ([Issue #267](https://github.com/grafana/grafana/issues/267))
- Graphite errors are now much easier to see and troubleshoot with the new inspector ([Issue #265](https://github.com/grafana/grafana/issues/265))
- Use influxdb aliases to distinguish between multiple columns ([Issue #283](https://github.com/grafana/grafana/issues/283))
- Correction to ms axis formater, now formats days correctly. ([Issue #189](https://github.com/grafana/grafana/issues/189))
- Css fix for Firefox and using top menu dropdowns in panel fullscren / edit mode ([Issue #106](https://github.com/grafana/grafana/issues/106))
- Browser page title is now Grafana - {{dashboard title}} ([Issue #294](https://github.com/grafana/grafana/issues/294))
- Disable auto refresh zooming in (every time you change to an absolute time range), refresh will be restored when you change time range back to relative ([Issue #282](https://github.com/grafana/grafana/issues/282))
- More graphite functions
# 1.5.2 (2014-03-24)
### New Features and improvements
- Support for second optional params for functions like aliasByNode ([Issue #167](https://github.com/grafana/grafana/issues/167)). Read the wiki on the [Function Editor](https://github.com/torkelo/grafana/wiki/Graphite-Function-Editor) for more info.
- More functions added to InfluxDB query editor ([Issue #218](https://github.com/grafana/grafana/issues/218))
- Filters can now be used inside other filters (templated segments) ([Issue #128](https://github.com/grafana/grafana/issues/128))
- More graphite functions added
### Fixes
- Float arguments now work for functions like scale ([Issue #223](https://github.com/grafana/grafana/issues/223))
- Fix for graphite function editor, the graph & target was not updated after adding a function and leaving default params as is #191
The zip files now contains a sub folder with project name and version prefix. ([Issue #209](https://github.com/grafana/grafana/issues/209))
# 1.5.1 (2014-03-10)
### Fixes
- maxDataPoints must be an integer #184 (thanks @frejsoya for fixing this)
For people who are find Grafana slow for large time spans or high resolution metrics. This is most likely due to graphite returning a large number of datapoints. The maxDataPoints parameter solves this issue. For maxDataPoints to work you need to run the latest graphite-web (some builds of 0.9.12 does not include this feature).
Read this for more info:
[Performance for large time spans](https://github.com/torkelo/grafana/wiki/Performance-for-large-time-spans)
# 1.5.0 (2014-03-09)
### New Features and improvements
- New function editor [video demo](http://youtu.be/I90WHRwE1ZM) ([Issue #178](https://github.com/grafana/grafana/issues/178))
- Links to function documentation from function editor ([Issue #3](https://github.com/grafana/grafana/issues/3))
- Reorder functions ([Issue #130](https://github.com/grafana/grafana/issues/130))
- [Initial support for InfluxDB](https://github.com/torkelo/grafana/wiki/InfluxDB) as metric datasource (#103), need feedback!
- [Dashboard playlist](https://github.com/torkelo/grafana/wiki/Dashboard-playlist) ([Issue #36](https://github.com/grafana/grafana/issues/36))
- When adding aliasByNode smartly set node number ([Issue #175](https://github.com/grafana/grafana/issues/175))
- Support graphite identifiers with embedded colons ([Issue #173](https://github.com/grafana/grafana/issues/173))
- Typeahead & autocomplete when adding new function ([Issue #164](https://github.com/grafana/grafana/issues/164))
- More graphite function definitions
- Make "ms" axis format include hour, day, weeks, month and year ([Issue #149](https://github.com/grafana/grafana/issues/149))
- Microsecond axis format ([Issue #146](https://github.com/grafana/grafana/issues/146))
- Specify template parameters in URL ([Issue #123](https://github.com/grafana/grafana/issues/123))
### Fixes
- Basic Auth fix ([Issue #152](https://github.com/grafana/grafana/issues/152))
- Fix to annotations with graphite source & null values ([Issue #138](https://github.com/grafana/grafana/issues/138))
# 1.4.0 (2014-02-21)
### New Features
- #44 Annotations! Required a lot of work to get right. Read wiki article for more info. Supported annotations data sources are graphite metrics and graphite events. Support for more will be added in the future!
- #35 Support for multiple graphite servers! (Read wiki article for more)
- #116 Back to dashboard link in top menu to easily exist full screen / edit mode.
- #114, #97 Legend values now use the same y axes formatter
- #77 Improvements and polish to the light theme
### Changes
- #98 Stack is no longer by default turned on in graph display settings.
- Hide controls (Ctrl+h) now hides the sub menu row (where filtering, and annotations are). So if you had filtering enabled and hide controls enabled you will not see the filtering sub menu.
### Fixes:
- #94 Fix for bug that caused dashboard settings to sometimes not contain timepicker tab.
- #110 Graph with many many metrics caused legend to push down graph editor below screen. You can now scroll in edit mode & full screen mode for graphs with lots of series & legends.
- #104 Improvement to graphite target editor, select wildcard now gives you a "select metric" link for the next node.
- #105 Added zero as a possible node value in groupByAlias function
# 1.3.0 (2014-02-13)
### New features or improvements
- #86 Dashboard tags and search (see wiki article for details)
- #54 Enhancement to filter / template. "Include All" improvement
- #82 Dashboard search result sorted in alphabetical order
### Fixes
- #91 Custom date selector is one day behind
- #89 Filter / template does not work after switching dashboard
- #88 Closed / Minimized row css bug
- #85 Added all parameters to summarize function
- #83 Stack as percent should now work a lot better!
# 1.2.0 (2014-02-10)
### New features
- #70 Grid Thresholds (warning and error regions or lines in graph)
- #72 Added an example of a scripted dashboard and a short wiki article documenting scripted dashboards.
### Fixes
- #81 Grid min/max values are ignored bug
- #80 "stacked as percent" graphs should always use "max" value of 100 bug
- #73 Left Y format change did not work
- #42 Fixes to grid min/max auto scaling
- #69 Fixes to lexer/parser for metrics segments like "10-20".
- #67 Allow decimal input for scale function
- #68 Bug when trying to open dashboard while in edit mode
# 1.1.0 (2014-02-06)
### New features:
- #22 Support for native graphite png renderer, does not support click and select zoom yet
- #60 Support for legend values (cactiStyle, min, max, current, total, avg). The options for these are found in the new "Axes & Grid" tab for now.
- #62 There is now a "New" button in the search/open dashboard view to quickly open a clean empty dashboard.
- #55 Basic auth is now supported for elastic search as well
- some new function definitions added (will focus more on this for next release).
### Fixes
- #45 zero values from graphite was handled as null.
- #63 Kibana / Grafana on same host would use same localStorage keys, now fixed
- #46 Impossible to edit graph without a name fixed.
- #24 fix for dashboard search when elastic search is configured to disable _all field.
- #38 Improvement to lexer / parser to support pure numeric literals in metric segments
Thanks to everyone who contributed fixes and provided feedback :+1:
# 1.0.4 (2014-01-24)
- [Issue #28](https://github.com/grafana/grafana/issues/28) - Relative time range caused 500 graphite error in some cases (thx rsommer for the fix)
# 1.0.3 (2014-01-23)
- #9 Add Y-axis format for milliseconds
- #16 Add support for Basic Auth (use http://username:password@yourgraphitedomain.com)
- #13 Relative time ranges now uses relative time ranges when issuing graphite query
# 1.0.2 (2014-01-21)
- [Issue #12](https://github.com/grafana/grafana/issues/12), should now work ok without ElasticSearch
# 1.0.1 (2014-01-21)
- Resize fix
- Improvements to drag & drop
- Added a few graphite function definitions
- Fixed duplicate panel bug
- Updated default dashboard with welcome message and randomWalk graph
# 1.0.0 (2014-01-19)
First public release

14
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,14 @@
If you have any idea for an improvement or found a bug do not hesitate to open an issue.
And if you have time clone this repo and submit a pull request and help me make Grafana the
kickass metrics & devops dashboard we all dream about!
Prerequisites:
- Nodejs (for jshint & grunt & development server)
Clone repository:
npm install
grunt server (starts development web server in src folder)
grunt (runs jshint and less -> css compilation)
Please remember to run grunt before doing pull request to verify that your code passes all the jshint validations.

111
Godeps/Godeps.json generated Normal file
View File

@@ -0,0 +1,111 @@
{
"ImportPath": "github.com/grafana/grafana",
"GoVersion": "go1.4.2",
"Packages": [
"./pkg/..."
],
"Deps": [
{
"ImportPath": "github.com/BurntSushi/toml",
"Comment": "v0.1.0-21-g056c9bc",
"Rev": "056c9bc7be7190eaa7715723883caffa5f8fa3e4"
},
{
"ImportPath": "github.com/Unknwon/com",
"Rev": "d9bcf409c8a368d06c9b347705c381e7c12d54df"
},
{
"ImportPath": "github.com/Unknwon/macaron",
"Rev": "93de4f3fad97bf246b838f828e2348f46f21f20a"
},
{
"ImportPath": "github.com/davecgh/go-spew/spew",
"Rev": "2df174808ee097f90d259e432cc04442cf60be21"
},
{
"ImportPath": "github.com/go-ldap/ldap",
"Comment": "v1-19-g83e6542",
"Rev": "83e65426fd1c06626e88aa8a085e5bfed0208e29"
},
{
"ImportPath": "github.com/go-sql-driver/mysql",
"Comment": "v1.2-26-g9543750",
"Rev": "9543750295406ef070f7de8ae9c43ccddd44e15e"
},
{
"ImportPath": "github.com/go-xorm/core",
"Rev": "be6e7ac47dc57bd0ada25322fa526944f66ccaa6"
},
{
"ImportPath": "github.com/go-xorm/xorm",
"Comment": "v0.4.2-58-ge2889e5",
"Rev": "e2889e5517600b82905f1d2ba8b70deb71823ffe"
},
{
"ImportPath": "github.com/gosimple/slug",
"Rev": "8d258463b4459f161f51d6a357edacd3eef9d663"
},
{
"ImportPath": "github.com/jtolds/gls",
"Rev": "f1ac7f4f24f50328e6bc838ca4437d1612a0243c"
},
{
"ImportPath": "github.com/lib/pq",
"Comment": "go1.0-cutoff-13-g19eeca3",
"Rev": "19eeca3e30d2577b1761db471ec130810e67f532"
},
{
"ImportPath": "github.com/macaron-contrib/binding",
"Rev": "0fbe4b9707e6eb556ef843e5471592f55ce0a5e7"
},
{
"ImportPath": "github.com/macaron-contrib/session",
"Rev": "31e841d95c7302b9ac456c830ea2d6dfcef4f84a"
},
{
"ImportPath": "github.com/mattn/go-sqlite3",
"Rev": "e28cd440fabdd39b9520344bc26829f61db40ece"
},
{
"ImportPath": "github.com/rainycape/unidecode",
"Rev": "836ef0a715aedf08a12d595ed73ec8ed5b288cac"
},
{
"ImportPath": "github.com/smartystreets/goconvey/convey",
"Comment": "1.5.0-356-gfbc0a1c",
"Rev": "fbc0a1c888f9f96263f9a559d1769905245f1123"
},
{
"ImportPath": "github.com/streadway/amqp",
"Rev": "150b7f24d6ad507e6026c13d85ce1f1391ac7400"
},
{
"ImportPath": "golang.org/x/net/context",
"Rev": "972f0c5fbe4ae29e666c3f78c3ed42ae7a448b0a"
},
{
"ImportPath": "golang.org/x/oauth2",
"Rev": "c58fcf0ffc1c772aa2e1ee4894bc19f2649263b2"
},
{
"ImportPath": "gopkg.in/asn1-ber.v1",
"Comment": "v1",
"Rev": "9eae18c3681ae3d3c677ac2b80a8fe57de45fc09"
},
{
"ImportPath": "gopkg.in/bufio.v1",
"Comment": "v1",
"Rev": "567b2bfa514e796916c4747494d6ff5132a1dfce"
},
{
"ImportPath": "gopkg.in/ini.v1",
"Comment": "v0-16-g1772191",
"Rev": "177219109c97e7920c933e21c9b25f874357b237"
},
{
"ImportPath": "gopkg.in/redis.v2",
"Comment": "v2.3.2",
"Rev": "e6179049628164864e6e84e973cfb56335748dea"
}
]
}

5
Godeps/Readme generated Normal file
View File

@@ -0,0 +1,5 @@
This directory tree is generated automatically by godep.
Please do not edit.
See https://github.com/tools/godep for more information.

2
Godeps/_workspace/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,2 @@
/pkg
/bin

View File

@@ -0,0 +1,5 @@
TAGS
tags
.*.swp
tomlcheck/tomlcheck
toml.test

View File

@@ -0,0 +1,12 @@
language: go
go:
- 1.1
- 1.2
- tip
install:
- go install ./...
- go get github.com/BurntSushi/toml-test
script:
- export PATH="$PATH:$HOME/gopath/bin"
- make test

View File

@@ -0,0 +1,3 @@
Compatible with TOML version
[v0.2.0](https://github.com/mojombo/toml/blob/master/versions/toml-v0.2.0.md)

View File

@@ -0,0 +1,14 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

View File

@@ -0,0 +1,19 @@
install:
go install ./...
test: install
go test -v
toml-test toml-test-decoder
toml-test -encoder toml-test-encoder
fmt:
gofmt -w *.go */*.go
colcheck *.go */*.go
tags:
find ./ -name '*.go' -print0 | xargs -0 gotags > TAGS
push:
git push origin master
git push github master

View File

@@ -0,0 +1,220 @@
## TOML parser and encoder for Go with reflection
TOML stands for Tom's Obvious, Minimal Language. This Go package provides a
reflection interface similar to Go's standard library `json` and `xml`
packages. This package also supports the `encoding.TextUnmarshaler` and
`encoding.TextMarshaler` interfaces so that you can define custom data
representations. (There is an example of this below.)
Spec: https://github.com/mojombo/toml
Compatible with TOML version
[v0.2.0](https://github.com/toml-lang/toml/blob/master/versions/en/toml-v0.2.0.md)
Documentation: http://godoc.org/github.com/BurntSushi/toml
Installation:
```bash
go get github.com/BurntSushi/toml
```
Try the toml validator:
```bash
go get github.com/BurntSushi/toml/cmd/tomlv
tomlv some-toml-file.toml
```
[![Build status](https://api.travis-ci.org/BurntSushi/toml.png)](https://travis-ci.org/BurntSushi/toml)
### Testing
This package passes all tests in
[toml-test](https://github.com/BurntSushi/toml-test) for both the decoder
and the encoder.
### Examples
This package works similarly to how the Go standard library handles `XML`
and `JSON`. Namely, data is loaded into Go values via reflection.
For the simplest example, consider some TOML file as just a list of keys
and values:
```toml
Age = 25
Cats = [ "Cauchy", "Plato" ]
Pi = 3.14
Perfection = [ 6, 28, 496, 8128 ]
DOB = 1987-07-05T05:45:00Z
```
Which could be defined in Go as:
```go
type Config struct {
Age int
Cats []string
Pi float64
Perfection []int
DOB time.Time // requires `import time`
}
```
And then decoded with:
```go
var conf Config
if _, err := toml.Decode(tomlData, &conf); err != nil {
// handle error
}
```
You can also use struct tags if your struct field name doesn't map to a TOML
key value directly:
```toml
some_key_NAME = "wat"
```
```go
type TOML struct {
ObscureKey string `toml:"some_key_NAME"`
}
```
### Using the `encoding.TextUnmarshaler` interface
Here's an example that automatically parses duration strings into
`time.Duration` values:
```toml
[[song]]
name = "Thunder Road"
duration = "4m49s"
[[song]]
name = "Stairway to Heaven"
duration = "8m03s"
```
Which can be decoded with:
```go
type song struct {
Name string
Duration duration
}
type songs struct {
Song []song
}
var favorites songs
if _, err := toml.Decode(blob, &favorites); err != nil {
log.Fatal(err)
}
for _, s := range favorites.Song {
fmt.Printf("%s (%s)\n", s.Name, s.Duration)
}
```
And you'll also need a `duration` type that satisfies the
`encoding.TextUnmarshaler` interface:
```go
type duration struct {
time.Duration
}
func (d *duration) UnmarshalText(text []byte) error {
var err error
d.Duration, err = time.ParseDuration(string(text))
return err
}
```
### More complex usage
Here's an example of how to load the example from the official spec page:
```toml
# This is a TOML document. Boom.
title = "TOML Example"
[owner]
name = "Tom Preston-Werner"
organization = "GitHub"
bio = "GitHub Cofounder & CEO\nLikes tater tots and beer."
dob = 1979-05-27T07:32:00Z # First class dates? Why not?
[database]
server = "192.168.1.1"
ports = [ 8001, 8001, 8002 ]
connection_max = 5000
enabled = true
[servers]
# You can indent as you please. Tabs or spaces. TOML don't care.
[servers.alpha]
ip = "10.0.0.1"
dc = "eqdc10"
[servers.beta]
ip = "10.0.0.2"
dc = "eqdc10"
[clients]
data = [ ["gamma", "delta"], [1, 2] ] # just an update to make sure parsers support it
# Line breaks are OK when inside arrays
hosts = [
"alpha",
"omega"
]
```
And the corresponding Go types are:
```go
type tomlConfig struct {
Title string
Owner ownerInfo
DB database `toml:"database"`
Servers map[string]server
Clients clients
}
type ownerInfo struct {
Name string
Org string `toml:"organization"`
Bio string
DOB time.Time
}
type database struct {
Server string
Ports []int
ConnMax int `toml:"connection_max"`
Enabled bool
}
type server struct {
IP string
DC string
}
type clients struct {
Data [][]interface{}
Hosts []string
}
```
Note that a case insensitive match will be tried if an exact match can't be
found.
A working example of the above can be found in `_examples/example.{go,toml}`.

View File

@@ -0,0 +1,14 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

View File

@@ -0,0 +1,14 @@
# Implements the TOML test suite interface
This is an implementation of the interface expected by
[toml-test](https://github.com/BurntSushi/toml-test) for my
[toml parser written in Go](https://github.com/BurntSushi/toml).
In particular, it maps TOML data on `stdin` to a JSON format on `stdout`.
Compatible with TOML version
[v0.2.0](https://github.com/mojombo/toml/blob/master/versions/toml-v0.2.0.md)
Compatible with `toml-test` version
[v0.2.0](https://github.com/BurntSushi/toml-test/tree/v0.2.0)

View File

@@ -0,0 +1,90 @@
// Command toml-test-decoder satisfies the toml-test interface for testing
// TOML decoders. Namely, it accepts TOML on stdin and outputs JSON on stdout.
package main
import (
"encoding/json"
"flag"
"fmt"
"log"
"os"
"path"
"time"
"github.com/BurntSushi/toml"
)
func init() {
log.SetFlags(0)
flag.Usage = usage
flag.Parse()
}
func usage() {
log.Printf("Usage: %s < toml-file\n", path.Base(os.Args[0]))
flag.PrintDefaults()
os.Exit(1)
}
func main() {
if flag.NArg() != 0 {
flag.Usage()
}
var tmp interface{}
if _, err := toml.DecodeReader(os.Stdin, &tmp); err != nil {
log.Fatalf("Error decoding TOML: %s", err)
}
typedTmp := translate(tmp)
if err := json.NewEncoder(os.Stdout).Encode(typedTmp); err != nil {
log.Fatalf("Error encoding JSON: %s", err)
}
}
func translate(tomlData interface{}) interface{} {
switch orig := tomlData.(type) {
case map[string]interface{}:
typed := make(map[string]interface{}, len(orig))
for k, v := range orig {
typed[k] = translate(v)
}
return typed
case []map[string]interface{}:
typed := make([]map[string]interface{}, len(orig))
for i, v := range orig {
typed[i] = translate(v).(map[string]interface{})
}
return typed
case []interface{}:
typed := make([]interface{}, len(orig))
for i, v := range orig {
typed[i] = translate(v)
}
// We don't really need to tag arrays, but let's be future proof.
// (If TOML ever supports tuples, we'll need this.)
return tag("array", typed)
case time.Time:
return tag("datetime", orig.Format("2006-01-02T15:04:05Z"))
case bool:
return tag("bool", fmt.Sprintf("%v", orig))
case int64:
return tag("integer", fmt.Sprintf("%d", orig))
case float64:
return tag("float", fmt.Sprintf("%v", orig))
case string:
return tag("string", orig)
}
panic(fmt.Sprintf("Unknown type: %T", tomlData))
}
func tag(typeName string, data interface{}) map[string]interface{} {
return map[string]interface{}{
"type": typeName,
"value": data,
}
}

View File

@@ -0,0 +1,14 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

View File

@@ -0,0 +1,14 @@
# Implements the TOML test suite interface for TOML encoders
This is an implementation of the interface expected by
[toml-test](https://github.com/BurntSushi/toml-test) for the
[TOML encoder](https://github.com/BurntSushi/toml).
In particular, it maps JSON data on `stdin` to a TOML format on `stdout`.
Compatible with TOML version
[v0.2.0](https://github.com/mojombo/toml/blob/master/versions/toml-v0.2.0.md)
Compatible with `toml-test` version
[v0.2.0](https://github.com/BurntSushi/toml-test/tree/v0.2.0)

View File

@@ -0,0 +1,131 @@
// Command toml-test-encoder satisfies the toml-test interface for testing
// TOML encoders. Namely, it accepts JSON on stdin and outputs TOML on stdout.
package main
import (
"encoding/json"
"flag"
"log"
"os"
"path"
"strconv"
"time"
"github.com/BurntSushi/toml"
)
func init() {
log.SetFlags(0)
flag.Usage = usage
flag.Parse()
}
func usage() {
log.Printf("Usage: %s < json-file\n", path.Base(os.Args[0]))
flag.PrintDefaults()
os.Exit(1)
}
func main() {
if flag.NArg() != 0 {
flag.Usage()
}
var tmp interface{}
if err := json.NewDecoder(os.Stdin).Decode(&tmp); err != nil {
log.Fatalf("Error decoding JSON: %s", err)
}
tomlData := translate(tmp)
if err := toml.NewEncoder(os.Stdout).Encode(tomlData); err != nil {
log.Fatalf("Error encoding TOML: %s", err)
}
}
func translate(typedJson interface{}) interface{} {
switch v := typedJson.(type) {
case map[string]interface{}:
if len(v) == 2 && in("type", v) && in("value", v) {
return untag(v)
}
m := make(map[string]interface{}, len(v))
for k, v2 := range v {
m[k] = translate(v2)
}
return m
case []interface{}:
tabArray := make([]map[string]interface{}, len(v))
for i := range v {
if m, ok := translate(v[i]).(map[string]interface{}); ok {
tabArray[i] = m
} else {
log.Fatalf("JSON arrays may only contain objects. This " +
"corresponds to only tables being allowed in " +
"TOML table arrays.")
}
}
return tabArray
}
log.Fatalf("Unrecognized JSON format '%T'.", typedJson)
panic("unreachable")
}
func untag(typed map[string]interface{}) interface{} {
t := typed["type"].(string)
v := typed["value"]
switch t {
case "string":
return v.(string)
case "integer":
v := v.(string)
n, err := strconv.Atoi(v)
if err != nil {
log.Fatalf("Could not parse '%s' as integer: %s", v, err)
}
return n
case "float":
v := v.(string)
f, err := strconv.ParseFloat(v, 64)
if err != nil {
log.Fatalf("Could not parse '%s' as float64: %s", v, err)
}
return f
case "datetime":
v := v.(string)
t, err := time.Parse("2006-01-02T15:04:05Z", v)
if err != nil {
log.Fatalf("Could not parse '%s' as a datetime: %s", v, err)
}
return t
case "bool":
v := v.(string)
switch v {
case "true":
return true
case "false":
return false
}
log.Fatalf("Could not parse '%s' as a boolean.", v)
case "array":
v := v.([]interface{})
array := make([]interface{}, len(v))
for i := range v {
if m, ok := v[i].(map[string]interface{}); ok {
array[i] = untag(m)
} else {
log.Fatalf("Arrays may only contain other arrays or "+
"primitive values, but found a '%T'.", m)
}
}
return array
}
log.Fatalf("Unrecognized tag type '%s'.", t)
panic("unreachable")
}
func in(key string, m map[string]interface{}) bool {
_, ok := m[key]
return ok
}

View File

@@ -0,0 +1,14 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

View File

@@ -0,0 +1,22 @@
# TOML Validator
If Go is installed, it's simple to try it out:
```bash
go get github.com/BurntSushi/toml/cmd/tomlv
tomlv some-toml-file.toml
```
You can see the types of every key in a TOML file with:
```bash
tomlv -types some-toml-file.toml
```
At the moment, only one error message is reported at a time. Error messages
include line numbers. No output means that the files given are valid TOML, or
there is a bug in `tomlv`.
Compatible with TOML version
[v0.1.0](https://github.com/mojombo/toml/blob/master/versions/toml-v0.1.0.md)

View File

@@ -0,0 +1,61 @@
// Command tomlv validates TOML documents and prints each key's type.
package main
import (
"flag"
"fmt"
"log"
"os"
"path"
"strings"
"text/tabwriter"
"github.com/BurntSushi/toml"
)
var (
flagTypes = false
)
func init() {
log.SetFlags(0)
flag.BoolVar(&flagTypes, "types", flagTypes,
"When set, the types of every defined key will be shown.")
flag.Usage = usage
flag.Parse()
}
func usage() {
log.Printf("Usage: %s toml-file [ toml-file ... ]\n",
path.Base(os.Args[0]))
flag.PrintDefaults()
os.Exit(1)
}
func main() {
if flag.NArg() < 1 {
flag.Usage()
}
for _, f := range flag.Args() {
var tmp interface{}
md, err := toml.DecodeFile(f, &tmp)
if err != nil {
log.Fatalf("Error in '%s': %s", f, err)
}
if flagTypes {
printTypes(md)
}
}
}
func printTypes(md toml.MetaData) {
tabw := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
for _, key := range md.Keys() {
fmt.Fprintf(tabw, "%s%s\t%s\n",
strings.Repeat(" ", len(key)-1), key, md.Type(key...))
}
tabw.Flush()
}

View File

@@ -0,0 +1,492 @@
package toml
import (
"fmt"
"io"
"io/ioutil"
"math"
"reflect"
"strings"
"time"
)
var e = fmt.Errorf
// Unmarshaler is the interface implemented by objects that can unmarshal a
// TOML description of themselves.
type Unmarshaler interface {
UnmarshalTOML(interface{}) error
}
// Unmarshal decodes the contents of `p` in TOML format into a pointer `v`.
func Unmarshal(p []byte, v interface{}) error {
_, err := Decode(string(p), v)
return err
}
// Primitive is a TOML value that hasn't been decoded into a Go value.
// When using the various `Decode*` functions, the type `Primitive` may
// be given to any value, and its decoding will be delayed.
//
// A `Primitive` value can be decoded using the `PrimitiveDecode` function.
//
// The underlying representation of a `Primitive` value is subject to change.
// Do not rely on it.
//
// N.B. Primitive values are still parsed, so using them will only avoid
// the overhead of reflection. They can be useful when you don't know the
// exact type of TOML data until run time.
type Primitive struct {
undecoded interface{}
context Key
}
// DEPRECATED!
//
// Use MetaData.PrimitiveDecode instead.
func PrimitiveDecode(primValue Primitive, v interface{}) error {
md := MetaData{decoded: make(map[string]bool)}
return md.unify(primValue.undecoded, rvalue(v))
}
// PrimitiveDecode is just like the other `Decode*` functions, except it
// decodes a TOML value that has already been parsed. Valid primitive values
// can *only* be obtained from values filled by the decoder functions,
// including this method. (i.e., `v` may contain more `Primitive`
// values.)
//
// Meta data for primitive values is included in the meta data returned by
// the `Decode*` functions with one exception: keys returned by the Undecoded
// method will only reflect keys that were decoded. Namely, any keys hidden
// behind a Primitive will be considered undecoded. Executing this method will
// update the undecoded keys in the meta data. (See the example.)
func (md *MetaData) PrimitiveDecode(primValue Primitive, v interface{}) error {
md.context = primValue.context
defer func() { md.context = nil }()
return md.unify(primValue.undecoded, rvalue(v))
}
// Decode will decode the contents of `data` in TOML format into a pointer
// `v`.
//
// TOML hashes correspond to Go structs or maps. (Dealer's choice. They can be
// used interchangeably.)
//
// TOML arrays of tables correspond to either a slice of structs or a slice
// of maps.
//
// TOML datetimes correspond to Go `time.Time` values.
//
// All other TOML types (float, string, int, bool and array) correspond
// to the obvious Go types.
//
// An exception to the above rules is if a type implements the
// encoding.TextUnmarshaler interface. In this case, any primitive TOML value
// (floats, strings, integers, booleans and datetimes) will be converted to
// a byte string and given to the value's UnmarshalText method. See the
// Unmarshaler example for a demonstration with time duration strings.
//
// Key mapping
//
// TOML keys can map to either keys in a Go map or field names in a Go
// struct. The special `toml` struct tag may be used to map TOML keys to
// struct fields that don't match the key name exactly. (See the example.)
// A case insensitive match to struct names will be tried if an exact match
// can't be found.
//
// The mapping between TOML values and Go values is loose. That is, there
// may exist TOML values that cannot be placed into your representation, and
// there may be parts of your representation that do not correspond to
// TOML values. This loose mapping can be made stricter by using the IsDefined
// and/or Undecoded methods on the MetaData returned.
//
// This decoder will not handle cyclic types. If a cyclic type is passed,
// `Decode` will not terminate.
func Decode(data string, v interface{}) (MetaData, error) {
p, err := parse(data)
if err != nil {
return MetaData{}, err
}
md := MetaData{
p.mapping, p.types, p.ordered,
make(map[string]bool, len(p.ordered)), nil,
}
return md, md.unify(p.mapping, rvalue(v))
}
// DecodeFile is just like Decode, except it will automatically read the
// contents of the file at `fpath` and decode it for you.
func DecodeFile(fpath string, v interface{}) (MetaData, error) {
bs, err := ioutil.ReadFile(fpath)
if err != nil {
return MetaData{}, err
}
return Decode(string(bs), v)
}
// DecodeReader is just like Decode, except it will consume all bytes
// from the reader and decode it for you.
func DecodeReader(r io.Reader, v interface{}) (MetaData, error) {
bs, err := ioutil.ReadAll(r)
if err != nil {
return MetaData{}, err
}
return Decode(string(bs), v)
}
// unify performs a sort of type unification based on the structure of `rv`,
// which is the client representation.
//
// Any type mismatch produces an error. Finding a type that we don't know
// how to handle produces an unsupported type error.
func (md *MetaData) unify(data interface{}, rv reflect.Value) error {
// Special case. Look for a `Primitive` value.
if rv.Type() == reflect.TypeOf((*Primitive)(nil)).Elem() {
// Save the undecoded data and the key context into the primitive
// value.
context := make(Key, len(md.context))
copy(context, md.context)
rv.Set(reflect.ValueOf(Primitive{
undecoded: data,
context: context,
}))
return nil
}
// Special case. Unmarshaler Interface support.
if rv.CanAddr() {
if v, ok := rv.Addr().Interface().(Unmarshaler); ok {
return v.UnmarshalTOML(data)
}
}
// Special case. Handle time.Time values specifically.
// TODO: Remove this code when we decide to drop support for Go 1.1.
// This isn't necessary in Go 1.2 because time.Time satisfies the encoding
// interfaces.
if rv.Type().AssignableTo(rvalue(time.Time{}).Type()) {
return md.unifyDatetime(data, rv)
}
// Special case. Look for a value satisfying the TextUnmarshaler interface.
if v, ok := rv.Interface().(TextUnmarshaler); ok {
return md.unifyText(data, v)
}
// BUG(burntsushi)
// The behavior here is incorrect whenever a Go type satisfies the
// encoding.TextUnmarshaler interface but also corresponds to a TOML
// hash or array. In particular, the unmarshaler should only be applied
// to primitive TOML values. But at this point, it will be applied to
// all kinds of values and produce an incorrect error whenever those values
// are hashes or arrays (including arrays of tables).
k := rv.Kind()
// laziness
if k >= reflect.Int && k <= reflect.Uint64 {
return md.unifyInt(data, rv)
}
switch k {
case reflect.Ptr:
elem := reflect.New(rv.Type().Elem())
err := md.unify(data, reflect.Indirect(elem))
if err != nil {
return err
}
rv.Set(elem)
return nil
case reflect.Struct:
return md.unifyStruct(data, rv)
case reflect.Map:
return md.unifyMap(data, rv)
case reflect.Array:
return md.unifyArray(data, rv)
case reflect.Slice:
return md.unifySlice(data, rv)
case reflect.String:
return md.unifyString(data, rv)
case reflect.Bool:
return md.unifyBool(data, rv)
case reflect.Interface:
// we only support empty interfaces.
if rv.NumMethod() > 0 {
return e("Unsupported type '%s'.", rv.Kind())
}
return md.unifyAnything(data, rv)
case reflect.Float32:
fallthrough
case reflect.Float64:
return md.unifyFloat64(data, rv)
}
return e("Unsupported type '%s'.", rv.Kind())
}
func (md *MetaData) unifyStruct(mapping interface{}, rv reflect.Value) error {
tmap, ok := mapping.(map[string]interface{})
if !ok {
return mismatch(rv, "map", mapping)
}
for key, datum := range tmap {
var f *field
fields := cachedTypeFields(rv.Type())
for i := range fields {
ff := &fields[i]
if ff.name == key {
f = ff
break
}
if f == nil && strings.EqualFold(ff.name, key) {
f = ff
}
}
if f != nil {
subv := rv
for _, i := range f.index {
subv = indirect(subv.Field(i))
}
if isUnifiable(subv) {
md.decoded[md.context.add(key).String()] = true
md.context = append(md.context, key)
if err := md.unify(datum, subv); err != nil {
return e("Type mismatch for '%s.%s': %s",
rv.Type().String(), f.name, err)
}
md.context = md.context[0 : len(md.context)-1]
} else if f.name != "" {
// Bad user! No soup for you!
return e("Field '%s.%s' is unexported, and therefore cannot "+
"be loaded with reflection.", rv.Type().String(), f.name)
}
}
}
return nil
}
func (md *MetaData) unifyMap(mapping interface{}, rv reflect.Value) error {
tmap, ok := mapping.(map[string]interface{})
if !ok {
return badtype("map", mapping)
}
if rv.IsNil() {
rv.Set(reflect.MakeMap(rv.Type()))
}
for k, v := range tmap {
md.decoded[md.context.add(k).String()] = true
md.context = append(md.context, k)
rvkey := indirect(reflect.New(rv.Type().Key()))
rvval := reflect.Indirect(reflect.New(rv.Type().Elem()))
if err := md.unify(v, rvval); err != nil {
return err
}
md.context = md.context[0 : len(md.context)-1]
rvkey.SetString(k)
rv.SetMapIndex(rvkey, rvval)
}
return nil
}
func (md *MetaData) unifyArray(data interface{}, rv reflect.Value) error {
datav := reflect.ValueOf(data)
if datav.Kind() != reflect.Slice {
return badtype("slice", data)
}
sliceLen := datav.Len()
if sliceLen != rv.Len() {
return e("expected array length %d; got TOML array of length %d",
rv.Len(), sliceLen)
}
return md.unifySliceArray(datav, rv)
}
func (md *MetaData) unifySlice(data interface{}, rv reflect.Value) error {
datav := reflect.ValueOf(data)
if datav.Kind() != reflect.Slice {
return badtype("slice", data)
}
sliceLen := datav.Len()
if rv.IsNil() {
rv.Set(reflect.MakeSlice(rv.Type(), sliceLen, sliceLen))
}
return md.unifySliceArray(datav, rv)
}
func (md *MetaData) unifySliceArray(data, rv reflect.Value) error {
sliceLen := data.Len()
for i := 0; i < sliceLen; i++ {
v := data.Index(i).Interface()
sliceval := indirect(rv.Index(i))
if err := md.unify(v, sliceval); err != nil {
return err
}
}
return nil
}
func (md *MetaData) unifyDatetime(data interface{}, rv reflect.Value) error {
if _, ok := data.(time.Time); ok {
rv.Set(reflect.ValueOf(data))
return nil
}
return badtype("time.Time", data)
}
func (md *MetaData) unifyString(data interface{}, rv reflect.Value) error {
if s, ok := data.(string); ok {
rv.SetString(s)
return nil
}
return badtype("string", data)
}
func (md *MetaData) unifyFloat64(data interface{}, rv reflect.Value) error {
if num, ok := data.(float64); ok {
switch rv.Kind() {
case reflect.Float32:
fallthrough
case reflect.Float64:
rv.SetFloat(num)
default:
panic("bug")
}
return nil
}
return badtype("float", data)
}
func (md *MetaData) unifyInt(data interface{}, rv reflect.Value) error {
if num, ok := data.(int64); ok {
if rv.Kind() >= reflect.Int && rv.Kind() <= reflect.Int64 {
switch rv.Kind() {
case reflect.Int, reflect.Int64:
// No bounds checking necessary.
case reflect.Int8:
if num < math.MinInt8 || num > math.MaxInt8 {
return e("Value '%d' is out of range for int8.", num)
}
case reflect.Int16:
if num < math.MinInt16 || num > math.MaxInt16 {
return e("Value '%d' is out of range for int16.", num)
}
case reflect.Int32:
if num < math.MinInt32 || num > math.MaxInt32 {
return e("Value '%d' is out of range for int32.", num)
}
}
rv.SetInt(num)
} else if rv.Kind() >= reflect.Uint && rv.Kind() <= reflect.Uint64 {
unum := uint64(num)
switch rv.Kind() {
case reflect.Uint, reflect.Uint64:
// No bounds checking necessary.
case reflect.Uint8:
if num < 0 || unum > math.MaxUint8 {
return e("Value '%d' is out of range for uint8.", num)
}
case reflect.Uint16:
if num < 0 || unum > math.MaxUint16 {
return e("Value '%d' is out of range for uint16.", num)
}
case reflect.Uint32:
if num < 0 || unum > math.MaxUint32 {
return e("Value '%d' is out of range for uint32.", num)
}
}
rv.SetUint(unum)
} else {
panic("unreachable")
}
return nil
}
return badtype("integer", data)
}
func (md *MetaData) unifyBool(data interface{}, rv reflect.Value) error {
if b, ok := data.(bool); ok {
rv.SetBool(b)
return nil
}
return badtype("boolean", data)
}
func (md *MetaData) unifyAnything(data interface{}, rv reflect.Value) error {
rv.Set(reflect.ValueOf(data))
return nil
}
func (md *MetaData) unifyText(data interface{}, v TextUnmarshaler) error {
var s string
switch sdata := data.(type) {
case TextMarshaler:
text, err := sdata.MarshalText()
if err != nil {
return err
}
s = string(text)
case fmt.Stringer:
s = sdata.String()
case string:
s = sdata
case bool:
s = fmt.Sprintf("%v", sdata)
case int64:
s = fmt.Sprintf("%d", sdata)
case float64:
s = fmt.Sprintf("%f", sdata)
default:
return badtype("primitive (string-like)", data)
}
if err := v.UnmarshalText([]byte(s)); err != nil {
return err
}
return nil
}
// rvalue returns a reflect.Value of `v`. All pointers are resolved.
func rvalue(v interface{}) reflect.Value {
return indirect(reflect.ValueOf(v))
}
// indirect returns the value pointed to by a pointer.
// Pointers are followed until the value is not a pointer.
// New values are allocated for each nil pointer.
//
// An exception to this rule is if the value satisfies an interface of
// interest to us (like encoding.TextUnmarshaler).
func indirect(v reflect.Value) reflect.Value {
if v.Kind() != reflect.Ptr {
if v.CanAddr() {
pv := v.Addr()
if _, ok := pv.Interface().(TextUnmarshaler); ok {
return pv
}
}
return v
}
if v.IsNil() {
v.Set(reflect.New(v.Type().Elem()))
}
return indirect(reflect.Indirect(v))
}
func isUnifiable(rv reflect.Value) bool {
if rv.CanSet() {
return true
}
if _, ok := rv.Interface().(TextUnmarshaler); ok {
return true
}
return false
}
func badtype(expected string, data interface{}) error {
return e("Expected %s but found '%T'.", expected, data)
}
func mismatch(user reflect.Value, expected string, data interface{}) error {
return e("Type mismatch for %s. Expected %s but found '%T'.",
user.Type().String(), expected, data)
}

View File

@@ -0,0 +1,122 @@
package toml
import "strings"
// MetaData allows access to meta information about TOML data that may not
// be inferrable via reflection. In particular, whether a key has been defined
// and the TOML type of a key.
type MetaData struct {
mapping map[string]interface{}
types map[string]tomlType
keys []Key
decoded map[string]bool
context Key // Used only during decoding.
}
// IsDefined returns true if the key given exists in the TOML data. The key
// should be specified hierarchially. e.g.,
//
// // access the TOML key 'a.b.c'
// IsDefined("a", "b", "c")
//
// IsDefined will return false if an empty key given. Keys are case sensitive.
func (md *MetaData) IsDefined(key ...string) bool {
if len(key) == 0 {
return false
}
var hash map[string]interface{}
var ok bool
var hashOrVal interface{} = md.mapping
for _, k := range key {
if hash, ok = hashOrVal.(map[string]interface{}); !ok {
return false
}
if hashOrVal, ok = hash[k]; !ok {
return false
}
}
return true
}
// Type returns a string representation of the type of the key specified.
//
// Type will return the empty string if given an empty key or a key that
// does not exist. Keys are case sensitive.
func (md *MetaData) Type(key ...string) string {
fullkey := strings.Join(key, ".")
if typ, ok := md.types[fullkey]; ok {
return typ.typeString()
}
return ""
}
// Key is the type of any TOML key, including key groups. Use (MetaData).Keys
// to get values of this type.
type Key []string
func (k Key) String() string {
return strings.Join(k, ".")
}
func (k Key) maybeQuotedAll() string {
var ss []string
for i := range k {
ss = append(ss, k.maybeQuoted(i))
}
return strings.Join(ss, ".")
}
func (k Key) maybeQuoted(i int) string {
quote := false
for _, c := range k[i] {
if !isBareKeyChar(c) {
quote = true
break
}
}
if quote {
return "\"" + strings.Replace(k[i], "\"", "\\\"", -1) + "\""
} else {
return k[i]
}
}
func (k Key) add(piece string) Key {
newKey := make(Key, len(k)+1)
copy(newKey, k)
newKey[len(k)] = piece
return newKey
}
// Keys returns a slice of every key in the TOML data, including key groups.
// Each key is itself a slice, where the first element is the top of the
// hierarchy and the last is the most specific.
//
// The list will have the same order as the keys appeared in the TOML data.
//
// All keys returned are non-empty.
func (md *MetaData) Keys() []Key {
return md.keys
}
// Undecoded returns all keys that have not been decoded in the order in which
// they appear in the original TOML document.
//
// This includes keys that haven't been decoded because of a Primitive value.
// Once the Primitive value is decoded, the keys will be considered decoded.
//
// Also note that decoding into an empty interface will result in no decoding,
// and so no keys will be considered decoded.
//
// In this sense, the Undecoded keys correspond to keys in the TOML document
// that do not have a concrete type in your representation.
func (md *MetaData) Undecoded() []Key {
undecoded := make([]Key, 0, len(md.keys))
for _, key := range md.keys {
if !md.decoded[key.String()] {
undecoded = append(undecoded, key)
}
}
return undecoded
}

View File

@@ -0,0 +1,950 @@
package toml
import (
"fmt"
"log"
"reflect"
"testing"
"time"
)
func init() {
log.SetFlags(0)
}
func TestDecodeSimple(t *testing.T) {
var testSimple = `
age = 250
andrew = "gallant"
kait = "brady"
now = 1987-07-05T05:45:00Z
yesOrNo = true
pi = 3.14
colors = [
["red", "green", "blue"],
["cyan", "magenta", "yellow", "black"],
]
[My.Cats]
plato = "cat 1"
cauchy = "cat 2"
`
type cats struct {
Plato string
Cauchy string
}
type simple struct {
Age int
Colors [][]string
Pi float64
YesOrNo bool
Now time.Time
Andrew string
Kait string
My map[string]cats
}
var val simple
_, err := Decode(testSimple, &val)
if err != nil {
t.Fatal(err)
}
now, err := time.Parse("2006-01-02T15:04:05", "1987-07-05T05:45:00")
if err != nil {
panic(err)
}
var answer = simple{
Age: 250,
Andrew: "gallant",
Kait: "brady",
Now: now,
YesOrNo: true,
Pi: 3.14,
Colors: [][]string{
{"red", "green", "blue"},
{"cyan", "magenta", "yellow", "black"},
},
My: map[string]cats{
"Cats": cats{Plato: "cat 1", Cauchy: "cat 2"},
},
}
if !reflect.DeepEqual(val, answer) {
t.Fatalf("Expected\n-----\n%#v\n-----\nbut got\n-----\n%#v\n",
answer, val)
}
}
func TestDecodeEmbedded(t *testing.T) {
type Dog struct{ Name string }
type Age int
tests := map[string]struct {
input string
decodeInto interface{}
wantDecoded interface{}
}{
"embedded struct": {
input: `Name = "milton"`,
decodeInto: &struct{ Dog }{},
wantDecoded: &struct{ Dog }{Dog{"milton"}},
},
"embedded non-nil pointer to struct": {
input: `Name = "milton"`,
decodeInto: &struct{ *Dog }{},
wantDecoded: &struct{ *Dog }{&Dog{"milton"}},
},
"embedded nil pointer to struct": {
input: ``,
decodeInto: &struct{ *Dog }{},
wantDecoded: &struct{ *Dog }{nil},
},
"embedded int": {
input: `Age = -5`,
decodeInto: &struct{ Age }{},
wantDecoded: &struct{ Age }{-5},
},
}
for label, test := range tests {
_, err := Decode(test.input, test.decodeInto)
if err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(test.wantDecoded, test.decodeInto) {
t.Errorf("%s: want decoded == %+v, got %+v",
label, test.wantDecoded, test.decodeInto)
}
}
}
func TestTableArrays(t *testing.T) {
var tomlTableArrays = `
[[albums]]
name = "Born to Run"
[[albums.songs]]
name = "Jungleland"
[[albums.songs]]
name = "Meeting Across the River"
[[albums]]
name = "Born in the USA"
[[albums.songs]]
name = "Glory Days"
[[albums.songs]]
name = "Dancing in the Dark"
`
type Song struct {
Name string
}
type Album struct {
Name string
Songs []Song
}
type Music struct {
Albums []Album
}
expected := Music{[]Album{
{"Born to Run", []Song{{"Jungleland"}, {"Meeting Across the River"}}},
{"Born in the USA", []Song{{"Glory Days"}, {"Dancing in the Dark"}}},
}}
var got Music
if _, err := Decode(tomlTableArrays, &got); err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(expected, got) {
t.Fatalf("\n%#v\n!=\n%#v\n", expected, got)
}
}
// Case insensitive matching tests.
// A bit more comprehensive than needed given the current implementation,
// but implementations change.
// Probably still missing demonstrations of some ugly corner cases regarding
// case insensitive matching and multiple fields.
func TestCase(t *testing.T) {
var caseToml = `
tOpString = "string"
tOpInt = 1
tOpFloat = 1.1
tOpBool = true
tOpdate = 2006-01-02T15:04:05Z
tOparray = [ "array" ]
Match = "i should be in Match only"
MatcH = "i should be in MatcH only"
once = "just once"
[nEst.eD]
nEstedString = "another string"
`
type InsensitiveEd struct {
NestedString string
}
type InsensitiveNest struct {
Ed InsensitiveEd
}
type Insensitive struct {
TopString string
TopInt int
TopFloat float64
TopBool bool
TopDate time.Time
TopArray []string
Match string
MatcH string
Once string
OncE string
Nest InsensitiveNest
}
tme, err := time.Parse(time.RFC3339, time.RFC3339[:len(time.RFC3339)-5])
if err != nil {
panic(err)
}
expected := Insensitive{
TopString: "string",
TopInt: 1,
TopFloat: 1.1,
TopBool: true,
TopDate: tme,
TopArray: []string{"array"},
MatcH: "i should be in MatcH only",
Match: "i should be in Match only",
Once: "just once",
OncE: "",
Nest: InsensitiveNest{
Ed: InsensitiveEd{NestedString: "another string"},
},
}
var got Insensitive
if _, err := Decode(caseToml, &got); err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(expected, got) {
t.Fatalf("\n%#v\n!=\n%#v\n", expected, got)
}
}
func TestPointers(t *testing.T) {
type Object struct {
Type string
Description string
}
type Dict struct {
NamedObject map[string]*Object
BaseObject *Object
Strptr *string
Strptrs []*string
}
s1, s2, s3 := "blah", "abc", "def"
expected := &Dict{
Strptr: &s1,
Strptrs: []*string{&s2, &s3},
NamedObject: map[string]*Object{
"foo": {"FOO", "fooooo!!!"},
"bar": {"BAR", "ba-ba-ba-ba-barrrr!!!"},
},
BaseObject: &Object{"BASE", "da base"},
}
ex1 := `
Strptr = "blah"
Strptrs = ["abc", "def"]
[NamedObject.foo]
Type = "FOO"
Description = "fooooo!!!"
[NamedObject.bar]
Type = "BAR"
Description = "ba-ba-ba-ba-barrrr!!!"
[BaseObject]
Type = "BASE"
Description = "da base"
`
dict := new(Dict)
_, err := Decode(ex1, dict)
if err != nil {
t.Errorf("Decode error: %v", err)
}
if !reflect.DeepEqual(expected, dict) {
t.Fatalf("\n%#v\n!=\n%#v\n", expected, dict)
}
}
type sphere struct {
Center [3]float64
Radius float64
}
func TestDecodeSimpleArray(t *testing.T) {
var s1 sphere
if _, err := Decode(`center = [0.0, 1.5, 0.0]`, &s1); err != nil {
t.Fatal(err)
}
}
func TestDecodeArrayWrongSize(t *testing.T) {
var s1 sphere
if _, err := Decode(`center = [0.1, 2.3]`, &s1); err == nil {
t.Fatal("Expected array type mismatch error")
}
}
func TestDecodeLargeIntoSmallInt(t *testing.T) {
type table struct {
Value int8
}
var tab table
if _, err := Decode(`value = 500`, &tab); err == nil {
t.Fatal("Expected integer out-of-bounds error.")
}
}
func TestDecodeSizedInts(t *testing.T) {
type table struct {
U8 uint8
U16 uint16
U32 uint32
U64 uint64
U uint
I8 int8
I16 int16
I32 int32
I64 int64
I int
}
answer := table{1, 1, 1, 1, 1, -1, -1, -1, -1, -1}
toml := `
u8 = 1
u16 = 1
u32 = 1
u64 = 1
u = 1
i8 = -1
i16 = -1
i32 = -1
i64 = -1
i = -1
`
var tab table
if _, err := Decode(toml, &tab); err != nil {
t.Fatal(err.Error())
}
if answer != tab {
t.Fatalf("Expected %#v but got %#v", answer, tab)
}
}
func TestUnmarshaler(t *testing.T) {
var tomlBlob = `
[dishes.hamboogie]
name = "Hamboogie with fries"
price = 10.99
[[dishes.hamboogie.ingredients]]
name = "Bread Bun"
[[dishes.hamboogie.ingredients]]
name = "Lettuce"
[[dishes.hamboogie.ingredients]]
name = "Real Beef Patty"
[[dishes.hamboogie.ingredients]]
name = "Tomato"
[dishes.eggsalad]
name = "Egg Salad with rice"
price = 3.99
[[dishes.eggsalad.ingredients]]
name = "Egg"
[[dishes.eggsalad.ingredients]]
name = "Mayo"
[[dishes.eggsalad.ingredients]]
name = "Rice"
`
m := &menu{}
if _, err := Decode(tomlBlob, m); err != nil {
log.Fatal(err)
}
if len(m.Dishes) != 2 {
t.Log("two dishes should be loaded with UnmarshalTOML()")
t.Errorf("expected %d but got %d", 2, len(m.Dishes))
}
eggSalad := m.Dishes["eggsalad"]
if _, ok := interface{}(eggSalad).(dish); !ok {
t.Errorf("expected a dish")
}
if eggSalad.Name != "Egg Salad with rice" {
t.Errorf("expected the dish to be named 'Egg Salad with rice'")
}
if len(eggSalad.Ingredients) != 3 {
t.Log("dish should be loaded with UnmarshalTOML()")
t.Errorf("expected %d but got %d", 3, len(eggSalad.Ingredients))
}
found := false
for _, i := range eggSalad.Ingredients {
if i.Name == "Rice" {
found = true
break
}
}
if !found {
t.Error("Rice was not loaded in UnmarshalTOML()")
}
// test on a value - must be passed as *
o := menu{}
if _, err := Decode(tomlBlob, &o); err != nil {
log.Fatal(err)
}
}
type menu struct {
Dishes map[string]dish
}
func (m *menu) UnmarshalTOML(p interface{}) error {
m.Dishes = make(map[string]dish)
data, _ := p.(map[string]interface{})
dishes := data["dishes"].(map[string]interface{})
for n, v := range dishes {
if d, ok := v.(map[string]interface{}); ok {
nd := dish{}
nd.UnmarshalTOML(d)
m.Dishes[n] = nd
} else {
return fmt.Errorf("not a dish")
}
}
return nil
}
type dish struct {
Name string
Price float32
Ingredients []ingredient
}
func (d *dish) UnmarshalTOML(p interface{}) error {
data, _ := p.(map[string]interface{})
d.Name, _ = data["name"].(string)
d.Price, _ = data["price"].(float32)
ingredients, _ := data["ingredients"].([]map[string]interface{})
for _, e := range ingredients {
n, _ := interface{}(e).(map[string]interface{})
name, _ := n["name"].(string)
i := ingredient{name}
d.Ingredients = append(d.Ingredients, i)
}
return nil
}
type ingredient struct {
Name string
}
func ExampleMetaData_PrimitiveDecode() {
var md MetaData
var err error
var tomlBlob = `
ranking = ["Springsteen", "J Geils"]
[bands.Springsteen]
started = 1973
albums = ["Greetings", "WIESS", "Born to Run", "Darkness"]
[bands."J Geils"]
started = 1970
albums = ["The J. Geils Band", "Full House", "Blow Your Face Out"]
`
type band struct {
Started int
Albums []string
}
type classics struct {
Ranking []string
Bands map[string]Primitive
}
// Do the initial decode. Reflection is delayed on Primitive values.
var music classics
if md, err = Decode(tomlBlob, &music); err != nil {
log.Fatal(err)
}
// MetaData still includes information on Primitive values.
fmt.Printf("Is `bands.Springsteen` defined? %v\n",
md.IsDefined("bands", "Springsteen"))
// Decode primitive data into Go values.
for _, artist := range music.Ranking {
// A band is a primitive value, so we need to decode it to get a
// real `band` value.
primValue := music.Bands[artist]
var aBand band
if err = md.PrimitiveDecode(primValue, &aBand); err != nil {
log.Fatal(err)
}
fmt.Printf("%s started in %d.\n", artist, aBand.Started)
}
// Check to see if there were any fields left undecoded.
// Note that this won't be empty before decoding the Primitive value!
fmt.Printf("Undecoded: %q\n", md.Undecoded())
// Output:
// Is `bands.Springsteen` defined? true
// Springsteen started in 1973.
// J Geils started in 1970.
// Undecoded: []
}
func ExampleDecode() {
var tomlBlob = `
# Some comments.
[alpha]
ip = "10.0.0.1"
[alpha.config]
Ports = [ 8001, 8002 ]
Location = "Toronto"
Created = 1987-07-05T05:45:00Z
[beta]
ip = "10.0.0.2"
[beta.config]
Ports = [ 9001, 9002 ]
Location = "New Jersey"
Created = 1887-01-05T05:55:00Z
`
type serverConfig struct {
Ports []int
Location string
Created time.Time
}
type server struct {
IP string `toml:"ip"`
Config serverConfig `toml:"config"`
}
type servers map[string]server
var config servers
if _, err := Decode(tomlBlob, &config); err != nil {
log.Fatal(err)
}
for _, name := range []string{"alpha", "beta"} {
s := config[name]
fmt.Printf("Server: %s (ip: %s) in %s created on %s\n",
name, s.IP, s.Config.Location,
s.Config.Created.Format("2006-01-02"))
fmt.Printf("Ports: %v\n", s.Config.Ports)
}
// Output:
// Server: alpha (ip: 10.0.0.1) in Toronto created on 1987-07-05
// Ports: [8001 8002]
// Server: beta (ip: 10.0.0.2) in New Jersey created on 1887-01-05
// Ports: [9001 9002]
}
type duration struct {
time.Duration
}
func (d *duration) UnmarshalText(text []byte) error {
var err error
d.Duration, err = time.ParseDuration(string(text))
return err
}
// Example Unmarshaler shows how to decode TOML strings into your own
// custom data type.
func Example_unmarshaler() {
blob := `
[[song]]
name = "Thunder Road"
duration = "4m49s"
[[song]]
name = "Stairway to Heaven"
duration = "8m03s"
`
type song struct {
Name string
Duration duration
}
type songs struct {
Song []song
}
var favorites songs
if _, err := Decode(blob, &favorites); err != nil {
log.Fatal(err)
}
// Code to implement the TextUnmarshaler interface for `duration`:
//
// type duration struct {
// time.Duration
// }
//
// func (d *duration) UnmarshalText(text []byte) error {
// var err error
// d.Duration, err = time.ParseDuration(string(text))
// return err
// }
for _, s := range favorites.Song {
fmt.Printf("%s (%s)\n", s.Name, s.Duration)
}
// Output:
// Thunder Road (4m49s)
// Stairway to Heaven (8m3s)
}
// Example StrictDecoding shows how to detect whether there are keys in the
// TOML document that weren't decoded into the value given. This is useful
// for returning an error to the user if they've included extraneous fields
// in their configuration.
func Example_strictDecoding() {
var blob = `
key1 = "value1"
key2 = "value2"
key3 = "value3"
`
type config struct {
Key1 string
Key3 string
}
var conf config
md, err := Decode(blob, &conf)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Undecoded keys: %q\n", md.Undecoded())
// Output:
// Undecoded keys: ["key2"]
}
// Example UnmarshalTOML shows how to implement a struct type that knows how to
// unmarshal itself. The struct must take full responsibility for mapping the
// values passed into the struct. The method may be used with interfaces in a
// struct in cases where the actual type is not known until the data is
// examined.
func Example_unmarshalTOML() {
var blob = `
[[parts]]
type = "valve"
id = "valve-1"
size = 1.2
rating = 4
[[parts]]
type = "valve"
id = "valve-2"
size = 2.1
rating = 5
[[parts]]
type = "pipe"
id = "pipe-1"
length = 2.1
diameter = 12
[[parts]]
type = "cable"
id = "cable-1"
length = 12
rating = 3.1
`
o := &order{}
err := Unmarshal([]byte(blob), o)
if err != nil {
log.Fatal(err)
}
fmt.Println(len(o.parts))
for _, part := range o.parts {
fmt.Println(part.Name())
}
// Code to implement UmarshalJSON.
// type order struct {
// // NOTE `order.parts` is a private slice of type `part` which is an
// // interface and may only be loaded from toml using the
// // UnmarshalTOML() method of the Umarshaler interface.
// parts parts
// }
// func (o *order) UnmarshalTOML(data interface{}) error {
// // NOTE the example below contains detailed type casting to show how
// // the 'data' is retrieved. In operational use, a type cast wrapper
// // may be prefered e.g.
// //
// // func AsMap(v interface{}) (map[string]interface{}, error) {
// // return v.(map[string]interface{})
// // }
// //
// // resulting in:
// // d, _ := AsMap(data)
// //
// d, _ := data.(map[string]interface{})
// parts, _ := d["parts"].([]map[string]interface{})
// for _, p := range parts {
// typ, _ := p["type"].(string)
// id, _ := p["id"].(string)
// // detect the type of part and handle each case
// switch p["type"] {
// case "valve":
// size := float32(p["size"].(float64))
// rating := int(p["rating"].(int64))
// valve := &valve{
// Type: typ,
// ID: id,
// Size: size,
// Rating: rating,
// }
// o.parts = append(o.parts, valve)
// case "pipe":
// length := float32(p["length"].(float64))
// diameter := int(p["diameter"].(int64))
// pipe := &pipe{
// Type: typ,
// ID: id,
// Length: length,
// Diameter: diameter,
// }
// o.parts = append(o.parts, pipe)
// case "cable":
// length := int(p["length"].(int64))
// rating := float32(p["rating"].(float64))
// cable := &cable{
// Type: typ,
// ID: id,
// Length: length,
// Rating: rating,
// }
// o.parts = append(o.parts, cable)
// }
// }
// return nil
// }
// type parts []part
// type part interface {
// Name() string
// }
// type valve struct {
// Type string
// ID string
// Size float32
// Rating int
// }
// func (v *valve) Name() string {
// return fmt.Sprintf("VALVE: %s", v.ID)
// }
// type pipe struct {
// Type string
// ID string
// Length float32
// Diameter int
// }
// func (p *pipe) Name() string {
// return fmt.Sprintf("PIPE: %s", p.ID)
// }
// type cable struct {
// Type string
// ID string
// Length int
// Rating float32
// }
// func (c *cable) Name() string {
// return fmt.Sprintf("CABLE: %s", c.ID)
// }
// Output:
// 4
// VALVE: valve-1
// VALVE: valve-2
// PIPE: pipe-1
// CABLE: cable-1
}
type order struct {
// NOTE `order.parts` is a private slice of type `part` which is an
// interface and may only be loaded from toml using the UnmarshalTOML()
// method of the Umarshaler interface.
parts parts
}
func (o *order) UnmarshalTOML(data interface{}) error {
// NOTE the example below contains detailed type casting to show how
// the 'data' is retrieved. In operational use, a type cast wrapper
// may be prefered e.g.
//
// func AsMap(v interface{}) (map[string]interface{}, error) {
// return v.(map[string]interface{})
// }
//
// resulting in:
// d, _ := AsMap(data)
//
d, _ := data.(map[string]interface{})
parts, _ := d["parts"].([]map[string]interface{})
for _, p := range parts {
typ, _ := p["type"].(string)
id, _ := p["id"].(string)
// detect the type of part and handle each case
switch p["type"] {
case "valve":
size := float32(p["size"].(float64))
rating := int(p["rating"].(int64))
valve := &valve{
Type: typ,
ID: id,
Size: size,
Rating: rating,
}
o.parts = append(o.parts, valve)
case "pipe":
length := float32(p["length"].(float64))
diameter := int(p["diameter"].(int64))
pipe := &pipe{
Type: typ,
ID: id,
Length: length,
Diameter: diameter,
}
o.parts = append(o.parts, pipe)
case "cable":
length := int(p["length"].(int64))
rating := float32(p["rating"].(float64))
cable := &cable{
Type: typ,
ID: id,
Length: length,
Rating: rating,
}
o.parts = append(o.parts, cable)
}
}
return nil
}
type parts []part
type part interface {
Name() string
}
type valve struct {
Type string
ID string
Size float32
Rating int
}
func (v *valve) Name() string {
return fmt.Sprintf("VALVE: %s", v.ID)
}
type pipe struct {
Type string
ID string
Length float32
Diameter int
}
func (p *pipe) Name() string {
return fmt.Sprintf("PIPE: %s", p.ID)
}
type cable struct {
Type string
ID string
Length int
Rating float32
}
func (c *cable) Name() string {
return fmt.Sprintf("CABLE: %s", c.ID)
}

View File

@@ -0,0 +1,27 @@
/*
Package toml provides facilities for decoding and encoding TOML configuration
files via reflection. There is also support for delaying decoding with
the Primitive type, and querying the set of keys in a TOML document with the
MetaData type.
The specification implemented: https://github.com/mojombo/toml
The sub-command github.com/BurntSushi/toml/cmd/tomlv can be used to verify
whether a file is a valid TOML document. It can also be used to print the
type of each key in a TOML document.
Testing
There are two important types of tests used for this package. The first is
contained inside '*_test.go' files and uses the standard Go unit testing
framework. These tests are primarily devoted to holistically testing the
decoder and encoder.
The second type of testing is used to verify the implementation's adherence
to the TOML specification. These tests have been factored into their own
project: https://github.com/BurntSushi/toml-test
The reason the tests are in a separate project is so that they can be used by
any implementation of TOML. Namely, it is language agnostic.
*/
package toml

View File

@@ -0,0 +1,551 @@
package toml
import (
"bufio"
"errors"
"fmt"
"io"
"reflect"
"sort"
"strconv"
"strings"
"time"
)
type tomlEncodeError struct{ error }
var (
errArrayMixedElementTypes = errors.New(
"can't encode array with mixed element types")
errArrayNilElement = errors.New(
"can't encode array with nil element")
errNonString = errors.New(
"can't encode a map with non-string key type")
errAnonNonStruct = errors.New(
"can't encode an anonymous field that is not a struct")
errArrayNoTable = errors.New(
"TOML array element can't contain a table")
errNoKey = errors.New(
"top-level values must be a Go map or struct")
errAnything = errors.New("") // used in testing
)
var quotedReplacer = strings.NewReplacer(
"\t", "\\t",
"\n", "\\n",
"\r", "\\r",
"\"", "\\\"",
"\\", "\\\\",
)
// Encoder controls the encoding of Go values to a TOML document to some
// io.Writer.
//
// The indentation level can be controlled with the Indent field.
type Encoder struct {
// A single indentation level. By default it is two spaces.
Indent string
// hasWritten is whether we have written any output to w yet.
hasWritten bool
w *bufio.Writer
}
// NewEncoder returns a TOML encoder that encodes Go values to the io.Writer
// given. By default, a single indentation level is 2 spaces.
func NewEncoder(w io.Writer) *Encoder {
return &Encoder{
w: bufio.NewWriter(w),
Indent: " ",
}
}
// Encode writes a TOML representation of the Go value to the underlying
// io.Writer. If the value given cannot be encoded to a valid TOML document,
// then an error is returned.
//
// The mapping between Go values and TOML values should be precisely the same
// as for the Decode* functions. Similarly, the TextMarshaler interface is
// supported by encoding the resulting bytes as strings. (If you want to write
// arbitrary binary data then you will need to use something like base64 since
// TOML does not have any binary types.)
//
// When encoding TOML hashes (i.e., Go maps or structs), keys without any
// sub-hashes are encoded first.
//
// If a Go map is encoded, then its keys are sorted alphabetically for
// deterministic output. More control over this behavior may be provided if
// there is demand for it.
//
// Encoding Go values without a corresponding TOML representation---like map
// types with non-string keys---will cause an error to be returned. Similarly
// for mixed arrays/slices, arrays/slices with nil elements, embedded
// non-struct types and nested slices containing maps or structs.
// (e.g., [][]map[string]string is not allowed but []map[string]string is OK
// and so is []map[string][]string.)
func (enc *Encoder) Encode(v interface{}) error {
rv := eindirect(reflect.ValueOf(v))
if err := enc.safeEncode(Key([]string{}), rv); err != nil {
return err
}
return enc.w.Flush()
}
func (enc *Encoder) safeEncode(key Key, rv reflect.Value) (err error) {
defer func() {
if r := recover(); r != nil {
if terr, ok := r.(tomlEncodeError); ok {
err = terr.error
return
}
panic(r)
}
}()
enc.encode(key, rv)
return nil
}
func (enc *Encoder) encode(key Key, rv reflect.Value) {
// Special case. Time needs to be in ISO8601 format.
// Special case. If we can marshal the type to text, then we used that.
// Basically, this prevents the encoder for handling these types as
// generic structs (or whatever the underlying type of a TextMarshaler is).
switch rv.Interface().(type) {
case time.Time, TextMarshaler:
enc.keyEqElement(key, rv)
return
}
k := rv.Kind()
switch k {
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32,
reflect.Int64,
reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32,
reflect.Uint64,
reflect.Float32, reflect.Float64, reflect.String, reflect.Bool:
enc.keyEqElement(key, rv)
case reflect.Array, reflect.Slice:
if typeEqual(tomlArrayHash, tomlTypeOfGo(rv)) {
enc.eArrayOfTables(key, rv)
} else {
enc.keyEqElement(key, rv)
}
case reflect.Interface:
if rv.IsNil() {
return
}
enc.encode(key, rv.Elem())
case reflect.Map:
if rv.IsNil() {
return
}
enc.eTable(key, rv)
case reflect.Ptr:
if rv.IsNil() {
return
}
enc.encode(key, rv.Elem())
case reflect.Struct:
enc.eTable(key, rv)
default:
panic(e("Unsupported type for key '%s': %s", key, k))
}
}
// eElement encodes any value that can be an array element (primitives and
// arrays).
func (enc *Encoder) eElement(rv reflect.Value) {
switch v := rv.Interface().(type) {
case time.Time:
// Special case time.Time as a primitive. Has to come before
// TextMarshaler below because time.Time implements
// encoding.TextMarshaler, but we need to always use UTC.
enc.wf(v.In(time.FixedZone("UTC", 0)).Format("2006-01-02T15:04:05Z"))
return
case TextMarshaler:
// Special case. Use text marshaler if it's available for this value.
if s, err := v.MarshalText(); err != nil {
encPanic(err)
} else {
enc.writeQuoted(string(s))
}
return
}
switch rv.Kind() {
case reflect.Bool:
enc.wf(strconv.FormatBool(rv.Bool()))
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32,
reflect.Int64:
enc.wf(strconv.FormatInt(rv.Int(), 10))
case reflect.Uint, reflect.Uint8, reflect.Uint16,
reflect.Uint32, reflect.Uint64:
enc.wf(strconv.FormatUint(rv.Uint(), 10))
case reflect.Float32:
enc.wf(floatAddDecimal(strconv.FormatFloat(rv.Float(), 'f', -1, 32)))
case reflect.Float64:
enc.wf(floatAddDecimal(strconv.FormatFloat(rv.Float(), 'f', -1, 64)))
case reflect.Array, reflect.Slice:
enc.eArrayOrSliceElement(rv)
case reflect.Interface:
enc.eElement(rv.Elem())
case reflect.String:
enc.writeQuoted(rv.String())
default:
panic(e("Unexpected primitive type: %s", rv.Kind()))
}
}
// By the TOML spec, all floats must have a decimal with at least one
// number on either side.
func floatAddDecimal(fstr string) string {
if !strings.Contains(fstr, ".") {
return fstr + ".0"
}
return fstr
}
func (enc *Encoder) writeQuoted(s string) {
enc.wf("\"%s\"", quotedReplacer.Replace(s))
}
func (enc *Encoder) eArrayOrSliceElement(rv reflect.Value) {
length := rv.Len()
enc.wf("[")
for i := 0; i < length; i++ {
elem := rv.Index(i)
enc.eElement(elem)
if i != length-1 {
enc.wf(", ")
}
}
enc.wf("]")
}
func (enc *Encoder) eArrayOfTables(key Key, rv reflect.Value) {
if len(key) == 0 {
encPanic(errNoKey)
}
for i := 0; i < rv.Len(); i++ {
trv := rv.Index(i)
if isNil(trv) {
continue
}
panicIfInvalidKey(key)
enc.newline()
enc.wf("%s[[%s]]", enc.indentStr(key), key.maybeQuotedAll())
enc.newline()
enc.eMapOrStruct(key, trv)
}
}
func (enc *Encoder) eTable(key Key, rv reflect.Value) {
panicIfInvalidKey(key)
if len(key) == 1 {
// Output an extra new line between top-level tables.
// (The newline isn't written if nothing else has been written though.)
enc.newline()
}
if len(key) > 0 {
enc.wf("%s[%s]", enc.indentStr(key), key.maybeQuotedAll())
enc.newline()
}
enc.eMapOrStruct(key, rv)
}
func (enc *Encoder) eMapOrStruct(key Key, rv reflect.Value) {
switch rv := eindirect(rv); rv.Kind() {
case reflect.Map:
enc.eMap(key, rv)
case reflect.Struct:
enc.eStruct(key, rv)
default:
panic("eTable: unhandled reflect.Value Kind: " + rv.Kind().String())
}
}
func (enc *Encoder) eMap(key Key, rv reflect.Value) {
rt := rv.Type()
if rt.Key().Kind() != reflect.String {
encPanic(errNonString)
}
// Sort keys so that we have deterministic output. And write keys directly
// underneath this key first, before writing sub-structs or sub-maps.
var mapKeysDirect, mapKeysSub []string
for _, mapKey := range rv.MapKeys() {
k := mapKey.String()
if typeIsHash(tomlTypeOfGo(rv.MapIndex(mapKey))) {
mapKeysSub = append(mapKeysSub, k)
} else {
mapKeysDirect = append(mapKeysDirect, k)
}
}
var writeMapKeys = func(mapKeys []string) {
sort.Strings(mapKeys)
for _, mapKey := range mapKeys {
mrv := rv.MapIndex(reflect.ValueOf(mapKey))
if isNil(mrv) {
// Don't write anything for nil fields.
continue
}
enc.encode(key.add(mapKey), mrv)
}
}
writeMapKeys(mapKeysDirect)
writeMapKeys(mapKeysSub)
}
func (enc *Encoder) eStruct(key Key, rv reflect.Value) {
// Write keys for fields directly under this key first, because if we write
// a field that creates a new table, then all keys under it will be in that
// table (not the one we're writing here).
rt := rv.Type()
var fieldsDirect, fieldsSub [][]int
var addFields func(rt reflect.Type, rv reflect.Value, start []int)
addFields = func(rt reflect.Type, rv reflect.Value, start []int) {
for i := 0; i < rt.NumField(); i++ {
f := rt.Field(i)
// skip unexporded fields
if f.PkgPath != "" {
continue
}
frv := rv.Field(i)
if f.Anonymous {
frv := eindirect(frv)
t := frv.Type()
if t.Kind() != reflect.Struct {
encPanic(errAnonNonStruct)
}
addFields(t, frv, f.Index)
} else if typeIsHash(tomlTypeOfGo(frv)) {
fieldsSub = append(fieldsSub, append(start, f.Index...))
} else {
fieldsDirect = append(fieldsDirect, append(start, f.Index...))
}
}
}
addFields(rt, rv, nil)
var writeFields = func(fields [][]int) {
for _, fieldIndex := range fields {
sft := rt.FieldByIndex(fieldIndex)
sf := rv.FieldByIndex(fieldIndex)
if isNil(sf) {
// Don't write anything for nil fields.
continue
}
keyName := sft.Tag.Get("toml")
if keyName == "-" {
continue
}
if keyName == "" {
keyName = sft.Name
}
keyName, opts := getOptions(keyName)
if _, ok := opts["omitempty"]; ok && isEmpty(sf) {
continue
} else if _, ok := opts["omitzero"]; ok && isZero(sf) {
continue
}
enc.encode(key.add(keyName), sf)
}
}
writeFields(fieldsDirect)
writeFields(fieldsSub)
}
// tomlTypeName returns the TOML type name of the Go value's type. It is
// used to determine whether the types of array elements are mixed (which is
// forbidden). If the Go value is nil, then it is illegal for it to be an array
// element, and valueIsNil is returned as true.
// Returns the TOML type of a Go value. The type may be `nil`, which means
// no concrete TOML type could be found.
func tomlTypeOfGo(rv reflect.Value) tomlType {
if isNil(rv) || !rv.IsValid() {
return nil
}
switch rv.Kind() {
case reflect.Bool:
return tomlBool
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32,
reflect.Int64,
reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32,
reflect.Uint64:
return tomlInteger
case reflect.Float32, reflect.Float64:
return tomlFloat
case reflect.Array, reflect.Slice:
if typeEqual(tomlHash, tomlArrayType(rv)) {
return tomlArrayHash
} else {
return tomlArray
}
case reflect.Ptr, reflect.Interface:
return tomlTypeOfGo(rv.Elem())
case reflect.String:
return tomlString
case reflect.Map:
return tomlHash
case reflect.Struct:
switch rv.Interface().(type) {
case time.Time:
return tomlDatetime
case TextMarshaler:
return tomlString
default:
return tomlHash
}
default:
panic("unexpected reflect.Kind: " + rv.Kind().String())
}
}
// tomlArrayType returns the element type of a TOML array. The type returned
// may be nil if it cannot be determined (e.g., a nil slice or a zero length
// slize). This function may also panic if it finds a type that cannot be
// expressed in TOML (such as nil elements, heterogeneous arrays or directly
// nested arrays of tables).
func tomlArrayType(rv reflect.Value) tomlType {
if isNil(rv) || !rv.IsValid() || rv.Len() == 0 {
return nil
}
firstType := tomlTypeOfGo(rv.Index(0))
if firstType == nil {
encPanic(errArrayNilElement)
}
rvlen := rv.Len()
for i := 1; i < rvlen; i++ {
elem := rv.Index(i)
switch elemType := tomlTypeOfGo(elem); {
case elemType == nil:
encPanic(errArrayNilElement)
case !typeEqual(firstType, elemType):
encPanic(errArrayMixedElementTypes)
}
}
// If we have a nested array, then we must make sure that the nested
// array contains ONLY primitives.
// This checks arbitrarily nested arrays.
if typeEqual(firstType, tomlArray) || typeEqual(firstType, tomlArrayHash) {
nest := tomlArrayType(eindirect(rv.Index(0)))
if typeEqual(nest, tomlHash) || typeEqual(nest, tomlArrayHash) {
encPanic(errArrayNoTable)
}
}
return firstType
}
func getOptions(keyName string) (string, map[string]struct{}) {
opts := make(map[string]struct{})
ss := strings.Split(keyName, ",")
name := ss[0]
if len(ss) > 1 {
for _, opt := range ss {
opts[opt] = struct{}{}
}
}
return name, opts
}
func isZero(rv reflect.Value) bool {
switch rv.Kind() {
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
if rv.Int() == 0 {
return true
}
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
if rv.Uint() == 0 {
return true
}
case reflect.Float32, reflect.Float64:
if rv.Float() == 0.0 {
return true
}
}
return false
}
func isEmpty(rv reflect.Value) bool {
switch rv.Kind() {
case reflect.String:
if len(strings.TrimSpace(rv.String())) == 0 {
return true
}
case reflect.Array, reflect.Slice, reflect.Map:
if rv.Len() == 0 {
return true
}
}
return false
}
func (enc *Encoder) newline() {
if enc.hasWritten {
enc.wf("\n")
}
}
func (enc *Encoder) keyEqElement(key Key, val reflect.Value) {
if len(key) == 0 {
encPanic(errNoKey)
}
panicIfInvalidKey(key)
enc.wf("%s%s = ", enc.indentStr(key), key.maybeQuoted(len(key)-1))
enc.eElement(val)
enc.newline()
}
func (enc *Encoder) wf(format string, v ...interface{}) {
if _, err := fmt.Fprintf(enc.w, format, v...); err != nil {
encPanic(err)
}
enc.hasWritten = true
}
func (enc *Encoder) indentStr(key Key) string {
return strings.Repeat(enc.Indent, len(key)-1)
}
func encPanic(err error) {
panic(tomlEncodeError{err})
}
func eindirect(v reflect.Value) reflect.Value {
switch v.Kind() {
case reflect.Ptr, reflect.Interface:
return eindirect(v.Elem())
default:
return v
}
}
func isNil(rv reflect.Value) bool {
switch rv.Kind() {
case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice:
return rv.IsNil()
default:
return false
}
}
func panicIfInvalidKey(key Key) {
for _, k := range key {
if len(k) == 0 {
encPanic(e("Key '%s' is not a valid table name. Key names "+
"cannot be empty.", key.maybeQuotedAll()))
}
}
}
func isValidKeyName(s string) bool {
return len(s) != 0
}

View File

@@ -0,0 +1,542 @@
package toml
import (
"bytes"
"fmt"
"log"
"net"
"testing"
"time"
)
func TestEncodeRoundTrip(t *testing.T) {
type Config struct {
Age int
Cats []string
Pi float64
Perfection []int
DOB time.Time
Ipaddress net.IP
}
var inputs = Config{
13,
[]string{"one", "two", "three"},
3.145,
[]int{11, 2, 3, 4},
time.Now(),
net.ParseIP("192.168.59.254"),
}
var firstBuffer bytes.Buffer
e := NewEncoder(&firstBuffer)
err := e.Encode(inputs)
if err != nil {
t.Fatal(err)
}
var outputs Config
if _, err := Decode(firstBuffer.String(), &outputs); err != nil {
log.Printf("Could not decode:\n-----\n%s\n-----\n",
firstBuffer.String())
t.Fatal(err)
}
// could test each value individually, but I'm lazy
var secondBuffer bytes.Buffer
e2 := NewEncoder(&secondBuffer)
err = e2.Encode(outputs)
if err != nil {
t.Fatal(err)
}
if firstBuffer.String() != secondBuffer.String() {
t.Error(
firstBuffer.String(),
"\n\n is not identical to\n\n",
secondBuffer.String())
}
}
// XXX(burntsushi)
// I think these tests probably should be removed. They are good, but they
// ought to be obsolete by toml-test.
func TestEncode(t *testing.T) {
type Embedded struct {
Int int `toml:"_int"`
}
type NonStruct int
date := time.Date(2014, 5, 11, 20, 30, 40, 0, time.FixedZone("IST", 3600))
dateStr := "2014-05-11T19:30:40Z"
tests := map[string]struct {
input interface{}
wantOutput string
wantError error
}{
"bool field": {
input: struct {
BoolTrue bool
BoolFalse bool
}{true, false},
wantOutput: "BoolTrue = true\nBoolFalse = false\n",
},
"int fields": {
input: struct {
Int int
Int8 int8
Int16 int16
Int32 int32
Int64 int64
}{1, 2, 3, 4, 5},
wantOutput: "Int = 1\nInt8 = 2\nInt16 = 3\nInt32 = 4\nInt64 = 5\n",
},
"uint fields": {
input: struct {
Uint uint
Uint8 uint8
Uint16 uint16
Uint32 uint32
Uint64 uint64
}{1, 2, 3, 4, 5},
wantOutput: "Uint = 1\nUint8 = 2\nUint16 = 3\nUint32 = 4" +
"\nUint64 = 5\n",
},
"float fields": {
input: struct {
Float32 float32
Float64 float64
}{1.5, 2.5},
wantOutput: "Float32 = 1.5\nFloat64 = 2.5\n",
},
"string field": {
input: struct{ String string }{"foo"},
wantOutput: "String = \"foo\"\n",
},
"string field and unexported field": {
input: struct {
String string
unexported int
}{"foo", 0},
wantOutput: "String = \"foo\"\n",
},
"datetime field in UTC": {
input: struct{ Date time.Time }{date},
wantOutput: fmt.Sprintf("Date = %s\n", dateStr),
},
"datetime field as primitive": {
// Using a map here to fail if isStructOrMap() returns true for
// time.Time.
input: map[string]interface{}{
"Date": date,
"Int": 1,
},
wantOutput: fmt.Sprintf("Date = %s\nInt = 1\n", dateStr),
},
"array fields": {
input: struct {
IntArray0 [0]int
IntArray3 [3]int
}{[0]int{}, [3]int{1, 2, 3}},
wantOutput: "IntArray0 = []\nIntArray3 = [1, 2, 3]\n",
},
"slice fields": {
input: struct{ IntSliceNil, IntSlice0, IntSlice3 []int }{
nil, []int{}, []int{1, 2, 3},
},
wantOutput: "IntSlice0 = []\nIntSlice3 = [1, 2, 3]\n",
},
"datetime slices": {
input: struct{ DatetimeSlice []time.Time }{
[]time.Time{date, date},
},
wantOutput: fmt.Sprintf("DatetimeSlice = [%s, %s]\n",
dateStr, dateStr),
},
"nested arrays and slices": {
input: struct {
SliceOfArrays [][2]int
ArrayOfSlices [2][]int
SliceOfArraysOfSlices [][2][]int
ArrayOfSlicesOfArrays [2][][2]int
SliceOfMixedArrays [][2]interface{}
ArrayOfMixedSlices [2][]interface{}
}{
[][2]int{{1, 2}, {3, 4}},
[2][]int{{1, 2}, {3, 4}},
[][2][]int{
{
{1, 2}, {3, 4},
},
{
{5, 6}, {7, 8},
},
},
[2][][2]int{
{
{1, 2}, {3, 4},
},
{
{5, 6}, {7, 8},
},
},
[][2]interface{}{
{1, 2}, {"a", "b"},
},
[2][]interface{}{
{1, 2}, {"a", "b"},
},
},
wantOutput: `SliceOfArrays = [[1, 2], [3, 4]]
ArrayOfSlices = [[1, 2], [3, 4]]
SliceOfArraysOfSlices = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]
ArrayOfSlicesOfArrays = [[[1, 2], [3, 4]], [[5, 6], [7, 8]]]
SliceOfMixedArrays = [[1, 2], ["a", "b"]]
ArrayOfMixedSlices = [[1, 2], ["a", "b"]]
`,
},
"empty slice": {
input: struct{ Empty []interface{} }{[]interface{}{}},
wantOutput: "Empty = []\n",
},
"(error) slice with element type mismatch (string and integer)": {
input: struct{ Mixed []interface{} }{[]interface{}{1, "a"}},
wantError: errArrayMixedElementTypes,
},
"(error) slice with element type mismatch (integer and float)": {
input: struct{ Mixed []interface{} }{[]interface{}{1, 2.5}},
wantError: errArrayMixedElementTypes,
},
"slice with elems of differing Go types, same TOML types": {
input: struct {
MixedInts []interface{}
MixedFloats []interface{}
}{
[]interface{}{
int(1), int8(2), int16(3), int32(4), int64(5),
uint(1), uint8(2), uint16(3), uint32(4), uint64(5),
},
[]interface{}{float32(1.5), float64(2.5)},
},
wantOutput: "MixedInts = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5]\n" +
"MixedFloats = [1.5, 2.5]\n",
},
"(error) slice w/ element type mismatch (one is nested array)": {
input: struct{ Mixed []interface{} }{
[]interface{}{1, []interface{}{2}},
},
wantError: errArrayMixedElementTypes,
},
"(error) slice with 1 nil element": {
input: struct{ NilElement1 []interface{} }{[]interface{}{nil}},
wantError: errArrayNilElement,
},
"(error) slice with 1 nil element (and other non-nil elements)": {
input: struct{ NilElement []interface{} }{
[]interface{}{1, nil},
},
wantError: errArrayNilElement,
},
"simple map": {
input: map[string]int{"a": 1, "b": 2},
wantOutput: "a = 1\nb = 2\n",
},
"map with interface{} value type": {
input: map[string]interface{}{"a": 1, "b": "c"},
wantOutput: "a = 1\nb = \"c\"\n",
},
"map with interface{} value type, some of which are structs": {
input: map[string]interface{}{
"a": struct{ Int int }{2},
"b": 1,
},
wantOutput: "b = 1\n\n[a]\n Int = 2\n",
},
"nested map": {
input: map[string]map[string]int{
"a": {"b": 1},
"c": {"d": 2},
},
wantOutput: "[a]\n b = 1\n\n[c]\n d = 2\n",
},
"nested struct": {
input: struct{ Struct struct{ Int int } }{
struct{ Int int }{1},
},
wantOutput: "[Struct]\n Int = 1\n",
},
"nested struct and non-struct field": {
input: struct {
Struct struct{ Int int }
Bool bool
}{struct{ Int int }{1}, true},
wantOutput: "Bool = true\n\n[Struct]\n Int = 1\n",
},
"2 nested structs": {
input: struct{ Struct1, Struct2 struct{ Int int } }{
struct{ Int int }{1}, struct{ Int int }{2},
},
wantOutput: "[Struct1]\n Int = 1\n\n[Struct2]\n Int = 2\n",
},
"deeply nested structs": {
input: struct {
Struct1, Struct2 struct{ Struct3 *struct{ Int int } }
}{
struct{ Struct3 *struct{ Int int } }{&struct{ Int int }{1}},
struct{ Struct3 *struct{ Int int } }{nil},
},
wantOutput: "[Struct1]\n [Struct1.Struct3]\n Int = 1" +
"\n\n[Struct2]\n",
},
"nested struct with nil struct elem": {
input: struct {
Struct struct{ Inner *struct{ Int int } }
}{
struct{ Inner *struct{ Int int } }{nil},
},
wantOutput: "[Struct]\n",
},
"nested struct with no fields": {
input: struct {
Struct struct{ Inner struct{} }
}{
struct{ Inner struct{} }{struct{}{}},
},
wantOutput: "[Struct]\n [Struct.Inner]\n",
},
"struct with tags": {
input: struct {
Struct struct {
Int int `toml:"_int"`
} `toml:"_struct"`
Bool bool `toml:"_bool"`
}{
struct {
Int int `toml:"_int"`
}{1}, true,
},
wantOutput: "_bool = true\n\n[_struct]\n _int = 1\n",
},
"embedded struct": {
input: struct{ Embedded }{Embedded{1}},
wantOutput: "_int = 1\n",
},
"embedded *struct": {
input: struct{ *Embedded }{&Embedded{1}},
wantOutput: "_int = 1\n",
},
"nested embedded struct": {
input: struct {
Struct struct{ Embedded } `toml:"_struct"`
}{struct{ Embedded }{Embedded{1}}},
wantOutput: "[_struct]\n _int = 1\n",
},
"nested embedded *struct": {
input: struct {
Struct struct{ *Embedded } `toml:"_struct"`
}{struct{ *Embedded }{&Embedded{1}}},
wantOutput: "[_struct]\n _int = 1\n",
},
"array of tables": {
input: struct {
Structs []*struct{ Int int } `toml:"struct"`
}{
[]*struct{ Int int }{{1}, {3}},
},
wantOutput: "[[struct]]\n Int = 1\n\n[[struct]]\n Int = 3\n",
},
"array of tables order": {
input: map[string]interface{}{
"map": map[string]interface{}{
"zero": 5,
"arr": []map[string]int{
map[string]int{
"friend": 5,
},
},
},
},
wantOutput: "[map]\n zero = 5\n\n [[map.arr]]\n friend = 5\n",
},
"(error) top-level slice": {
input: []struct{ Int int }{{1}, {2}, {3}},
wantError: errNoKey,
},
"(error) slice of slice": {
input: struct {
Slices [][]struct{ Int int }
}{
[][]struct{ Int int }{{{1}}, {{2}}, {{3}}},
},
wantError: errArrayNoTable,
},
"(error) map no string key": {
input: map[int]string{1: ""},
wantError: errNonString,
},
"(error) anonymous non-struct": {
input: struct{ NonStruct }{5},
wantError: errAnonNonStruct,
},
"(error) empty key name": {
input: map[string]int{"": 1},
wantError: errAnything,
},
"(error) empty map name": {
input: map[string]interface{}{
"": map[string]int{"v": 1},
},
wantError: errAnything,
},
}
for label, test := range tests {
encodeExpected(t, label, test.input, test.wantOutput, test.wantError)
}
}
func TestEncodeNestedTableArrays(t *testing.T) {
type song struct {
Name string `toml:"name"`
}
type album struct {
Name string `toml:"name"`
Songs []song `toml:"songs"`
}
type springsteen struct {
Albums []album `toml:"albums"`
}
value := springsteen{
[]album{
{"Born to Run",
[]song{{"Jungleland"}, {"Meeting Across the River"}}},
{"Born in the USA",
[]song{{"Glory Days"}, {"Dancing in the Dark"}}},
},
}
expected := `[[albums]]
name = "Born to Run"
[[albums.songs]]
name = "Jungleland"
[[albums.songs]]
name = "Meeting Across the River"
[[albums]]
name = "Born in the USA"
[[albums.songs]]
name = "Glory Days"
[[albums.songs]]
name = "Dancing in the Dark"
`
encodeExpected(t, "nested table arrays", value, expected, nil)
}
func TestEncodeArrayHashWithNormalHashOrder(t *testing.T) {
type Alpha struct {
V int
}
type Beta struct {
V int
}
type Conf struct {
V int
A Alpha
B []Beta
}
val := Conf{
V: 1,
A: Alpha{2},
B: []Beta{{3}},
}
expected := "V = 1\n\n[A]\n V = 2\n\n[[B]]\n V = 3\n"
encodeExpected(t, "array hash with normal hash order", val, expected, nil)
}
func TestEncodeWithOmitEmpty(t *testing.T) {
type simple struct {
User string `toml:"user"`
Pass string `toml:"password,omitempty"`
}
value := simple{"Testing", ""}
expected := fmt.Sprintf("user = %q\n", value.User)
encodeExpected(t, "simple with omitempty, is empty", value, expected, nil)
value.Pass = "some password"
expected = fmt.Sprintf("user = %q\npassword = %q\n", value.User, value.Pass)
encodeExpected(t, "simple with omitempty, not empty", value, expected, nil)
}
func TestEncodeWithOmitZero(t *testing.T) {
type simple struct {
Number int `toml:"number,omitzero"`
Real float64 `toml:"real,omitzero"`
Unsigned uint `toml:"unsigned,omitzero"`
}
value := simple{0, 0.0, uint(0)}
expected := ""
encodeExpected(t, "simple with omitzero, all zero", value, expected, nil)
value.Number = 10
value.Real = 20
value.Unsigned = 5
expected = `number = 10
real = 20.0
unsigned = 5
`
encodeExpected(t, "simple with omitzero, non-zero", value, expected, nil)
}
func encodeExpected(
t *testing.T, label string, val interface{}, wantStr string, wantErr error,
) {
var buf bytes.Buffer
enc := NewEncoder(&buf)
err := enc.Encode(val)
if err != wantErr {
if wantErr != nil {
if wantErr == errAnything && err != nil {
return
}
t.Errorf("%s: want Encode error %v, got %v", label, wantErr, err)
} else {
t.Errorf("%s: Encode failed: %s", label, err)
}
}
if err != nil {
return
}
if got := buf.String(); wantStr != got {
t.Errorf("%s: want\n-----\n%q\n-----\nbut got\n-----\n%q\n-----\n",
label, wantStr, got)
}
}
func ExampleEncoder_Encode() {
date, _ := time.Parse(time.RFC822, "14 Mar 10 18:00 UTC")
var config = map[string]interface{}{
"date": date,
"counts": []int{1, 1, 2, 3, 5, 8},
"hash": map[string]string{
"key1": "val1",
"key2": "val2",
},
}
buf := new(bytes.Buffer)
if err := NewEncoder(buf).Encode(config); err != nil {
log.Fatal(err)
}
fmt.Println(buf.String())
// Output:
// counts = [1, 1, 2, 3, 5, 8]
// date = 2010-03-14T18:00:00Z
//
// [hash]
// key1 = "val1"
// key2 = "val2"
}

View File

@@ -0,0 +1,19 @@
// +build go1.2
package toml
// In order to support Go 1.1, we define our own TextMarshaler and
// TextUnmarshaler types. For Go 1.2+, we just alias them with the
// standard library interfaces.
import (
"encoding"
)
// TextMarshaler is a synonym for encoding.TextMarshaler. It is defined here
// so that Go 1.1 can be supported.
type TextMarshaler encoding.TextMarshaler
// TextUnmarshaler is a synonym for encoding.TextUnmarshaler. It is defined
// here so that Go 1.1 can be supported.
type TextUnmarshaler encoding.TextUnmarshaler

View File

@@ -0,0 +1,18 @@
// +build !go1.2
package toml
// These interfaces were introduced in Go 1.2, so we add them manually when
// compiling for Go 1.1.
// TextMarshaler is a synonym for encoding.TextMarshaler. It is defined here
// so that Go 1.1 can be supported.
type TextMarshaler interface {
MarshalText() (text []byte, err error)
}
// TextUnmarshaler is a synonym for encoding.TextUnmarshaler. It is defined
// here so that Go 1.1 can be supported.
type TextUnmarshaler interface {
UnmarshalText(text []byte) error
}

874
Godeps/_workspace/src/github.com/BurntSushi/toml/lex.go generated vendored Normal file
View File

@@ -0,0 +1,874 @@
package toml
import (
"fmt"
"strings"
"unicode/utf8"
)
type itemType int
const (
itemError itemType = iota
itemNIL // used in the parser to indicate no type
itemEOF
itemText
itemString
itemRawString
itemMultilineString
itemRawMultilineString
itemBool
itemInteger
itemFloat
itemDatetime
itemArray // the start of an array
itemArrayEnd
itemTableStart
itemTableEnd
itemArrayTableStart
itemArrayTableEnd
itemKeyStart
itemCommentStart
)
const (
eof = 0
tableStart = '['
tableEnd = ']'
arrayTableStart = '['
arrayTableEnd = ']'
tableSep = '.'
keySep = '='
arrayStart = '['
arrayEnd = ']'
arrayValTerm = ','
commentStart = '#'
stringStart = '"'
stringEnd = '"'
rawStringStart = '\''
rawStringEnd = '\''
)
type stateFn func(lx *lexer) stateFn
type lexer struct {
input string
start int
pos int
width int
line int
state stateFn
items chan item
// A stack of state functions used to maintain context.
// The idea is to reuse parts of the state machine in various places.
// For example, values can appear at the top level or within arbitrarily
// nested arrays. The last state on the stack is used after a value has
// been lexed. Similarly for comments.
stack []stateFn
}
type item struct {
typ itemType
val string
line int
}
func (lx *lexer) nextItem() item {
for {
select {
case item := <-lx.items:
return item
default:
lx.state = lx.state(lx)
}
}
}
func lex(input string) *lexer {
lx := &lexer{
input: input + "\n",
state: lexTop,
line: 1,
items: make(chan item, 10),
stack: make([]stateFn, 0, 10),
}
return lx
}
func (lx *lexer) push(state stateFn) {
lx.stack = append(lx.stack, state)
}
func (lx *lexer) pop() stateFn {
if len(lx.stack) == 0 {
return lx.errorf("BUG in lexer: no states to pop.")
}
last := lx.stack[len(lx.stack)-1]
lx.stack = lx.stack[0 : len(lx.stack)-1]
return last
}
func (lx *lexer) current() string {
return lx.input[lx.start:lx.pos]
}
func (lx *lexer) emit(typ itemType) {
lx.items <- item{typ, lx.current(), lx.line}
lx.start = lx.pos
}
func (lx *lexer) emitTrim(typ itemType) {
lx.items <- item{typ, strings.TrimSpace(lx.current()), lx.line}
lx.start = lx.pos
}
func (lx *lexer) next() (r rune) {
if lx.pos >= len(lx.input) {
lx.width = 0
return eof
}
if lx.input[lx.pos] == '\n' {
lx.line++
}
r, lx.width = utf8.DecodeRuneInString(lx.input[lx.pos:])
lx.pos += lx.width
return r
}
// ignore skips over the pending input before this point.
func (lx *lexer) ignore() {
lx.start = lx.pos
}
// backup steps back one rune. Can be called only once per call of next.
func (lx *lexer) backup() {
lx.pos -= lx.width
if lx.pos < len(lx.input) && lx.input[lx.pos] == '\n' {
lx.line--
}
}
// accept consumes the next rune if it's equal to `valid`.
func (lx *lexer) accept(valid rune) bool {
if lx.next() == valid {
return true
}
lx.backup()
return false
}
// peek returns but does not consume the next rune in the input.
func (lx *lexer) peek() rune {
r := lx.next()
lx.backup()
return r
}
// errorf stops all lexing by emitting an error and returning `nil`.
// Note that any value that is a character is escaped if it's a special
// character (new lines, tabs, etc.).
func (lx *lexer) errorf(format string, values ...interface{}) stateFn {
lx.items <- item{
itemError,
fmt.Sprintf(format, values...),
lx.line,
}
return nil
}
// lexTop consumes elements at the top level of TOML data.
func lexTop(lx *lexer) stateFn {
r := lx.next()
if isWhitespace(r) || isNL(r) {
return lexSkip(lx, lexTop)
}
switch r {
case commentStart:
lx.push(lexTop)
return lexCommentStart
case tableStart:
return lexTableStart
case eof:
if lx.pos > lx.start {
return lx.errorf("Unexpected EOF.")
}
lx.emit(itemEOF)
return nil
}
// At this point, the only valid item can be a key, so we back up
// and let the key lexer do the rest.
lx.backup()
lx.push(lexTopEnd)
return lexKeyStart
}
// lexTopEnd is entered whenever a top-level item has been consumed. (A value
// or a table.) It must see only whitespace, and will turn back to lexTop
// upon a new line. If it sees EOF, it will quit the lexer successfully.
func lexTopEnd(lx *lexer) stateFn {
r := lx.next()
switch {
case r == commentStart:
// a comment will read to a new line for us.
lx.push(lexTop)
return lexCommentStart
case isWhitespace(r):
return lexTopEnd
case isNL(r):
lx.ignore()
return lexTop
case r == eof:
lx.ignore()
return lexTop
}
return lx.errorf("Expected a top-level item to end with a new line, "+
"comment or EOF, but got %q instead.", r)
}
// lexTable lexes the beginning of a table. Namely, it makes sure that
// it starts with a character other than '.' and ']'.
// It assumes that '[' has already been consumed.
// It also handles the case that this is an item in an array of tables.
// e.g., '[[name]]'.
func lexTableStart(lx *lexer) stateFn {
if lx.peek() == arrayTableStart {
lx.next()
lx.emit(itemArrayTableStart)
lx.push(lexArrayTableEnd)
} else {
lx.emit(itemTableStart)
lx.push(lexTableEnd)
}
return lexTableNameStart
}
func lexTableEnd(lx *lexer) stateFn {
lx.emit(itemTableEnd)
return lexTopEnd
}
func lexArrayTableEnd(lx *lexer) stateFn {
if r := lx.next(); r != arrayTableEnd {
return lx.errorf("Expected end of table array name delimiter %q, "+
"but got %q instead.", arrayTableEnd, r)
}
lx.emit(itemArrayTableEnd)
return lexTopEnd
}
func lexTableNameStart(lx *lexer) stateFn {
switch r := lx.peek(); {
case r == tableEnd || r == eof:
return lx.errorf("Unexpected end of table name. (Table names cannot " +
"be empty.)")
case r == tableSep:
return lx.errorf("Unexpected table separator. (Table names cannot " +
"be empty.)")
case r == stringStart || r == rawStringStart:
lx.ignore()
lx.push(lexTableNameEnd)
return lexValue // reuse string lexing
case isWhitespace(r):
return lexTableNameStart
default:
return lexBareTableName
}
}
// lexTableName lexes the name of a table. It assumes that at least one
// valid character for the table has already been read.
func lexBareTableName(lx *lexer) stateFn {
switch r := lx.next(); {
case isBareKeyChar(r):
return lexBareTableName
case r == tableSep || r == tableEnd:
lx.backup()
lx.emitTrim(itemText)
return lexTableNameEnd
default:
return lx.errorf("Bare keys cannot contain %q.", r)
}
}
// lexTableNameEnd reads the end of a piece of a table name, optionally
// consuming whitespace.
func lexTableNameEnd(lx *lexer) stateFn {
switch r := lx.next(); {
case isWhitespace(r):
return lexTableNameEnd
case r == tableSep:
lx.ignore()
return lexTableNameStart
case r == tableEnd:
return lx.pop()
default:
return lx.errorf("Expected '.' or ']' to end table name, but got %q "+
"instead.", r)
}
}
// lexKeyStart consumes a key name up until the first non-whitespace character.
// lexKeyStart will ignore whitespace.
func lexKeyStart(lx *lexer) stateFn {
r := lx.peek()
switch {
case r == keySep:
return lx.errorf("Unexpected key separator %q.", keySep)
case isWhitespace(r) || isNL(r):
lx.next()
return lexSkip(lx, lexKeyStart)
case r == stringStart || r == rawStringStart:
lx.ignore()
lx.emit(itemKeyStart)
lx.push(lexKeyEnd)
return lexValue // reuse string lexing
default:
lx.ignore()
lx.emit(itemKeyStart)
return lexBareKey
}
}
// lexBareKey consumes the text of a bare key. Assumes that the first character
// (which is not whitespace) has not yet been consumed.
func lexBareKey(lx *lexer) stateFn {
switch r := lx.next(); {
case isBareKeyChar(r):
return lexBareKey
case isWhitespace(r):
lx.emitTrim(itemText)
return lexKeyEnd
case r == keySep:
lx.backup()
lx.emitTrim(itemText)
return lexKeyEnd
default:
return lx.errorf("Bare keys cannot contain %q.", r)
}
}
// lexKeyEnd consumes the end of a key and trims whitespace (up to the key
// separator).
func lexKeyEnd(lx *lexer) stateFn {
switch r := lx.next(); {
case r == keySep:
return lexSkip(lx, lexValue)
case isWhitespace(r):
return lexSkip(lx, lexKeyEnd)
default:
return lx.errorf("Expected key separator %q, but got %q instead.",
keySep, r)
}
}
// lexValue starts the consumption of a value anywhere a value is expected.
// lexValue will ignore whitespace.
// After a value is lexed, the last state on the next is popped and returned.
func lexValue(lx *lexer) stateFn {
// We allow whitespace to precede a value, but NOT new lines.
// In array syntax, the array states are responsible for ignoring new
// lines.
r := lx.next()
if isWhitespace(r) {
return lexSkip(lx, lexValue)
}
switch {
case r == arrayStart:
lx.ignore()
lx.emit(itemArray)
return lexArrayValue
case r == stringStart:
if lx.accept(stringStart) {
if lx.accept(stringStart) {
lx.ignore() // Ignore """
return lexMultilineString
}
lx.backup()
}
lx.ignore() // ignore the '"'
return lexString
case r == rawStringStart:
if lx.accept(rawStringStart) {
if lx.accept(rawStringStart) {
lx.ignore() // Ignore """
return lexMultilineRawString
}
lx.backup()
}
lx.ignore() // ignore the "'"
return lexRawString
case r == 't':
return lexTrue
case r == 'f':
return lexFalse
case r == '-':
return lexNumberStart
case isDigit(r):
lx.backup() // avoid an extra state and use the same as above
return lexNumberOrDateStart
case r == '.': // special error case, be kind to users
return lx.errorf("Floats must start with a digit, not '.'.")
}
return lx.errorf("Expected value but found %q instead.", r)
}
// lexArrayValue consumes one value in an array. It assumes that '[' or ','
// have already been consumed. All whitespace and new lines are ignored.
func lexArrayValue(lx *lexer) stateFn {
r := lx.next()
switch {
case isWhitespace(r) || isNL(r):
return lexSkip(lx, lexArrayValue)
case r == commentStart:
lx.push(lexArrayValue)
return lexCommentStart
case r == arrayValTerm:
return lx.errorf("Unexpected array value terminator %q.",
arrayValTerm)
case r == arrayEnd:
return lexArrayEnd
}
lx.backup()
lx.push(lexArrayValueEnd)
return lexValue
}
// lexArrayValueEnd consumes the cruft between values of an array. Namely,
// it ignores whitespace and expects either a ',' or a ']'.
func lexArrayValueEnd(lx *lexer) stateFn {
r := lx.next()
switch {
case isWhitespace(r) || isNL(r):
return lexSkip(lx, lexArrayValueEnd)
case r == commentStart:
lx.push(lexArrayValueEnd)
return lexCommentStart
case r == arrayValTerm:
lx.ignore()
return lexArrayValue // move on to the next value
case r == arrayEnd:
return lexArrayEnd
}
return lx.errorf("Expected an array value terminator %q or an array "+
"terminator %q, but got %q instead.", arrayValTerm, arrayEnd, r)
}
// lexArrayEnd finishes the lexing of an array. It assumes that a ']' has
// just been consumed.
func lexArrayEnd(lx *lexer) stateFn {
lx.ignore()
lx.emit(itemArrayEnd)
return lx.pop()
}
// lexString consumes the inner contents of a string. It assumes that the
// beginning '"' has already been consumed and ignored.
func lexString(lx *lexer) stateFn {
r := lx.next()
switch {
case isNL(r):
return lx.errorf("Strings cannot contain new lines.")
case r == '\\':
lx.push(lexString)
return lexStringEscape
case r == stringEnd:
lx.backup()
lx.emit(itemString)
lx.next()
lx.ignore()
return lx.pop()
}
return lexString
}
// lexMultilineString consumes the inner contents of a string. It assumes that
// the beginning '"""' has already been consumed and ignored.
func lexMultilineString(lx *lexer) stateFn {
r := lx.next()
switch {
case r == '\\':
return lexMultilineStringEscape
case r == stringEnd:
if lx.accept(stringEnd) {
if lx.accept(stringEnd) {
lx.backup()
lx.backup()
lx.backup()
lx.emit(itemMultilineString)
lx.next()
lx.next()
lx.next()
lx.ignore()
return lx.pop()
}
lx.backup()
}
}
return lexMultilineString
}
// lexRawString consumes a raw string. Nothing can be escaped in such a string.
// It assumes that the beginning "'" has already been consumed and ignored.
func lexRawString(lx *lexer) stateFn {
r := lx.next()
switch {
case isNL(r):
return lx.errorf("Strings cannot contain new lines.")
case r == rawStringEnd:
lx.backup()
lx.emit(itemRawString)
lx.next()
lx.ignore()
return lx.pop()
}
return lexRawString
}
// lexMultilineRawString consumes a raw string. Nothing can be escaped in such
// a string. It assumes that the beginning "'" has already been consumed and
// ignored.
func lexMultilineRawString(lx *lexer) stateFn {
r := lx.next()
switch {
case r == rawStringEnd:
if lx.accept(rawStringEnd) {
if lx.accept(rawStringEnd) {
lx.backup()
lx.backup()
lx.backup()
lx.emit(itemRawMultilineString)
lx.next()
lx.next()
lx.next()
lx.ignore()
return lx.pop()
}
lx.backup()
}
}
return lexMultilineRawString
}
// lexMultilineStringEscape consumes an escaped character. It assumes that the
// preceding '\\' has already been consumed.
func lexMultilineStringEscape(lx *lexer) stateFn {
// Handle the special case first:
if isNL(lx.next()) {
lx.next()
return lexMultilineString
} else {
lx.backup()
lx.push(lexMultilineString)
return lexStringEscape(lx)
}
}
func lexStringEscape(lx *lexer) stateFn {
r := lx.next()
switch r {
case 'b':
fallthrough
case 't':
fallthrough
case 'n':
fallthrough
case 'f':
fallthrough
case 'r':
fallthrough
case '"':
fallthrough
case '\\':
return lx.pop()
case 'u':
return lexShortUnicodeEscape
case 'U':
return lexLongUnicodeEscape
}
return lx.errorf("Invalid escape character %q. Only the following "+
"escape characters are allowed: "+
"\\b, \\t, \\n, \\f, \\r, \\\", \\/, \\\\, "+
"\\uXXXX and \\UXXXXXXXX.", r)
}
func lexShortUnicodeEscape(lx *lexer) stateFn {
var r rune
for i := 0; i < 4; i++ {
r = lx.next()
if !isHexadecimal(r) {
return lx.errorf("Expected four hexadecimal digits after '\\u', "+
"but got '%s' instead.", lx.current())
}
}
return lx.pop()
}
func lexLongUnicodeEscape(lx *lexer) stateFn {
var r rune
for i := 0; i < 8; i++ {
r = lx.next()
if !isHexadecimal(r) {
return lx.errorf("Expected eight hexadecimal digits after '\\U', "+
"but got '%s' instead.", lx.current())
}
}
return lx.pop()
}
// lexNumberOrDateStart consumes either a (positive) integer, float or
// datetime. It assumes that NO negative sign has been consumed.
func lexNumberOrDateStart(lx *lexer) stateFn {
r := lx.next()
if !isDigit(r) {
if r == '.' {
return lx.errorf("Floats must start with a digit, not '.'.")
} else {
return lx.errorf("Expected a digit but got %q.", r)
}
}
return lexNumberOrDate
}
// lexNumberOrDate consumes either a (positive) integer, float or datetime.
func lexNumberOrDate(lx *lexer) stateFn {
r := lx.next()
switch {
case r == '-':
if lx.pos-lx.start != 5 {
return lx.errorf("All ISO8601 dates must be in full Zulu form.")
}
return lexDateAfterYear
case isDigit(r):
return lexNumberOrDate
case r == '.':
return lexFloatStart
}
lx.backup()
lx.emit(itemInteger)
return lx.pop()
}
// lexDateAfterYear consumes a full Zulu Datetime in ISO8601 format.
// It assumes that "YYYY-" has already been consumed.
func lexDateAfterYear(lx *lexer) stateFn {
formats := []rune{
// digits are '0'.
// everything else is direct equality.
'0', '0', '-', '0', '0',
'T',
'0', '0', ':', '0', '0', ':', '0', '0',
'Z',
}
for _, f := range formats {
r := lx.next()
if f == '0' {
if !isDigit(r) {
return lx.errorf("Expected digit in ISO8601 datetime, "+
"but found %q instead.", r)
}
} else if f != r {
return lx.errorf("Expected %q in ISO8601 datetime, "+
"but found %q instead.", f, r)
}
}
lx.emit(itemDatetime)
return lx.pop()
}
// lexNumberStart consumes either an integer or a float. It assumes that
// a negative sign has already been read, but that *no* digits have been
// consumed. lexNumberStart will move to the appropriate integer or float
// states.
func lexNumberStart(lx *lexer) stateFn {
// we MUST see a digit. Even floats have to start with a digit.
r := lx.next()
if !isDigit(r) {
if r == '.' {
return lx.errorf("Floats must start with a digit, not '.'.")
} else {
return lx.errorf("Expected a digit but got %q.", r)
}
}
return lexNumber
}
// lexNumber consumes an integer or a float after seeing the first digit.
func lexNumber(lx *lexer) stateFn {
r := lx.next()
switch {
case isDigit(r):
return lexNumber
case r == '.':
return lexFloatStart
}
lx.backup()
lx.emit(itemInteger)
return lx.pop()
}
// lexFloatStart starts the consumption of digits of a float after a '.'.
// Namely, at least one digit is required.
func lexFloatStart(lx *lexer) stateFn {
r := lx.next()
if !isDigit(r) {
return lx.errorf("Floats must have a digit after the '.', but got "+
"%q instead.", r)
}
return lexFloat
}
// lexFloat consumes the digits of a float after a '.'.
// Assumes that one digit has been consumed after a '.' already.
func lexFloat(lx *lexer) stateFn {
r := lx.next()
if isDigit(r) {
return lexFloat
}
lx.backup()
lx.emit(itemFloat)
return lx.pop()
}
// lexConst consumes the s[1:] in s. It assumes that s[0] has already been
// consumed.
func lexConst(lx *lexer, s string) stateFn {
for i := range s[1:] {
if r := lx.next(); r != rune(s[i+1]) {
return lx.errorf("Expected %q, but found %q instead.", s[:i+1],
s[:i]+string(r))
}
}
return nil
}
// lexTrue consumes the "rue" in "true". It assumes that 't' has already
// been consumed.
func lexTrue(lx *lexer) stateFn {
if fn := lexConst(lx, "true"); fn != nil {
return fn
}
lx.emit(itemBool)
return lx.pop()
}
// lexFalse consumes the "alse" in "false". It assumes that 'f' has already
// been consumed.
func lexFalse(lx *lexer) stateFn {
if fn := lexConst(lx, "false"); fn != nil {
return fn
}
lx.emit(itemBool)
return lx.pop()
}
// lexCommentStart begins the lexing of a comment. It will emit
// itemCommentStart and consume no characters, passing control to lexComment.
func lexCommentStart(lx *lexer) stateFn {
lx.ignore()
lx.emit(itemCommentStart)
return lexComment
}
// lexComment lexes an entire comment. It assumes that '#' has been consumed.
// It will consume *up to* the first new line character, and pass control
// back to the last state on the stack.
func lexComment(lx *lexer) stateFn {
r := lx.peek()
if isNL(r) || r == eof {
lx.emit(itemText)
return lx.pop()
}
lx.next()
return lexComment
}
// lexSkip ignores all slurped input and moves on to the next state.
func lexSkip(lx *lexer, nextState stateFn) stateFn {
return func(lx *lexer) stateFn {
lx.ignore()
return nextState
}
}
// isWhitespace returns true if `r` is a whitespace character according
// to the spec.
func isWhitespace(r rune) bool {
return r == '\t' || r == ' '
}
func isNL(r rune) bool {
return r == '\n' || r == '\r'
}
func isDigit(r rune) bool {
return r >= '0' && r <= '9'
}
func isHexadecimal(r rune) bool {
return (r >= '0' && r <= '9') ||
(r >= 'a' && r <= 'f') ||
(r >= 'A' && r <= 'F')
}
func isBareKeyChar(r rune) bool {
return (r >= 'A' && r <= 'Z') ||
(r >= 'a' && r <= 'z') ||
(r >= '0' && r <= '9') ||
r == '_' ||
r == '-'
}
func (itype itemType) String() string {
switch itype {
case itemError:
return "Error"
case itemNIL:
return "NIL"
case itemEOF:
return "EOF"
case itemText:
return "Text"
case itemString:
return "String"
case itemRawString:
return "String"
case itemMultilineString:
return "String"
case itemRawMultilineString:
return "String"
case itemBool:
return "Bool"
case itemInteger:
return "Integer"
case itemFloat:
return "Float"
case itemDatetime:
return "DateTime"
case itemTableStart:
return "TableStart"
case itemTableEnd:
return "TableEnd"
case itemKeyStart:
return "KeyStart"
case itemArray:
return "Array"
case itemArrayEnd:
return "ArrayEnd"
case itemCommentStart:
return "CommentStart"
}
panic(fmt.Sprintf("BUG: Unknown type '%d'.", int(itype)))
}
func (item item) String() string {
return fmt.Sprintf("(%s, %s)", item.typ.String(), item.val)
}

View File

@@ -0,0 +1,498 @@
package toml
import (
"fmt"
"log"
"strconv"
"strings"
"time"
"unicode"
"unicode/utf8"
)
type parser struct {
mapping map[string]interface{}
types map[string]tomlType
lx *lexer
// A list of keys in the order that they appear in the TOML data.
ordered []Key
// the full key for the current hash in scope
context Key
// the base key name for everything except hashes
currentKey string
// rough approximation of line number
approxLine int
// A map of 'key.group.names' to whether they were created implicitly.
implicits map[string]bool
}
type parseError string
func (pe parseError) Error() string {
return string(pe)
}
func parse(data string) (p *parser, err error) {
defer func() {
if r := recover(); r != nil {
var ok bool
if err, ok = r.(parseError); ok {
return
}
panic(r)
}
}()
p = &parser{
mapping: make(map[string]interface{}),
types: make(map[string]tomlType),
lx: lex(data),
ordered: make([]Key, 0),
implicits: make(map[string]bool),
}
for {
item := p.next()
if item.typ == itemEOF {
break
}
p.topLevel(item)
}
return p, nil
}
func (p *parser) panicf(format string, v ...interface{}) {
msg := fmt.Sprintf("Near line %d (last key parsed '%s'): %s",
p.approxLine, p.current(), fmt.Sprintf(format, v...))
panic(parseError(msg))
}
func (p *parser) next() item {
it := p.lx.nextItem()
if it.typ == itemError {
p.panicf("%s", it.val)
}
return it
}
func (p *parser) bug(format string, v ...interface{}) {
log.Fatalf("BUG: %s\n\n", fmt.Sprintf(format, v...))
}
func (p *parser) expect(typ itemType) item {
it := p.next()
p.assertEqual(typ, it.typ)
return it
}
func (p *parser) assertEqual(expected, got itemType) {
if expected != got {
p.bug("Expected '%s' but got '%s'.", expected, got)
}
}
func (p *parser) topLevel(item item) {
switch item.typ {
case itemCommentStart:
p.approxLine = item.line
p.expect(itemText)
case itemTableStart:
kg := p.next()
p.approxLine = kg.line
var key Key
for ; kg.typ != itemTableEnd && kg.typ != itemEOF; kg = p.next() {
key = append(key, p.keyString(kg))
}
p.assertEqual(itemTableEnd, kg.typ)
p.establishContext(key, false)
p.setType("", tomlHash)
p.ordered = append(p.ordered, key)
case itemArrayTableStart:
kg := p.next()
p.approxLine = kg.line
var key Key
for ; kg.typ != itemArrayTableEnd && kg.typ != itemEOF; kg = p.next() {
key = append(key, p.keyString(kg))
}
p.assertEqual(itemArrayTableEnd, kg.typ)
p.establishContext(key, true)
p.setType("", tomlArrayHash)
p.ordered = append(p.ordered, key)
case itemKeyStart:
kname := p.next()
p.approxLine = kname.line
p.currentKey = p.keyString(kname)
val, typ := p.value(p.next())
p.setValue(p.currentKey, val)
p.setType(p.currentKey, typ)
p.ordered = append(p.ordered, p.context.add(p.currentKey))
p.currentKey = ""
default:
p.bug("Unexpected type at top level: %s", item.typ)
}
}
// Gets a string for a key (or part of a key in a table name).
func (p *parser) keyString(it item) string {
switch it.typ {
case itemText:
return it.val
case itemString, itemMultilineString,
itemRawString, itemRawMultilineString:
s, _ := p.value(it)
return s.(string)
default:
p.bug("Unexpected key type: %s", it.typ)
panic("unreachable")
}
}
// value translates an expected value from the lexer into a Go value wrapped
// as an empty interface.
func (p *parser) value(it item) (interface{}, tomlType) {
switch it.typ {
case itemString:
return p.replaceEscapes(it.val), p.typeOfPrimitive(it)
case itemMultilineString:
trimmed := stripFirstNewline(stripEscapedWhitespace(it.val))
return p.replaceEscapes(trimmed), p.typeOfPrimitive(it)
case itemRawString:
return it.val, p.typeOfPrimitive(it)
case itemRawMultilineString:
return stripFirstNewline(it.val), p.typeOfPrimitive(it)
case itemBool:
switch it.val {
case "true":
return true, p.typeOfPrimitive(it)
case "false":
return false, p.typeOfPrimitive(it)
}
p.bug("Expected boolean value, but got '%s'.", it.val)
case itemInteger:
num, err := strconv.ParseInt(it.val, 10, 64)
if err != nil {
// See comment below for floats describing why we make a
// distinction between a bug and a user error.
if e, ok := err.(*strconv.NumError); ok &&
e.Err == strconv.ErrRange {
p.panicf("Integer '%s' is out of the range of 64-bit "+
"signed integers.", it.val)
} else {
p.bug("Expected integer value, but got '%s'.", it.val)
}
}
return num, p.typeOfPrimitive(it)
case itemFloat:
num, err := strconv.ParseFloat(it.val, 64)
if err != nil {
// Distinguish float values. Normally, it'd be a bug if the lexer
// provides an invalid float, but it's possible that the float is
// out of range of valid values (which the lexer cannot determine).
// So mark the former as a bug but the latter as a legitimate user
// error.
//
// This is also true for integers.
if e, ok := err.(*strconv.NumError); ok &&
e.Err == strconv.ErrRange {
p.panicf("Float '%s' is out of the range of 64-bit "+
"IEEE-754 floating-point numbers.", it.val)
} else {
p.bug("Expected float value, but got '%s'.", it.val)
}
}
return num, p.typeOfPrimitive(it)
case itemDatetime:
t, err := time.Parse("2006-01-02T15:04:05Z", it.val)
if err != nil {
p.bug("Expected Zulu formatted DateTime, but got '%s'.", it.val)
}
return t, p.typeOfPrimitive(it)
case itemArray:
array := make([]interface{}, 0)
types := make([]tomlType, 0)
for it = p.next(); it.typ != itemArrayEnd; it = p.next() {
if it.typ == itemCommentStart {
p.expect(itemText)
continue
}
val, typ := p.value(it)
array = append(array, val)
types = append(types, typ)
}
return array, p.typeOfArray(types)
}
p.bug("Unexpected value type: %s", it.typ)
panic("unreachable")
}
// establishContext sets the current context of the parser,
// where the context is either a hash or an array of hashes. Which one is
// set depends on the value of the `array` parameter.
//
// Establishing the context also makes sure that the key isn't a duplicate, and
// will create implicit hashes automatically.
func (p *parser) establishContext(key Key, array bool) {
var ok bool
// Always start at the top level and drill down for our context.
hashContext := p.mapping
keyContext := make(Key, 0)
// We only need implicit hashes for key[0:-1]
for _, k := range key[0 : len(key)-1] {
_, ok = hashContext[k]
keyContext = append(keyContext, k)
// No key? Make an implicit hash and move on.
if !ok {
p.addImplicit(keyContext)
hashContext[k] = make(map[string]interface{})
}
// If the hash context is actually an array of tables, then set
// the hash context to the last element in that array.
//
// Otherwise, it better be a table, since this MUST be a key group (by
// virtue of it not being the last element in a key).
switch t := hashContext[k].(type) {
case []map[string]interface{}:
hashContext = t[len(t)-1]
case map[string]interface{}:
hashContext = t
default:
p.panicf("Key '%s' was already created as a hash.", keyContext)
}
}
p.context = keyContext
if array {
// If this is the first element for this array, then allocate a new
// list of tables for it.
k := key[len(key)-1]
if _, ok := hashContext[k]; !ok {
hashContext[k] = make([]map[string]interface{}, 0, 5)
}
// Add a new table. But make sure the key hasn't already been used
// for something else.
if hash, ok := hashContext[k].([]map[string]interface{}); ok {
hashContext[k] = append(hash, make(map[string]interface{}))
} else {
p.panicf("Key '%s' was already created and cannot be used as "+
"an array.", keyContext)
}
} else {
p.setValue(key[len(key)-1], make(map[string]interface{}))
}
p.context = append(p.context, key[len(key)-1])
}
// setValue sets the given key to the given value in the current context.
// It will make sure that the key hasn't already been defined, account for
// implicit key groups.
func (p *parser) setValue(key string, value interface{}) {
var tmpHash interface{}
var ok bool
hash := p.mapping
keyContext := make(Key, 0)
for _, k := range p.context {
keyContext = append(keyContext, k)
if tmpHash, ok = hash[k]; !ok {
p.bug("Context for key '%s' has not been established.", keyContext)
}
switch t := tmpHash.(type) {
case []map[string]interface{}:
// The context is a table of hashes. Pick the most recent table
// defined as the current hash.
hash = t[len(t)-1]
case map[string]interface{}:
hash = t
default:
p.bug("Expected hash to have type 'map[string]interface{}', but "+
"it has '%T' instead.", tmpHash)
}
}
keyContext = append(keyContext, key)
if _, ok := hash[key]; ok {
// Typically, if the given key has already been set, then we have
// to raise an error since duplicate keys are disallowed. However,
// it's possible that a key was previously defined implicitly. In this
// case, it is allowed to be redefined concretely. (See the
// `tests/valid/implicit-and-explicit-after.toml` test in `toml-test`.)
//
// But we have to make sure to stop marking it as an implicit. (So that
// another redefinition provokes an error.)
//
// Note that since it has already been defined (as a hash), we don't
// want to overwrite it. So our business is done.
if p.isImplicit(keyContext) {
p.removeImplicit(keyContext)
return
}
// Otherwise, we have a concrete key trying to override a previous
// key, which is *always* wrong.
p.panicf("Key '%s' has already been defined.", keyContext)
}
hash[key] = value
}
// setType sets the type of a particular value at a given key.
// It should be called immediately AFTER setValue.
//
// Note that if `key` is empty, then the type given will be applied to the
// current context (which is either a table or an array of tables).
func (p *parser) setType(key string, typ tomlType) {
keyContext := make(Key, 0, len(p.context)+1)
for _, k := range p.context {
keyContext = append(keyContext, k)
}
if len(key) > 0 { // allow type setting for hashes
keyContext = append(keyContext, key)
}
p.types[keyContext.String()] = typ
}
// addImplicit sets the given Key as having been created implicitly.
func (p *parser) addImplicit(key Key) {
p.implicits[key.String()] = true
}
// removeImplicit stops tagging the given key as having been implicitly
// created.
func (p *parser) removeImplicit(key Key) {
p.implicits[key.String()] = false
}
// isImplicit returns true if the key group pointed to by the key was created
// implicitly.
func (p *parser) isImplicit(key Key) bool {
return p.implicits[key.String()]
}
// current returns the full key name of the current context.
func (p *parser) current() string {
if len(p.currentKey) == 0 {
return p.context.String()
}
if len(p.context) == 0 {
return p.currentKey
}
return fmt.Sprintf("%s.%s", p.context, p.currentKey)
}
func stripFirstNewline(s string) string {
if len(s) == 0 || s[0] != '\n' {
return s
}
return s[1:len(s)]
}
func stripEscapedWhitespace(s string) string {
esc := strings.Split(s, "\\\n")
if len(esc) > 1 {
for i := 1; i < len(esc); i++ {
esc[i] = strings.TrimLeftFunc(esc[i], unicode.IsSpace)
}
}
return strings.Join(esc, "")
}
func (p *parser) replaceEscapes(str string) string {
var replaced []rune
s := []byte(str)
r := 0
for r < len(s) {
if s[r] != '\\' {
c, size := utf8.DecodeRune(s[r:])
r += size
replaced = append(replaced, c)
continue
}
r += 1
if r >= len(s) {
p.bug("Escape sequence at end of string.")
return ""
}
switch s[r] {
default:
p.bug("Expected valid escape code after \\, but got %q.", s[r])
return ""
case 'b':
replaced = append(replaced, rune(0x0008))
r += 1
case 't':
replaced = append(replaced, rune(0x0009))
r += 1
case 'n':
replaced = append(replaced, rune(0x000A))
r += 1
case 'f':
replaced = append(replaced, rune(0x000C))
r += 1
case 'r':
replaced = append(replaced, rune(0x000D))
r += 1
case '"':
replaced = append(replaced, rune(0x0022))
r += 1
case '\\':
replaced = append(replaced, rune(0x005C))
r += 1
case 'u':
// At this point, we know we have a Unicode escape of the form
// `uXXXX` at [r, r+5). (Because the lexer guarantees this
// for us.)
escaped := p.asciiEscapeToUnicode(s[r+1 : r+5])
replaced = append(replaced, escaped)
r += 5
case 'U':
// At this point, we know we have a Unicode escape of the form
// `uXXXX` at [r, r+9). (Because the lexer guarantees this
// for us.)
escaped := p.asciiEscapeToUnicode(s[r+1 : r+9])
replaced = append(replaced, escaped)
r += 9
}
}
return string(replaced)
}
func (p *parser) asciiEscapeToUnicode(bs []byte) rune {
s := string(bs)
hex, err := strconv.ParseUint(strings.ToLower(s), 16, 32)
if err != nil {
p.bug("Could not parse '%s' as a hexadecimal number, but the "+
"lexer claims it's OK: %s", s, err)
}
// BUG(burntsushi)
// I honestly don't understand how this works. I can't seem
// to find a way to make this fail. I figured this would fail on invalid
// UTF-8 characters like U+DCFF, but it doesn't.
if !utf8.ValidString(string(rune(hex))) {
p.panicf("Escaped character '\\u%s' is not valid UTF-8.", s)
}
return rune(hex)
}
func isStringType(ty itemType) bool {
return ty == itemString || ty == itemMultilineString ||
ty == itemRawString || ty == itemRawMultilineString
}

View File

@@ -0,0 +1 @@
au BufWritePost *.go silent!make tags > /dev/null 2>&1

View File

@@ -0,0 +1,91 @@
package toml
// tomlType represents any Go type that corresponds to a TOML type.
// While the first draft of the TOML spec has a simplistic type system that
// probably doesn't need this level of sophistication, we seem to be militating
// toward adding real composite types.
type tomlType interface {
typeString() string
}
// typeEqual accepts any two types and returns true if they are equal.
func typeEqual(t1, t2 tomlType) bool {
if t1 == nil || t2 == nil {
return false
}
return t1.typeString() == t2.typeString()
}
func typeIsHash(t tomlType) bool {
return typeEqual(t, tomlHash) || typeEqual(t, tomlArrayHash)
}
type tomlBaseType string
func (btype tomlBaseType) typeString() string {
return string(btype)
}
func (btype tomlBaseType) String() string {
return btype.typeString()
}
var (
tomlInteger tomlBaseType = "Integer"
tomlFloat tomlBaseType = "Float"
tomlDatetime tomlBaseType = "Datetime"
tomlString tomlBaseType = "String"
tomlBool tomlBaseType = "Bool"
tomlArray tomlBaseType = "Array"
tomlHash tomlBaseType = "Hash"
tomlArrayHash tomlBaseType = "ArrayHash"
)
// typeOfPrimitive returns a tomlType of any primitive value in TOML.
// Primitive values are: Integer, Float, Datetime, String and Bool.
//
// Passing a lexer item other than the following will cause a BUG message
// to occur: itemString, itemBool, itemInteger, itemFloat, itemDatetime.
func (p *parser) typeOfPrimitive(lexItem item) tomlType {
switch lexItem.typ {
case itemInteger:
return tomlInteger
case itemFloat:
return tomlFloat
case itemDatetime:
return tomlDatetime
case itemString:
return tomlString
case itemMultilineString:
return tomlString
case itemRawString:
return tomlString
case itemRawMultilineString:
return tomlString
case itemBool:
return tomlBool
}
p.bug("Cannot infer primitive type of lex item '%s'.", lexItem)
panic("unreachable")
}
// typeOfArray returns a tomlType for an array given a list of types of its
// values.
//
// In the current spec, if an array is homogeneous, then its type is always
// "Array". If the array is not homogeneous, an error is generated.
func (p *parser) typeOfArray(types []tomlType) tomlType {
// Empty arrays are cool.
if len(types) == 0 {
return tomlArray
}
theType := types[0]
for _, t := range types[1:] {
if !typeEqual(theType, t) {
p.panicf("Array contains values of type '%s' and '%s', but "+
"arrays must be homogeneous.", theType, t)
}
}
return tomlArray
}

View File

@@ -0,0 +1,241 @@
package toml
// Struct field handling is adapted from code in encoding/json:
//
// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the Go distribution.
import (
"reflect"
"sort"
"sync"
)
// A field represents a single field found in a struct.
type field struct {
name string // the name of the field (`toml` tag included)
tag bool // whether field has a `toml` tag
index []int // represents the depth of an anonymous field
typ reflect.Type // the type of the field
}
// byName sorts field by name, breaking ties with depth,
// then breaking ties with "name came from toml tag", then
// breaking ties with index sequence.
type byName []field
func (x byName) Len() int { return len(x) }
func (x byName) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
func (x byName) Less(i, j int) bool {
if x[i].name != x[j].name {
return x[i].name < x[j].name
}
if len(x[i].index) != len(x[j].index) {
return len(x[i].index) < len(x[j].index)
}
if x[i].tag != x[j].tag {
return x[i].tag
}
return byIndex(x).Less(i, j)
}
// byIndex sorts field by index sequence.
type byIndex []field
func (x byIndex) Len() int { return len(x) }
func (x byIndex) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
func (x byIndex) Less(i, j int) bool {
for k, xik := range x[i].index {
if k >= len(x[j].index) {
return false
}
if xik != x[j].index[k] {
return xik < x[j].index[k]
}
}
return len(x[i].index) < len(x[j].index)
}
// typeFields returns a list of fields that TOML should recognize for the given
// type. The algorithm is breadth-first search over the set of structs to
// include - the top struct and then any reachable anonymous structs.
func typeFields(t reflect.Type) []field {
// Anonymous fields to explore at the current level and the next.
current := []field{}
next := []field{{typ: t}}
// Count of queued names for current level and the next.
count := map[reflect.Type]int{}
nextCount := map[reflect.Type]int{}
// Types already visited at an earlier level.
visited := map[reflect.Type]bool{}
// Fields found.
var fields []field
for len(next) > 0 {
current, next = next, current[:0]
count, nextCount = nextCount, map[reflect.Type]int{}
for _, f := range current {
if visited[f.typ] {
continue
}
visited[f.typ] = true
// Scan f.typ for fields to include.
for i := 0; i < f.typ.NumField(); i++ {
sf := f.typ.Field(i)
if sf.PkgPath != "" { // unexported
continue
}
name := sf.Tag.Get("toml")
if name == "-" {
continue
}
index := make([]int, len(f.index)+1)
copy(index, f.index)
index[len(f.index)] = i
ft := sf.Type
if ft.Name() == "" && ft.Kind() == reflect.Ptr {
// Follow pointer.
ft = ft.Elem()
}
// Record found field and index sequence.
if name != "" || !sf.Anonymous || ft.Kind() != reflect.Struct {
tagged := name != ""
if name == "" {
name = sf.Name
}
fields = append(fields, field{name, tagged, index, ft})
if count[f.typ] > 1 {
// If there were multiple instances, add a second,
// so that the annihilation code will see a duplicate.
// It only cares about the distinction between 1 or 2,
// so don't bother generating any more copies.
fields = append(fields, fields[len(fields)-1])
}
continue
}
// Record new anonymous struct to explore in next round.
nextCount[ft]++
if nextCount[ft] == 1 {
f := field{name: ft.Name(), index: index, typ: ft}
next = append(next, f)
}
}
}
}
sort.Sort(byName(fields))
// Delete all fields that are hidden by the Go rules for embedded fields,
// except that fields with TOML tags are promoted.
// The fields are sorted in primary order of name, secondary order
// of field index length. Loop over names; for each name, delete
// hidden fields by choosing the one dominant field that survives.
out := fields[:0]
for advance, i := 0, 0; i < len(fields); i += advance {
// One iteration per name.
// Find the sequence of fields with the name of this first field.
fi := fields[i]
name := fi.name
for advance = 1; i+advance < len(fields); advance++ {
fj := fields[i+advance]
if fj.name != name {
break
}
}
if advance == 1 { // Only one field with this name
out = append(out, fi)
continue
}
dominant, ok := dominantField(fields[i : i+advance])
if ok {
out = append(out, dominant)
}
}
fields = out
sort.Sort(byIndex(fields))
return fields
}
// dominantField looks through the fields, all of which are known to
// have the same name, to find the single field that dominates the
// others using Go's embedding rules, modified by the presence of
// TOML tags. If there are multiple top-level fields, the boolean
// will be false: This condition is an error in Go and we skip all
// the fields.
func dominantField(fields []field) (field, bool) {
// The fields are sorted in increasing index-length order. The winner
// must therefore be one with the shortest index length. Drop all
// longer entries, which is easy: just truncate the slice.
length := len(fields[0].index)
tagged := -1 // Index of first tagged field.
for i, f := range fields {
if len(f.index) > length {
fields = fields[:i]
break
}
if f.tag {
if tagged >= 0 {
// Multiple tagged fields at the same level: conflict.
// Return no field.
return field{}, false
}
tagged = i
}
}
if tagged >= 0 {
return fields[tagged], true
}
// All remaining fields have the same length. If there's more than one,
// we have a conflict (two fields named "X" at the same level) and we
// return no field.
if len(fields) > 1 {
return field{}, false
}
return fields[0], true
}
var fieldCache struct {
sync.RWMutex
m map[reflect.Type][]field
}
// cachedTypeFields is like typeFields but uses a cache to avoid repeated work.
func cachedTypeFields(t reflect.Type) []field {
fieldCache.RLock()
f := fieldCache.m[t]
fieldCache.RUnlock()
if f != nil {
return f
}
// Compute fields without lock.
// Might duplicate effort but won't hold other computations back.
f = typeFields(t)
if f == nil {
f = []field{}
}
fieldCache.Lock()
if fieldCache.m == nil {
fieldCache.m = map[reflect.Type][]field{}
}
fieldCache.m[t] = f
fieldCache.Unlock()
return f
}

View File

@@ -0,0 +1,24 @@
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
# Folders
_obj
_test
.idea
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe
*.iml

191
Godeps/_workspace/src/github.com/Unknwon/com/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,191 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and
distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright
owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities
that control, are controlled by, or are under common control with that entity.
For the purposes of this definition, "control" means (i) the power, direct or
indirect, to cause the direction or management of such entity, whether by
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising
permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including
but not limited to software source code, documentation source, and configuration
files.
"Object" form shall mean any form resulting from mechanical transformation or
translation of a Source form, including but not limited to compiled object code,
generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made
available under the License, as indicated by a copyright notice that is included
in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that
is based on (or derived from) the Work and for which the editorial revisions,
annotations, elaborations, or other modifications represent, as a whole, an
original work of authorship. For the purposes of this License, Derivative Works
shall not include works that remain separable from, or merely link (or bind by
name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version
of the Work and any modifications or additions to that Work or Derivative Works
thereof, that is intentionally submitted to Licensor for inclusion in the Work
by the copyright owner or by an individual or Legal Entity authorized to submit
on behalf of the copyright owner. For the purposes of this definition,
"submitted" means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems, and
issue tracking systems that are managed by, or on behalf of, the Licensor for
the purpose of discussing and improving the Work, but excluding communication
that is conspicuously marked or otherwise designated in writing by the copyright
owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
of whom a Contribution has been received by Licensor and subsequently
incorporated within the Work.
2. Grant of Copyright License.
Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the Work and such
Derivative Works in Source or Object form.
3. Grant of Patent License.
Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable (except as stated in this section) patent license to make, have
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
such license applies only to those patent claims licensable by such Contributor
that are necessarily infringed by their Contribution(s) alone or by combination
of their Contribution(s) with the Work to which such Contribution(s) was
submitted. If You institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
Contribution incorporated within the Work constitutes direct or contributory
patent infringement, then any patent licenses granted to You under this License
for that Work shall terminate as of the date such litigation is filed.
4. Redistribution.
You may reproduce and distribute copies of the Work or Derivative Works thereof
in any medium, with or without modifications, and in Source or Object form,
provided that You meet the following conditions:
You must give any other recipients of the Work or Derivative Works a copy of
this License; and
You must cause any modified files to carry prominent notices stating that You
changed the files; and
You must retain, in the Source form of any Derivative Works that You distribute,
all copyright, patent, trademark, and attribution notices from the Source form
of the Work, excluding those notices that do not pertain to any part of the
Derivative Works; and
If the Work includes a "NOTICE" text file as part of its distribution, then any
Derivative Works that You distribute must include a readable copy of the
attribution notices contained within such NOTICE file, excluding those notices
that do not pertain to any part of the Derivative Works, in at least one of the
following places: within a NOTICE text file distributed as part of the
Derivative Works; within the Source form or documentation, if provided along
with the Derivative Works; or, within a display generated by the Derivative
Works, if and wherever such third-party notices normally appear. The contents of
the NOTICE file are for informational purposes only and do not modify the
License. You may add Your own attribution notices within Derivative Works that
You distribute, alongside or as an addendum to the NOTICE text from the Work,
provided that such additional attribution notices cannot be construed as
modifying the License.
You may add Your own copyright statement to Your modifications and may provide
additional or different license terms and conditions for use, reproduction, or
distribution of Your modifications, or for any such Derivative Works as a whole,
provided Your use, reproduction, and distribution of the Work otherwise complies
with the conditions stated in this License.
5. Submission of Contributions.
Unless You explicitly state otherwise, any Contribution intentionally submitted
for inclusion in the Work by You to the Licensor shall be under the terms and
conditions of this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify the terms of
any separate license agreement you may have executed with Licensor regarding
such Contributions.
6. Trademarks.
This License does not grant permission to use the trade names, trademarks,
service marks, or product names of the Licensor, except as required for
reasonable and customary use in describing the origin of the Work and
reproducing the content of the NOTICE file.
7. Disclaimer of Warranty.
Unless required by applicable law or agreed to in writing, Licensor provides the
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
including, without limitation, any warranties or conditions of TITLE,
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
solely responsible for determining the appropriateness of using or
redistributing the Work and assume any risks associated with Your exercise of
permissions under this License.
8. Limitation of Liability.
In no event and under no legal theory, whether in tort (including negligence),
contract, or otherwise, unless required by applicable law (such as deliberate
and grossly negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special, incidental,
or consequential damages of any character arising as a result of this License or
out of the use or inability to use the Work (including but not limited to
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
any and all other commercial damages or losses), even if such Contributor has
been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability.
While redistributing the Work or Derivative Works thereof, You may choose to
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
other liability obligations and/or rights consistent with this License. However,
in accepting such obligations, You may act only on Your own behalf and on Your
sole responsibility, not on behalf of any other Contributor, and only if You
agree to indemnify, defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason of your
accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work
To apply the Apache License to your work, attach the following boilerplate
notice, with the fields enclosed by brackets "[]" replaced with your own
identifying information. (Don't include the brackets!) The text should be
enclosed in the appropriate comment syntax for the file format. We also
recommend that a file or class name and description of purpose be included on
the same "printed page" as the copyright notice for easier identification within
third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

24
Godeps/_workspace/src/github.com/Unknwon/com/README.md generated vendored Normal file
View File

@@ -0,0 +1,24 @@
Common functions
===
[![Build Status](https://drone.io/github.com/Unknwon/com/status.png)](https://drone.io/github.com/Unknwon/com/latest) [![Go Walker](http://gowalker.org/api/v1/badge)](http://gowalker.org/github.com/Unknwon/com)
This is an open source project for commonly used functions for the Go programming language.
This package need >= **go 1.2**
Code Convention: based on [Go Code Convention](https://github.com/Unknwon/go-code-convention).
## Contribute
Your contribute is welcome, but you have to check following steps after you added some functions and commit them:
1. Make sure you wrote user-friendly comments for **all functions** .
2. Make sure you wrote test cases with any possible condition for **all functions** in file `*_test.go`.
3. Make sure you wrote benchmarks for **all functions** in file `*_test.go`.
4. Make sure you wrote useful examples for **all functions** in file `example_test.go`.
5. Make sure you ran `go test -bench="."` and got **PASS** .
## Performance
See results on [drone.io](https://drone.io/github.com/Unknwon/com/latest) by `go test -bench="."`.

161
Godeps/_workspace/src/github.com/Unknwon/com/cmd.go generated vendored Normal file
View File

@@ -0,0 +1,161 @@
// +build go1.2
// Copyright 2013 com authors
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
// Package com is an open source project for commonly used functions for the Go programming language.
package com
import (
"bytes"
"fmt"
"os/exec"
"runtime"
"strings"
)
// ExecCmdDirBytes executes system command in given directory
// and return stdout, stderr in bytes type, along with possible error.
func ExecCmdDirBytes(dir, cmdName string, args ...string) ([]byte, []byte, error) {
bufOut := new(bytes.Buffer)
bufErr := new(bytes.Buffer)
cmd := exec.Command(cmdName, args...)
cmd.Dir = dir
cmd.Stdout = bufOut
cmd.Stderr = bufErr
err := cmd.Run()
return bufOut.Bytes(), bufErr.Bytes(), err
}
// ExecCmdBytes executes system command
// and return stdout, stderr in bytes type, along with possible error.
func ExecCmdBytes(cmdName string, args ...string) ([]byte, []byte, error) {
return ExecCmdDirBytes("", cmdName, args...)
}
// ExecCmdDir executes system command in given directory
// and return stdout, stderr in string type, along with possible error.
func ExecCmdDir(dir, cmdName string, args ...string) (string, string, error) {
bufOut, bufErr, err := ExecCmdDirBytes(dir, cmdName, args...)
return string(bufOut), string(bufErr), err
}
// ExecCmd executes system command
// and return stdout, stderr in string type, along with possible error.
func ExecCmd(cmdName string, args ...string) (string, string, error) {
return ExecCmdDir("", cmdName, args...)
}
// _________ .__ .____
// \_ ___ \ ____ | | ___________ | | ____ ____
// / \ \/ / _ \| | / _ \_ __ \ | | / _ \ / ___\
// \ \___( <_> ) |_( <_> ) | \/ | |__( <_> ) /_/ >
// \______ /\____/|____/\____/|__| |_______ \____/\___ /
// \/ \/ /_____/
// Color number constants.
const (
Gray = uint8(iota + 90)
Red
Green
Yellow
Blue
Magenta
//NRed = uint8(31) // Normal
EndColor = "\033[0m"
)
// getColorLevel returns colored level string by given level.
func getColorLevel(level string) string {
level = strings.ToUpper(level)
switch level {
case "TRAC":
return fmt.Sprintf("\033[%dm%s\033[0m", Blue, level)
case "ERRO":
return fmt.Sprintf("\033[%dm%s\033[0m", Red, level)
case "WARN":
return fmt.Sprintf("\033[%dm%s\033[0m", Magenta, level)
case "SUCC":
return fmt.Sprintf("\033[%dm%s\033[0m", Green, level)
default:
return level
}
}
// ColorLogS colors log and return colored content.
// Log format: <level> <content [highlight][path]> [ error ].
// Level: TRAC -> blue; ERRO -> red; WARN -> Magenta; SUCC -> green; others -> default.
// Content: default; path: yellow; error -> red.
// Level has to be surrounded by "[" and "]".
// Highlights have to be surrounded by "# " and " #"(space), "#" will be deleted.
// Paths have to be surrounded by "( " and " )"(space).
// Errors have to be surrounded by "[ " and " ]"(space).
// Note: it hasn't support windows yet, contribute is welcome.
func ColorLogS(format string, a ...interface{}) string {
log := fmt.Sprintf(format, a...)
var clog string
if runtime.GOOS != "windows" {
// Level.
i := strings.Index(log, "]")
if log[0] == '[' && i > -1 {
clog += "[" + getColorLevel(log[1:i]) + "]"
}
log = log[i+1:]
// Error.
log = strings.Replace(log, "[ ", fmt.Sprintf("[\033[%dm", Red), -1)
log = strings.Replace(log, " ]", EndColor+"]", -1)
// Path.
log = strings.Replace(log, "( ", fmt.Sprintf("(\033[%dm", Yellow), -1)
log = strings.Replace(log, " )", EndColor+")", -1)
// Highlights.
log = strings.Replace(log, "# ", fmt.Sprintf("\033[%dm", Gray), -1)
log = strings.Replace(log, " #", EndColor, -1)
} else {
// Level.
i := strings.Index(log, "]")
if log[0] == '[' && i > -1 {
clog += "[" + log[1:i] + "]"
}
log = log[i+1:]
// Error.
log = strings.Replace(log, "[ ", "[", -1)
log = strings.Replace(log, " ]", "]", -1)
// Path.
log = strings.Replace(log, "( ", "(", -1)
log = strings.Replace(log, " )", ")", -1)
// Highlights.
log = strings.Replace(log, "# ", "", -1)
log = strings.Replace(log, " #", "", -1)
}
return clog + log
}
// ColorLog prints colored log to stdout.
// See color rules in function 'ColorLogS'.
func ColorLog(format string, a ...interface{}) {
fmt.Print(ColorLogS(format, a...))
}

View File

@@ -0,0 +1,140 @@
// Copyright 2013 com authors
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package com
import (
"fmt"
"runtime"
"strings"
"testing"
)
func TestColorLogS(t *testing.T) {
if runtime.GOOS != "windows" {
// Trace + path.
cls := ColorLogS("[TRAC] Trace level test with path( %s )", "/path/to/somethere")
clsR := fmt.Sprintf(
"[\033[%dmTRAC%s] Trace level test with path(\033[%dm%s%s)",
Blue, EndColor, Yellow, "/path/to/somethere", EndColor)
if cls != clsR {
t.Errorf("ColorLogS:\n Expect => %s\n Got => %s\n", clsR, cls)
}
// Error + error.
cls = ColorLogS("[ERRO] Error level test with error[ %s ]", "test error")
clsR = fmt.Sprintf(
"[\033[%dmERRO%s] Error level test with error[\033[%dm%s%s]",
Red, EndColor, Red, "test error", EndColor)
if cls != clsR {
t.Errorf("ColorLogS:\n Expect => %s\n Got => %s\n", clsR, cls)
}
// Warning + highlight.
cls = ColorLogS("[WARN] Warnning level test with highlight # %s #", "special offer!")
clsR = fmt.Sprintf(
"[\033[%dmWARN%s] Warnning level test with highlight \033[%dm%s%s",
Magenta, EndColor, Gray, "special offer!", EndColor)
if cls != clsR {
t.Errorf("ColorLogS:\n Expect => %s\n Got => %s\n", clsR, cls)
}
// Success.
cls = ColorLogS("[SUCC] Success level test")
clsR = fmt.Sprintf(
"[\033[%dmSUCC%s] Success level test",
Green, EndColor)
if cls != clsR {
t.Errorf("ColorLogS:\n Expect => %s\n Got => %s\n", clsR, cls)
}
// Default.
cls = ColorLogS("[INFO] Default level test")
clsR = fmt.Sprintf(
"[INFO] Default level test")
if cls != clsR {
t.Errorf("ColorLogS:\n Expect => %s\n Got => %s\n", clsR, cls)
}
} else {
// Trace + path.
cls := ColorLogS("[TRAC] Trace level test with path( %s )", "/path/to/somethere")
clsR := fmt.Sprintf(
"[TRAC] Trace level test with path(%s)",
"/path/to/somethere")
if cls != clsR {
t.Errorf("ColorLogS:\n Expect => %s\n Got => %s\n", clsR, cls)
}
// Error + error.
cls = ColorLogS("[ERRO] Error level test with error[ %s ]", "test error")
clsR = fmt.Sprintf(
"[ERRO] Error level test with error[%s]",
"test error")
if cls != clsR {
t.Errorf("ColorLogS:\n Expect => %s\n Got => %s\n", clsR, cls)
}
// Warning + highlight.
cls = ColorLogS("[WARN] Warnning level test with highlight # %s #", "special offer!")
clsR = fmt.Sprintf(
"[WARN] Warnning level test with highlight %s",
"special offer!")
if cls != clsR {
t.Errorf("ColorLogS:\n Expect => %s\n Got => %s\n", clsR, cls)
}
// Success.
cls = ColorLogS("[SUCC] Success level test")
clsR = fmt.Sprintf(
"[SUCC] Success level test")
if cls != clsR {
t.Errorf("ColorLogS:\n Expect => %s\n Got => %s\n", clsR, cls)
}
// Default.
cls = ColorLogS("[INFO] Default level test")
clsR = fmt.Sprintf(
"[INFO] Default level test")
if cls != clsR {
t.Errorf("ColorLogS:\n Expect => %s\n Got => %s\n", clsR, cls)
}
}
}
func TestExecCmd(t *testing.T) {
stdout, stderr, err := ExecCmd("go", "help", "get")
if err != nil {
t.Errorf("ExecCmd:\n Expect => %v\n Got => %v\n", nil, err)
} else if len(stderr) != 0 {
t.Errorf("ExecCmd:\n Expect => %s\n Got => %s\n", "", stderr)
} else if !strings.HasPrefix(stdout, "usage: go get") {
t.Errorf("ExecCmd:\n Expect => %s\n Got => %s\n", "usage: go get", stdout)
}
}
func BenchmarkColorLogS(b *testing.B) {
log := fmt.Sprintf(
"[WARN] This is a tesing log that should be colored, path( %s ),"+
" highlight # %s #, error [ %s ].",
"path to somewhere", "highlighted content", "tesing error")
for i := 0; i < b.N; i++ {
ColorLogS(log)
}
}
func BenchmarkExecCmd(b *testing.B) {
for i := 0; i < b.N; i++ {
ExecCmd("go", "help", "get")
}
}

157
Godeps/_workspace/src/github.com/Unknwon/com/convert.go generated vendored Normal file
View File

@@ -0,0 +1,157 @@
// Copyright 2014 com authors
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package com
import (
"fmt"
"strconv"
)
// Convert string to specify type.
type StrTo string
func (f StrTo) Exist() bool {
return string(f) != string(0x1E)
}
func (f StrTo) Uint8() (uint8, error) {
v, err := strconv.ParseUint(f.String(), 10, 8)
return uint8(v), err
}
func (f StrTo) Int() (int, error) {
v, err := strconv.ParseInt(f.String(), 10, 32)
return int(v), err
}
func (f StrTo) Int64() (int64, error) {
v, err := strconv.ParseInt(f.String(), 10, 64)
return int64(v), err
}
func (f StrTo) MustUint8() uint8 {
v, _ := f.Uint8()
return v
}
func (f StrTo) MustInt() int {
v, _ := f.Int()
return v
}
func (f StrTo) MustInt64() int64 {
v, _ := f.Int64()
return v
}
func (f StrTo) String() string {
if f.Exist() {
return string(f)
}
return ""
}
// Convert any type to string.
func ToStr(value interface{}, args ...int) (s string) {
switch v := value.(type) {
case bool:
s = strconv.FormatBool(v)
case float32:
s = strconv.FormatFloat(float64(v), 'f', argInt(args).Get(0, -1), argInt(args).Get(1, 32))
case float64:
s = strconv.FormatFloat(v, 'f', argInt(args).Get(0, -1), argInt(args).Get(1, 64))
case int:
s = strconv.FormatInt(int64(v), argInt(args).Get(0, 10))
case int8:
s = strconv.FormatInt(int64(v), argInt(args).Get(0, 10))
case int16:
s = strconv.FormatInt(int64(v), argInt(args).Get(0, 10))
case int32:
s = strconv.FormatInt(int64(v), argInt(args).Get(0, 10))
case int64:
s = strconv.FormatInt(v, argInt(args).Get(0, 10))
case uint:
s = strconv.FormatUint(uint64(v), argInt(args).Get(0, 10))
case uint8:
s = strconv.FormatUint(uint64(v), argInt(args).Get(0, 10))
case uint16:
s = strconv.FormatUint(uint64(v), argInt(args).Get(0, 10))
case uint32:
s = strconv.FormatUint(uint64(v), argInt(args).Get(0, 10))
case uint64:
s = strconv.FormatUint(v, argInt(args).Get(0, 10))
case string:
s = v
case []byte:
s = string(v)
default:
s = fmt.Sprintf("%v", v)
}
return s
}
type argInt []int
func (a argInt) Get(i int, args ...int) (r int) {
if i >= 0 && i < len(a) {
r = a[i]
} else if len(args) > 0 {
r = args[0]
}
return
}
// HexStr2int converts hex format string to decimal number.
func HexStr2int(hexStr string) (int, error) {
num := 0
length := len(hexStr)
for i := 0; i < length; i++ {
char := hexStr[length-i-1]
factor := -1
switch {
case char >= '0' && char <= '9':
factor = int(char) - '0'
case char >= 'a' && char <= 'f':
factor = int(char) - 'a' + 10
default:
return -1, fmt.Errorf("invalid hex: %s", string(char))
}
num += factor * PowInt(16, i)
}
return num, nil
}
// Int2HexStr converts decimal number to hex format string.
func Int2HexStr(num int) (hex string) {
if num == 0 {
return "0"
}
for num > 0 {
r := num % 16
c := "?"
if r >= 0 && r <= 9 {
c = string(r + '0')
} else {
c = string(r + 'a' - 10)
}
hex = c + hex
num = num / 16
}
return hex
}

View File

@@ -0,0 +1,56 @@
// Copyright 2014 com authors
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package com
import (
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestHexStr2int(t *testing.T) {
Convey("Convert hex format string to decimal", t, func() {
hexDecs := map[string]int{
"1": 1,
"002": 2,
"011": 17,
"0a1": 161,
"35e": 862,
}
for hex, dec := range hexDecs {
val, err := HexStr2int(hex)
So(err, ShouldBeNil)
So(val, ShouldEqual, dec)
}
})
}
func TestInt2HexStr(t *testing.T) {
Convey("Convert decimal to hex format string", t, func() {
decHexs := map[int]string{
1: "1",
2: "2",
17: "11",
161: "a1",
862: "35e",
}
for dec, hex := range decHexs {
val := Int2HexStr(dec)
So(val, ShouldEqual, hex)
}
})
}

173
Godeps/_workspace/src/github.com/Unknwon/com/dir.go generated vendored Normal file
View File

@@ -0,0 +1,173 @@
// Copyright 2013 com authors
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package com
import (
"errors"
"fmt"
"os"
"path"
"strings"
)
// IsDir returns true if given path is a directory,
// or returns false when it's a file or does not exist.
func IsDir(dir string) bool {
f, e := os.Stat(dir)
if e != nil {
return false
}
return f.IsDir()
}
func statDir(dirPath, recPath string, includeDir, isDirOnly bool) ([]string, error) {
dir, err := os.Open(dirPath)
if err != nil {
return nil, err
}
defer dir.Close()
fis, err := dir.Readdir(0)
if err != nil {
return nil, err
}
statList := make([]string, 0)
for _, fi := range fis {
if strings.Contains(fi.Name(), ".DS_Store") {
continue
}
relPath := path.Join(recPath, fi.Name())
curPath := path.Join(dirPath, fi.Name())
if fi.IsDir() {
if includeDir {
statList = append(statList, relPath+"/")
}
s, err := statDir(curPath, relPath, includeDir, isDirOnly)
if err != nil {
return nil, err
}
statList = append(statList, s...)
} else if !isDirOnly {
statList = append(statList, relPath)
}
}
return statList, nil
}
// StatDir gathers information of given directory by depth-first.
// It returns slice of file list and includes subdirectories if enabled;
// it returns error and nil slice when error occurs in underlying functions,
// or given path is not a directory or does not exist.
//
// Slice does not include given path itself.
// If subdirectories is enabled, they will have suffix '/'.
func StatDir(rootPath string, includeDir ...bool) ([]string, error) {
if !IsDir(rootPath) {
return nil, errors.New("not a directory or does not exist: " + rootPath)
}
isIncludeDir := false
if len(includeDir) >= 1 {
isIncludeDir = includeDir[0]
}
return statDir(rootPath, "", isIncludeDir, false)
}
// GetAllSubDirs returns all subdirectories of given root path.
// Slice does not include given path itself.
func GetAllSubDirs(rootPath string) ([]string, error) {
if !IsDir(rootPath) {
return nil, errors.New("not a directory or does not exist: " + rootPath)
}
return statDir(rootPath, "", true, true)
}
// GetFileListBySuffix returns an ordered list of file paths.
// It recognize if given path is a file, and don't do recursive find.
func GetFileListBySuffix(dirPath, suffix string) ([]string, error) {
if !IsExist(dirPath) {
return nil, fmt.Errorf("given path does not exist: %s", dirPath)
} else if IsFile(dirPath) {
return []string{dirPath}, nil
}
// Given path is a directory.
dir, err := os.Open(dirPath)
if err != nil {
return nil, err
}
fis, err := dir.Readdir(0)
if err != nil {
return nil, err
}
files := make([]string, 0, len(fis))
for _, fi := range fis {
if strings.HasSuffix(fi.Name(), suffix) {
files = append(files, path.Join(dirPath, fi.Name()))
}
}
return files, nil
}
// CopyDir copy files recursively from source to target directory.
//
// The filter accepts a function that process the path info.
// and should return true for need to filter.
//
// It returns error when error occurs in underlying functions.
func CopyDir(srcPath, destPath string, filters ...func(filePath string) bool) error {
// Check if target directory exists.
if IsExist(destPath) {
return errors.New("file or directory alreay exists: " + destPath)
}
err := os.MkdirAll(destPath, os.ModePerm)
if err != nil {
return err
}
// Gather directory info.
infos, err := StatDir(srcPath, true)
if err != nil {
return err
}
var filter func(filePath string) bool
if len(filters) > 0 {
filter = filters[0]
}
for _, info := range infos {
if filter != nil && filter(info) {
continue
}
curPath := path.Join(destPath, info)
if strings.HasSuffix(info, "/") {
err = os.MkdirAll(curPath, os.ModePerm)
} else {
err = Copy(path.Join(srcPath, info), curPath)
}
if err != nil {
return err
}
}
return nil
}

View File

@@ -0,0 +1,58 @@
// Copyright 2013 com authors
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package com
import (
"os"
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestIsDir(t *testing.T) {
Convey("Check if given path is a directory", t, func() {
Convey("Pass a file name", func() {
So(IsDir("file.go"), ShouldEqual, false)
})
Convey("Pass a directory name", func() {
So(IsDir("testdata"), ShouldEqual, true)
})
Convey("Pass a invalid path", func() {
So(IsDir("foo"), ShouldEqual, false)
})
})
}
func TestCopyDir(t *testing.T) {
Convey("Items of two slices should be same", t, func() {
s1, err := StatDir("testdata", true)
So(err, ShouldEqual, nil)
err = CopyDir("testdata", "testdata2")
So(err, ShouldEqual, nil)
s2, err := StatDir("testdata2", true)
os.RemoveAll("testdata2")
So(err, ShouldEqual, nil)
So(CompareSliceStr(s1, s2), ShouldEqual, true)
})
}
func BenchmarkIsDir(b *testing.B) {
for i := 0; i < b.N; i++ {
IsDir("file.go")
}
}

View File

@@ -0,0 +1,299 @@
// Copyright 2013 com authors
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package com_test
import (
"fmt"
"io/ioutil"
"net/http"
"github.com/Unknwon/com"
)
// ------------------------------
// cmd.go
// ------------------------------
func ExampleColorLogS() {
coloredLog := com.ColorLogS(fmt.Sprintf(
"[WARN] This is a tesing log that should be colored, path( %s ),"+
" highlight # %s #, error [ %s ].",
"path to somewhere", "highlighted content", "tesing error"))
fmt.Println(coloredLog)
}
func ExampleColorLog() {
com.ColorLog(fmt.Sprintf(
"[WARN] This is a tesing log that should be colored, path( %s ),"+
" highlight # %s #, error [ %s ].",
"path to somewhere", "highlighted content", "tesing error"))
}
func ExampleExecCmd() {
stdout, stderr, err := com.ExecCmd("go", "help", "get")
fmt.Println(stdout, stderr, err)
}
// ------------- END ------------
// ------------------------------
// html.go
// ------------------------------
func ExampleHtml2JS() {
htm := "<div id=\"button\" class=\"btn\">Click me</div>\n\r"
js := string(com.Html2JS([]byte(htm)))
fmt.Println(js)
// Output: <div id=\"button\" class=\"btn\">Click me</div>\n
}
// ------------- END ------------
// ------------------------------
// path.go
// ------------------------------
func ExampleGetGOPATHs() {
gps := com.GetGOPATHs()
fmt.Println(gps)
}
func ExampleGetSrcPath() {
srcPath, err := com.GetSrcPath("github.com/Unknwon/com")
if err != nil {
fmt.Println(err)
return
}
fmt.Println(srcPath)
}
func ExampleHomeDir() {
hd, err := com.HomeDir()
fmt.Println(hd, err)
}
// ------------- END ------------
// ------------------------------
// file.go
// ------------------------------
func ExampleIsFile() {
if com.IsFile("file.go") {
fmt.Println("file.go exists")
return
}
fmt.Println("file.go is not a file or does not exist")
}
func ExampleIsExist() {
if com.IsExist("file.go") {
fmt.Println("file.go exists")
return
}
fmt.Println("file.go does not exist")
}
// ------------- END ------------
// ------------------------------
// dir.go
// ------------------------------
func ExampleIsDir() {
if com.IsDir("files") {
fmt.Println("directory 'files' exists")
return
}
fmt.Println("'files' is not a directory or does not exist")
}
// ------------- END ------------
// ------------------------------
// string.go
// ------------------------------
func ExampleIsLetter() {
fmt.Println(com.IsLetter('1'))
fmt.Println(com.IsLetter('['))
fmt.Println(com.IsLetter('a'))
fmt.Println(com.IsLetter('Z'))
// Output:
// false
// false
// true
// true
}
func ExampleExpand() {
match := map[string]string{
"domain": "gowalker.org",
"subdomain": "github.com",
}
s := "http://{domain}/{subdomain}/{0}/{1}"
fmt.Println(com.Expand(s, match, "Unknwon", "gowalker"))
// Output: http://gowalker.org/github.com/Unknwon/gowalker
}
// ------------- END ------------
// ------------------------------
// http.go
// ------------------------------
func ExampleHttpGet() ([]byte, error) {
rc, err := com.HttpGet(&http.Client{}, "http://gowalker.org", nil)
if err != nil {
return nil, err
}
p, err := ioutil.ReadAll(rc)
rc.Close()
return p, err
}
func ExampleHttpGetBytes() ([]byte, error) {
p, err := com.HttpGetBytes(&http.Client{}, "http://gowalker.org", nil)
return p, err
}
func ExampleHttpGetJSON() interface{} {
j := com.HttpGetJSON(&http.Client{}, "http://gowalker.org", nil)
return j
}
type rawFile struct {
name string
rawURL string
data []byte
}
func (rf *rawFile) Name() string {
return rf.name
}
func (rf *rawFile) RawUrl() string {
return rf.rawURL
}
func (rf *rawFile) Data() []byte {
return rf.data
}
func (rf *rawFile) SetData(p []byte) {
rf.data = p
}
func ExampleFetchFiles() {
// Code that should be outside of your function body.
// type rawFile struct {
// name string
// rawURL string
// data []byte
// }
// func (rf *rawFile) Name() string {
// return rf.name
// }
// func (rf *rawFile) RawUrl() string {
// return rf.rawURL
// }
// func (rf *rawFile) Data() []byte {
// return rf.data
// }
// func (rf *rawFile) SetData(p []byte) {
// rf.data = p
// }
files := []com.RawFile{
&rawFile{rawURL: "http://example.com"},
&rawFile{rawURL: "http://example.com/foo"},
}
err := com.FetchFiles(&http.Client{}, files, nil)
fmt.Println(err, len(files[0].Data()), len(files[1].Data()))
}
func ExampleFetchFilesCurl() {
// Code that should be outside of your function body.
// type rawFile struct {
// name string
// rawURL string
// data []byte
// }
// func (rf *rawFile) Name() string {
// return rf.name
// }
// func (rf *rawFile) RawUrl() string {
// return rf.rawURL
// }
// func (rf *rawFile) Data() []byte {
// return rf.data
// }
// func (rf *rawFile) SetData(p []byte) {
// rf.data = p
// }
files := []com.RawFile{
&rawFile{rawURL: "http://example.com"},
&rawFile{rawURL: "http://example.com/foo"},
}
err := com.FetchFilesCurl(files)
fmt.Println(err, len(files[0].Data()), len(files[1].Data()))
}
// ------------- END ------------
// ------------------------------
// regex.go
// ------------------------------
func ExampleIsEmail() {
fmt.Println(com.IsEmail("test@example.com"))
fmt.Println(com.IsEmail("@example.com"))
// Output:
// true
// false
}
func ExampleIsUrl() {
fmt.Println(com.IsUrl("http://example.com"))
fmt.Println(com.IsUrl("http//example.com"))
// Output:
// true
// false
}
// ------------- END ------------
// ------------------------------
// slice.go
// ------------------------------
func ExampleAppendStr() {
s := []string{"a"}
s = com.AppendStr(s, "a")
s = com.AppendStr(s, "b")
fmt.Println(s)
// Output: [a b]
}
// ------------- END ------------

145
Godeps/_workspace/src/github.com/Unknwon/com/file.go generated vendored Normal file
View File

@@ -0,0 +1,145 @@
// Copyright 2013 com authors
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package com
import (
"fmt"
"io"
"io/ioutil"
"math"
"os"
"path"
)
// Storage unit constants.
const (
Byte = 1
KByte = Byte * 1024
MByte = KByte * 1024
GByte = MByte * 1024
TByte = GByte * 1024
PByte = TByte * 1024
EByte = PByte * 1024
)
func logn(n, b float64) float64 {
return math.Log(n) / math.Log(b)
}
func humanateBytes(s uint64, base float64, sizes []string) string {
if s < 10 {
return fmt.Sprintf("%dB", s)
}
e := math.Floor(logn(float64(s), base))
suffix := sizes[int(e)]
val := float64(s) / math.Pow(base, math.Floor(e))
f := "%.0f"
if val < 10 {
f = "%.1f"
}
return fmt.Sprintf(f+"%s", val, suffix)
}
// HumaneFileSize calculates the file size and generate user-friendly string.
func HumaneFileSize(s uint64) string {
sizes := []string{"B", "KB", "MB", "GB", "TB", "PB", "EB"}
return humanateBytes(s, 1024, sizes)
}
// FileMTime returns file modified time and possible error.
func FileMTime(file string) (int64, error) {
f, err := os.Stat(file)
if err != nil {
return 0, err
}
return f.ModTime().Unix(), nil
}
// FileSize returns file size in bytes and possible error.
func FileSize(file string) (int64, error) {
f, err := os.Stat(file)
if err != nil {
return 0, err
}
return f.Size(), nil
}
// Copy copies file from source to target path.
func Copy(src, dest string) error {
// Gather file information to set back later.
si, err := os.Lstat(src)
if err != nil {
return err
}
// Handle symbolic link.
if si.Mode()&os.ModeSymlink != 0 {
target, err := os.Readlink(src)
if err != nil {
return err
}
// NOTE: os.Chmod and os.Chtimes don't recoganize symbolic link,
// which will lead "no such file or directory" error.
return os.Symlink(target, dest)
}
sr, err := os.Open(src)
if err != nil {
return err
}
defer sr.Close()
dw, err := os.Create(dest)
if err != nil {
return err
}
defer dw.Close()
if _, err = io.Copy(dw, sr); err != nil {
return err
}
// Set back file information.
if err = os.Chtimes(dest, si.ModTime(), si.ModTime()); err != nil {
return err
}
return os.Chmod(dest, si.Mode())
}
// WriteFile writes data to a file named by filename.
// If the file does not exist, WriteFile creates it
// and its upper level paths.
func WriteFile(filename string, data []byte) error {
os.MkdirAll(path.Dir(filename), os.ModePerm)
return ioutil.WriteFile(filename, data, 0655)
}
// IsFile returns true if given path is a file,
// or returns false when it's a directory or does not exist.
func IsFile(filePath string) bool {
f, e := os.Stat(filePath)
if e != nil {
return false
}
return !f.IsDir()
}
// IsExist checks whether a file or directory exists.
// It returns false when the file or directory does not exist.
func IsExist(path string) bool {
_, err := os.Stat(path)
return err == nil || os.IsExist(err)
}

View File

@@ -0,0 +1,61 @@
// Copyright 2013 com authors
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package com
import (
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestIsFile(t *testing.T) {
if !IsFile("file.go") {
t.Errorf("IsExist:\n Expect => %v\n Got => %v\n", true, false)
}
if IsFile("testdata") {
t.Errorf("IsExist:\n Expect => %v\n Got => %v\n", false, true)
}
if IsFile("files.go") {
t.Errorf("IsExist:\n Expect => %v\n Got => %v\n", false, true)
}
}
func TestIsExist(t *testing.T) {
Convey("Check if file or directory exists", t, func() {
Convey("Pass a file name that exists", func() {
So(IsExist("file.go"), ShouldEqual, true)
})
Convey("Pass a directory name that exists", func() {
So(IsExist("testdata"), ShouldEqual, true)
})
Convey("Pass a directory name that does not exist", func() {
So(IsExist(".hg"), ShouldEqual, false)
})
})
}
func BenchmarkIsFile(b *testing.B) {
for i := 0; i < b.N; i++ {
IsFile("file.go")
}
}
func BenchmarkIsExist(b *testing.B) {
for i := 0; i < b.N; i++ {
IsExist("file.go")
}
}

60
Godeps/_workspace/src/github.com/Unknwon/com/html.go generated vendored Normal file
View File

@@ -0,0 +1,60 @@
// Copyright 2013 com authors
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package com
import (
"html"
"regexp"
"strings"
)
// Html2JS converts []byte type of HTML content into JS format.
func Html2JS(data []byte) []byte {
s := string(data)
s = strings.Replace(s, `\`, `\\`, -1)
s = strings.Replace(s, "\n", `\n`, -1)
s = strings.Replace(s, "\r", "", -1)
s = strings.Replace(s, "\"", `\"`, -1)
s = strings.Replace(s, "<table>", "&lt;table>", -1)
return []byte(s)
}
// encode html chars to string
func HtmlEncode(str string) string {
return html.EscapeString(str)
}
// decode string to html chars
func HtmlDecode(str string) string {
return html.UnescapeString(str)
}
// strip tags in html string
func StripTags(src string) string {
//去除style,script,html tag
re := regexp.MustCompile(`(?s)<(?:style|script)[^<>]*>.*?</(?:style|script)>|</?[a-z][a-z0-9]*[^<>]*>|<!--.*?-->`)
src = re.ReplaceAllString(src, "")
//trim all spaces(2+) into \n
re = regexp.MustCompile(`\s{2,}`)
src = re.ReplaceAllString(src, "\n")
return strings.TrimSpace(src)
}
// change \n to <br/>
func Nl2br(str string) string {
return strings.Replace(str, "\n", "<br/>", -1)
}

View File

@@ -0,0 +1,35 @@
// Copyright 2013 com authors
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package com
import (
"testing"
)
func TestHtml2JS(t *testing.T) {
htm := "<div id=\"button\" class=\"btn\">Click me</div>\n\r"
js := string(Html2JS([]byte(htm)))
jsR := `<div id=\"button\" class=\"btn\">Click me</div>\n`
if js != jsR {
t.Errorf("Html2JS:\n Expect => %s\n Got => %s\n", jsR, js)
}
}
func BenchmarkHtml2JS(b *testing.B) {
htm := "<div id=\"button\" class=\"btn\">Click me</div>\n\r"
for i := 0; i < b.N; i++ {
Html2JS([]byte(htm))
}
}

201
Godeps/_workspace/src/github.com/Unknwon/com/http.go generated vendored Normal file
View File

@@ -0,0 +1,201 @@
// Copyright 2013 com authors
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package com
import (
"bytes"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"path"
)
type NotFoundError struct {
Message string
}
func (e NotFoundError) Error() string {
return e.Message
}
type RemoteError struct {
Host string
Err error
}
func (e *RemoteError) Error() string {
return e.Err.Error()
}
var UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1541.0 Safari/537.36"
// HttpCall makes HTTP method call.
func HttpCall(client *http.Client, method, url string, header http.Header, body io.Reader) (io.ReadCloser, error) {
req, err := http.NewRequest(method, url, body)
if err != nil {
return nil, err
}
req.Header.Set("User-Agent", UserAgent)
for k, vs := range header {
req.Header[k] = vs
}
resp, err := client.Do(req)
if err != nil {
return nil, err
}
if resp.StatusCode == 200 {
return resp.Body, nil
}
resp.Body.Close()
if resp.StatusCode == 404 { // 403 can be rate limit error. || resp.StatusCode == 403 {
err = fmt.Errorf("resource not found: %s", url)
} else {
err = fmt.Errorf("%s %s -> %d", method, url, resp.StatusCode)
}
return nil, err
}
// HttpGet gets the specified resource.
// ErrNotFound is returned if the server responds with status 404.
func HttpGet(client *http.Client, url string, header http.Header) (io.ReadCloser, error) {
return HttpCall(client, "GET", url, header, nil)
}
// HttpPost posts the specified resource.
// ErrNotFound is returned if the server responds with status 404.
func HttpPost(client *http.Client, url string, header http.Header, body []byte) (io.ReadCloser, error) {
return HttpCall(client, "POST", url, header, bytes.NewBuffer(body))
}
// HttpGetToFile gets the specified resource and writes to file.
// ErrNotFound is returned if the server responds with status 404.
func HttpGetToFile(client *http.Client, url string, header http.Header, fileName string) error {
rc, err := HttpGet(client, url, header)
if err != nil {
return err
}
defer rc.Close()
os.MkdirAll(path.Dir(fileName), os.ModePerm)
f, err := os.Create(fileName)
if err != nil {
return err
}
defer f.Close()
_, err = io.Copy(f, rc)
return err
}
// HttpGetBytes gets the specified resource. ErrNotFound is returned if the server
// responds with status 404.
func HttpGetBytes(client *http.Client, url string, header http.Header) ([]byte, error) {
rc, err := HttpGet(client, url, header)
if err != nil {
return nil, err
}
defer rc.Close()
return ioutil.ReadAll(rc)
}
// HttpGetJSON gets the specified resource and mapping to struct.
// ErrNotFound is returned if the server responds with status 404.
func HttpGetJSON(client *http.Client, url string, v interface{}) error {
rc, err := HttpGet(client, url, nil)
if err != nil {
return err
}
defer rc.Close()
err = json.NewDecoder(rc).Decode(v)
if _, ok := err.(*json.SyntaxError); ok {
return fmt.Errorf("JSON syntax error at %s", url)
}
return nil
}
// HttpPostJSON posts the specified resource with struct values,
// and maps results to struct.
// ErrNotFound is returned if the server responds with status 404.
func HttpPostJSON(client *http.Client, url string, body, v interface{}) error {
data, err := json.Marshal(body)
if err != nil {
return err
}
rc, err := HttpPost(client, url, http.Header{"content-type": []string{"application/json"}}, data)
if err != nil {
return err
}
defer rc.Close()
err = json.NewDecoder(rc).Decode(v)
if _, ok := err.(*json.SyntaxError); ok {
return fmt.Errorf("JSON syntax error at %s", url)
}
return nil
}
// A RawFile describes a file that can be downloaded.
type RawFile interface {
Name() string
RawUrl() string
Data() []byte
SetData([]byte)
}
// FetchFiles fetches files specified by the rawURL field in parallel.
func FetchFiles(client *http.Client, files []RawFile, header http.Header) error {
ch := make(chan error, len(files))
for i := range files {
go func(i int) {
p, err := HttpGetBytes(client, files[i].RawUrl(), nil)
if err != nil {
ch <- err
return
}
files[i].SetData(p)
ch <- nil
}(i)
}
for _ = range files {
if err := <-ch; err != nil {
return err
}
}
return nil
}
// FetchFiles uses command `curl` to fetch files specified by the rawURL field in parallel.
func FetchFilesCurl(files []RawFile, curlOptions ...string) error {
ch := make(chan error, len(files))
for i := range files {
go func(i int) {
stdout, _, err := ExecCmd("curl", append(curlOptions, files[i].RawUrl())...)
if err != nil {
ch <- err
return
}
files[i].SetData([]byte(stdout))
ch <- nil
}(i)
}
for _ = range files {
if err := <-ch; err != nil {
return err
}
}
return nil
}

View File

@@ -0,0 +1,111 @@
// Copyright 2013 com authors
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package com
import (
"io/ioutil"
"net/http"
"strings"
"testing"
)
var examplePrefix = `<!doctype html>
<html>
<head>
<title>Example Domain</title>
`
func TestHttpGet(t *testing.T) {
// 200.
rc, err := HttpGet(&http.Client{}, "http://example.com", nil)
if err != nil {
t.Fatalf("HttpGet:\n Expect => %v\n Got => %s\n", nil, err)
}
p, err := ioutil.ReadAll(rc)
if err != nil {
t.Errorf("HttpGet:\n Expect => %v\n Got => %s\n", nil, err)
}
s := string(p)
if !strings.HasPrefix(s, examplePrefix) {
t.Errorf("HttpGet:\n Expect => %s\n Got => %s\n", examplePrefix, s)
}
}
func TestHttpGetBytes(t *testing.T) {
p, err := HttpGetBytes(&http.Client{}, "http://example.com", nil)
if err != nil {
t.Errorf("HttpGetBytes:\n Expect => %v\n Got => %s\n", nil, err)
}
s := string(p)
if !strings.HasPrefix(s, examplePrefix) {
t.Errorf("HttpGet:\n Expect => %s\n Got => %s\n", examplePrefix, s)
}
}
func TestHttpGetJSON(t *testing.T) {
}
type rawFile struct {
name string
rawURL string
data []byte
}
func (rf *rawFile) Name() string {
return rf.name
}
func (rf *rawFile) RawUrl() string {
return rf.rawURL
}
func (rf *rawFile) Data() []byte {
return rf.data
}
func (rf *rawFile) SetData(p []byte) {
rf.data = p
}
func TestFetchFiles(t *testing.T) {
files := []RawFile{
&rawFile{rawURL: "http://example.com"},
&rawFile{rawURL: "http://example.com"},
}
err := FetchFiles(&http.Client{}, files, nil)
if err != nil {
t.Errorf("FetchFiles:\n Expect => %v\n Got => %s\n", nil, err)
} else if len(files[0].Data()) != 1270 {
t.Errorf("FetchFiles:\n Expect => %d\n Got => %d\n", 1270, len(files[0].Data()))
} else if len(files[1].Data()) != 1270 {
t.Errorf("FetchFiles:\n Expect => %d\n Got => %d\n", 1270, len(files[1].Data()))
}
}
func TestFetchFilesCurl(t *testing.T) {
files := []RawFile{
&rawFile{rawURL: "http://example.com"},
&rawFile{rawURL: "http://example.com"},
}
err := FetchFilesCurl(files)
if err != nil {
t.Errorf("FetchFilesCurl:\n Expect => %v\n Got => %s\n", nil, err)
} else if len(files[0].Data()) != 1270 {
t.Errorf("FetchFilesCurl:\n Expect => %d\n Got => %d\n", 1270, len(files[0].Data()))
} else if len(files[1].Data()) != 1270 {
t.Errorf("FetchFilesCurl:\n Expect => %d\n Got => %d\n", 1270, len(files[1].Data()))
}
}

24
Godeps/_workspace/src/github.com/Unknwon/com/math.go generated vendored Normal file
View File

@@ -0,0 +1,24 @@
// Copyright 2014 com authors
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package com
// PowInt is int type of math.Pow function.
func PowInt(x int, y int) int {
num := 1
for i := 0; i < y; i++ {
num *= x
}
return num
}

80
Godeps/_workspace/src/github.com/Unknwon/com/path.go generated vendored Normal file
View File

@@ -0,0 +1,80 @@
// Copyright 2013 com authors
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package com
import (
"errors"
"os"
"path/filepath"
"runtime"
"strings"
)
// GetGOPATHs returns all paths in GOPATH variable.
func GetGOPATHs() []string {
gopath := os.Getenv("GOPATH")
var paths []string
if runtime.GOOS == "windows" {
gopath = strings.Replace(gopath, "\\", "/", -1)
paths = strings.Split(gopath, ";")
} else {
paths = strings.Split(gopath, ":")
}
return paths
}
// GetSrcPath returns app. source code path.
// It only works when you have src. folder in GOPATH,
// it returns error not able to locate source folder path.
func GetSrcPath(importPath string) (appPath string, err error) {
paths := GetGOPATHs()
for _, p := range paths {
if IsExist(p + "/src/" + importPath + "/") {
appPath = p + "/src/" + importPath + "/"
break
}
}
if len(appPath) == 0 {
return "", errors.New("Unable to locate source folder path")
}
appPath = filepath.Dir(appPath) + "/"
if runtime.GOOS == "windows" {
// Replace all '\' to '/'.
appPath = strings.Replace(appPath, "\\", "/", -1)
}
return appPath, nil
}
// HomeDir returns path of '~'(in Linux) on Windows,
// it returns error when the variable does not exist.
func HomeDir() (home string, err error) {
if runtime.GOOS == "windows" {
home = os.Getenv("HOMEDRIVE") + os.Getenv("HOMEPATH")
if home == "" {
home = os.Getenv("USERPROFILE")
}
} else {
home = os.Getenv("HOME")
}
if len(home) == 0 {
return "", errors.New("Cannot specify home directory because it's empty")
}
return home, nil
}

View File

@@ -0,0 +1,67 @@
// Copyright 2013 com authors
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package com
import (
"os"
"runtime"
"testing"
)
func TestGetGOPATHs(t *testing.T) {
var gpsR []string
if runtime.GOOS != "windows" {
gpsR = []string{"path/to/gopath1", "path/to/gopath2", "path/to/gopath3"}
os.Setenv("GOPATH", "path/to/gopath1:path/to/gopath2:path/to/gopath3")
} else {
gpsR = []string{"path/to/gopath1", "path/to/gopath2", "path/to/gopath3"}
os.Setenv("GOPATH", "path\\to\\gopath1;path\\to\\gopath2;path\\to\\gopath3")
}
gps := GetGOPATHs()
if !CompareSliceStr(gps, gpsR) {
t.Errorf("GetGOPATHs:\n Expect => %s\n Got => %s\n", gpsR, gps)
}
}
func TestGetSrcPath(t *testing.T) {
}
func TestHomeDir(t *testing.T) {
_, err := HomeDir()
if err != nil {
t.Errorf("HomeDir:\n Expect => %v\n Got => %s\n", nil, err)
}
}
func BenchmarkGetGOPATHs(b *testing.B) {
for i := 0; i < b.N; i++ {
GetGOPATHs()
}
}
func BenchmarkGetSrcPath(b *testing.B) {
for i := 0; i < b.N; i++ {
GetSrcPath("github.com/Unknwon/com")
}
}
func BenchmarkHomeDir(b *testing.B) {
for i := 0; i < b.N; i++ {
HomeDir()
}
}

56
Godeps/_workspace/src/github.com/Unknwon/com/regex.go generated vendored Normal file
View File

@@ -0,0 +1,56 @@
// Copyright 2013 com authors
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package com
import "regexp"
const (
regex_email_pattern = `(?i)[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}`
regex_strict_email_pattern = `(?i)[A-Z0-9!#$%&'*+/=?^_{|}~-]+` +
`(?:\.[A-Z0-9!#$%&'*+/=?^_{|}~-]+)*` +
`@(?:[A-Z0-9](?:[A-Z0-9-]*[A-Z0-9])?\.)+` +
`[A-Z0-9](?:[A-Z0-9-]*[A-Z0-9])?`
regex_url_pattern = `(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?`
)
var (
regex_email *regexp.Regexp
regex_strict_email *regexp.Regexp
regex_url *regexp.Regexp
)
func init() {
regex_email = regexp.MustCompile(regex_email_pattern)
regex_strict_email = regexp.MustCompile(regex_strict_email_pattern)
regex_url = regexp.MustCompile(regex_url_pattern)
}
// validate string is an email address, if not return false
// basically validation can match 99% cases
func IsEmail(email string) bool {
return regex_email.MatchString(email)
}
// validate string is an email address, if not return false
// this validation omits RFC 2822
func IsEmailRFC(email string) bool {
return regex_strict_email.MatchString(email)
}
// validate string is a url link, if not return false
// simple validation can match 99% cases
func IsUrl(url string) bool {
return regex_url.MatchString(url)
}

View File

@@ -0,0 +1,70 @@
// Copyright 2013 com authors
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package com
import (
"testing"
)
func TestIsEmail(t *testing.T) {
emails := map[string]bool{
`test@example.com`: true,
`single-character@b.org`: true,
`uncommon_address@test.museum`: true,
`local@sld.UPPER`: true,
`@missing.org`: false,
`missing@.com`: false,
`missing@qq.`: false,
`wrong-ip@127.1.1.1.26`: false,
}
for e, r := range emails {
b := IsEmail(e)
if b != r {
t.Errorf("IsEmail:\n Expect => %v\n Got => %v\n", r, b)
}
}
}
func TestIsUrl(t *testing.T) {
urls := map[string]bool{
"http://www.example.com": true,
"http://example.com": true,
"http://example.com?user=test&password=test": true,
"http://example.com?user=test#login": true,
"ftp://example.com": true,
"https://example.com": true,
"htp://example.com": false,
"http//example.com": false,
"http://example": true,
}
for u, r := range urls {
b := IsUrl(u)
if b != r {
t.Errorf("IsUrl:\n Expect => %v\n Got => %v\n", r, b)
}
}
}
func BenchmarkIsEmail(b *testing.B) {
for i := 0; i < b.N; i++ {
IsEmail("test@example.com")
}
}
func BenchmarkIsUrl(b *testing.B) {
for i := 0; i < b.N; i++ {
IsEmail("http://example.com")
}
}

87
Godeps/_workspace/src/github.com/Unknwon/com/slice.go generated vendored Normal file
View File

@@ -0,0 +1,87 @@
// Copyright 2013 com authors
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package com
import (
"strings"
)
// AppendStr appends string to slice with no duplicates.
func AppendStr(strs []string, str string) []string {
for _, s := range strs {
if s == str {
return strs
}
}
return append(strs, str)
}
// CompareSliceStr compares two 'string' type slices.
// It returns true if elements and order are both the same.
func CompareSliceStr(s1, s2 []string) bool {
if len(s1) != len(s2) {
return false
}
for i := range s1 {
if s1[i] != s2[i] {
return false
}
}
return true
}
// CompareSliceStr compares two 'string' type slices.
// It returns true if elements are the same, and ignores the order.
func CompareSliceStrU(s1, s2 []string) bool {
if len(s1) != len(s2) {
return false
}
for i := range s1 {
for j := len(s2) - 1; j >= 0; j-- {
if s1[i] == s2[j] {
s2 = append(s2[:j], s2[j+1:]...)
break
}
}
}
if len(s2) > 0 {
return false
}
return true
}
// IsSliceContainsStr returns true if the string exists in given slice, ignore case.
func IsSliceContainsStr(sl []string, str string) bool {
str = strings.ToLower(str)
for _, s := range sl {
if strings.ToLower(s) == str {
return true
}
}
return false
}
// IsSliceContainsInt64 returns true if the int64 exists in given slice.
func IsSliceContainsInt64(sl []int64, i int64) bool {
for _, s := range sl {
if s == i {
return true
}
}
return false
}

View File

@@ -0,0 +1,99 @@
// Copyright 2013 com authors
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package com
import (
"fmt"
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestAppendStr(t *testing.T) {
Convey("Append a string to a slice with no duplicates", t, func() {
s := []string{"a"}
Convey("Append a string that does not exist in slice", func() {
s = AppendStr(s, "b")
So(len(s), ShouldEqual, 2)
})
Convey("Append a string that does exist in slice", func() {
s = AppendStr(s, "b")
So(len(s), ShouldEqual, 2)
})
})
}
func TestCompareSliceStr(t *testing.T) {
Convey("Compares two 'string' type slices with elements and order", t, func() {
Convey("Compare two slices that do have same elements and order", func() {
So(CompareSliceStr(
[]string{"1", "2", "3"}, []string{"1", "2", "3"}), ShouldBeTrue)
})
Convey("Compare two slices that do have same elements but does not have same order", func() {
So(!CompareSliceStr(
[]string{"2", "1", "3"}, []string{"1", "2", "3"}), ShouldBeTrue)
})
Convey("Compare two slices that have different number of elements", func() {
So(!CompareSliceStr(
[]string{"2", "1"}, []string{"1", "2", "3"}), ShouldBeTrue)
})
})
}
func TestCompareSliceStrU(t *testing.T) {
Convey("Compare two 'string' type slices with elements and ignore the order", t, func() {
Convey("Compare two slices that do have same elements and order", func() {
So(CompareSliceStrU(
[]string{"1", "2", "3"}, []string{"1", "2", "3"}), ShouldBeTrue)
})
Convey("Compare two slices that do have same elements but does not have same order", func() {
So(CompareSliceStrU(
[]string{"2", "1", "3"}, []string{"1", "2", "3"}), ShouldBeTrue)
})
Convey("Compare two slices that have different number of elements", func() {
So(!CompareSliceStrU(
[]string{"2", "1"}, []string{"1", "2", "3"}), ShouldBeTrue)
})
})
}
func BenchmarkAppendStr(b *testing.B) {
s := []string{"a"}
for i := 0; i < b.N; i++ {
s = AppendStr(s, fmt.Sprint(b.N%3))
}
}
func BenchmarkCompareSliceStr(b *testing.B) {
s1 := []string{"1", "2", "3"}
s2 := []string{"1", "2", "3"}
for i := 0; i < b.N; i++ {
CompareSliceStr(s1, s2)
}
}
func BenchmarkCompareSliceStrU(b *testing.B) {
s1 := []string{"1", "4", "2", "3"}
s2 := []string{"1", "2", "3", "4"}
for i := 0; i < b.N; i++ {
CompareSliceStrU(s1, s2)
}
}

140
Godeps/_workspace/src/github.com/Unknwon/com/string.go generated vendored Normal file
View File

@@ -0,0 +1,140 @@
// Copyright 2013 com authors
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package com
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/base64"
"errors"
"io"
r "math/rand"
"strconv"
"strings"
"time"
)
// AESEncrypt encrypts text and given key with AES.
func AESEncrypt(key, text []byte) ([]byte, error) {
block, err := aes.NewCipher(key)
if err != nil {
return nil, err
}
b := base64.StdEncoding.EncodeToString(text)
ciphertext := make([]byte, aes.BlockSize+len(b))
iv := ciphertext[:aes.BlockSize]
if _, err := io.ReadFull(rand.Reader, iv); err != nil {
return nil, err
}
cfb := cipher.NewCFBEncrypter(block, iv)
cfb.XORKeyStream(ciphertext[aes.BlockSize:], []byte(b))
return ciphertext, nil
}
// AESDecrypt decrypts text and given key with AES.
func AESDecrypt(key, text []byte) ([]byte, error) {
block, err := aes.NewCipher(key)
if err != nil {
return nil, err
}
if len(text) < aes.BlockSize {
return nil, errors.New("ciphertext too short")
}
iv := text[:aes.BlockSize]
text = text[aes.BlockSize:]
cfb := cipher.NewCFBDecrypter(block, iv)
cfb.XORKeyStream(text, text)
data, err := base64.StdEncoding.DecodeString(string(text))
if err != nil {
return nil, err
}
return data, nil
}
// IsLetter returns true if the 'l' is an English letter.
func IsLetter(l uint8) bool {
n := (l | 0x20) - 'a'
if n >= 0 && n < 26 {
return true
}
return false
}
// Expand replaces {k} in template with match[k] or subs[atoi(k)] if k is not in match.
func Expand(template string, match map[string]string, subs ...string) string {
var p []byte
var i int
for {
i = strings.Index(template, "{")
if i < 0 {
break
}
p = append(p, template[:i]...)
template = template[i+1:]
i = strings.Index(template, "}")
if s, ok := match[template[:i]]; ok {
p = append(p, s...)
} else {
j, _ := strconv.Atoi(template[:i])
if j >= len(subs) {
p = append(p, []byte("Missing")...)
} else {
p = append(p, subs[j]...)
}
}
template = template[i+1:]
}
p = append(p, template...)
return string(p)
}
// Reverse s string, support unicode
func Reverse(s string) string {
n := len(s)
runes := make([]rune, n)
for _, rune := range s {
n--
runes[n] = rune
}
return string(runes[n:])
}
// RandomCreateBytes generate random []byte by specify chars.
func RandomCreateBytes(n int, alphabets ...byte) []byte {
const alphanum = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
var bytes = make([]byte, n)
var randby bool
if num, err := rand.Read(bytes); num != n || err != nil {
r.Seed(time.Now().UnixNano())
randby = true
}
for i, b := range bytes {
if len(alphabets) == 0 {
if randby {
bytes[i] = alphanum[r.Intn(len(alphanum))]
} else {
bytes[i] = alphanum[b%byte(len(alphanum))]
}
} else {
if randby {
bytes[i] = alphabets[r.Intn(len(alphabets))]
} else {
bytes[i] = alphabets[b%byte(len(alphabets))]
}
}
}
return bytes
}

View File

@@ -0,0 +1,82 @@
// Copyright 2013 com authors
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package com
import (
"testing"
)
func TestIsLetter(t *testing.T) {
if IsLetter('1') {
t.Errorf("IsLetter:\n Expect => %v\n Got => %v\n", false, true)
}
if IsLetter('[') {
t.Errorf("IsLetter:\n Expect => %v\n Got => %v\n", false, true)
}
if !IsLetter('a') {
t.Errorf("IsLetter:\n Expect => %v\n Got => %v\n", true, false)
}
if !IsLetter('Z') {
t.Errorf("IsLetter:\n Expect => %v\n Got => %v\n", true, false)
}
}
func TestExpand(t *testing.T) {
match := map[string]string{
"domain": "gowalker.org",
"subdomain": "github.com",
}
s := "http://{domain}/{subdomain}/{0}/{1}"
sR := "http://gowalker.org/github.com/Unknwon/gowalker"
if Expand(s, match, "Unknwon", "gowalker") != sR {
t.Errorf("Expand:\n Expect => %s\n Got => %s\n", sR, s)
}
}
func TestReverse(t *testing.T) {
if Reverse("abcdefg") != "gfedcba" {
t.Errorf("Reverse:\n Except => %s\n Got =>%s\n", "gfedcba", Reverse("abcdefg"))
}
if Reverse("上善若水厚德载物") != "物载德厚水若善上" {
t.Errorf("Reverse:\n Except => %s\n Got =>%s\n", "物载德厚水若善上", Reverse("上善若水厚德载物"))
}
}
func BenchmarkIsLetter(b *testing.B) {
for i := 0; i < b.N; i++ {
IsLetter('a')
}
}
func BenchmarkExpand(b *testing.B) {
match := map[string]string{
"domain": "gowalker.org",
"subdomain": "github.com",
}
s := "http://{domain}/{subdomain}/{0}/{1}"
for i := 0; i < b.N; i++ {
Expand(s, match, "Unknwon", "gowalker")
}
}
func BenchmarkReverse(b *testing.B) {
s := "abscef中文"
for i := 0; i < b.N; i++ {
Reverse(s)
}
}

View File

@@ -0,0 +1 @@
TestSaveFile

View File

@@ -0,0 +1 @@
TestSaveFileS

View File

View File

@@ -0,0 +1 @@
TestSaveFile

View File

@@ -0,0 +1 @@
TestSaveFileS

View File

@@ -0,0 +1 @@
TestSaveFile

View File

@@ -0,0 +1 @@
TestSaveFileS

115
Godeps/_workspace/src/github.com/Unknwon/com/time.go generated vendored Normal file
View File

@@ -0,0 +1,115 @@
// Copyright 2013 com authors
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package com
import (
"fmt"
"strconv"
"strings"
"time"
)
// Format unix time int64 to string
func Date(ti int64, format string) string {
t := time.Unix(int64(ti), 0)
return DateT(t, format)
}
// Format unix time string to string
func DateS(ts string, format string) string {
i, _ := strconv.ParseInt(ts, 10, 64)
return Date(i, format)
}
// Format time.Time struct to string
// MM - month - 01
// M - month - 1, single bit
// DD - day - 02
// D - day 2
// YYYY - year - 2006
// YY - year - 06
// HH - 24 hours - 03
// H - 24 hours - 3
// hh - 12 hours - 03
// h - 12 hours - 3
// mm - minute - 04
// m - minute - 4
// ss - second - 05
// s - second = 5
func DateT(t time.Time, format string) string {
res := strings.Replace(format, "MM", t.Format("01"), -1)
res = strings.Replace(res, "M", t.Format("1"), -1)
res = strings.Replace(res, "DD", t.Format("02"), -1)
res = strings.Replace(res, "D", t.Format("2"), -1)
res = strings.Replace(res, "YYYY", t.Format("2006"), -1)
res = strings.Replace(res, "YY", t.Format("06"), -1)
res = strings.Replace(res, "HH", fmt.Sprintf("%02d", t.Hour()), -1)
res = strings.Replace(res, "H", fmt.Sprintf("%d", t.Hour()), -1)
res = strings.Replace(res, "hh", t.Format("03"), -1)
res = strings.Replace(res, "h", t.Format("3"), -1)
res = strings.Replace(res, "mm", t.Format("04"), -1)
res = strings.Replace(res, "m", t.Format("4"), -1)
res = strings.Replace(res, "ss", t.Format("05"), -1)
res = strings.Replace(res, "s", t.Format("5"), -1)
return res
}
// DateFormat pattern rules.
var datePatterns = []string{
// year
"Y", "2006", // A full numeric representation of a year, 4 digits Examples: 1999 or 2003
"y", "06", //A two digit representation of a year Examples: 99 or 03
// month
"m", "01", // Numeric representation of a month, with leading zeros 01 through 12
"n", "1", // Numeric representation of a month, without leading zeros 1 through 12
"M", "Jan", // A short textual representation of a month, three letters Jan through Dec
"F", "January", // A full textual representation of a month, such as January or March January through December
// day
"d", "02", // Day of the month, 2 digits with leading zeros 01 to 31
"j", "2", // Day of the month without leading zeros 1 to 31
// week
"D", "Mon", // A textual representation of a day, three letters Mon through Sun
"l", "Monday", // A full textual representation of the day of the week Sunday through Saturday
// time
"g", "3", // 12-hour format of an hour without leading zeros 1 through 12
"G", "15", // 24-hour format of an hour without leading zeros 0 through 23
"h", "03", // 12-hour format of an hour with leading zeros 01 through 12
"H", "15", // 24-hour format of an hour with leading zeros 00 through 23
"a", "pm", // Lowercase Ante meridiem and Post meridiem am or pm
"A", "PM", // Uppercase Ante meridiem and Post meridiem AM or PM
"i", "04", // Minutes with leading zeros 00 to 59
"s", "05", // Seconds, with leading zeros 00 through 59
// time zone
"T", "MST",
"P", "-07:00",
"O", "-0700",
// RFC 2822
"r", time.RFC1123Z,
}
// Parse Date use PHP time format.
func DateParse(dateString, format string) (time.Time, error) {
replacer := strings.NewReplacer(datePatterns...)
format = replacer.Replace(format)
return time.ParseInLocation(format, dateString, time.Local)
}

41
Godeps/_workspace/src/github.com/Unknwon/com/url.go generated vendored Normal file
View File

@@ -0,0 +1,41 @@
// Copyright 2013 com authors
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package com
import (
"encoding/base64"
"net/url"
)
// url encode string, is + not %20
func UrlEncode(str string) string {
return url.QueryEscape(str)
}
// url decode string
func UrlDecode(str string) (string, error) {
return url.QueryUnescape(str)
}
// base64 encode
func Base64Encode(str string) string {
return base64.StdEncoding.EncodeToString([]byte(str))
}
// base64 decode
func Base64Decode(str string) (string, error) {
s, e := base64.StdEncoding.DecodeString(str)
return string(s), e
}

View File

@@ -0,0 +1,2 @@
macaron.sublime-project
macaron.sublime-workspace

View File

@@ -0,0 +1,191 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and
distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright
owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities
that control, are controlled by, or are under common control with that entity.
For the purposes of this definition, "control" means (i) the power, direct or
indirect, to cause the direction or management of such entity, whether by
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising
permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including
but not limited to software source code, documentation source, and configuration
files.
"Object" form shall mean any form resulting from mechanical transformation or
translation of a Source form, including but not limited to compiled object code,
generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made
available under the License, as indicated by a copyright notice that is included
in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that
is based on (or derived from) the Work and for which the editorial revisions,
annotations, elaborations, or other modifications represent, as a whole, an
original work of authorship. For the purposes of this License, Derivative Works
shall not include works that remain separable from, or merely link (or bind by
name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version
of the Work and any modifications or additions to that Work or Derivative Works
thereof, that is intentionally submitted to Licensor for inclusion in the Work
by the copyright owner or by an individual or Legal Entity authorized to submit
on behalf of the copyright owner. For the purposes of this definition,
"submitted" means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems, and
issue tracking systems that are managed by, or on behalf of, the Licensor for
the purpose of discussing and improving the Work, but excluding communication
that is conspicuously marked or otherwise designated in writing by the copyright
owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
of whom a Contribution has been received by Licensor and subsequently
incorporated within the Work.
2. Grant of Copyright License.
Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the Work and such
Derivative Works in Source or Object form.
3. Grant of Patent License.
Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable (except as stated in this section) patent license to make, have
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
such license applies only to those patent claims licensable by such Contributor
that are necessarily infringed by their Contribution(s) alone or by combination
of their Contribution(s) with the Work to which such Contribution(s) was
submitted. If You institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
Contribution incorporated within the Work constitutes direct or contributory
patent infringement, then any patent licenses granted to You under this License
for that Work shall terminate as of the date such litigation is filed.
4. Redistribution.
You may reproduce and distribute copies of the Work or Derivative Works thereof
in any medium, with or without modifications, and in Source or Object form,
provided that You meet the following conditions:
You must give any other recipients of the Work or Derivative Works a copy of
this License; and
You must cause any modified files to carry prominent notices stating that You
changed the files; and
You must retain, in the Source form of any Derivative Works that You distribute,
all copyright, patent, trademark, and attribution notices from the Source form
of the Work, excluding those notices that do not pertain to any part of the
Derivative Works; and
If the Work includes a "NOTICE" text file as part of its distribution, then any
Derivative Works that You distribute must include a readable copy of the
attribution notices contained within such NOTICE file, excluding those notices
that do not pertain to any part of the Derivative Works, in at least one of the
following places: within a NOTICE text file distributed as part of the
Derivative Works; within the Source form or documentation, if provided along
with the Derivative Works; or, within a display generated by the Derivative
Works, if and wherever such third-party notices normally appear. The contents of
the NOTICE file are for informational purposes only and do not modify the
License. You may add Your own attribution notices within Derivative Works that
You distribute, alongside or as an addendum to the NOTICE text from the Work,
provided that such additional attribution notices cannot be construed as
modifying the License.
You may add Your own copyright statement to Your modifications and may provide
additional or different license terms and conditions for use, reproduction, or
distribution of Your modifications, or for any such Derivative Works as a whole,
provided Your use, reproduction, and distribution of the Work otherwise complies
with the conditions stated in this License.
5. Submission of Contributions.
Unless You explicitly state otherwise, any Contribution intentionally submitted
for inclusion in the Work by You to the Licensor shall be under the terms and
conditions of this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify the terms of
any separate license agreement you may have executed with Licensor regarding
such Contributions.
6. Trademarks.
This License does not grant permission to use the trade names, trademarks,
service marks, or product names of the Licensor, except as required for
reasonable and customary use in describing the origin of the Work and
reproducing the content of the NOTICE file.
7. Disclaimer of Warranty.
Unless required by applicable law or agreed to in writing, Licensor provides the
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
including, without limitation, any warranties or conditions of TITLE,
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
solely responsible for determining the appropriateness of using or
redistributing the Work and assume any risks associated with Your exercise of
permissions under this License.
8. Limitation of Liability.
In no event and under no legal theory, whether in tort (including negligence),
contract, or otherwise, unless required by applicable law (such as deliberate
and grossly negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special, incidental,
or consequential damages of any character arising as a result of this License or
out of the use or inability to use the Work (including but not limited to
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
any and all other commercial damages or losses), even if such Contributor has
been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability.
While redistributing the Work or Derivative Works thereof, You may choose to
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
other liability obligations and/or rights consistent with this License. However,
in accepting such obligations, You may act only on Your own behalf and on Your
sole responsibility, not on behalf of any other Contributor, and only if You
agree to indemnify, defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason of your
accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work
To apply the Apache License to your work, attach the following boilerplate
notice, with the fields enclosed by brackets "[]" replaced with your own
identifying information. (Don't include the brackets!) The text should be
enclosed in the appropriate comment syntax for the file format. We also
recommend that a file or class name and description of purpose be included on
the same "printed page" as the copyright notice for easier identification within
third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,94 @@
Macaron [![Build Status](https://drone.io/github.com/Unknwon/macaron/status.png)](https://drone.io/github.com/Unknwon/macaron/latest) [![](http://gocover.io/_badge/github.com/Unknwon/macaron)](http://gocover.io/github.com/Unknwon/macaron)
=======================
![Macaron Logo](https://raw.githubusercontent.com/Unknwon/macaron/master/macaronlogo.png)
Package macaron is a high productive and modular design web framework in Go.
##### Current version: 0.5.4
## Getting Started
To install Macaron:
go get github.com/Unknwon/macaron
The very basic usage of Macaron:
```go
package main
import "github.com/Unknwon/macaron"
func main() {
m := macaron.Classic()
m.Get("/", func() string {
return "Hello world!"
})
m.Run()
}
```
## Features
- Powerful routing with suburl.
- Flexible routes combinations.
- Unlimited nested group routers.
- Directly integrate with existing services.
- Dynamically change template files at runtime.
- Allow to use in-memory template and static files.
- Easy to plugin/unplugin features with modular design.
- Handy dependency injection powered by [inject](https://github.com/codegangsta/inject).
- Better router layer and less reflection make faster speed.
## Middlewares
Middlewares allow you easily plugin/unplugin features for your Macaron applications.
There are already many [middlewares](https://github.com/macaron-contrib) to simplify your work:
- gzip - Gzip compression to all requests
- render - Go template engine
- static - Serves static files
- [binding](https://github.com/macaron-contrib/binding) - Request data binding and validation
- [i18n](https://github.com/macaron-contrib/i18n) - Internationalization and Localization
- [cache](https://github.com/macaron-contrib/cache) - Cache manager
- [session](https://github.com/macaron-contrib/session) - Session manager
- [csrf](https://github.com/macaron-contrib/csrf) - Generates and validates csrf tokens
- [captcha](https://github.com/macaron-contrib/captcha) - Captcha service
- [pongo2](https://github.com/macaron-contrib/pongo2) - Pongo2 template engine support
- [sockets](https://github.com/macaron-contrib/sockets) - WebSockets channels binding
- [bindata](https://github.com/macaron-contrib/bindata) - Embed binary data as static and template files
- [toolbox](https://github.com/macaron-contrib/toolbox) - Health check, pprof, profile and statistic services
- [oauth2](https://github.com/macaron-contrib/oauth2) - OAuth 2.0 backend
- [switcher](https://github.com/macaron-contrib/switcher) - Multiple-site support
- [method](https://github.com/macaron-contrib/method) - HTTP method override
- [permissions2](https://github.com/xyproto/permissions2) - Cookies, users and permissions
- [renders](https://github.com/macaron-contrib/renders) - Beego-like render engine(Macaron has built-in template engine, this is another option)
## Use Cases
- [Gogs](https://github.com/gogits/gogs): Go Git Service
- [Gogs Web](https://github.com/gogits/gogsweb): Gogs official website
- [Go Walker](https://gowalker.org): Go online API documentation
- [Switch](https://github.com/gpmgo/switch): Gopm registry
- [YouGam](http://yougam.com): Online Forum
- [Car Girl](http://qcnl.gzsy.com/): Online campaign
- [Critical Stack Intel](https://intel.criticalstack.com/): A 100% free intel marketplace from Critical Stack, Inc.
## Getting Help
- [API Reference](https://gowalker.org/github.com/Unknwon/macaron)
- [Documentation](http://macaron.gogs.io)
- [FAQs](http://macaron.gogs.io/docs/faqs)
- [![Join the chat at https://gitter.im/Unknwon/macaron](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Unknwon/macaron?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
## Credits
- Basic design of [Martini](https://github.com/go-martini/martini).
- Router layer of [beego](https://github.com/astaxie/beego).
- Logo is modified by [@insionng](https://github.com/insionng) based on [Tribal Dragon](http://xtremeyamazaki.deviantart.com/art/Tribal-Dragon-27005087).
## License
This project is under Apache v2 License. See the [LICENSE](LICENSE) file for the full license text.

View File

@@ -0,0 +1,478 @@
// Copyright 2014 Unknwon
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package macaron
import (
"crypto/md5"
"encoding/hex"
"html/template"
"io"
"io/ioutil"
"mime/multipart"
"net/http"
"net/url"
"os"
"path"
"path/filepath"
"reflect"
"strconv"
"strings"
"time"
"github.com/Unknwon/com"
"github.com/Unknwon/macaron/inject"
)
// Locale reprents a localization interface.
type Locale interface {
Language() string
Tr(string, ...interface{}) string
}
// RequestBody represents a request body.
type RequestBody struct {
reader io.ReadCloser
}
// Bytes reads and returns content of request body in bytes.
func (rb *RequestBody) Bytes() ([]byte, error) {
return ioutil.ReadAll(rb.reader)
}
// String reads and returns content of request body in string.
func (rb *RequestBody) String() (string, error) {
data, err := rb.Bytes()
return string(data), err
}
// ReadCloser returns a ReadCloser for request body.
func (rb *RequestBody) ReadCloser() io.ReadCloser {
return rb.reader
}
// Request represents an HTTP request received by a server or to be sent by a client.
type Request struct {
*http.Request
}
func (r *Request) Body() *RequestBody {
return &RequestBody{r.Request.Body}
}
// Context represents the runtime context of current request of Macaron instance.
// It is the integration of most frequently used middlewares and helper methods.
type Context struct {
inject.Injector
handlers []Handler
action Handler
index int
*Router
Req Request
Resp ResponseWriter
params Params
Render // Not nil only if you use macaran.Render middleware.
Locale
Data map[string]interface{}
}
func (c *Context) handler() Handler {
if c.index < len(c.handlers) {
return c.handlers[c.index]
}
if c.index == len(c.handlers) {
return c.action
}
panic("invalid index for context handler")
}
func (c *Context) Next() {
c.index += 1
c.run()
}
func (c *Context) Written() bool {
return c.Resp.Written()
}
func (c *Context) run() {
for c.index <= len(c.handlers) {
vals, err := c.Invoke(c.handler())
if err != nil {
panic(err)
}
c.index += 1
// if the handler returned something, write it to the http response
if len(vals) > 0 {
ev := c.GetVal(reflect.TypeOf(ReturnHandler(nil)))
handleReturn := ev.Interface().(ReturnHandler)
handleReturn(c, vals)
}
if c.Written() {
return
}
}
}
// RemoteAddr returns more real IP address.
func (ctx *Context) RemoteAddr() string {
addr := ctx.Req.Header.Get("X-Real-IP")
if len(addr) == 0 {
addr = ctx.Req.Header.Get("X-Forwarded-For")
if addr == "" {
addr = ctx.Req.RemoteAddr
if i := strings.LastIndex(addr, ":"); i > -1 {
addr = addr[:i]
}
}
}
return addr
}
func (ctx *Context) renderHTML(status int, setName, tplName string, data ...interface{}) {
if ctx.Render == nil {
panic("renderer middleware hasn't been registered")
}
if len(data) <= 0 {
ctx.Render.HTMLSet(status, setName, tplName, ctx.Data)
} else if len(data) == 1 {
ctx.Render.HTMLSet(status, setName, tplName, data[0])
} else {
ctx.Render.HTMLSet(status, setName, tplName, data[0], data[1].(HTMLOptions))
}
}
// HTML calls Render.HTML but allows less arguments.
func (ctx *Context) HTML(status int, name string, data ...interface{}) {
ctx.renderHTML(status, _DEFAULT_TPL_SET_NAME, name, data...)
}
// HTML calls Render.HTMLSet but allows less arguments.
func (ctx *Context) HTMLSet(status int, setName, tplName string, data ...interface{}) {
ctx.renderHTML(status, setName, tplName, data...)
}
func (ctx *Context) Redirect(location string, status ...int) {
code := http.StatusFound
if len(status) == 1 {
code = status[0]
}
http.Redirect(ctx.Resp, ctx.Req.Request, location, code)
}
// Query querys form parameter.
func (ctx *Context) Query(name string) string {
if ctx.Req.Form == nil {
ctx.Req.ParseForm()
}
return ctx.Req.Form.Get(name)
}
// QueryTrim querys and trims spaces form parameter.
func (ctx *Context) QueryTrim(name string) string {
return strings.TrimSpace(ctx.Query(name))
}
// QueryStrings returns a list of results by given query name.
func (ctx *Context) QueryStrings(name string) []string {
if ctx.Req.Form == nil {
ctx.Req.ParseForm()
}
vals, ok := ctx.Req.Form[name]
if !ok {
return []string{}
}
return vals
}
// QueryEscape returns escapred query result.
func (ctx *Context) QueryEscape(name string) string {
return template.HTMLEscapeString(ctx.Query(name))
}
// QueryInt returns query result in int type.
func (ctx *Context) QueryInt(name string) int {
return com.StrTo(ctx.Query(name)).MustInt()
}
// QueryInt64 returns query result in int64 type.
func (ctx *Context) QueryInt64(name string) int64 {
return com.StrTo(ctx.Query(name)).MustInt64()
}
// QueryFloat64 returns query result in float64 type.
func (ctx *Context) QueryFloat64(name string) float64 {
v, _ := strconv.ParseFloat(ctx.Query(name), 64)
return v
}
// Params returns value of given param name.
// e.g. ctx.Params(":uid") or ctx.Params("uid")
func (ctx *Context) Params(name string) string {
if len(name) == 0 {
return ""
}
if name[0] != '*' && name[0] != ':' {
name = ":" + name
}
return ctx.params[name]
}
// SetParams sets value of param with given name.
func (ctx *Context) SetParams(name, val string) {
if !strings.HasPrefix(name, ":") {
name = ":" + name
}
ctx.params[name] = val
}
// ParamsEscape returns escapred params result.
// e.g. ctx.ParamsEscape(":uname")
func (ctx *Context) ParamsEscape(name string) string {
return template.HTMLEscapeString(ctx.Params(name))
}
// ParamsInt returns params result in int type.
// e.g. ctx.ParamsInt(":uid")
func (ctx *Context) ParamsInt(name string) int {
return com.StrTo(ctx.Params(name)).MustInt()
}
// ParamsInt64 returns params result in int64 type.
// e.g. ctx.ParamsInt64(":uid")
func (ctx *Context) ParamsInt64(name string) int64 {
return com.StrTo(ctx.Params(name)).MustInt64()
}
// ParamsFloat64 returns params result in int64 type.
// e.g. ctx.ParamsFloat64(":uid")
func (ctx *Context) ParamsFloat64(name string) float64 {
v, _ := strconv.ParseFloat(ctx.Params(name), 64)
return v
}
// GetFile returns information about user upload file by given form field name.
func (ctx *Context) GetFile(name string) (multipart.File, *multipart.FileHeader, error) {
return ctx.Req.FormFile(name)
}
// SetCookie sets given cookie value to response header.
// FIXME: IE support? http://golanghome.com/post/620#reply2
func (ctx *Context) SetCookie(name string, value string, others ...interface{}) {
cookie := http.Cookie{}
cookie.Name = name
cookie.Value = url.QueryEscape(value)
if len(others) > 0 {
switch v := others[0].(type) {
case int:
cookie.MaxAge = v
case int64:
cookie.MaxAge = int(v)
case int32:
cookie.MaxAge = int(v)
}
}
cookie.Path = "/"
if len(others) > 1 {
if v, ok := others[1].(string); ok && len(v) > 0 {
cookie.Path = v
}
}
if len(others) > 2 {
if v, ok := others[2].(string); ok && len(v) > 0 {
cookie.Domain = v
}
}
if len(others) > 3 {
switch v := others[3].(type) {
case bool:
cookie.Secure = v
default:
if others[3] != nil {
cookie.Secure = true
}
}
}
if len(others) > 4 {
if v, ok := others[4].(bool); ok && v {
cookie.HttpOnly = true
}
}
ctx.Resp.Header().Add("Set-Cookie", cookie.String())
}
// GetCookie returns given cookie value from request header.
func (ctx *Context) GetCookie(name string) string {
cookie, err := ctx.Req.Cookie(name)
if err != nil {
return ""
}
val, _ := url.QueryUnescape(cookie.Value)
return val
}
// GetCookieInt returns cookie result in int type.
func (ctx *Context) GetCookieInt(name string) int {
return com.StrTo(ctx.GetCookie(name)).MustInt()
}
// GetCookieInt64 returns cookie result in int64 type.
func (ctx *Context) GetCookieInt64(name string) int64 {
return com.StrTo(ctx.GetCookie(name)).MustInt64()
}
// GetCookieFloat64 returns cookie result in float64 type.
func (ctx *Context) GetCookieFloat64(name string) float64 {
v, _ := strconv.ParseFloat(ctx.GetCookie(name), 64)
return v
}
var defaultCookieSecret string
// SetDefaultCookieSecret sets global default secure cookie secret.
func (m *Macaron) SetDefaultCookieSecret(secret string) {
defaultCookieSecret = secret
}
// SetSecureCookie sets given cookie value to response header with default secret string.
func (ctx *Context) SetSecureCookie(name, value string, others ...interface{}) {
ctx.SetSuperSecureCookie(defaultCookieSecret, name, value, others...)
}
// GetSecureCookie returns given cookie value from request header with default secret string.
func (ctx *Context) GetSecureCookie(key string) (string, bool) {
return ctx.GetSuperSecureCookie(defaultCookieSecret, key)
}
// SetSuperSecureCookie sets given cookie value to response header with secret string.
func (ctx *Context) SetSuperSecureCookie(secret, name, value string, others ...interface{}) {
m := md5.Sum([]byte(secret))
secret = hex.EncodeToString(m[:])
text, err := com.AESEncrypt([]byte(secret), []byte(value))
if err != nil {
panic("error encrypting cookie: " + err.Error())
}
ctx.SetCookie(name, hex.EncodeToString(text), others...)
}
// GetSuperSecureCookie returns given cookie value from request header with secret string.
func (ctx *Context) GetSuperSecureCookie(secret, key string) (string, bool) {
val := ctx.GetCookie(key)
if val == "" {
return "", false
}
data, err := hex.DecodeString(val)
if err != nil {
return "", false
}
m := md5.Sum([]byte(secret))
secret = hex.EncodeToString(m[:])
text, err := com.AESDecrypt([]byte(secret), data)
return string(text), err == nil
}
func (ctx *Context) setRawContentHeader() {
ctx.Resp.Header().Set("Content-Description", "Raw content")
ctx.Resp.Header().Set("Content-Type", "text/plain")
ctx.Resp.Header().Set("Expires", "0")
ctx.Resp.Header().Set("Cache-Control", "must-revalidate")
ctx.Resp.Header().Set("Pragma", "public")
}
// ServeContent serves given content to response.
func (ctx *Context) ServeContent(name string, r io.ReadSeeker, params ...interface{}) {
modtime := time.Now()
for _, p := range params {
switch v := p.(type) {
case time.Time:
modtime = v
}
}
ctx.setRawContentHeader()
http.ServeContent(ctx.Resp, ctx.Req.Request, name, modtime, r)
}
// ServeFileContent serves given file as content to response.
func (ctx *Context) ServeFileContent(file string, names ...string) {
var name string
if len(names) > 0 {
name = names[0]
} else {
name = path.Base(file)
}
f, err := os.Open(file)
if err != nil {
if Env == PROD {
http.Error(ctx.Resp, "Internal Server Error", 500)
} else {
http.Error(ctx.Resp, err.Error(), 500)
}
return
}
defer f.Close()
ctx.setRawContentHeader()
http.ServeContent(ctx.Resp, ctx.Req.Request, name, time.Now(), f)
}
// ServeFile serves given file to response.
func (ctx *Context) ServeFile(file string, names ...string) {
var name string
if len(names) > 0 {
name = names[0]
} else {
name = path.Base(file)
}
ctx.Resp.Header().Set("Content-Description", "File Transfer")
ctx.Resp.Header().Set("Content-Type", "application/octet-stream")
ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+name)
ctx.Resp.Header().Set("Content-Transfer-Encoding", "binary")
ctx.Resp.Header().Set("Expires", "0")
ctx.Resp.Header().Set("Cache-Control", "must-revalidate")
ctx.Resp.Header().Set("Pragma", "public")
http.ServeFile(ctx.Resp, ctx.Req.Request, file)
}
// ChangeStaticPath changes static path from old to new one.
func (ctx *Context) ChangeStaticPath(oldPath, newPath string) {
if !filepath.IsAbs(oldPath) {
oldPath = filepath.Join(Root, oldPath)
}
dir := statics.Get(oldPath)
if dir != nil {
statics.Delete(oldPath)
if !filepath.IsAbs(newPath) {
newPath = filepath.Join(Root, newPath)
}
*dir = http.Dir(newPath)
statics.Set(dir)
}
}

View File

@@ -0,0 +1,370 @@
// Copyright 2014 Unknwon
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package macaron
import (
"bytes"
"io/ioutil"
"net/http"
"net/http/httptest"
"net/url"
"strings"
"testing"
"time"
"github.com/Unknwon/com"
. "github.com/smartystreets/goconvey/convey"
)
func Test_Context(t *testing.T) {
Convey("Do advanced encapsulation operations", t, func() {
m := Classic()
m.Use(Renderers(RenderOptions{
Directory: "fixtures/basic",
}, "fixtures/basic2"))
Convey("Get request body", func() {
m.Get("/body1", func(ctx *Context) {
data, err := ioutil.ReadAll(ctx.Req.Body().ReadCloser())
So(err, ShouldBeNil)
So(string(data), ShouldEqual, "This is my request body")
})
m.Get("/body2", func(ctx *Context) {
data, err := ctx.Req.Body().Bytes()
So(err, ShouldBeNil)
So(string(data), ShouldEqual, "This is my request body")
})
m.Get("/body3", func(ctx *Context) {
data, err := ctx.Req.Body().String()
So(err, ShouldBeNil)
So(data, ShouldEqual, "This is my request body")
})
for i := 1; i <= 3; i++ {
resp := httptest.NewRecorder()
req, err := http.NewRequest("GET", "/body"+com.ToStr(i), nil)
req.Body = ioutil.NopCloser(bytes.NewBufferString("This is my request body"))
So(err, ShouldBeNil)
m.ServeHTTP(resp, req)
}
})
Convey("Get remote IP address", func() {
m.Get("/remoteaddr", func(ctx *Context) string {
return ctx.RemoteAddr()
})
resp := httptest.NewRecorder()
req, err := http.NewRequest("GET", "/remoteaddr", nil)
req.RemoteAddr = "127.0.0.1:3333"
So(err, ShouldBeNil)
m.ServeHTTP(resp, req)
So(resp.Body.String(), ShouldEqual, "127.0.0.1")
})
Convey("Render HTML", func() {
Convey("Normal HTML", func() {
m.Get("/html", func(ctx *Context) {
ctx.HTML(304, "hello", "Unknwon") // 304 for logger test.
})
resp := httptest.NewRecorder()
req, err := http.NewRequest("GET", "/html", nil)
So(err, ShouldBeNil)
m.ServeHTTP(resp, req)
So(resp.Body.String(), ShouldEqual, "<h1>Hello Unknwon</h1>")
})
Convey("HTML template set", func() {
m.Get("/html2", func(ctx *Context) {
ctx.Data["Name"] = "Unknwon"
ctx.HTMLSet(200, "basic2", "hello2")
})
resp := httptest.NewRecorder()
req, err := http.NewRequest("GET", "/html2", nil)
So(err, ShouldBeNil)
m.ServeHTTP(resp, req)
So(resp.Body.String(), ShouldEqual, "<h1>Hello Unknwon</h1>")
})
Convey("With layout", func() {
m.Get("/layout", func(ctx *Context) {
ctx.HTML(200, "hello", "Unknwon", HTMLOptions{"layout"})
})
resp := httptest.NewRecorder()
req, err := http.NewRequest("GET", "/layout", nil)
So(err, ShouldBeNil)
m.ServeHTTP(resp, req)
So(resp.Body.String(), ShouldEqual, "head<h1>Hello Unknwon</h1>foot")
})
})
Convey("Parse from and query", func() {
m.Get("/query", func(ctx *Context) string {
var buf bytes.Buffer
buf.WriteString(ctx.QueryTrim("name") + " ")
buf.WriteString(ctx.QueryEscape("name") + " ")
buf.WriteString(com.ToStr(ctx.QueryInt("int")) + " ")
buf.WriteString(com.ToStr(ctx.QueryInt64("int64")) + " ")
buf.WriteString(com.ToStr(ctx.QueryFloat64("float64")) + " ")
return buf.String()
})
m.Get("/query2", func(ctx *Context) string {
var buf bytes.Buffer
buf.WriteString(strings.Join(ctx.QueryStrings("list"), ",") + " ")
buf.WriteString(strings.Join(ctx.QueryStrings("404"), ",") + " ")
return buf.String()
})
resp := httptest.NewRecorder()
req, err := http.NewRequest("GET", "/query?name=Unknwon&int=12&int64=123&float64=1.25", nil)
So(err, ShouldBeNil)
m.ServeHTTP(resp, req)
So(resp.Body.String(), ShouldEqual, "Unknwon Unknwon 12 123 1.25 ")
resp = httptest.NewRecorder()
req, err = http.NewRequest("GET", "/query2?list=item1&list=item2", nil)
So(err, ShouldBeNil)
m.ServeHTTP(resp, req)
So(resp.Body.String(), ShouldEqual, "item1,item2 ")
})
Convey("URL parameter", func() {
m.Get("/:name/:int/:int64/:float64", func(ctx *Context) string {
var buf bytes.Buffer
ctx.SetParams("name", ctx.Params("name"))
buf.WriteString(ctx.Params(""))
buf.WriteString(ctx.Params(":name") + " ")
buf.WriteString(ctx.ParamsEscape(":name") + " ")
buf.WriteString(com.ToStr(ctx.ParamsInt(":int")) + " ")
buf.WriteString(com.ToStr(ctx.ParamsInt64(":int64")) + " ")
buf.WriteString(com.ToStr(ctx.ParamsFloat64(":float64")) + " ")
return buf.String()
})
resp := httptest.NewRecorder()
req, err := http.NewRequest("GET", "/user/1/13/1.24", nil)
So(err, ShouldBeNil)
m.ServeHTTP(resp, req)
So(resp.Body.String(), ShouldEqual, "user user 1 13 1.24 ")
})
Convey("Get file", func() {
m.Get("/getfile", func(ctx *Context) {
ctx.GetFile("hi")
})
resp := httptest.NewRecorder()
req, err := http.NewRequest("GET", "/getfile", nil)
So(err, ShouldBeNil)
m.ServeHTTP(resp, req)
})
Convey("Set and get cookie", func() {
m.Get("/set", func(ctx *Context) {
ctx.SetCookie("user", "Unknwon", 1, "/", "localhost", true, true)
ctx.SetCookie("user", "Unknwon", int32(1), "/", "localhost", 1)
ctx.SetCookie("user", "Unknwon", int64(1))
})
resp := httptest.NewRecorder()
req, err := http.NewRequest("GET", "/set", nil)
So(err, ShouldBeNil)
m.ServeHTTP(resp, req)
So(resp.Header().Get("Set-Cookie"), ShouldEqual, "user=Unknwon; Path=/; Domain=localhost; Max-Age=1; HttpOnly; Secure")
m.Get("/get", func(ctx *Context) string {
ctx.GetCookie("404")
So(ctx.GetCookieInt("uid"), ShouldEqual, 1)
So(ctx.GetCookieInt64("uid"), ShouldEqual, 1)
So(ctx.GetCookieFloat64("balance"), ShouldEqual, 1.25)
return ctx.GetCookie("user")
})
resp = httptest.NewRecorder()
req, err = http.NewRequest("GET", "/get", nil)
So(err, ShouldBeNil)
req.Header.Set("Cookie", "user=Unknwon; uid=1; balance=1.25")
m.ServeHTTP(resp, req)
So(resp.Body.String(), ShouldEqual, "Unknwon")
})
Convey("Set and get secure cookie", func() {
m.SetDefaultCookieSecret("macaron")
m.Get("/set", func(ctx *Context) {
ctx.SetSecureCookie("user", "Unknwon", 1)
})
resp := httptest.NewRecorder()
req, err := http.NewRequest("GET", "/set", nil)
So(err, ShouldBeNil)
m.ServeHTTP(resp, req)
cookie := resp.Header().Get("Set-Cookie")
m.Get("/get", func(ctx *Context) string {
name, ok := ctx.GetSecureCookie("user")
So(ok, ShouldBeTrue)
return name
})
resp = httptest.NewRecorder()
req, err = http.NewRequest("GET", "/get", nil)
So(err, ShouldBeNil)
req.Header.Set("Cookie", cookie)
m.ServeHTTP(resp, req)
So(resp.Body.String(), ShouldEqual, "Unknwon")
})
Convey("Serve files", func() {
m.Get("/file", func(ctx *Context) {
ctx.ServeFile("fixtures/custom_funcs/index.tmpl")
})
resp := httptest.NewRecorder()
req, err := http.NewRequest("GET", "/file", nil)
So(err, ShouldBeNil)
m.ServeHTTP(resp, req)
So(resp.Body.String(), ShouldEqual, "{{ myCustomFunc }}")
m.Get("/file2", func(ctx *Context) {
ctx.ServeFile("fixtures/custom_funcs/index.tmpl", "ok.tmpl")
})
resp = httptest.NewRecorder()
req, err = http.NewRequest("GET", "/file2", nil)
So(err, ShouldBeNil)
m.ServeHTTP(resp, req)
So(resp.Body.String(), ShouldEqual, "{{ myCustomFunc }}")
})
Convey("Serve file content", func() {
m.Get("/file", func(ctx *Context) {
ctx.ServeFileContent("fixtures/custom_funcs/index.tmpl")
})
resp := httptest.NewRecorder()
req, err := http.NewRequest("GET", "/file", nil)
So(err, ShouldBeNil)
m.ServeHTTP(resp, req)
So(resp.Body.String(), ShouldEqual, "{{ myCustomFunc }}")
m.Get("/file2", func(ctx *Context) {
ctx.ServeFileContent("fixtures/custom_funcs/index.tmpl", "ok.tmpl")
})
resp = httptest.NewRecorder()
req, err = http.NewRequest("GET", "/file2", nil)
So(err, ShouldBeNil)
m.ServeHTTP(resp, req)
So(resp.Body.String(), ShouldEqual, "{{ myCustomFunc }}")
m.Get("/file3", func(ctx *Context) {
ctx.ServeFileContent("404.tmpl")
})
resp = httptest.NewRecorder()
req, err = http.NewRequest("GET", "/file3", nil)
So(err, ShouldBeNil)
m.ServeHTTP(resp, req)
So(resp.Body.String(), ShouldEqual, "open 404.tmpl: no such file or directory\n")
So(resp.Code, ShouldEqual, 500)
})
Convey("Serve content", func() {
m.Get("/content", func(ctx *Context) {
ctx.ServeContent("content1", bytes.NewReader([]byte("Hello world!")))
})
resp := httptest.NewRecorder()
req, err := http.NewRequest("GET", "/content", nil)
So(err, ShouldBeNil)
m.ServeHTTP(resp, req)
So(resp.Body.String(), ShouldEqual, "Hello world!")
m.Get("/content2", func(ctx *Context) {
ctx.ServeContent("content1", bytes.NewReader([]byte("Hello world!")), time.Now())
})
resp = httptest.NewRecorder()
req, err = http.NewRequest("GET", "/content2", nil)
So(err, ShouldBeNil)
m.ServeHTTP(resp, req)
So(resp.Body.String(), ShouldEqual, "Hello world!")
})
})
}
func Test_Context_Render(t *testing.T) {
Convey("Invalid render", t, func() {
defer func() {
So(recover(), ShouldNotBeNil)
}()
m := New()
m.Get("/", func(ctx *Context) {
ctx.HTML(200, "hey")
})
resp := httptest.NewRecorder()
req, err := http.NewRequest("GET", "/", nil)
So(err, ShouldBeNil)
m.ServeHTTP(resp, req)
})
}
func Test_Context_Redirect(t *testing.T) {
Convey("Context with default redirect", t, func() {
url, err := url.Parse("http://localhost/path/one")
So(err, ShouldBeNil)
resp := httptest.NewRecorder()
req := http.Request{
Method: "GET",
URL: url,
}
ctx := &Context{
Req: Request{&req},
Resp: NewResponseWriter(resp),
Data: make(map[string]interface{}),
}
ctx.Redirect("two")
So(resp.Code, ShouldEqual, http.StatusFound)
So(resp.HeaderMap["Location"][0], ShouldEqual, "/path/two")
})
Convey("Context with custom redirect", t, func() {
url, err := url.Parse("http://localhost/path/one")
So(err, ShouldBeNil)
resp := httptest.NewRecorder()
req := http.Request{
Method: "GET",
URL: url,
}
ctx := &Context{
Req: Request{&req},
Resp: NewResponseWriter(resp),
Data: make(map[string]interface{}),
}
ctx.Redirect("two", 307)
So(resp.Code, ShouldEqual, http.StatusTemporaryRedirect)
So(resp.HeaderMap["Location"][0], ShouldEqual, "/path/two")
})
}

View File

@@ -0,0 +1 @@
<h1>Admin {{.}}</h1>

View File

@@ -0,0 +1 @@
another head{{ yield }}another foot

View File

@@ -0,0 +1 @@
<h1>{{ . }}</h1>

View File

@@ -0,0 +1 @@
{{ current }} head{{ yield }}{{ current }} foot

View File

@@ -0,0 +1 @@
<h1>Hello {[{.}]}</h1>

View File

@@ -0,0 +1 @@
<h1>Hello {{.}}</h1>

View File

@@ -0,0 +1 @@
Hypertext!

View File

@@ -0,0 +1 @@
head{{ yield }}foot

View File

@@ -0,0 +1 @@
<h1>What's up, {{.}}</h1>

View File

@@ -0,0 +1 @@
<h1>Hello {{.Name}}</h1>

View File

@@ -0,0 +1 @@
{{ myCustomFunc }}

View File

@@ -0,0 +1,81 @@
// Copyright 2013 Martini Authors
// Copyright 2014 Unknwon
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package macaron
import (
"bufio"
"compress/gzip"
"fmt"
"net"
"net/http"
"strings"
)
const (
HeaderAcceptEncoding = "Accept-Encoding"
HeaderContentEncoding = "Content-Encoding"
HeaderContentLength = "Content-Length"
HeaderContentType = "Content-Type"
HeaderVary = "Vary"
)
// Gziper returns a Handler that adds gzip compression to all requests.
// Make sure to include the Gzip middleware above other middleware
// that alter the response body (like the render middleware).
func Gziper() Handler {
return func(ctx *Context) {
if !strings.Contains(ctx.Req.Header.Get(HeaderAcceptEncoding), "gzip") {
return
}
headers := ctx.Resp.Header()
headers.Set(HeaderContentEncoding, "gzip")
headers.Set(HeaderVary, HeaderAcceptEncoding)
gz := gzip.NewWriter(ctx.Resp)
defer gz.Close()
gzw := gzipResponseWriter{gz, ctx.Resp}
ctx.Resp = gzw
ctx.MapTo(gzw, (*http.ResponseWriter)(nil))
ctx.Next()
// delete content length after we know we have been written to
gzw.Header().Del("Content-Length")
}
}
type gzipResponseWriter struct {
w *gzip.Writer
ResponseWriter
}
func (grw gzipResponseWriter) Write(p []byte) (int, error) {
if len(grw.Header().Get(HeaderContentType)) == 0 {
grw.Header().Set(HeaderContentType, http.DetectContentType(p))
}
return grw.w.Write(p)
}
func (grw gzipResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
hijacker, ok := grw.ResponseWriter.(http.Hijacker)
if !ok {
return nil, nil, fmt.Errorf("the ResponseWriter doesn't support the Hijacker interface")
}
return hijacker.Hijack()
}

View File

@@ -0,0 +1,65 @@
// Copyright 2013 Martini Authors
// Copyright 2014 Unknwon
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package macaron
import (
"net/http"
"net/http/httptest"
"strings"
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func Test_Gzip(t *testing.T) {
Convey("Gzip response content", t, func() {
before := false
m := New()
m.Use(Gziper())
m.Use(func(r http.ResponseWriter) {
r.(ResponseWriter).Before(func(rw ResponseWriter) {
before = true
})
})
m.Get("/", func() string { return "hello wolrd!" })
// Not yet gzip.
resp := httptest.NewRecorder()
req, err := http.NewRequest("GET", "/", nil)
So(err, ShouldBeNil)
m.ServeHTTP(resp, req)
_, ok := resp.HeaderMap[HeaderContentEncoding]
So(ok, ShouldBeFalse)
ce := resp.Header().Get(HeaderContentEncoding)
So(strings.EqualFold(ce, "gzip"), ShouldBeFalse)
// Gzip now.
resp = httptest.NewRecorder()
req.Header.Set(HeaderAcceptEncoding, "gzip")
m.ServeHTTP(resp, req)
_, ok = resp.HeaderMap[HeaderContentEncoding]
So(ok, ShouldBeTrue)
ce = resp.Header().Get(HeaderContentEncoding)
So(strings.EqualFold(ce, "gzip"), ShouldBeTrue)
So(before, ShouldBeTrue)
})
}

View File

@@ -0,0 +1,4 @@
inject
======
Dependency injection for go

View File

@@ -0,0 +1,187 @@
// Package inject provides utilities for mapping and injecting dependencies in various ways.
package inject
import (
"fmt"
"reflect"
)
// Injector represents an interface for mapping and injecting dependencies into structs
// and function arguments.
type Injector interface {
Applicator
Invoker
TypeMapper
// SetParent sets the parent of the injector. If the injector cannot find a
// dependency in its Type map it will check its parent before returning an
// error.
SetParent(Injector)
}
// Applicator represents an interface for mapping dependencies to a struct.
type Applicator interface {
// Maps dependencies in the Type map to each field in the struct
// that is tagged with 'inject'. Returns an error if the injection
// fails.
Apply(interface{}) error
}
// Invoker represents an interface for calling functions via reflection.
type Invoker interface {
// Invoke attempts to call the interface{} provided as a function,
// providing dependencies for function arguments based on Type. Returns
// a slice of reflect.Value representing the returned values of the function.
// Returns an error if the injection fails.
Invoke(interface{}) ([]reflect.Value, error)
}
// TypeMapper represents an interface for mapping interface{} values based on type.
type TypeMapper interface {
// Maps the interface{} value based on its immediate type from reflect.TypeOf.
Map(interface{}) TypeMapper
// Maps the interface{} value based on the pointer of an Interface provided.
// This is really only useful for mapping a value as an interface, as interfaces
// cannot at this time be referenced directly without a pointer.
MapTo(interface{}, interface{}) TypeMapper
// Provides a possibility to directly insert a mapping based on type and value.
// This makes it possible to directly map type arguments not possible to instantiate
// with reflect like unidirectional channels.
Set(reflect.Type, reflect.Value) TypeMapper
// Returns the Value that is mapped to the current type. Returns a zeroed Value if
// the Type has not been mapped.
GetVal(reflect.Type) reflect.Value
}
type injector struct {
values map[reflect.Type]reflect.Value
parent Injector
}
// InterfaceOf dereferences a pointer to an Interface type.
// It panics if value is not an pointer to an interface.
func InterfaceOf(value interface{}) reflect.Type {
t := reflect.TypeOf(value)
for t.Kind() == reflect.Ptr {
t = t.Elem()
}
if t.Kind() != reflect.Interface {
panic("Called inject.InterfaceOf with a value that is not a pointer to an interface. (*MyInterface)(nil)")
}
return t
}
// New returns a new Injector.
func New() Injector {
return &injector{
values: make(map[reflect.Type]reflect.Value),
}
}
// Invoke attempts to call the interface{} provided as a function,
// providing dependencies for function arguments based on Type.
// Returns a slice of reflect.Value representing the returned values of the function.
// Returns an error if the injection fails.
// It panics if f is not a function
func (inj *injector) Invoke(f interface{}) ([]reflect.Value, error) {
t := reflect.TypeOf(f)
var in = make([]reflect.Value, t.NumIn()) //Panic if t is not kind of Func
for i := 0; i < t.NumIn(); i++ {
argType := t.In(i)
val := inj.GetVal(argType)
if !val.IsValid() {
return nil, fmt.Errorf("Value not found for type %v", argType)
}
in[i] = val
}
return reflect.ValueOf(f).Call(in), nil
}
// Maps dependencies in the Type map to each field in the struct
// that is tagged with 'inject'.
// Returns an error if the injection fails.
func (inj *injector) Apply(val interface{}) error {
v := reflect.ValueOf(val)
for v.Kind() == reflect.Ptr {
v = v.Elem()
}
if v.Kind() != reflect.Struct {
return nil // Should not panic here ?
}
t := v.Type()
for i := 0; i < v.NumField(); i++ {
f := v.Field(i)
structField := t.Field(i)
if f.CanSet() && (structField.Tag == "inject" || structField.Tag.Get("inject") != "") {
ft := f.Type()
v := inj.GetVal(ft)
if !v.IsValid() {
return fmt.Errorf("Value not found for type %v", ft)
}
f.Set(v)
}
}
return nil
}
// Maps the concrete value of val to its dynamic type using reflect.TypeOf,
// It returns the TypeMapper registered in.
func (i *injector) Map(val interface{}) TypeMapper {
i.values[reflect.TypeOf(val)] = reflect.ValueOf(val)
return i
}
func (i *injector) MapTo(val interface{}, ifacePtr interface{}) TypeMapper {
i.values[InterfaceOf(ifacePtr)] = reflect.ValueOf(val)
return i
}
// Maps the given reflect.Type to the given reflect.Value and returns
// the Typemapper the mapping has been registered in.
func (i *injector) Set(typ reflect.Type, val reflect.Value) TypeMapper {
i.values[typ] = val
return i
}
func (i *injector) GetVal(t reflect.Type) reflect.Value {
val := i.values[t]
if val.IsValid() {
return val
}
// no concrete types found, try to find implementors
// if t is an interface
if t.Kind() == reflect.Interface {
for k, v := range i.values {
if k.Implements(t) {
val = v
break
}
}
}
// Still no type found, try to look it up on the parent
if !val.IsValid() && i.parent != nil {
val = i.parent.GetVal(t)
}
return val
}
func (i *injector) SetParent(parent Injector) {
i.parent = parent
}

View File

@@ -0,0 +1 @@
ignore

View File

@@ -0,0 +1,174 @@
// Copyright 2013 Martini Authors
// Copyright 2014 Unknwon
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package inject_test
import (
"fmt"
"reflect"
"testing"
"github.com/Unknwon/macaron/inject"
)
type SpecialString interface {
}
type TestStruct struct {
Dep1 string `inject:"t" json:"-"`
Dep2 SpecialString `inject`
Dep3 string
}
type Greeter struct {
Name string
}
func (g *Greeter) String() string {
return "Hello, My name is" + g.Name
}
/* Test Helpers */
func expect(t *testing.T, a interface{}, b interface{}) {
if a != b {
t.Errorf("Expected %v (type %v) - Got %v (type %v)", b, reflect.TypeOf(b), a, reflect.TypeOf(a))
}
}
func refute(t *testing.T, a interface{}, b interface{}) {
if a == b {
t.Errorf("Did not expect %v (type %v) - Got %v (type %v)", b, reflect.TypeOf(b), a, reflect.TypeOf(a))
}
}
func Test_InjectorInvoke(t *testing.T) {
injector := inject.New()
expect(t, injector == nil, false)
dep := "some dependency"
injector.Map(dep)
dep2 := "another dep"
injector.MapTo(dep2, (*SpecialString)(nil))
dep3 := make(chan *SpecialString)
dep4 := make(chan *SpecialString)
typRecv := reflect.ChanOf(reflect.RecvDir, reflect.TypeOf(dep3).Elem())
typSend := reflect.ChanOf(reflect.SendDir, reflect.TypeOf(dep4).Elem())
injector.Set(typRecv, reflect.ValueOf(dep3))
injector.Set(typSend, reflect.ValueOf(dep4))
_, err := injector.Invoke(func(d1 string, d2 SpecialString, d3 <-chan *SpecialString, d4 chan<- *SpecialString) {
expect(t, d1, dep)
expect(t, d2, dep2)
expect(t, reflect.TypeOf(d3).Elem(), reflect.TypeOf(dep3).Elem())
expect(t, reflect.TypeOf(d4).Elem(), reflect.TypeOf(dep4).Elem())
expect(t, reflect.TypeOf(d3).ChanDir(), reflect.RecvDir)
expect(t, reflect.TypeOf(d4).ChanDir(), reflect.SendDir)
})
expect(t, err, nil)
}
func Test_InjectorInvokeReturnValues(t *testing.T) {
injector := inject.New()
expect(t, injector == nil, false)
dep := "some dependency"
injector.Map(dep)
dep2 := "another dep"
injector.MapTo(dep2, (*SpecialString)(nil))
result, err := injector.Invoke(func(d1 string, d2 SpecialString) string {
expect(t, d1, dep)
expect(t, d2, dep2)
return "Hello world"
})
expect(t, result[0].String(), "Hello world")
expect(t, err, nil)
}
func Test_InjectorApply(t *testing.T) {
injector := inject.New()
injector.Map("a dep").MapTo("another dep", (*SpecialString)(nil))
s := TestStruct{}
err := injector.Apply(&s)
expect(t, err, nil)
expect(t, s.Dep1, "a dep")
expect(t, s.Dep2, "another dep")
}
func Test_InterfaceOf(t *testing.T) {
iType := inject.InterfaceOf((*SpecialString)(nil))
expect(t, iType.Kind(), reflect.Interface)
iType = inject.InterfaceOf((**SpecialString)(nil))
expect(t, iType.Kind(), reflect.Interface)
// Expecting nil
defer func() {
rec := recover()
refute(t, rec, nil)
}()
iType = inject.InterfaceOf((*testing.T)(nil))
}
func Test_InjectorSet(t *testing.T) {
injector := inject.New()
typ := reflect.TypeOf("string")
typSend := reflect.ChanOf(reflect.SendDir, typ)
typRecv := reflect.ChanOf(reflect.RecvDir, typ)
// instantiating unidirectional channels is not possible using reflect
// http://golang.org/src/pkg/reflect/value.go?s=60463:60504#L2064
chanRecv := reflect.MakeChan(reflect.ChanOf(reflect.BothDir, typ), 0)
chanSend := reflect.MakeChan(reflect.ChanOf(reflect.BothDir, typ), 0)
injector.Set(typSend, chanSend)
injector.Set(typRecv, chanRecv)
expect(t, injector.GetVal(typSend).IsValid(), true)
expect(t, injector.GetVal(typRecv).IsValid(), true)
expect(t, injector.GetVal(chanSend.Type()).IsValid(), false)
}
func Test_InjectorGet(t *testing.T) {
injector := inject.New()
injector.Map("some dependency")
expect(t, injector.GetVal(reflect.TypeOf("string")).IsValid(), true)
expect(t, injector.GetVal(reflect.TypeOf(11)).IsValid(), false)
}
func Test_InjectorSetParent(t *testing.T) {
injector := inject.New()
injector.MapTo("another dep", (*SpecialString)(nil))
injector2 := inject.New()
injector2.SetParent(injector)
expect(t, injector2.GetVal(inject.InterfaceOf((*SpecialString)(nil))).IsValid(), true)
}
func TestInjectImplementors(t *testing.T) {
injector := inject.New()
g := &Greeter{"Jeremy"}
injector.Map(g)
expect(t, injector.GetVal(inject.InterfaceOf((*fmt.Stringer)(nil))).IsValid(), true)
}

View File

@@ -0,0 +1,61 @@
// Copyright 2013 Martini Authors
// Copyright 2014 Unknwon
//
// Licensed under the Apache License, Version 2.0 (the "License"): you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations
// under the License.
package macaron
import (
"fmt"
"log"
"net/http"
"runtime"
"time"
)
var ColorLog = true
func init() {
ColorLog = runtime.GOOS != "windows"
}
// Logger returns a middleware handler that logs the request as it goes in and the response as it goes out.
func Logger() Handler {
return func(ctx *Context, log *log.Logger) {
start := time.Now()
log.Printf("Started %s %s for %s", ctx.Req.Method, ctx.Req.RequestURI, ctx.RemoteAddr())
rw := ctx.Resp.(ResponseWriter)
ctx.Next()
content := fmt.Sprintf("Completed %s %v %s in %v", ctx.Req.RequestURI, rw.Status(), http.StatusText(rw.Status()), time.Since(start))
if ColorLog {
switch rw.Status() {
case 200, 201, 202:
content = fmt.Sprintf("\033[1;32m%s\033[0m", content)
case 301, 302:
content = fmt.Sprintf("\033[1;37m%s\033[0m", content)
case 304:
content = fmt.Sprintf("\033[1;33m%s\033[0m", content)
case 401, 403:
content = fmt.Sprintf("\033[4;31m%s\033[0m", content)
case 404:
content = fmt.Sprintf("\033[1;31m%s\033[0m", content)
case 500:
content = fmt.Sprintf("\033[1;36m%s\033[0m", content)
}
}
log.Println(content)
}
}

Some files were not shown because too many files have changed in this diff Show More