Merge branch 'master' into alerting_mqe

This commit is contained in:
bergquist
2016-12-13 16:15:04 +01:00
10 changed files with 56 additions and 72 deletions

View File

@@ -11,7 +11,8 @@
* **Elasticsearch**: Added support for Missing option (bucket) for terms aggregation [#4244](https://github.com/grafana/grafana/pull/4244), thx [@shanielh](https://github.com/shanielh) * **Elasticsearch**: Added support for Missing option (bucket) for terms aggregation [#4244](https://github.com/grafana/grafana/pull/4244), thx [@shanielh](https://github.com/shanielh)
* **Elasticsearch**: Added support for Elasticsearch 5.x [#6356](https://github.com/grafana/grafana/pull/6356), thx [@lpic10](https://github.com/lpic10) * **Elasticsearch**: Added support for Elasticsearch 5.x [#6356](https://github.com/grafana/grafana/pull/6356), thx [@lpic10](https://github.com/lpic10)
* **CLI**: Make it possible to reset the admin password using the grafana-cli. [#5479](https://github.com/grafana/grafana/issues/5479) * **CLI**: Make it possible to reset the admin password using the grafana-cli. [#5479](https://github.com/grafana/grafana/issues/5479)
* **Influxdb**: Support multiple tags in InfluxDB annotations. [#4550](https://github.com/grafana/grafana/pull/4550) * **Influxdb**: Support multiple tags in InfluxDB annotations. [#4550](https://github.com/grafana/grafana/pull/4550), thx [@adrianlzt](https://github.com/adrianlzt)
* **LDAP**: Basic Auth now supports LDAP username and password, [#6940](https://github.com/grafana/grafana/pull/6940), thx [@utkarshcmu](https://github.com/utkarshcmu)
### Bugfixes ### Bugfixes
* **API**: HTTP API for deleting org returning incorrect message for a non-existing org [#6679](https://github.com/grafana/grafana/issues/6679) * **API**: HTTP API for deleting org returning incorrect message for a non-existing org [#6679](https://github.com/grafana/grafana/issues/6679)

View File

@@ -1,16 +0,0 @@
FROM debian:jessie
RUN apt-get -y update
RUN apt-get -y install libfontconfig
RUN mkdir -p /opt/grafana
ADD tmp/ /opt/grafana/
EXPOSE 3000
VOLUME ["/opt/grafana/data"]
VOLUME ["/opt/grafana/conf"]
WORKDIR /opt/grafana/
ENTRYPOINT ["./grafana", "web"]

View File

@@ -1,31 +0,0 @@
# Grafana docker image
This container currently only contains the in development alpha of Grafana 2.0 (ie non production use). The
`#develop` tag is constantly updated as we make progress towards a beta release.
## Running your Grafana image
--------------------------
Start your image binding the external port `3000`.
docker run -i -p 3000:3000 grafana/grafana
Try it out, default admin user is admin/admin.
## Configuring your Grafana container
All options defined in conf/grafana.ini can be overridden using environment variables, for example:
```
docker run -i -p 3000:3000 \
-e "GF_SERVER_ROOT_URL=http://grafana.server.name" \
-e "GF_SECURITY_ADMIN_PASSWORD=secret" \
grafana/grafana:develop
```

View File

@@ -1,15 +0,0 @@
#!/bin/bash
cp Dockerfile ../../
cd ../../
go run build.go build
grunt release
docker build --tag "grafana/grafana:develop" .
rm Dockerfile
cd docker/production

View File

@@ -1,5 +0,0 @@
#!/bin/bash
docker run -i -p 3001:3000 \
-e "GF_SERVER_ROOT_URL=http://grafana.server.name" \
grafana/grafana:develop

View File

@@ -18,7 +18,7 @@ Currently you can authenticate via an `API Token` or via a `Session cookie` (acq
## Basic Auth ## Basic Auth
If basic auth is enabled (it is enabled by default) you can authenticate your HTTP request via If basic auth is enabled (it is enabled by default) you can authenticate your HTTP request via
standard basic auth. standard basic auth. Basic auth will also authenticate LDAP users.
curl example: curl example:
``` ```

View File

@@ -9,6 +9,7 @@ import (
"github.com/grafana/grafana/pkg/bus" "github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/components/apikeygen" "github.com/grafana/grafana/pkg/components/apikeygen"
"github.com/grafana/grafana/pkg/log" "github.com/grafana/grafana/pkg/log"
l "github.com/grafana/grafana/pkg/login"
"github.com/grafana/grafana/pkg/metrics" "github.com/grafana/grafana/pkg/metrics"
m "github.com/grafana/grafana/pkg/models" m "github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/setting"
@@ -137,6 +138,7 @@ func initContextWithApiKey(ctx *Context) bool {
} }
func initContextWithBasicAuth(ctx *Context) bool { func initContextWithBasicAuth(ctx *Context) bool {
if !setting.BasicAuthEnabled { if !setting.BasicAuthEnabled {
return false return false
} }
@@ -160,9 +162,9 @@ func initContextWithBasicAuth(ctx *Context) bool {
user := loginQuery.Result user := loginQuery.Result
// validate password loginUserQuery := l.LoginUserQuery{Username: username, Password: password, User: user}
if util.EncodePassword(password, user.Salt) != user.Password { if err := bus.Dispatch(&loginUserQuery); err != nil {
ctx.JsonApiErr(401, "Invalid username or password", nil) ctx.JsonApiErr(401, "Invalid username or password", err)
return true return true
} }

View File

@@ -9,6 +9,7 @@ import (
"github.com/go-macaron/session" "github.com/go-macaron/session"
"github.com/grafana/grafana/pkg/bus" "github.com/grafana/grafana/pkg/bus"
l "github.com/grafana/grafana/pkg/login"
m "github.com/grafana/grafana/pkg/models" m "github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/setting" "github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/util" "github.com/grafana/grafana/pkg/util"
@@ -58,6 +59,10 @@ func TestMiddlewareContext(t *testing.T) {
return nil return nil
}) })
bus.AddHandler("test", func(loginUserQuery *l.LoginUserQuery) error {
return nil
})
bus.AddHandler("test", func(query *m.GetSignedInUserQuery) error { bus.AddHandler("test", func(query *m.GetSignedInUserQuery) error {
query.Result = &m.SignedInUser{OrgId: 2, UserId: 12} query.Result = &m.SignedInUser{OrgId: 2, UserId: 12}
return nil return nil

View File

@@ -0,0 +1,20 @@
import {describe, beforeEach, it, sinon, expect, angularMocks} from 'test/lib/common';
import {AlertTabCtrl} from '../alert_tab_ctrl';
import helpers from '../../../../test/specs/helpers';
describe('AlertTabCtrl', () => {
var $scope = {
ctrl: {}
};
describe('with null parameters', () => {
it('can be created', () => {
var alertTab = new AlertTabCtrl($scope, null, null, null, null, null, null, null);
expect(alertTab).to.not.be(null);
});
});
});

View File

@@ -160,4 +160,27 @@ describe('GraphiteQueryCtrl', function() {
expect(ctx.panelCtrl.refresh.called).to.be(true); expect(ctx.panelCtrl.refresh.called).to.be(true);
}); });
}); });
describe('when updating targets with nested query', function() {
beforeEach(function() {
ctx.ctrl.target.target = 'scaleToSeconds(#A)';
ctx.ctrl.datasource.metricFindQuery = sinon.stub().returns(ctx.$q.when([{expandable: false}]));
ctx.ctrl.parseTarget();
ctx.ctrl.panelCtrl.panel.targets = [ {
target: 'nested.query.count',
refId: 'A'
}];
ctx.ctrl.updateModelTarget();
});
it('target should remain the same', function() {
expect(ctx.ctrl.target.target).to.be('scaleToSeconds(#A)');
});
it('targetFull should include nexted queries', function() {
expect(ctx.ctrl.target.targetFull).to.be('scaleToSeconds(nested.query.count)');
});
});
}); });