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 @@
-
-

Gestion des catégories

+
+

Gestion des catégories

-
+
diff --git a/public/app/components/logs/logs.html b/public/app/components/logs/logs.html new file mode 100644 index 0000000..33c956c --- /dev/null +++ b/public/app/components/logs/logs.html @@ -0,0 +1,74 @@ + +

+
+
+ +
+
+
+

Gestion des logs

+
+
+
+ + +
+
+
+ +
+
+
+ +
+
+
+ + + + + + + + + + + + + + +
+ Type + + Description + Date
+ {{log.level}} + {{log.level}} + {{log.level}} + + {{ log.description }} + + {{ log.created_at.toString().replace(' ', 'T') | date : "dd/MM/yyyy HH:mm" }} +
+
+

+
+ + + + \ No newline at end of file diff --git a/public/app/directives/inWrapper/in_wrapper.html b/public/app/directives/inWrapper/in_wrapper.html index a5b82fa..67a37c5 100644 --- a/public/app/directives/inWrapper/in_wrapper.html +++ b/public/app/directives/inWrapper/in_wrapper.html @@ -70,6 +70,7 @@ Matériels Réservations Bugs + Logs diff --git a/resources/app/app.js b/resources/app/app.js index 0121719..c35a1c1 100644 --- a/resources/app/app.js +++ b/resources/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/resources/app/components/logs/logs.html b/resources/app/components/logs/logs.html new file mode 100644 index 0000000..33c956c --- /dev/null +++ b/resources/app/components/logs/logs.html @@ -0,0 +1,74 @@ + +

+
+
+ +
+
+
+

Gestion des logs

+
+
+
+ + +
+
+
+ +
+
+
+ +
+
+ + + + + + + + + + + + + + + +
+ Type + + Description + Date
+ {{log.level}} + {{log.level}} + {{log.level}} + + {{ log.description }} + + {{ log.created_at.toString().replace(' ', 'T') | date : "dd/MM/yyyy HH:mm" }} +
+
+

+
+
+
+
+ \ No newline at end of file diff --git a/resources/app/components/logs/logsControllers.js b/resources/app/components/logs/logsControllers.js new file mode 100644 index 0000000..c6636d7 --- /dev/null +++ b/resources/app/components/logs/logsControllers.js @@ -0,0 +1,63 @@ +'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; + } + + }); + diff --git a/resources/app/directives/inWrapper/in_wrapper.html b/resources/app/directives/inWrapper/in_wrapper.html index a5b82fa..67a37c5 100644 --- a/resources/app/directives/inWrapper/in_wrapper.html +++ b/resources/app/directives/inWrapper/in_wrapper.html @@ -70,6 +70,7 @@ Matériels Réservations Bugs + Logs