Merge branch 'master' into graphite-series-by-tags

This commit is contained in:
Torkel Ödegaard
2017-11-16 16:20:44 +01:00
82 changed files with 10934 additions and 165 deletions

View File

@@ -333,7 +333,7 @@ function (angular, _, moment, dateMath, kbn, templatingVariable) {
};
return backendSrv.datasourceRequest(options).then(function(result) {
return result;
return result.data;
});
};

View File

@@ -68,7 +68,7 @@ describe('CloudWatchDatasource', function() {
beforeEach(function() {
ctx.backendSrv.datasourceRequest = function(params) {
requestParams = params.data;
return ctx.$q.when(response);
return ctx.$q.when({data: response});
};
});
@@ -213,7 +213,7 @@ describe('CloudWatchDatasource', function() {
beforeEach(function() {
ctx.backendSrv.datasourceRequest = function(params) {
requestParams = params.data;
return ctx.$q.when(response);
return ctx.$q.when({data: response});
};
});
@@ -235,7 +235,7 @@ describe('CloudWatchDatasource', function() {
setupCallback();
ctx.backendSrv.datasourceRequest = args => {
scenario.request = args.data;
return ctx.$q.when(scenario.requestResponse);
return ctx.$q.when({data: scenario.requestResponse});
};
ctx.ds.metricFindQuery(query).then(args => {
scenario.result = args;

View File

@@ -19,6 +19,7 @@ export class PrometheusDatasource {
basicAuth: any;
withCredentials: any;
metricsNameCache: any;
interval: string;
/** @ngInject */
constructor(instanceSettings,
@@ -34,6 +35,7 @@ export class PrometheusDatasource {
this.directUrl = instanceSettings.directUrl;
this.basicAuth = instanceSettings.basicAuth;
this.withCredentials = instanceSettings.withCredentials;
this.interval = instanceSettings.jsonData.timeInterval || '15s';
}
_request(method, url, requestId?) {

View File

@@ -1,3 +1,16 @@
<datasource-http-settings current="ctrl.current" suggest-url="http://localhost:9090">
</datasource-http-settings>
<div class="gf-form-group">
<div class="gf-form-inline">
<div class="gf-form">
<span class="gf-form-label">Scrape interval</span>
<input type="text" class="gf-form-input width-6" ng-model="ctrl.current.jsonData.timeInterval" spellcheck='false' placeholder="15s"></input>
<info-popover mode="right-absolute">
Set this to your global scrape interval defined in your Prometheus config file. This will be used as a lower limit for
the Prometheus step query parameter.
</info-popover>
</div>
</div>
</div>

View File

@@ -5,7 +5,7 @@ import {PrometheusDatasource} from '../datasource';
describe('PrometheusDatasource', function() {
var ctx = new helpers.ServiceTestContext();
var instanceSettings = {url: 'proxied', directUrl: 'direct', user: 'test', password: 'mupp' };
var instanceSettings = {url: 'proxied', directUrl: 'direct', user: 'test', password: 'mupp', jsonData: {}};
beforeEach(angularMocks.module('grafana.core'));
beforeEach(angularMocks.module('grafana.services'));

View File

@@ -8,7 +8,7 @@ import PrometheusMetricFindQuery from '../metric_find_query';
describe('PrometheusMetricFindQuery', function() {
var ctx = new helpers.ServiceTestContext();
var instanceSettings = {url: 'proxied', directUrl: 'direct', user: 'test', password: 'mupp' };
var instanceSettings = {url: 'proxied', directUrl: 'direct', user: 'test', password: 'mupp', jsonData: {}};
beforeEach(angularMocks.module('grafana.core'));
beforeEach(angularMocks.module('grafana.services'));

View File

@@ -8,7 +8,7 @@
<span class="dashlist-title">
{{dash.title}}
</span>
<span class="dashlist-star">
<span class="dashlist-star" ng-click="ctrl.starDashboard(dash, $event)">
<i class="fa" ng-class="{'fa-star': dash.isStarred, 'fa-star-o': dash.isStarred === false}"></i>
</span>
</a>

View File

@@ -21,7 +21,7 @@ class DashListCtrl extends PanelCtrl {
};
/** @ngInject */
constructor($scope, $injector, private backendSrv) {
constructor($scope, $injector, private backendSrv, private dashboardSrv) {
super($scope, $injector);
_.defaults(this.panel, this.panelDefaults);
@@ -105,6 +105,17 @@ class DashListCtrl extends PanelCtrl {
});
}
starDashboard(dash, evt) {
this.dashboardSrv.starDashboard(dash.id, dash.isStarred).then(newState => {
dash.isStarred = newState;
});
if (evt) {
evt.stopPropagation();
evt.preventDefault();
}
}
getRecentDashboards() {
this.groups[1].show = this.panel.recent;
if (!this.panel.recent) {