Permalink
Browse files

Hacking ES in

  • Loading branch information...
1 parent 5c89a67 commit 83f89f88b153d3abd0f028e57bc464c3e9bc6c1b @bobtfish bobtfish committed Mar 29, 2013
Showing with 20 additions and 6 deletions.
  1. +1 −1 app/js/app.js
  2. +19 −5 app/js/controllers.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'});
}]);
View
@@ -12,10 +12,24 @@ function cleanData(data) {
}
function ReportListCtrl($scope, $http) {
- $http.get('data/reports_latest.json').success(function(data) {
- $scope.reports = cleanData(data);
+ $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(hit["_source"]);
+ })
+ $scope.reports = cleanData(d);
});
-
$scope.orderProp = 'age';
}
@@ -24,8 +38,8 @@ function ReportListCtrl($scope, $http) {
function ReportDetailCtrl($scope, $routeParams, $http) {
$scope.uuid = $routeParams.uuid;
- $http.get('data/' + $routeParams.uuid + '.json').success(function(data) {
- $scope.report = cleanData(data);
+ $http.get('/es/' + $routeParams.index + '/puppet-apply/' + $routeParams.uuid).success(function(data) {
+ $scope.report = cleanData(data["_source"]);
});
}

0 comments on commit 83f89f8

Please sign in to comment.