Handle errors when loading dashboard with template variables that query data sources that cannot be found

This commit is contained in:
Torkel Ödegaard 2015-04-07 13:48:26 +02:00
parent 8f73328e25
commit 646298f5c5
3 changed files with 9 additions and 1 deletions

View File

@ -11,6 +11,7 @@ func Gziper() macaron.Handler {
return func(ctx *macaron.Context) {
requestPath := ctx.Req.URL.RequestURI()
// ignore datasource proxy requests
if strings.HasPrefix(requestPath, "/api/datasources/proxy") {
return
}

View File

@ -45,7 +45,7 @@ function (angular, $, config) {
// template values service needs to initialize completely before
// the rest of the dashboard can load
templateValuesSrv.init(dashboard).then(function() {
templateValuesSrv.init(dashboard).finally(function() {
$scope.dashboard = dashboard;
$scope.dashboardMeta = dashboard.meta;
$scope.dashboardViewState = dashboardViewStateSrv.create($scope);
@ -57,6 +57,9 @@ function (angular, $, config) {
$scope.setWindowTitleAndTheme();
$scope.appEvent("dashboard-loaded", $scope.dashboard);
}).catch(function(err) {
console.log('Failed to initialize dashboard template variables, error: ', err);
$scope.appEvent("alert-error", ['Dashboard init failed', 'Template variables could not be initialized: ' + err.message]);
});
};

View File

@ -31,6 +31,10 @@ function (angular, _, kbn) {
return backendSrv.get('/api/metrics/test', { from: from, to: to, maxDataPoints: options.maxDataPoints });
};
GrafanaDatasource.prototype.metricFindQuery = function() {
return $q.when([]);
};
GrafanaDatasource.prototype.starDashboard = function(dashId) {
return backendSrv.post('/api/user/stars/dashboard/' + dashId);
};