Skip to content

Commit 631af46

Browse files
committed
Merge branch 'master' into react-panels-step1
2 parents 8ba865b + 5e9ef5f commit 631af46

File tree

18 files changed

+2123
-30
lines changed

18 files changed

+2123
-30
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ debug.test
6969
/vendor/**/*.yml
7070
/vendor/**/*_test.go
7171
/vendor/**/.editorconfig
72-
/vendor/**/appengine*
7372
*.orig
7473

7574
/devenv/bulk-dashboards/*.json

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
* **Datasource Proxy**: Keep trailing slash for datasource proxy requests [#13326](https://github.com/grafana/grafana/pull/13326), thx [@ryantxu](https://github.com/ryantxu)
1010
* **Elasticsearch**: Fix no limit size in terms aggregation for alerting queries [#13172](https://github.com/grafana/grafana/issues/13172), thx [@Yukinoshita-Yukino](https://github.com/Yukinoshita-Yukino)
11+
* **Units**: New clock time format, to format ms or second values as for example `01h:59m`, [#13635](https://github.com/grafana/grafana/issues/13635), thx [@franciscocpg](https://github.com/franciscocpg)
1112

1213
### Breaking changes
1314

@@ -16,6 +17,7 @@
1617
# 5.3.1 (unreleased)
1718

1819
* **Render**: Fix PhantomJS render of graph panel when legend displayed as table to the right [#13616](https://github.com/grafana/grafana/issues/13616)
20+
* **Stackdriver**: Filter option disappears after removing initial filter [#13607](https://github.com/grafana/grafana/issues/13607)
1921

2022
# 5.3.0 (2018-10-10)
2123

@@ -68,7 +70,7 @@
6870
* **Profile**: List teams that the user is member of in current/active organization [#12476](https://github.com/grafana/grafana/issues/12476)
6971
* **Configuration**: Allow auto-assigning users to specific organization (other than Main. Org) [#1823](https://github.com/grafana/grafana/issues/1823) [#12801](https://github.com/grafana/grafana/issues/12801), thx [@gzzo](https://github.com/gzzo) and [@ofosos](https://github.com/ofosos)
7072
* **Dataproxy**: Pass configured/auth headers to a Datasource [#10971](https://github.com/grafana/grafana/issues/10971), thx [@mrsiano](https://github.com/mrsiano)
71-
* ****: **: CloudWatch GetMetricData support [#11487](https://github.com/grafana/grafana/issues/11487), thx [@mtanda](https://github.com/mtanda)
73+
* **CloudWatch**: GetMetricData support [#11487](https://github.com/grafana/grafana/issues/11487), thx [@mtanda](https://github.com/mtanda)
7274
* **Postgres**: TimescaleDB support, e.g. use `time_bucket` for grouping by time when option enabled [#12680](https://github.com/grafana/grafana/pull/12680), thx [svenklemm](https://github.com/svenklemm)
7375
* **Cleanup**: Make temp file time to live configurable [#11607](https://github.com/grafana/grafana/issues/11607), thx [@xapon](https://github.com/xapon)
7476

docs/sources/plugins/developing/development.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ weight = 1
1010

1111
# Developer Guide
1212

13-
You can extend Grafana by writing your own plugins and then share then with other users in [our plugin repository](https://grafana.com/plugins).
13+
You can extend Grafana by writing your own plugins and then share them with other users in [our plugin repository](https://grafana.com/plugins).
1414

1515
## Short version
1616

@@ -33,7 +33,7 @@ There are two blog posts about authoring a plugin that might also be of interest
3333
## What languages?
3434

3535
Since everything turns into javascript it's up to you to choose which language you want. That said it's probably a good idea to choose es6 or typescript since
36-
we use es6 classes in Grafana. So it's easier to get inspiration from the Grafana repo is you choose one of those languages.
36+
we use es6 classes in Grafana. So it's easier to get inspiration from the Grafana repo if you choose one of those languages.
3737

3838
## Buildscript
3939

@@ -60,7 +60,6 @@ and [apps]({{< relref "apps.md" >}}) plugins in the documentation.
6060
The Grafana SDK is quite small so far and can be found here:
6161

6262
- [SDK file in Grafana](https://github.com/grafana/grafana/blob/master/public/app/plugins/sdk.ts)
63-
- [SDK Readme](https://github.com/grafana/grafana/blob/master/public/app/plugins/plugin_api.md)
6463

6564
The SDK contains three different plugin classes: PanelCtrl, MetricsPanelCtrl and QueryCtrl. For plugins of the panel type, the module.js file should export one of these. There are some extra classes for [data sources]({{< relref "datasources.md" >}}).
6665

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"style-loader": "^0.21.0",
8181
"systemjs": "0.20.19",
8282
"systemjs-plugin-css": "^0.1.36",
83-
"ts-jest": "^23.1.4",
83+
"ts-jest": "^23.10.4",
8484
"ts-loader": "^5.1.0",
8585
"tslib": "^1.9.3",
8686
"tslint": "^5.8.0",

pkg/api/http_server.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
"github.com/grafana/grafana/pkg/models"
2929
"github.com/grafana/grafana/pkg/plugins"
3030
"github.com/grafana/grafana/pkg/registry"
31+
"github.com/grafana/grafana/pkg/services/hooks"
3132
"github.com/grafana/grafana/pkg/services/rendering"
3233
"github.com/grafana/grafana/pkg/setting"
3334
)
@@ -52,6 +53,7 @@ type HTTPServer struct {
5253
Bus bus.Bus `inject:""`
5354
RenderService rendering.Service `inject:""`
5455
Cfg *setting.Cfg `inject:""`
56+
HooksService *hooks.HooksService `inject:""`
5557
}
5658

5759
func (hs *HTTPServer) Init() error {

pkg/api/index.go

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -316,27 +316,20 @@ func (hs *HTTPServer) setIndexViewData(c *m.ReqContext) (*dtos.IndexViewData, er
316316
}
317317

318318
if c.IsGrafanaAdmin {
319-
children := []*dtos.NavLink{
320-
{Text: "Users", Id: "global-users", Url: setting.AppSubUrl + "/admin/users", Icon: "gicon gicon-user"},
321-
{Text: "Orgs", Id: "global-orgs", Url: setting.AppSubUrl + "/admin/orgs", Icon: "gicon gicon-org"},
322-
{Text: "Settings", Id: "server-settings", Url: setting.AppSubUrl + "/admin/settings", Icon: "gicon gicon-preferences"},
323-
{Text: "Stats", Id: "server-stats", Url: setting.AppSubUrl + "/admin/stats", Icon: "fa fa-fw fa-bar-chart"},
324-
}
325-
326-
if setting.IsEnterprise {
327-
children = append(children, &dtos.NavLink{Text: "Licensing", Id: "licensing", Url: setting.AppSubUrl + "/admin/licensing", Icon: "fa fa-fw fa-unlock-alt"})
328-
}
329-
330-
children = append(children, &dtos.NavLink{Text: "Style Guide", Id: "styleguide", Url: setting.AppSubUrl + "/styleguide", Icon: "fa fa-fw fa-eyedropper"})
331-
332319
cfgNode.Children = append(cfgNode.Children, &dtos.NavLink{
333320
Text: "Server Admin",
334321
HideFromTabs: true,
335322
SubTitle: "Manage all users & orgs",
336323
Id: "admin",
337324
Icon: "gicon gicon-shield",
338325
Url: setting.AppSubUrl + "/admin/users",
339-
Children: children,
326+
Children: []*dtos.NavLink{
327+
{Text: "Users", Id: "global-users", Url: setting.AppSubUrl + "/admin/users", Icon: "gicon gicon-user"},
328+
{Text: "Orgs", Id: "global-orgs", Url: setting.AppSubUrl + "/admin/orgs", Icon: "gicon gicon-org"},
329+
{Text: "Settings", Id: "server-settings", Url: setting.AppSubUrl + "/admin/settings", Icon: "gicon gicon-preferences"},
330+
{Text: "Stats", Id: "server-stats", Url: setting.AppSubUrl + "/admin/stats", Icon: "fa fa-fw fa-bar-chart"},
331+
{Text: "Style Guide", Id: "styleguide", Url: setting.AppSubUrl + "/styleguide", Icon: "fa fa-fw fa-eyedropper"},
332+
},
340333
})
341334
}
342335

@@ -357,6 +350,7 @@ func (hs *HTTPServer) setIndexViewData(c *m.ReqContext) (*dtos.IndexViewData, er
357350
},
358351
})
359352

353+
hs.HooksService.RunIndexDataHooks(&data)
360354
return &data, nil
361355
}
362356

pkg/services/alerting/notifiers/telegram.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,13 @@ func (this *TelegramNotifier) buildMessageInlineImage(evalContext *alerting.Eval
127127
var err error
128128

129129
imageFile, err = os.Open(evalContext.ImageOnDiskPath)
130-
defer imageFile.Close()
130+
defer func() {
131+
err := imageFile.Close()
132+
if err != nil {
133+
log.Error2("Could not close Telegram inline image.", "err", err)
134+
}
135+
}()
136+
131137
if err != nil {
132138
return nil, err
133139
}

pkg/services/hooks/hooks.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package hooks
2+
3+
import (
4+
"github.com/grafana/grafana/pkg/api/dtos"
5+
"github.com/grafana/grafana/pkg/registry"
6+
)
7+
8+
type IndexDataHook func(indexData *dtos.IndexViewData)
9+
10+
type HooksService struct {
11+
indexDataHooks []IndexDataHook
12+
}
13+
14+
func init() {
15+
registry.RegisterService(&HooksService{})
16+
}
17+
18+
func (srv *HooksService) Init() error {
19+
return nil
20+
}
21+
22+
func (srv *HooksService) AddIndexDataHook(hook IndexDataHook) {
23+
srv.indexDataHooks = append(srv.indexDataHooks, hook)
24+
}
25+
26+
func (srv *HooksService) RunIndexDataHooks(indexData *dtos.IndexViewData) {
27+
for _, hook := range srv.indexDataHooks {
28+
hook(indexData)
29+
}
30+
}

pkg/services/sqlstore/user_auth_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ func TestUserAuth(t *testing.T) {
1616
Convey("Given 5 users", t, func() {
1717
var err error
1818
var cmd *m.CreateUserCommand
19-
users := []m.User{}
2019
for i := 0; i < 5; i++ {
2120
cmd = &m.CreateUserCommand{
2221
Email: fmt.Sprint("user", i, "@test.com"),
@@ -25,7 +24,6 @@ func TestUserAuth(t *testing.T) {
2524
}
2625
err = CreateUser(context.Background(), cmd)
2726
So(err, ShouldBeNil)
28-
users = append(users, cmd.Result)
2927
}
3028

3129
Reset(func() {

pkg/tsdb/mssql/mssql_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ func TestMSSQL(t *testing.T) {
692692
},
693693
}
694694

695-
resp, err := endpoint.Query(nil, nil, query)
695+
resp, err := endpoint.Query(context.Background(), nil, query)
696696
So(err, ShouldBeNil)
697697
queryResult := resp.Results["A"]
698698
So(queryResult.Error, ShouldBeNil)

0 commit comments

Comments
 (0)