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.all = true; 30 return; 31 } 32 } 33 34 if($scope.selectedSeverity.low && 35 $scope.selectedSeverity.medium && 36 $scope.selectedSeverity.high){ 37 $scope.selectedSeverity.all = true; 38 $scope.selectedSeverity.low = false; 39 $scope.selectedSeverity.medium = false; 40 $scope.selectedSeverity.high = false; 41 }else{ 42 $scope.selectedSeverity.all = false; 43 } 44 } 45 }] 46 }; 47 }]); 48})(window.angular); 49