diff --git a/public/app/controllers/inspectCtrl.js b/public/app/controllers/inspectCtrl.js index d6034516a6b..e70a88323e9 100644 --- a/public/app/controllers/inspectCtrl.js +++ b/public/app/controllers/inspectCtrl.js @@ -1,8 +1,9 @@ define([ 'angular', - 'lodash' + 'lodash', + 'jquery', ], -function (angular, _) { +function (angular, _, $) { 'use strict'; var module = angular.module('grafana.controllers'); @@ -30,7 +31,11 @@ function (angular, _) { } if (_.isString(model.error.data)) { - $scope.response = model.error.data; + $scope.response = $("
" + model.error.data + "
").text(); + } else if (model.error.data) { + $scope.response = angular.toJson(model.error.data, true); + } else if (model.error.message) { + $scope.message = model.error.message; } if (model.error.config && model.error.config.params) { @@ -44,43 +49,20 @@ function (angular, _) { $scope.stack_trace = model.error.stack; $scope.message = model.error.message; } - else if (model.error.config && model.error.config.data) { + + if (model.error.config && model.error.config.data) { $scope.editor.index = 1; - $scope.request_parameters = getParametersFromQueryString(model.error.config.data); - - if (model.error.data.indexOf('DOCTYPE') !== -1) { - $scope.response_html = model.error.data; + if (_.isString(model.error.config.data)) { + $scope.request_parameters = getParametersFromQueryString(model.error.config.data); + } else { + $scope.request_parameters = _.map(model.error.config.data, function(value, key) { + return {key: key, value: angular.toJson(value, true)}; + }); } } }; }); - angular - .module('grafana.directives') - .directive('iframeContent', function($parse) { - return { - restrict: 'A', - link: function($scope, elem, attrs) { - var getter = $parse(attrs.iframeContent), value = getter($scope); - - $scope.$on("$destroy",function() { - elem.remove(); - }); - - var iframe = document.createElement('iframe'); - iframe.width = '100%'; - iframe.height = '400px'; - iframe.style.border = 'none'; - iframe.src = 'about:blank'; - elem.append(iframe); - - iframe.contentWindow.document.open('text/html', 'replace'); - iframe.contentWindow.document.write(value); - iframe.contentWindow.document.close(); - } - }; - }); - }); diff --git a/public/app/directives/configModal.js b/public/app/directives/configModal.js index b7e579e7026..35a70173798 100644 --- a/public/app/directives/configModal.js +++ b/public/app/directives/configModal.js @@ -24,9 +24,9 @@ function (angular, _, $) { var panelModal = $modal({ template: partial, - persist: true, + persist: false, show: false, - scope: scope, + scope: scope.$new(), keyboard: false }); diff --git a/public/app/partials/inspector.html b/public/app/partials/inspector.html index 14069f31961..7e7c25209f5 100644 --- a/public/app/partials/inspector.html +++ b/public/app/partials/inspector.html @@ -49,12 +49,10 @@
-
- -
-
-
- +
{{message}}
+
+{{response}}
+			
diff --git a/public/app/plugins/datasource/influxdb/datasource.js b/public/app/plugins/datasource/influxdb/datasource.js index 7a37bac2a7f..fb9bb0f8e46 100644 --- a/public/app/plugins/datasource/influxdb/datasource.js +++ b/public/app/plugins/datasource/influxdb/datasource.js @@ -161,13 +161,13 @@ function (angular, _, kbn, InfluxSeries, InfluxQueryBuilder) { return $http(options).then(function(result) { return result.data; - }, function(reason) { - if (reason.status !== 0 || reason.status >= 300) { - if (reason.data && reason.data.error) { - throw { message: 'InfluxDB Error Response: ' + reason.data.error }; + }, function(err) { + if (err.status !== 0 || err.status >= 300) { + if (err.data && err.data.error) { + throw { message: 'InfluxDB Error Response: ' + err.data.error, data: err.data, config: err.config }; } else { - throw { messsage: 'InfluxDB Error: ' + reason.message }; + throw { messsage: 'InfluxDB Error: ' + err.message, data: err.data, config: err.config }; } } });