Commit 58ef61a0 by Torkel Ödegaard

working on inspector

parent a9abd2ff
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();
}
};
});
});
\ No newline at end of file
...@@ -124,6 +124,13 @@ function (angular, app, _) { ...@@ -124,6 +124,13 @@ function (angular, app, _) {
*/ */
type : type 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 /** @scratch /panels/2
......
...@@ -16,10 +16,10 @@ function (angular, $, _) { ...@@ -16,10 +16,10 @@ function (angular, $, _) {
var panelHeader = var panelHeader =
'<div class="panel-header">'+ '<div class="panel-header">'+
'<div class="row-fluid">' + '<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>' + '<a class="close" ng-click="panel.error=false">&times;</a>' +
'<span><i class="icon-exclamation-sign"></i> <strong>Oops!</strong> {{panel.error}} </span>' + '<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>' +
'</div>\n' + '</div>\n' +
......
...@@ -261,8 +261,10 @@ function (angular, app, $, _, kbn, moment, timeSeries) { ...@@ -261,8 +261,10 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
return $scope.datasource.query(graphiteQuery) return $scope.datasource.query(graphiteQuery)
.then($scope.dataHandler) .then($scope.dataHandler)
.then(null, function(err) { .then(null, function(err) {
$scope.panelMeta.loading = false;
$scope.inspector_info = { error: err }; $scope.inspector_info = { error: err };
$scope.panel.error = err.message || "Graphite HTTP Request Error"; $scope.panel.error = err.message || "Graphite HTTP Request Error";
$scope.render([]);
}); });
}; };
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -112,7 +112,12 @@ code, pre { ...@@ -112,7 +112,12 @@ code, pre {
.panel-error { .panel-error {
color: @white; color: @white;
padding: 3px 10px 0px 10px; padding: 5px 10px 0px 10px;
}
.panel-error-inspector-link {
float: right;
margin-right: 10px;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment