debug.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. (function () {
  2. 'use strict';
  3. angular.module('ariaNg').controller('AriaNgDebugController', ['$rootScope', '$scope', '$location', '$timeout', 'ariaNgConstants', 'ariaNgLocalizationService', 'ariaNgLogService', 'ariaNgSettingService', function ($rootScope, $scope, $location, $timeout, ariaNgConstants, ariaNgLocalizationService, ariaNgLogService, ariaNgSettingService) {
  4. $scope.logMaxCount = ariaNgConstants.cachedDebugLogsLimit;
  5. $scope.currentLog = null;
  6. $scope.enableDebugMode = function () {
  7. return ariaNgSettingService.isEnableDebugMode();
  8. };
  9. $scope.reloadLogs = function () {
  10. $scope.logs = ariaNgLogService.getDebugLogs().slice();
  11. };
  12. $scope.showLogDetail = function (log) {
  13. $scope.currentLog = log;
  14. angular.element('#log-detail-modal').modal();
  15. };
  16. $('#log-detail-modal').on('hide.bs.modal', function (e) {
  17. $scope.currentLog = null;
  18. });
  19. $rootScope.loadPromise = $timeout(function () {
  20. if (!ariaNgSettingService.isEnableDebugMode()) {
  21. ariaNgLocalizationService.showError('Access Denied!', function () {
  22. if (!ariaNgSettingService.isEnableDebugMode()) {
  23. $location.path('/settings/ariang');
  24. }
  25. });
  26. return;
  27. }
  28. $scope.reloadLogs();
  29. }, 100);
  30. }]);
  31. }());