Run js-beautify and fixjsstyle on code
Found this pointer on stackoverflow:
https://stackoverflow.com/a/31660434/5508494
End goal is to get the code formatted well enough that
clang format will run correctly against it.
Change-Id: I80053e78d253d8eee49233e42d55e5807ae8fdc8
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/app/common/directives/app-header.js b/app/common/directives/app-header.js
index 93d8fa8..31f683c 100644
--- a/app/common/directives/app-header.js
+++ b/app/common/directives/app-header.js
@@ -1,94 +1,98 @@
-window.angular && (function (angular) {
- 'use strict';
+window.angular && (function(angular) {
+ 'use strict';
- angular
- .module('app.common.directives')
- .directive('appHeader', ['APIUtils', function (APIUtils) {
- return {
- 'restrict': 'E',
- 'template': require('./app-header.html'),
- 'scope': {
- 'path': '='
- },
- 'controller': ['$rootScope', '$scope','dataService', 'userModel', '$location', '$route',
- function($rootScope, $scope, dataService, userModel, $location, $route){
- $scope.dataService = dataService;
+ angular
+ .module('app.common.directives')
+ .directive('appHeader', ['APIUtils', function(APIUtils) {
+ return {
+ 'restrict': 'E',
+ 'template': require('./app-header.html'),
+ 'scope': {
+ 'path': '='
+ },
+ 'controller': ['$rootScope', '$scope', 'dataService', 'userModel', '$location', '$route',
+ function($rootScope, $scope, dataService, userModel, $location, $route) {
+ $scope.dataService = dataService;
- $scope.loadServerHealth = function(){
- APIUtils.getLogs().then(function(result){
- dataService.updateServerHealth(result.data);
- });
- }
-
- $scope.loadServerStatus = function(){
- if(!userModel.isLoggedIn()){
- return;
- }
- APIUtils.getHostState().then(function(status){
- if(status == 'xyz.openbmc_project.State.Host.HostState.Off'){
- dataService.setPowerOffState();
- }else if(status == 'xyz.openbmc_project.State.Host.HostState.Running'){
- dataService.setPowerOnState();
- }else{
- dataService.setErrorState();
- }
- }, function(error){
- dataService.activateErrorModal();
- });
- }
-
- $scope.loadNetworkInfo = function(){
- if(!userModel.isLoggedIn()){
- return;
- }
- APIUtils.getNetworkInfo().then(function(data){
- dataService.setNetworkInfo(data);
- });
- }
-
- function loadData(){
- $scope.loadServerStatus();
- $scope.loadNetworkInfo();
- $scope.loadServerHealth();
- }
-
- loadData();
-
- $scope.logout = function(){
- userModel.logout(function(status, error){
- if(status){
- $location.path('/logout');
- }else{
- console.log(error);
- }
- });
- }
-
- $scope.refresh = function(){
- //reload current page controllers and header
- loadData();
- $route.reload();
- //Add flash class to header timestamp on click of refresh
- var myEl = angular.element( document.querySelector( '.header__refresh' ) );
- myEl.addClass('flash');
- setTimeout(function () {
- myEl.removeClass("flash");
- },2000);
-
- }
-
- var loginListener = $rootScope.$on('user-logged-in', function(event, arg){
- loadData();
- });
-
- $scope.$on('$destroy', function(){
- loginListener();
- });
-
- $scope.multiRecent = function(){
- $scope.multi_server_recent = !$scope.multi_server_recent;
- };
- }]
+ $scope.loadServerHealth = function() {
+ APIUtils.getLogs().then(function(result) {
+ dataService.updateServerHealth(result.data);
+ });
};
- }]);
+
+ $scope.loadServerStatus = function() {
+ if (!userModel.isLoggedIn()) {
+ return;
+ }
+ APIUtils.getHostState().then(function(status) {
+ if (status == 'xyz.openbmc_project.State.Host.HostState.Off') {
+ dataService.setPowerOffState();
+ }
+ else if (status == 'xyz.openbmc_project.State.Host.HostState.Running') {
+ dataService.setPowerOnState();
+ }
+ else {
+ dataService.setErrorState();
+ }
+ }, function(error) {
+ dataService.activateErrorModal();
+ });
+ };
+
+ $scope.loadNetworkInfo = function() {
+ if (!userModel.isLoggedIn()) {
+ return;
+ }
+ APIUtils.getNetworkInfo().then(function(data) {
+ dataService.setNetworkInfo(data);
+ });
+ };
+
+ function loadData() {
+ $scope.loadServerStatus();
+ $scope.loadNetworkInfo();
+ $scope.loadServerHealth();
+ }
+
+ loadData();
+
+ $scope.logout = function() {
+ userModel.logout(function(status, error) {
+ if (status) {
+ $location.path('/logout');
+ }
+ else {
+ console.log(error);
+ }
+ });
+ };
+
+ $scope.refresh = function() {
+ //reload current page controllers and header
+ loadData();
+ $route.reload();
+ //Add flash class to header timestamp on click of refresh
+ var myEl = angular.element(document.querySelector('.header__refresh'));
+ myEl.addClass('flash');
+ setTimeout(function() {
+ myEl.removeClass('flash');
+ }, 2000);
+
+ };
+
+ var loginListener = $rootScope.$on('user-logged-in', function(event, arg) {
+ loadData();
+ });
+
+ $scope.$on('$destroy', function() {
+ loginListener();
+ });
+
+ $scope.multiRecent = function() {
+ $scope.multi_server_recent = !$scope.multi_server_recent;
+ };
+ }
+ ]
+ };
+ }]);
})(window.angular);
diff --git a/app/common/directives/app-navigation.js b/app/common/directives/app-navigation.js
index 02d3f2d..80d09ec 100644
--- a/app/common/directives/app-navigation.js
+++ b/app/common/directives/app-navigation.js
@@ -1,68 +1,75 @@
-window.angular && (function (angular) {
- 'use strict';
+window.angular && (function(angular) {
+ 'use strict';
- angular
- .module('app.common.directives')
- .directive('appNavigation', function () {
- return {
- 'restrict': 'E',
- 'template': require('./app-navigation.html'),
- 'scope': {
- 'path': '=',
- 'showNavigation': '='
- },
- 'controller': ['$scope', '$location', 'dataService', function($scope, $location, dataService){
- $scope.dataService = dataService;
- $scope.showSubMenu = false;
- $scope.change = function(firstLevel){
- if(firstLevel != $scope.firstLevel) {
- $scope.firstLevel = firstLevel;
- $scope.showSubMenu = true;
- }else{
- $scope.showSubMenu = !$scope.showSubMenu;
- }
- };
- $scope.closeSubnav = function(){
- $scope.showSubMenu = false;
- };
- $scope.$watch('path', function(){
- var urlRoot = $location.path().split("/")[1];
- if(urlRoot != ""){
- $scope.firstLevel = urlRoot;
- }else{
- $scope.firstLevel = 'overview';
- }
- $scope.showSubMenu = false;
- });
- $scope.$watch('showNavigation', function(){
- var paddingTop = 0;
- var urlRoot = $location.path().split("/")[1];
- if(urlRoot != ""){
- $scope.firstLevel = urlRoot;
- }else{
- $scope.firstLevel = 'overview';
- }
+ angular
+ .module('app.common.directives')
+ .directive('appNavigation', function() {
+ return {
+ 'restrict': 'E',
+ 'template': require('./app-navigation.html'),
+ 'scope': {
+ 'path': '=',
+ 'showNavigation': '='
+ },
+ 'controller': ['$scope', '$location', 'dataService', function($scope, $location, dataService) {
+ $scope.dataService = dataService;
+ $scope.showSubMenu = false;
+ $scope.change = function(firstLevel) {
+ if (firstLevel != $scope.firstLevel) {
+ $scope.firstLevel = firstLevel;
+ $scope.showSubMenu = true;
+ }
+ else {
+ $scope.showSubMenu = !$scope.showSubMenu;
+ }
+ };
+ $scope.closeSubnav = function() {
+ $scope.showSubMenu = false;
+ };
+ $scope.$watch('path', function() {
+ var urlRoot = $location.path().split('/')[1];
+ if (urlRoot != '') {
+ $scope.firstLevel = urlRoot;
+ }
+ else {
+ $scope.firstLevel = 'overview';
+ }
+ $scope.showSubMenu = false;
+ });
+ $scope.$watch('showNavigation', function() {
+ var paddingTop = 0;
+ var urlRoot = $location.path().split('/')[1];
+ if (urlRoot != '') {
+ $scope.firstLevel = urlRoot;
+ }
+ else {
+ $scope.firstLevel = 'overview';
+ }
- if($scope.showNavigation){
- paddingTop = document.getElementById('header__wrapper').offsetHeight;
- }
- dataService.bodyStyle = {'padding-top': paddingTop + 'px'};
- $scope.navStyle = {'top': paddingTop + 'px'};
- });
- }],
- link: function(scope, element, attributes) {
- var rawNavElement = angular.element(element)[0];
- angular.element(window.document).bind('click', function(event){
- if (rawNavElement.contains(event.target))
- return;
-
- if(scope.showSubMenu){
- scope.$apply(function(){
- scope.showSubMenu = false;
- });
- }
- });
- }
+ if ($scope.showNavigation) {
+ paddingTop = document.getElementById('header__wrapper').offsetHeight;
+ }
+ dataService.bodyStyle = {
+ 'padding-top': paddingTop + 'px'
};
- });
+ $scope.navStyle = {
+ 'top': paddingTop + 'px'
+ };
+ });
+ }],
+ link: function(scope, element, attributes) {
+ var rawNavElement = angular.element(element)[0];
+ angular.element(window.document).bind('click', function(event) {
+ if (rawNavElement.contains(event.target))
+ return;
+
+ if (scope.showSubMenu) {
+ scope.$apply(function() {
+ scope.showSubMenu = false;
+ });
+ }
+ });
+ }
+ };
+ });
})(window.angular);
diff --git a/app/common/directives/confirm.js b/app/common/directives/confirm.js
index 5bb699a..a542783 100644
--- a/app/common/directives/confirm.js
+++ b/app/common/directives/confirm.js
@@ -1,39 +1,44 @@
-window.angular && (function (angular) {
- 'use strict';
+window.angular && (function(angular) {
+ 'use strict';
- angular
- .module('app.common.directives')
- .directive('confirm', ['$timeout', function($timeout){
- return {
- 'restrict': 'E',
- 'template': require('./confirm.html'),
- 'scope': {
- 'title': '@',
- 'message': '@',
- 'confirm': '=',
- 'callback': '='
- },
- 'controller': ['$scope',function($scope){
- $scope.cancel = function(){
- $scope.confirm = false;
- $scope.$parent.confirm = false;
- };
- $scope.accept = function(){
- $scope.callback();
- $scope.cancel();
- }
- }],
- link: function(scope, e) {
- scope.$watch('confirm', function(){
- if(scope.confirm){
- $timeout(function(){
- angular.element(e[0].parentNode).css({'min-height': e[0].querySelector('.inline__confirm').offsetHeight + 'px'});
- }, 0);
- }else{
- angular.element(e[0].parentNode).css({'min-height': 0+ 'px'});
- }
- });
- }
- };
- }]);
+ angular
+ .module('app.common.directives')
+ .directive('confirm', ['$timeout', function($timeout) {
+ return {
+ 'restrict': 'E',
+ 'template': require('./confirm.html'),
+ 'scope': {
+ 'title': '@',
+ 'message': '@',
+ 'confirm': '=',
+ 'callback': '='
+ },
+ 'controller': ['$scope', function($scope) {
+ $scope.cancel = function() {
+ $scope.confirm = false;
+ $scope.$parent.confirm = false;
+ };
+ $scope.accept = function() {
+ $scope.callback();
+ $scope.cancel();
+ };
+ }],
+ link: function(scope, e) {
+ scope.$watch('confirm', function() {
+ if (scope.confirm) {
+ $timeout(function() {
+ angular.element(e[0].parentNode).css({
+ 'min-height': e[0].querySelector('.inline__confirm').offsetHeight + 'px'
+ });
+ }, 0);
+ }
+ else {
+ angular.element(e[0].parentNode).css({
+ 'min-height': 0 + 'px'
+ });
+ }
+ });
+ }
+ };
+ }]);
})(window.angular);
diff --git a/app/common/directives/errors.js b/app/common/directives/errors.js
index 2c9b109..8123694 100644
--- a/app/common/directives/errors.js
+++ b/app/common/directives/errors.js
@@ -1,18 +1,18 @@
-window.angular && (function (angular) {
- 'use strict';
+window.angular && (function(angular) {
+ 'use strict';
- angular
- .module('app.common.directives')
- .directive('errors', ['APIUtils', function (APIUtils) {
- return {
- 'restrict': 'E',
- 'template': require('./errors.html'),
- 'scope': {
- 'path': '='
- },
- 'controller': ['$scope','dataService', function($scope, dataService){
- $scope.dataService = dataService;
- }]
- };
- }]);
+ angular
+ .module('app.common.directives')
+ .directive('errors', ['APIUtils', function(APIUtils) {
+ return {
+ 'restrict': 'E',
+ 'template': require('./errors.html'),
+ 'scope': {
+ 'path': '='
+ },
+ 'controller': ['$scope', 'dataService', function($scope, dataService) {
+ $scope.dataService = dataService;
+ }]
+ };
+ }]);
})(window.angular);
diff --git a/app/common/directives/file.js b/app/common/directives/file.js
index 11adf8a..8ed6c2e 100644
--- a/app/common/directives/file.js
+++ b/app/common/directives/file.js
@@ -1,21 +1,21 @@
-window.angular && (function (angular) {
- 'use strict';
+window.angular && (function(angular) {
+ 'use strict';
- angular
- .module('app.common.directives')
- .directive('file', function () {
- return {
- scope: {
- file: '='
- },
- link: function (scope, el, attrs) {
- el.bind('change', function (event) {
- var file = event.target.files[0];
- scope.file = file ? file : undefined;
- scope.$apply();
- });
- }
- };
- });
+ angular
+ .module('app.common.directives')
+ .directive('file', function() {
+ return {
+ scope: {
+ file: '='
+ },
+ link: function(scope, el, attrs) {
+ el.bind('change', function(event) {
+ var file = event.target.files[0];
+ scope.file = file ? file : undefined;
+ scope.$apply();
+ });
+ }
+ };
+ });
-})(window.angular);
\ No newline at end of file
+})(window.angular);
diff --git a/app/common/directives/firmware-list.js b/app/common/directives/firmware-list.js
index 4cdf6d7..163df82 100644
--- a/app/common/directives/firmware-list.js
+++ b/app/common/directives/firmware-list.js
@@ -1,32 +1,32 @@
-window.angular && (function (angular) {
- 'use strict';
+window.angular && (function(angular) {
+ 'use strict';
- angular
- .module('app.common.directives')
- .directive('firmwareList', ['APIUtils', function (APIUtils) {
- return {
- 'restrict': 'E',
- 'template': require('./firmware-list.html'),
- 'scope': {
- 'title': '@',
- 'firmwares': '=',
- 'filterBy': '=',
- 'version': '='
- },
- 'controller': ['$rootScope', '$scope','dataService', '$location', '$timeout', function($rootScope, $scope, dataService, $location, $timeout){
- $scope.dataService = dataService;
- $scope.activate = function(imageId, imageVersion, imageType){
- $scope.$parent.activateImage(imageId, imageVersion, imageType);
- }
+ angular
+ .module('app.common.directives')
+ .directive('firmwareList', ['APIUtils', function(APIUtils) {
+ return {
+ 'restrict': 'E',
+ 'template': require('./firmware-list.html'),
+ 'scope': {
+ 'title': '@',
+ 'firmwares': '=',
+ 'filterBy': '=',
+ 'version': '='
+ },
+ 'controller': ['$rootScope', '$scope', 'dataService', '$location', '$timeout', function($rootScope, $scope, dataService, $location, $timeout) {
+ $scope.dataService = dataService;
+ $scope.activate = function(imageId, imageVersion, imageType) {
+ $scope.$parent.activateImage(imageId, imageVersion, imageType);
+ };
- $scope.delete = function(imageId, imageVersion){
- $scope.$parent.deleteImage(imageId, imageVersion);
- }
+ $scope.delete = function(imageId, imageVersion) {
+ $scope.$parent.deleteImage(imageId, imageVersion);
+ };
- $scope.changePriority = function(imageId, imageVersion, from, to){
- $scope.$parent.changePriority(imageId, imageVersion, from, to);
- }
- }]
- };
- }]);
+ $scope.changePriority = function(imageId, imageVersion, from, to) {
+ $scope.$parent.changePriority(imageId, imageVersion, from, to);
+ };
+ }]
+ };
+ }]);
})(window.angular);
diff --git a/app/common/directives/index.js b/app/common/directives/index.js
index 1fed678..33155f4 100644
--- a/app/common/directives/index.js
+++ b/app/common/directives/index.js
@@ -1,9 +1,9 @@
-window.angular && (function (angular) {
- 'use strict';
+window.angular && (function(angular) {
+ 'use strict';
- angular
- .module('app.common.directives', [
- 'app.common.services'
- ]);
+ angular
+ .module('app.common.directives', [
+ 'app.common.services'
+ ]);
})(window.angular);
diff --git a/app/common/directives/loader.js b/app/common/directives/loader.js
index b37a898..8edc128 100644
--- a/app/common/directives/loader.js
+++ b/app/common/directives/loader.js
@@ -1,16 +1,16 @@
-window.angular && (function (angular) {
- 'use strict';
+window.angular && (function(angular) {
+ 'use strict';
- angular
- .module('app.common.directives')
- .directive('loader', function () {
- return {
- 'restrict': 'E',
- 'template': require('./loader.html'),
- scope: {
- loading: '='
- }
- };
- });
+ angular
+ .module('app.common.directives')
+ .directive('loader', function() {
+ return {
+ 'restrict': 'E',
+ 'template': require('./loader.html'),
+ scope: {
+ loading: '='
+ }
+ };
+ });
})(window.angular);
diff --git a/app/common/directives/log-event.js b/app/common/directives/log-event.js
index e858239..c48a3ee 100644
--- a/app/common/directives/log-event.js
+++ b/app/common/directives/log-event.js
@@ -1,41 +1,43 @@
-window.angular && (function (angular) {
- 'use strict';
+window.angular && (function(angular) {
+ 'use strict';
- angular
- .module('app.common.directives')
- .directive('logEvent', ['APIUtils', function (APIUtils) {
- return {
- 'restrict': 'E',
- 'template': require('./log-event.html'),
- 'scope': {
- 'event': '=',
- 'tmz': '=',
- 'multiSelected': '='
- },
- 'controller': ['$rootScope', '$scope','dataService', '$location', '$timeout', function($rootScope, $scope, dataService, $location, $timeout){
- $scope.dataService = dataService;
- $scope.copySuccess = function (event) {
- event.copied = true;
- $timeout(function(){
- event.copied = false;
- }, 5000);
- };
- $scope.copyFailed = function (err) {
- console.error('Error!', err);
- };
- $scope.resolveEvent = function(event){
- APIUtils.resolveLogs([{Id: event.Id}]).then(function(){
- event.Resolved = 1;
- });
- }
+ angular
+ .module('app.common.directives')
+ .directive('logEvent', ['APIUtils', function(APIUtils) {
+ return {
+ 'restrict': 'E',
+ 'template': require('./log-event.html'),
+ 'scope': {
+ 'event': '=',
+ 'tmz': '=',
+ 'multiSelected': '='
+ },
+ 'controller': ['$rootScope', '$scope', 'dataService', '$location', '$timeout', function($rootScope, $scope, dataService, $location, $timeout) {
+ $scope.dataService = dataService;
+ $scope.copySuccess = function(event) {
+ event.copied = true;
+ $timeout(function() {
+ event.copied = false;
+ }, 5000);
+ };
+ $scope.copyFailed = function(err) {
+ console.error('Error!', err);
+ };
+ $scope.resolveEvent = function(event) {
+ APIUtils.resolveLogs([{
+ Id: event.Id
+ }]).then(function() {
+ event.Resolved = 1;
+ });
+ };
- $scope.accept = function(){
- $scope.event.selected = true;
- $timeout(function(){
- $scope.$parent.accept();
- }, 10);
- }
- }]
- };
- }]);
+ $scope.accept = function() {
+ $scope.event.selected = true;
+ $timeout(function() {
+ $scope.$parent.accept();
+ }, 10);
+ };
+ }]
+ };
+ }]);
})(window.angular);
diff --git a/app/common/directives/log-filter.js b/app/common/directives/log-filter.js
index 370e666..69bb8e3 100644
--- a/app/common/directives/log-filter.js
+++ b/app/common/directives/log-filter.js
@@ -1,50 +1,51 @@
-window.angular && (function (angular) {
- 'use strict';
+window.angular && (function(angular) {
+ 'use strict';
- angular
- .module('app.common.directives')
- .directive('logFilter', ['APIUtils', function (APIUtils) {
- return {
- 'restrict': 'E',
- 'template': require('./log-filter.html'),
- 'controller': ['$rootScope', '$scope','dataService', '$location', function($rootScope, $scope, dataService, $location){
- $scope.dataService = dataService;
- $scope.toggleSeverityAll = function(){
- $scope.selectedSeverity.all = !$scope.selectedSeverity.all;
+ angular
+ .module('app.common.directives')
+ .directive('logFilter', ['APIUtils', function(APIUtils) {
+ return {
+ 'restrict': 'E',
+ 'template': require('./log-filter.html'),
+ 'controller': ['$rootScope', '$scope', 'dataService', '$location', function($rootScope, $scope, dataService, $location) {
+ $scope.dataService = dataService;
+ $scope.toggleSeverityAll = function() {
+ $scope.selectedSeverity.all = !$scope.selectedSeverity.all;
- if($scope.selectedSeverity.all){
- $scope.selectedSeverity.low = false;
- $scope.selectedSeverity.medium = false;
- $scope.selectedSeverity.high = false;
- }
- }
+ if ($scope.selectedSeverity.all) {
+ $scope.selectedSeverity.low = false;
+ $scope.selectedSeverity.medium = false;
+ $scope.selectedSeverity.high = false;
+ }
+ };
- $scope.toggleSeverity = function(severity){
- $scope.selectedSeverity[severity] = !$scope.selectedSeverity[severity];
+ $scope.toggleSeverity = function(severity) {
+ $scope.selectedSeverity[severity] = !$scope.selectedSeverity[severity];
- if(['high', 'medium', 'low'].indexOf(severity) > -1){
- if($scope.selectedSeverity[severity] == false &&
- (!$scope.selectedSeverity.low &&
- !$scope.selectedSeverity.medium &&
- !$scope.selectedSeverity.high
- )){
- $scope.selectedSeverity.all = true;
- return;
- }
- }
+ if (['high', 'medium', 'low'].indexOf(severity) > -1) {
+ if ($scope.selectedSeverity[severity] == false &&
+ (!$scope.selectedSeverity.low &&
+ !$scope.selectedSeverity.medium &&
+ !$scope.selectedSeverity.high
+ )) {
+ $scope.selectedSeverity.all = true;
+ return;
+ }
+ }
- if($scope.selectedSeverity.low &&
- $scope.selectedSeverity.medium &&
- $scope.selectedSeverity.high){
- $scope.selectedSeverity.all = true;
- $scope.selectedSeverity.low = false;
- $scope.selectedSeverity.medium = false;
- $scope.selectedSeverity.high = false;
- }else{
- $scope.selectedSeverity.all = false;
- }
- }
- }]
- };
- }]);
+ if ($scope.selectedSeverity.low &&
+ $scope.selectedSeverity.medium &&
+ $scope.selectedSeverity.high) {
+ $scope.selectedSeverity.all = true;
+ $scope.selectedSeverity.low = false;
+ $scope.selectedSeverity.medium = false;
+ $scope.selectedSeverity.high = false;
+ }
+ else {
+ $scope.selectedSeverity.all = false;
+ }
+ };
+ }]
+ };
+ }]);
})(window.angular);
diff --git a/app/common/directives/log-search-control.js b/app/common/directives/log-search-control.js
index c610c18..f262f5f 100644
--- a/app/common/directives/log-search-control.js
+++ b/app/common/directives/log-search-control.js
@@ -1,44 +1,46 @@
-window.angular && (function (angular) {
- 'use strict';
+window.angular && (function(angular) {
+ 'use strict';
- angular
- .module('app.common.directives')
- .directive('logSearchControl', ['APIUtils', function (APIUtils) {
- return {
- 'restrict': 'E',
- 'template': require('./log-search-control.html'),
- 'controller': ['$rootScope', '$scope','dataService', '$location', function($rootScope, $scope, dataService, $location){
- $scope.dataService = dataService;
- $scope.doSearchOnEnter = function (event) {
- var search = $scope.customSearch.replace(/^\s+/g,'').replace(/\s+$/g,'');
- if (event.keyCode === 13 &&
- search.length >= 2) {
- $scope.clearSearchItem();
- $scope.addSearchItem(search);
- }else{
- if(search.length == 0){
- $scope.clearSearchItem();
- }
- }
- };
+ angular
+ .module('app.common.directives')
+ .directive('logSearchControl', ['APIUtils', function(APIUtils) {
+ return {
+ 'restrict': 'E',
+ 'template': require('./log-search-control.html'),
+ 'controller': ['$rootScope', '$scope', 'dataService', '$location', function($rootScope, $scope, dataService, $location) {
+ $scope.dataService = dataService;
+ $scope.doSearchOnEnter = function(event) {
+ var search = $scope.customSearch.replace(/^\s+/g, '').replace(/\s+$/g, '');
+ if (event.keyCode === 13 &&
+ search.length >= 2) {
+ $scope.clearSearchItem();
+ $scope.addSearchItem(search);
+ }
+ else {
+ if (search.length == 0) {
+ $scope.clearSearchItem();
+ }
+ }
+ };
- $scope.clear = function(){
- $scope.customSearch = "";
- $scope.clearSearchItem();
- }
+ $scope.clear = function() {
+ $scope.customSearch = '';
+ $scope.clearSearchItem();
+ };
- $scope.doSearchOnClick = function() {
- var search = $scope.customSearch.replace(/^\s+/g,'').replace(/\s+$/g,'');
- if (search.length >= 2) {
- $scope.clearSearchItem();
- $scope.addSearchItem(search);
- }else{
- if(search.length == 0){
- $scope.clearSearchItem();
- }
- }
- }
- }]
- };
- }]);
+ $scope.doSearchOnClick = function() {
+ var search = $scope.customSearch.replace(/^\s+/g, '').replace(/\s+$/g, '');
+ if (search.length >= 2) {
+ $scope.clearSearchItem();
+ $scope.addSearchItem(search);
+ }
+ else {
+ if (search.length == 0) {
+ $scope.clearSearchItem();
+ }
+ }
+ };
+ }]
+ };
+ }]);
})(window.angular);
diff --git a/app/common/directives/paginate.js b/app/common/directives/paginate.js
index e69de29..8b13789 100644
--- a/app/common/directives/paginate.js
+++ b/app/common/directives/paginate.js
@@ -0,0 +1 @@
+
diff --git a/app/common/directives/toggle-flag.js b/app/common/directives/toggle-flag.js
index 9c342b0..4a4e454 100644
--- a/app/common/directives/toggle-flag.js
+++ b/app/common/directives/toggle-flag.js
@@ -1,31 +1,31 @@
-window.angular && (function (angular) {
- 'use strict';
+window.angular && (function(angular) {
+ 'use strict';
- angular
- .module('app.common.directives')
- .directive('toggleFlag', function ($document) {
- return {
- restrict: 'A',
- link: function (scope, element, attrs) {
+ angular
+ .module('app.common.directives')
+ .directive('toggleFlag', function($document) {
+ return {
+ restrict: 'A',
+ link: function(scope, element, attrs) {
- function elementClick(e) {
- e.stopPropagation();
- }
+ function elementClick(e) {
+ e.stopPropagation();
+ }
- function documentClick(e) {
- scope[attrs.toggleFlag] = false;
- scope.$apply();
- }
+ function documentClick(e) {
+ scope[attrs.toggleFlag] = false;
+ scope.$apply();
+ }
- element.on('click', elementClick);
- $document.on('click', documentClick);
+ element.on('click', elementClick);
+ $document.on('click', documentClick);
- // remove event handlers when directive is destroyed
- scope.$on('$destroy', function () {
- element.off('click', elementClick);
- $document.off('click', documentClick);
- });
- }
- };
- });
-})(window.angular);
\ No newline at end of file
+ // remove event handlers when directive is destroyed
+ scope.$on('$destroy', function() {
+ element.off('click', elementClick);
+ $document.off('click', documentClick);
+ });
+ }
+ };
+ });
+})(window.angular);