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

pull/1738/head
Torkel Ödegaard 10 years ago
parent 8f73328e25
commit 646298f5c5
  1. 1
      pkg/middleware/util.go
  2. 5
      public/app/features/dashboard/dashboardCtrl.js
  3. 4
      public/app/plugins/datasource/grafana/datasource.js

@ -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
}

@ -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]);
});
};

@ -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);
};

Loading…
Cancel
Save