Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: tim-group/norman
base: c984e846e3
...
head fork: tim-group/norman
compare: 953e397311
  • 3 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 26 additions and 8 deletions.
  1. +1 −1  app/js/app.js
  2. +25 −7 app/js/controllers.js
View
2  app/js/app.js
@@ -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
32 app/js/controllers.js
@@ -3,15 +3,33 @@
/* Controllers */
function cleanData(data) {
- var jsonStringWithoutEvilAtSigns = angular.toJson(data).replace(/@/g, "")
- return angular.fromJson(jsonStringWithoutEvilAtSigns);
+ var out = {};
+ for (var key in data) {
+ var newKey = key.replace(/@/g, "");
+ out[newKey] = data[key];
+ }
+ return out;
}
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(cleanData(hit["_source"]));
+ })
+ $scope.reports = d;
});
-
$scope.orderProp = 'age';
}
@@ -20,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"]);
});
}

No commit comments for this range

Something went wrong with that request. Please try again.