Merge branch 'master' of github.com:grafana/grafana

This commit is contained in:
Torkel Ödegaard 2016-01-13 10:40:58 +01:00
commit ed989ecc8d
7 changed files with 80 additions and 1 deletions

2
.gitignore vendored
View File

@ -31,5 +31,5 @@ public/css/*.min.css
conf/custom.ini
fig.yml
profile.cov
grafana
/grafana
.notouch

View File

@ -1,5 +1,8 @@
# 3.0.0 (unrelased master branch)
### New Features ###
* **Playlists**: Playlists can now be persisted and started from urls, closes [#3655](https://github.com/grafana/grafana/pull/3655)
### Breaking changes
**InfluxDB 0.8.x** The data source for the old version of influxdb (0.8.x) is no longer included in default builds. Can easily be installed via improved plugin system, closes #3523
**KairosDB** The data source is no longer included in default builds. Can easily be installed via improved plugin system, closes #3524

View File

@ -147,6 +147,11 @@ func Register(r *macaron.Macaron) {
r.Put("/quotas/:target", bind(m.UpdateOrgQuotaCmd{}), wrap(UpdateOrgQuota))
}, reqGrafanaAdmin)
// orgs (admin routes)
r.Group("/orgs/name/:name", func() {
r.Get("/", wrap(GetOrgByName))
}, reqGrafanaAdmin)
// auth api keys
r.Group("/auth/keys", func() {
r.Get("/", wrap(GetApiKeys))

View File

@ -20,6 +20,33 @@ func GetOrgById(c *middleware.Context) Response {
return getOrgHelper(c.ParamsInt64(":orgId"))
}
// Get /api/orgs/:name
func GetOrgByName(c *middleware.Context) Response {
query := m.GetOrgByNameQuery{Name: c.Params(":name")}
if err := bus.Dispatch(&query); err != nil {
if err == m.ErrOrgNotFound {
return ApiError(404, "Organization not found", err)
}
return ApiError(500, "Failed to get organization", err)
}
org := query.Result
result := m.OrgDetailsDTO{
Id: org.Id,
Name: org.Name,
Address: m.Address{
Address1: org.Address1,
Address2: org.Address2,
City: org.City,
ZipCode: org.ZipCode,
State: org.State,
Country: org.Country,
},
}
return Json(200, &result)
}
func getOrgHelper(orgId int64) Response {
query := m.GetOrgByIdQuery{Id: orgId}

View File

@ -0,0 +1,16 @@
///<reference path="../../../headers/common.d.ts" />
class GrafanaDatasource {
constructor(private backendSrv) {}
query(options) {
return this.backendSrv.get('/api/metrics/test', {
from: options.range.from.valueOf(),
to: options.range.to.valueOf(),
maxDataPoints: options.maxDataPoints
});
}
}
export {GrafanaDatasource};

View File

@ -0,0 +1,14 @@
///<reference path="../../../headers/common.d.ts" />
import angular from 'angular';
import {GrafanaDatasource} from './datasource';
var module = angular.module('grafana.directives');
module.directive('metricQueryEditorGrafana', function() {
return {templateUrl: 'app/plugins/datasource/grafana/partials/query.editor.html'};
});
export {GrafanaDatasource, GrafanaDatasource as Datasource};

View File

@ -0,0 +1,14 @@
///<reference path="../../../headers/common.d.ts" />
import angular from 'angular';
import {MixedDatasource} from './datasource';
var module = angular.module('grafana.directives');
module.directive('metricQueryEditorMixed', function() {
return {templateUrl: 'app/plugins/datasource/mixed/partials/query.editor.html'};
});
export {MixedDatasource, MixedDatasource as Datasource};