working on inspector

This commit is contained in:
Torkel Ödegaard
2014-04-05 13:26:48 +02:00
parent a9abd2ff5c
commit 58ef61a0bb
7 changed files with 81 additions and 5 deletions
+62
View File
@@ -0,0 +1,62 @@
define([
'angular'
],
function (angular) {
'use strict';
var module = angular.module('kibana.controllers');
module.controller('InspectCtrl', function($scope) {
$scope.init = function () {
if ($scope.inspector_info) {
$scope.init_model($scope.inspector_info);
}
};
$scope.init_model = function(info) {
if (info.error) {
console.log(info.error);
if (info.error.config && info.error.config.data) {
$scope.request_parameters = info.error.config.data.split('&');
}
if (info.error.data) {
if (info.error.data.indexOf('DOCTYPE') !== -1) {
$scope.response_html = info.error.data;
}
}
}
};
});
angular
.module('kibana.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();
}
};
});
});
+7
View File
@@ -124,6 +124,13 @@ function (angular, app, _) {
*/
type : type
};
if (!$scope.row.height) {
$scope.row.height = "200px";
}
else if($scope.row.height.indexOf('px') === -1) {
$scope.row.height = $scope.row.height + 'px';
}
};
/** @scratch /panels/2
+2 -2
View File
@@ -16,10 +16,10 @@ function (angular, $, _) {
var panelHeader =
'<div class="panel-header">'+
'<div class="row-fluid">' +
'<div class="span12 alert-error panel-error" ng-if="panel.error">' +
'<div class="span12 alert-error panel-error small" ng-if="panel.error">' +
'<a class="close" ng-click="panel.error=false">&times;</a>' +
'<span><i class="icon-exclamation-sign"></i> <strong>Oops!</strong> {{panel.error}} </span>' +
'<span class="pointer" config-modal="app/partials/inspector.html"> &nbsp;&nbsp; (inspect)</span>' +
'<span class="pointer panel-error-inspector-link" config-modal="app/partials/inspector.html">View details</span>' +
'</div>' +
'</div>\n' +
+2
View File
@@ -261,8 +261,10 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
return $scope.datasource.query(graphiteQuery)
.then($scope.dataHandler)
.then(null, function(err) {
$scope.panelMeta.loading = false;
$scope.inspector_info = { error: err };
$scope.panel.error = err.message || "Graphite HTTP Request Error";
$scope.render([]);
});
};
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+6 -1
View File
@@ -112,7 +112,12 @@ code, pre {
.panel-error {
color: @white;
padding: 3px 10px 0px 10px;
padding: 5px 10px 0px 10px;
}
.panel-error-inspector-link {
float: right;
margin-right: 10px;
}