lib/puppet-herald/public/report/report.js in puppet-herald-0.2.0 vs lib/puppet-herald/public/report/report.js in puppet-herald-0.8.0

- old
+ new

@@ -1,26 +1,33 @@ +(function() { + 'use strict'; angular.module('herald.report', [ - 'ngRoute', + 'ui.router', 'herald.page', 'herald.directives' ]) -.config(['$routeProvider', function($routeProvider) { - $routeProvider.when('/report/:reportId', { - templateUrl: 'report/report.html', - controller: 'ReportController' - }); -}]) - -.controller('ReportController', ['$http', '$routeParams', 'Page', function($http, $routeParams, Page) { - Page.title('Report'); +.controller('ReportController', ['$http', '$stateParams', 'Page', function($http, $stateParams, Page) { var ctrl = this; + Page.title('Puppet report'); ctrl.report = null; - this.reportId = $routeParams.reportId; + ctrl.nav = { + node: null, + report: null + }; + this.reportId = $stateParams.reportId; + function setReport(reportData) { + ctrl.report = reportData; + ctrl.nav.node = ctrl.report.host; + ctrl.nav.report = ctrl.report.configuration_version; + } + $http.get('/api/v1/reports/' + this.reportId).success(function(data) { - ctrl.report = data; - Page.title('Report', data.configuration_version); + setReport(data); + Page.title('Puppet report', data.configuration_version); }); -}]); +}]); + +})(); \ No newline at end of file