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 'template': require('./log-filter.html'), 10 'controller': ['$rootScope', '$scope','dataService', '$location', function($rootScope, $scope, dataService, $location){ 11 $scope.dataService = dataService; 12 $scope.toggleSeverityAll = function(){ 13 $scope.selectedSeverity.all = !$scope.selectedSeverity.all; 14 15 if($scope.selectedSeverity.all){ 16 $scope.selectedSeverity.low = false; 17 $scope.selectedSeverity.medium = false; 18 $scope.selectedSeverity.high = false; 19 } 20 } 21 22 $scope.toggleSeverity = function(severity){ 23 $scope.selectedSeverity[severity] = !$scope.selectedSeverity[severity]; 24 25 if(['high', 'medium', 'low'].indexOf(severity) > -1){ 26 if($scope.selectedSeverity[severity] == false && 27 (!$scope.selectedSeverity.low && 28 !$scope.selectedSeverity.medium && 29 !$scope.selectedSeverity.high 30 )){ 31 $scope.selectedSeverity.all = true; 32 return; 33 } 34 } 35 36 if($scope.selectedSeverity.low && 37 $scope.selectedSeverity.medium && 38 $scope.selectedSeverity.high){ 39 $scope.selectedSeverity.all = true; 40 $scope.selectedSeverity.low = false; 41 $scope.selectedSeverity.medium = false; 42 $scope.selectedSeverity.high = false; 43 }else{ 44 $scope.selectedSeverity.all = false; 45 } 46 } 47 }] 48 }; 49 }]); 50})(window.angular); 51