Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Hacking ES in

  • Loading branch information...
commit 2323d6dfb19b1d557e7c598cbc6af31b89c034ff 1 parent e1aba13
Tomas Doran bobtfish authored
Showing with 19 additions and 12 deletions.
  1. +1 −1  app/js/app.js
  2. +18 −11 app/js/controllers.js
2  app/js/app.js
View
@@ -6,6 +6,6 @@ angular.module('norman', []).
config(['$routeProvider', function($routeProvider) {
$routeProvider.
when('/latest', {templateUrl: 'partials/report-latest.html', controller: ReportListCtrl}).
- when('/report/:uuid', {templateUrl: 'partials/report-detail.html', controller: ReportDetailCtrl}).
+ when('/report/:index/:uuid', {templateUrl: 'partials/report-detail.html', controller: ReportDetailCtrl}).
otherwise({redirectTo: '/latest'});
}]);
29 app/js/controllers.js
View
@@ -12,13 +12,22 @@ function cleanData(data) {
}
function ReportListCtrl($scope, $http) {
- $http.get('data/reports_latest.json').success(function(data) {
- var d = [];
- data.forEach(function(datum) {
- var dat = cleanData(datum);
- addContextTo(dat);
- d.push(dat);
- });
+ $http.post('/es/_all/puppet-apply/_search', angular.toJson({
+ "from" : 0, "size" : 100,
+ "query": {
+ "term": {
+ "@tags": "puppet-apply"
+ }
+ },
+ "sort" : [
+ { "@timestamp" : {"order" : "desc"} }
+ ]
+})).success(function(data) {
+ var d = []
+ data['hits']['hits'].forEach(function(hit) {
+ hit["_source"]["uuid"] = hit["_index"].concat("/").concat(hit["_id"]);
+ d.push(addContextTo(cleanData(hit["_source"])));
+ })
$scope.reports = d;
});
@@ -29,10 +38,8 @@ function ReportListCtrl($scope, $http) {
function ReportDetailCtrl($scope, $routeParams, $http) {
$scope.uuid = $routeParams.uuid;
- $http.get('data/' + $routeParams.uuid + '.json').success(function(data) {
- var parsedData = cleanData(data);
- addContextTo(parsedData);
- $scope.report = parsedData;
+ $http.get('/es/' + $routeParams.index + '/puppet-apply/' + $routeParams.uuid).success(function(data) {
+ $scope.report = addContextTo(cleanData(data["_source"]));
});
}
Please sign in to comment.
Something went wrong with that request. Please try again.