working on inspector
This commit is contained in:
@@ -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();
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
});
|
||||
@@ -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
|
||||
|
||||
@@ -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">×</a>' +
|
||||
'<span><i class="icon-exclamation-sign"></i> <strong>Oops!</strong> {{panel.error}} </span>' +
|
||||
'<span class="pointer" config-modal="app/partials/inspector.html"> (inspect)</span>' +
|
||||
'<span class="pointer panel-error-inspector-link" config-modal="app/partials/inspector.html">View details</span>' +
|
||||
'</div>' +
|
||||
'</div>\n' +
|
||||
|
||||
|
||||
@@ -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([]);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user