diff --git a/public/app/app.js b/public/app/app.js index 0121719..c35a1c1 100644 --- a/public/app/app.js +++ b/public/app/app.js @@ -119,6 +119,11 @@ app.run(function($rootScope, PortailAuth) { controller : 'loginCtrl', controllerAs : 'login' }) + .when('/gestion/logs',{ + templateUrl : 'app/components/logs/logs.html', + controller : 'logsCtrl', + controllerAs : 'logs' + }) .when('/logout',{ templateUrl : 'app/components/logout/logout.html', controller : 'logoutCtrl', diff --git a/public/app/components.js b/public/app/components.js index cb7fae8..c70b5f4 100644 --- a/public/app/components.js +++ b/public/app/components.js @@ -1214,6 +1214,70 @@ app.controller('logoutCtrl', function($scope, PortailAuth) { 'use strict'; + +angular.module('bobbyApp') + .controller('logsCtrl', function ($scope, serviceAjax, $location, $rootScope) { + this.awesomeThings = [ + 'HTML5 Boilerplate', + 'AngularJS', + 'Karma' + ]; + + if(!$rootScope.isAdmin()){ + $location.path('/error/403'); + } + + $scope.error = false; + + $scope.dates = { + currentDate : new Date(), + selectedDate : new Date(), + } + + // Chargement des bugs + var loadLogs = function(selectedDate){ + $scope.loading = true; + const day = ("0" + (selectedDate.getDate())).slice(-2); + const month_number = ("0" + (selectedDate.getMonth() + 1)).slice(-2) + const year = selectedDate.getFullYear(); + const date = year + "-" + month_number + "-" + day; + serviceAjax.post('logs', {date : date}).then(function(res){ + $scope.logs = res.data; + $scope.loading = false; + }) + } + loadLogs($scope.dates.selectedDate); + + + /* Listener sur la date sélectionnée */ + $scope.$watch("dates.selectedDate", function(){ + if ($scope.dates.selectedDate) { + loadLogs($scope.dates.selectedDate); + } + }); + + $scope.logLevel = "error"; + + $scope.isActive = function(logLevel){ + return logLevel == $scope.logLevel; + } + + $scope.changeLogLevel = function(logLevel){ + $scope.logLevel = logLevel; + } + + $scope.showLog = function(log){ + if ($scope.logLevel == "all") { + return true; + } + return log.level == $scope.logLevel; + } + + }); + + +'use strict'; + /** * @ngdoc function * @name bobbyApp.controller:MainCtrl diff --git a/public/app/components/categories/administrator/categories_management.html b/public/app/components/categories/administrator/categories_management.html index 714aecf..ac61e7a 100644 --- a/public/app/components/categories/administrator/categories_management.html +++ b/public/app/components/categories/administrator/categories_management.html @@ -5,10 +5,10 @@
+ Type + | ++ Description + | +Date | +
---|---|---|
+ {{log.level}} + {{log.level}} + {{log.level}} + | ++ {{ log.description }} + | ++ {{ log.created_at.toString().replace(' ', 'T') | date : "dd/MM/yyyy HH:mm" }} + | +
+
+ Type + | ++ Description + | +Date | +
---|---|---|
+ {{log.level}} + {{log.level}} + {{log.level}} + | ++ {{ log.description }} + | ++ {{ log.created_at.toString().replace(' ', 'T') | date : "dd/MM/yyyy HH:mm" }} + | +
+