1window.angular && (function (angular) { 2 'use strict'; 3 4 angular 5 .module('app.common.directives') 6 .directive('logFilter', ['APIUtils', function (APIUtils) { 7 return { 8 'restrict': 'E', 9 'templateUrl': 'common/directives/log-filter.html', 10 'controller': ['$rootScope', '$scope','dataService', '$location', function($rootScope, $scope, dataService, $location){ 11 $scope.dataService = dataService; 12 $scope.toggleSeverityAll = function(){ 13 if($scope.selectedSeverity.all !== true){ 14 $scope.selectedSeverity.all = !$scope.selectedSeverity.all; 15 } 16 17 if($scope.selectedSeverity.all){ 18 $scope.selectedSeverity.low = false; 19 $scope.selectedSeverity.medium = false; 20 $scope.selectedSeverity.high = false; 21 } 22 } 23 24 $scope.toggleSeverity = function(severity){ 25 $scope.selectedSeverity[severity] = !$scope.selectedSeverity[severity]; 26 27 if(['high', 'medium', 'low'].indexOf(severity) > -1){ 28 if($scope.selectedSeverity[severity] == false && 29 (!$scope.selectedSeverity.low && 30 !$scope.selectedSeverity.medium && 31 !$scope.selectedSeverity.high 32 )){ 33 $scope.selectedSeverity.all = true; 34 return; 35 } 36 } 37 38 if($scope.selectedSeverity.low && 39 $scope.selectedSeverity.medium && 40 $scope.selectedSeverity.high){ 41 $scope.selectedSeverity.all = true; 42 $scope.selectedSeverity.low = false; 43 $scope.selectedSeverity.medium = false; 44 $scope.selectedSeverity.high = false; 45 }else{ 46 $scope.selectedSeverity.all = false; 47 } 48 } 49 }] 50 }; 51 }]); 52})(window.angular); 53