diff --git a/app/common/directives/app-header.js b/app/common/directives/app-header.js
index 31f683c..d15697b 100644
--- a/app/common/directives/app-header.js
+++ b/app/common/directives/app-header.js
@@ -1,17 +1,18 @@
 window.angular && (function(angular) {
   'use strict';
 
-  angular
-    .module('app.common.directives')
-    .directive('appHeader', ['APIUtils', function(APIUtils) {
+  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': {'path': '='},
+        'controller': [
+          '$rootScope', '$scope', 'dataService', 'userModel', '$location',
+          '$route',
+          function(
+              $rootScope, $scope, dataService, userModel, $location, $route) {
             $scope.dataService = dataService;
 
             $scope.loadServerHealth = function() {
@@ -24,19 +25,22 @@
               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();
-              });
+              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() {
@@ -60,19 +64,19 @@
               userModel.logout(function(status, error) {
                 if (status) {
                   $location.path('/logout');
-                }
-                else {
+                } else {
                   console.log(error);
                 }
               });
             };
 
             $scope.refresh = function() {
-              //reload current page controllers and header
+              // 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'));
+              // 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');
@@ -80,9 +84,10 @@
 
             };
 
-            var loginListener = $rootScope.$on('user-logged-in', function(event, arg) {
-              loadData();
-            });
+            var loginListener =
+                $rootScope.$on('user-logged-in', function(event, arg) {
+                  loadData();
+                });
 
             $scope.$on('$destroy', function() {
               loginListener();
@@ -94,5 +99,6 @@
           }
         ]
       };
-    }]);
+    }
+  ]);
 })(window.angular);
diff --git a/app/common/directives/app-navigation.js b/app/common/directives/app-navigation.js
index 80d09ec..c1272de 100644
--- a/app/common/directives/app-navigation.js
+++ b/app/common/directives/app-navigation.js
@@ -1,75 +1,67 @@
 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 a542783..b537905 100644
--- a/app/common/directives/confirm.js
+++ b/app/common/directives/confirm.js
@@ -1,44 +1,42 @@
 window.angular && (function(angular) {
   'use strict';
 
-  angular
-    .module('app.common.directives')
-    .directive('confirm', ['$timeout', function($timeout) {
+  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();
-          };
-        }],
+        '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'
+                  'min-height':
+                      e[0].querySelector('.inline__confirm').offsetHeight + 'px'
                 });
               }, 0);
-            }
-            else {
-              angular.element(e[0].parentNode).css({
-                'min-height': 0 + 'px'
-              });
+            } 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 8123694..5bd1e52 100644
--- a/app/common/directives/errors.js
+++ b/app/common/directives/errors.js
@@ -1,18 +1,20 @@
 window.angular && (function(angular) {
   'use strict';
 
-  angular
-    .module('app.common.directives')
-    .directive('errors', ['APIUtils', function(APIUtils) {
+  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;
-        }]
+        '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 8ed6c2e..b0f5289 100644
--- a/app/common/directives/file.js
+++ b/app/common/directives/file.js
@@ -1,21 +1,17 @@
 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);
diff --git a/app/common/directives/firmware-list.js b/app/common/directives/firmware-list.js
index 163df82..a08ef8d 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';
 
-  angular
-    .module('app.common.directives')
-    .directive('firmwareList', ['APIUtils', function(APIUtils) {
+  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':
+            {'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 33155f4..150b43f 100644
--- a/app/common/directives/index.js
+++ b/app/common/directives/index.js
@@ -1,9 +1,6 @@
 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 8edc128..46fba9a 100644
--- a/app/common/directives/loader.js
+++ b/app/common/directives/loader.js
@@ -1,16 +1,12 @@
 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 c48a3ee..2a71164 100644
--- a/app/common/directives/log-event.js
+++ b/app/common/directives/log-event.js
@@ -1,43 +1,41 @@
 window.angular && (function(angular) {
   'use strict';
 
-  angular
-    .module('app.common.directives')
-    .directive('logEvent', ['APIUtils', function(APIUtils) {
+  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': {'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 69bb8e3..fcbe0b3 100644
--- a/app/common/directives/log-filter.js
+++ b/app/common/directives/log-filter.js
@@ -1,51 +1,54 @@
 window.angular && (function(angular) {
   'use strict';
 
-  angular
-    .module('app.common.directives')
-    .directive('logFilter', ['APIUtils', function(APIUtils) {
+  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;
+        '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;
-            }
-          };
-
-          $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 ($scope.selectedSeverity.all) {
+                $scope.selectedSeverity.low = false;
+                $scope.selectedSeverity.medium = false;
+                $scope.selectedSeverity.high = 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;
-            }
-          };
-        }]
+            $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 ($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 f262f5f..abdc9ff 100644
--- a/app/common/directives/log-search-control.js
+++ b/app/common/directives/log-search-control.js
@@ -1,46 +1,49 @@
 window.angular && (function(angular) {
   'use strict';
 
-  angular
-    .module('app.common.directives')
-    .directive('logSearchControl', ['APIUtils', function(APIUtils) {
+  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) {
+        '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.doSearchOnClick = function() {
-            var search = $scope.customSearch.replace(/^\s+/g, '').replace(/\s+$/g, '');
-            if (search.length >= 2) {
+            $scope.clear = function() {
+              $scope.customSearch = '';
               $scope.clearSearchItem();
-              $scope.addSearchItem(search);
-            }
-            else {
-              if (search.length == 0) {
+            };
+
+            $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/toggle-flag.js b/app/common/directives/toggle-flag.js
index 4a4e454..0869af3 100644
--- a/app/common/directives/toggle-flag.js
+++ b/app/common/directives/toggle-flag.js
@@ -1,31 +1,30 @@
 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();
+            }
+
+            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);
+            });
           }
-
-          function documentClick(e) {
-            scope[attrs.toggleFlag] = false;
-            scope.$apply();
-          }
-
-          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);
diff --git a/app/common/filters/index.js b/app/common/filters/index.js
index f3de907..743bd4e 100644
--- a/app/common/filters/index.js
+++ b/app/common/filters/index.js
@@ -1,25 +1,25 @@
 window.angular && (function(angular) {
   'use strict';
 
-  angular
-    .module('app.common.filters', [])
-    .filter('unResolvedCount', function() {
-      return function(data) {
-        data = data.filter(function(item) {
-          return item.Resolved == 0;
-        });
-        return data.length;
-      }
-    })
-    .filter('quiescedToError', function() {
-      return function(state) {
-        if (state.toLowerCase() == 'quiesced') {
-          return 'Error';
+  angular.module('app.common.filters', [])
+      .filter(
+          'unResolvedCount',
+          function() {
+            return function(data) {
+              data = data.filter(function(item) {
+                return item.Resolved == 0;
+              });
+              return data.length;
+            }
+          })
+      .filter('quiescedToError', function() {
+        return function(state) {
+          if (state.toLowerCase() == 'quiesced') {
+            return 'Error';
+          } else {
+            return state;
+          }
         }
-        else {
-          return state;
-        }
-      }
-    });
+      });
 
 })(window.angular);
diff --git a/app/common/services/api-utils.js b/app/common/services/api-utils.js
index a024142..7354385 100644
--- a/app/common/services/api-utils.js
+++ b/app/common/services/api-utils.js
@@ -8,9 +8,9 @@
 
 window.angular && (function(angular) {
   'use strict';
-  angular
-    .module('app.common.services')
-    .factory('APIUtils', ['$http', 'Constants', '$q', 'dataService', function($http, Constants, $q, DataService) {
+  angular.module('app.common.services').factory('APIUtils', [
+    '$http', 'Constants', '$q', 'dataService',
+    function($http, Constants, $q, DataService) {
       var getScaledValue = function(value, scale) {
         scale = scale + '';
         scale = parseInt(scale, 10);
@@ -18,8 +18,7 @@
 
         if (scale > 0) {
           value = value * Math.pow(10, power);
-        }
-        else if (scale < 0) {
+        } else if (scale < 0) {
           value = value / Math.pow(10, power);
         }
         return value;
@@ -37,155 +36,175 @@
           var deferred = $q.defer();
           $http({
             method: 'GET',
-            url: DataService.getHost() + '/xyz/openbmc_project/state/chassis0/attr/CurrentPowerState',
+            url: DataService.getHost() +
+                '/xyz/openbmc_project/state/chassis0/attr/CurrentPowerState',
             headers: {
               'Accept': 'application/json',
               'Content-Type': 'application/json'
             },
             withCredentials: true
-          }).then(function(response) {
-            var json = JSON.stringify(response.data);
-            var content = JSON.parse(json);
-            deferred.resolve(content.data);
-          }, function(error) {
-            console.log(error);
-            deferred.reject(error);
-          });
+          })
+              .then(
+                  function(response) {
+                    var json = JSON.stringify(response.data);
+                    var content = JSON.parse(json);
+                    deferred.resolve(content.data);
+                  },
+                  function(error) {
+                    console.log(error);
+                    deferred.reject(error);
+                  });
           return deferred.promise;
         },
         getHostState: function() {
           var deferred = $q.defer();
           $http({
             method: 'GET',
-            url: DataService.getHost() + '/xyz/openbmc_project/state/host0/attr/CurrentHostState',
+            url: DataService.getHost() +
+                '/xyz/openbmc_project/state/host0/attr/CurrentHostState',
             headers: {
               'Accept': 'application/json',
               'Content-Type': 'application/json'
             },
             withCredentials: true
-          }).then(function(response) {
-            var json = JSON.stringify(response.data);
-            var content = JSON.parse(json);
-            deferred.resolve(content.data);
-          }, function(error) {
-            console.log(error);
-            deferred.reject(error);
-          });
+          })
+              .then(
+                  function(response) {
+                    var json = JSON.stringify(response.data);
+                    var content = JSON.parse(json);
+                    deferred.resolve(content.data);
+                  },
+                  function(error) {
+                    console.log(error);
+                    deferred.reject(error);
+                  });
           return deferred.promise;
         },
         getNetworkInfo: function() {
           var deferred = $q.defer();
           $http({
             method: 'GET',
-            url: DataService.getHost() + '/xyz/openbmc_project/network/enumerate',
+            url: DataService.getHost() +
+                '/xyz/openbmc_project/network/enumerate',
             headers: {
               'Accept': 'application/json',
               'Content-Type': 'application/json'
             },
             withCredentials: true
-          }).then(function(response) {
-            var json = JSON.stringify(response.data);
-            var content = JSON.parse(json);
-            var hostname = '';
-            var macAddress = '';
+          })
+              .then(
+                  function(response) {
+                    var json = JSON.stringify(response.data);
+                    var content = JSON.parse(json);
+                    var hostname = '';
+                    var macAddress = '';
 
-            function parseNetworkData(content) {
-              var data = {
-                interface_ids: [],
-                interfaces: {},
-                ip_addresses: {
-                  ipv4: [],
-                  ipv6: []
-                },
-              };
-              var interfaceId = '',
-                keyParts = [],
-                interfaceHash = '',
-                interfaceType = '';
-              for (var key in content.data) {
-                if (key.match(/network\/eth\d+$/ig)) {
-                  interfaceId = key.split('/').pop();
-                  if (data.interface_ids.indexOf(interfaceId) == -1) {
-                    data.interface_ids.push(interfaceId);
-                    data.interfaces[interfaceId] = {
-                      interfaceIname: '',
-                      DomainName: '',
-                      MACAddress: '',
-                      Nameservers: [],
-                      DHCPEnabled: 0,
-                      ipv4: {
-                        ids: [],
-                        values: []
-                      },
-                      ipv6: {
-                        ids: [],
-                        values: []
+                    function parseNetworkData(content) {
+                      var data = {
+                        interface_ids: [],
+                        interfaces: {},
+                        ip_addresses: {ipv4: [], ipv6: []},
+                      };
+                      var interfaceId = '', keyParts = [], interfaceHash = '',
+                          interfaceType = '';
+                      for (var key in content.data) {
+                        if (key.match(/network\/eth\d+$/ig)) {
+                          interfaceId = key.split('/').pop();
+                          if (data.interface_ids.indexOf(interfaceId) == -1) {
+                            data.interface_ids.push(interfaceId);
+                            data.interfaces[interfaceId] = {
+                              interfaceIname: '',
+                              DomainName: '',
+                              MACAddress: '',
+                              Nameservers: [],
+                              DHCPEnabled: 0,
+                              ipv4: {ids: [], values: []},
+                              ipv6: {ids: [], values: []}
+                            };
+                            data.interfaces[interfaceId].MACAddress =
+                                content.data[key].MACAddress;
+                            data.interfaces[interfaceId].DomainName =
+                                content.data[key].DomainName.join(' ');
+                            data.interfaces[interfaceId].Nameservers =
+                                content.data[key].Nameservers;
+                            data.interfaces[interfaceId].DHCPEnabled =
+                                content.data[key].DHCPEnabled;
+                          }
+                        } else if (
+                            key.match(
+                                /network\/eth\d+\/ipv[4|6]\/[a-z0-9]+$/ig)) {
+                          keyParts = key.split('/');
+                          interfaceHash = keyParts.pop();
+                          interfaceType = keyParts.pop();
+                          interfaceId = keyParts.pop();
+
+                          if (data.interfaces[interfaceId][interfaceType]
+                                  .ids.indexOf(interfaceHash) == -1) {
+                            data.interfaces[interfaceId][interfaceType]
+                                .ids.push(interfaceHash);
+                            data.interfaces[interfaceId][interfaceType]
+                                .values.push(content.data[key]);
+                            data.ip_addresses[interfaceType].push(
+                                content.data[key]['Address']);
+                          }
+                        }
                       }
-                    };
-                    data.interfaces[interfaceId].MACAddress = content.data[key].MACAddress;
-                    data.interfaces[interfaceId].DomainName = content.data[key].DomainName.join(' ');
-                    data.interfaces[interfaceId].Nameservers = content.data[key].Nameservers;
-                    data.interfaces[interfaceId].DHCPEnabled = content.data[key].DHCPEnabled;
-                  }
-                }
-                else if (key.match(/network\/eth\d+\/ipv[4|6]\/[a-z0-9]+$/ig)) {
-                  keyParts = key.split('/');
-                  interfaceHash = keyParts.pop();
-                  interfaceType = keyParts.pop();
-                  interfaceId = keyParts.pop();
+                      return data;
+                    }
 
-                  if (data.interfaces[interfaceId][interfaceType].ids.indexOf(interfaceHash) == -1) {
-                    data.interfaces[interfaceId][interfaceType].ids.push(interfaceHash);
-                    data.interfaces[interfaceId][interfaceType].values.push(content.data[key]);
-                    data.ip_addresses[interfaceType].push(content.data[key]['Address']);
-                  }
-                }
-              }
-              return data;
-            }
+                    if (content.data.hasOwnProperty(
+                            '/xyz/openbmc_project/network/config') &&
+                        content.data['/xyz/openbmc_project/network/config']
+                            .hasOwnProperty('HostName')) {
+                      hostname =
+                          content.data['/xyz/openbmc_project/network/config']
+                              .HostName;
+                    }
 
-            if (content.data.hasOwnProperty('/xyz/openbmc_project/network/config') &&
-              content.data['/xyz/openbmc_project/network/config'].hasOwnProperty('HostName')
-            ) {
-              hostname = content.data['/xyz/openbmc_project/network/config'].HostName;
-            }
+                    if (content.data.hasOwnProperty(
+                            '/xyz/openbmc_project/network/eth0') &&
+                        content.data['/xyz/openbmc_project/network/eth0']
+                            .hasOwnProperty('MACAddress')) {
+                      macAddress =
+                          content.data['/xyz/openbmc_project/network/eth0']
+                              .MACAddress;
+                    }
 
-            if (content.data.hasOwnProperty('/xyz/openbmc_project/network/eth0') &&
-              content.data['/xyz/openbmc_project/network/eth0'].hasOwnProperty('MACAddress')
-            ) {
-              macAddress = content.data['/xyz/openbmc_project/network/eth0'].MACAddress;
-            }
-
-            deferred.resolve({
-              data: content.data,
-              hostname: hostname,
-              mac_address: macAddress,
-              formatted_data: parseNetworkData(content)
-            });
-          }, function(error) {
-            console.log(error);
-            deferred.reject(error);
-          });
+                    deferred.resolve({
+                      data: content.data,
+                      hostname: hostname,
+                      mac_address: macAddress,
+                      formatted_data: parseNetworkData(content)
+                    });
+                  },
+                  function(error) {
+                    console.log(error);
+                    deferred.reject(error);
+                  });
           return deferred.promise;
         },
         getLEDState: function() {
           var deferred = $q.defer();
           $http({
             method: 'GET',
-            url: DataService.getHost() + '/xyz/openbmc_project/led/groups/enclosure_identify',
+            url: DataService.getHost() +
+                '/xyz/openbmc_project/led/groups/enclosure_identify',
             headers: {
               'Accept': 'application/json',
               'Content-Type': 'application/json'
             },
             withCredentials: true
-          }).then(function(response) {
-            var json = JSON.stringify(response.data);
-            var content = JSON.parse(json);
-            deferred.resolve(content.data.Asserted);
-          }, function(error) {
-            console.log(error);
-            deferred.reject(error);
-          });
+          })
+              .then(
+                  function(response) {
+                    var json = JSON.stringify(response.data);
+                    var content = JSON.parse(json);
+                    deferred.resolve(content.data.Asserted);
+                  },
+                  function(error) {
+                    console.log(error);
+                    deferred.reject(error);
+                  });
           return deferred.promise;
         },
         login: function(username, password, callback) {
@@ -197,43 +216,42 @@
               'Content-Type': 'application/json'
             },
             withCredentials: true,
-            data: JSON.stringify({
-              'data': [username, password]
-            })
-          }).then(function(response) {
-            if (callback) {
-              callback(response.data);
-            }
-          }, function(error) {
-            if (callback) {
-              if (error && error.status && error.status == 'error') {
-                callback(error);
-              }
-              else {
-                callback(error, true);
-              }
-            }
-            console.log(error);
-          });
+            data: JSON.stringify({'data': [username, password]})
+          })
+              .then(
+                  function(response) {
+                    if (callback) {
+                      callback(response.data);
+                    }
+                  },
+                  function(error) {
+                    if (callback) {
+                      if (error && error.status && error.status == 'error') {
+                        callback(error);
+                      } else {
+                        callback(error, true);
+                      }
+                    }
+                    console.log(error);
+                  });
         },
         testPassword: function(username, password) {
-          // Calls /login without the current session to verify the given password is correct
-          // ignore the interceptor logout on a bad password
+          // Calls /login without the current session to verify the given
+          // password is correct ignore the interceptor logout on a bad password
           DataService.ignoreHttpError = true;
           return $http({
-            method: 'POST',
-            url: DataService.getHost() + '/login',
-            headers: {
-              'Accept': 'application/json',
-              'Content-Type': 'application/json'
-            },
-            withCredentials: false,
-            data: JSON.stringify({
-              'data': [username, password]
-            })
-          }).then(function(response) {
-            return response.data;
-          });
+                   method: 'POST',
+                   url: DataService.getHost() + '/login',
+                   headers: {
+                     'Accept': 'application/json',
+                     'Content-Type': 'application/json'
+                   },
+                   withCredentials: false,
+                   data: JSON.stringify({'data': [username, password]})
+                 })
+              .then(function(response) {
+                return response.data;
+              });
         },
         logout: function(callback) {
           $http({
@@ -244,44 +262,44 @@
               'Content-Type': 'application/json'
             },
             withCredentials: true,
-            data: JSON.stringify({
-              'data': []
-            })
-          }).then(function(response) {
-            if (callback) {
-              callback(response.data);
-            }
-          }, function(error) {
-            if (callback) {
-              callback(null, error);
-            }
-            console.log(error);
-          });
+            data: JSON.stringify({'data': []})
+          })
+              .then(
+                  function(response) {
+                    if (callback) {
+                      callback(response.data);
+                    }
+                  },
+                  function(error) {
+                    if (callback) {
+                      callback(null, error);
+                    }
+                    console.log(error);
+                  });
         },
         changePassword: function(user, newPassword) {
           var deferred = $q.defer();
           $http({
             method: 'POST',
-            url: DataService.getHost() + '/xyz/openbmc_project/user/' + user + '/action/SetPassword',
+            url: DataService.getHost() + '/xyz/openbmc_project/user/' + user +
+                '/action/SetPassword',
             headers: {
               'Accept': 'application/json',
               'Content-Type': 'application/json'
             },
             withCredentials: true,
-            data: JSON.stringify({
-              'data': [newPassword]
-            }),
+            data: JSON.stringify({'data': [newPassword]}),
             responseType: 'arraybuffer'
-          }).then(function(response, status, headers) {
-            deferred.resolve({
-              data: response,
-              status: status,
-              headers: headers
-            });
-          }, function(error) {
-            console.log(error);
-            deferred.reject(error);
-          });
+          })
+              .then(
+                  function(response, status, headers) {
+                    deferred.resolve(
+                        {data: response, status: status, headers: headers});
+                  },
+                  function(error) {
+                    console.log(error);
+                    deferred.reject(error);
+                  });
           return deferred.promise;
         },
         chassisPowerOn: function(callback) {
@@ -293,168 +311,183 @@
               'Content-Type': 'application/json'
             },
             withCredentials: true,
-            data: JSON.stringify({
-              'data': []
-            })
-          }).then(function(response) {
-            var json = JSON.stringify(response.data);
-            var content = JSON.parse(json);
-            if (callback) {
-              return callback(content.data.CurrentPowerState);
-            }
-          }, function(error) {
-            if (callback) {
-              callback(error);
-            }
-            else {
-              console.log(error);
-            }
-          });
+            data: JSON.stringify({'data': []})
+          })
+              .then(
+                  function(response) {
+                    var json = JSON.stringify(response.data);
+                    var content = JSON.parse(json);
+                    if (callback) {
+                      return callback(content.data.CurrentPowerState);
+                    }
+                  },
+                  function(error) {
+                    if (callback) {
+                      callback(error);
+                    } else {
+                      console.log(error);
+                    }
+                  });
         },
         chassisPowerOff: function() {
           var deferred = $q.defer();
           $http({
             method: 'PUT',
-            url: DataService.getHost() + '/xyz/openbmc_project/state/chassis0/attr/RequestedPowerTransition',
+            url: DataService.getHost() +
+                '/xyz/openbmc_project/state/chassis0/attr/RequestedPowerTransition',
             headers: {
               'Accept': 'application/json',
               'Content-Type': 'application/json'
             },
             withCredentials: true,
-            data: JSON.stringify({
-              'data': 'xyz.openbmc_project.State.Chassis.Transition.Off'
-            })
-          }).then(function(response) {
-            var json = JSON.stringify(response.data);
-            var content = JSON.parse(json);
-            deferred.resolve(content.status);
-          }, function(error) {
-            console.log(error);
-            deferred.reject(error);
-          });
+            data: JSON.stringify(
+                {'data': 'xyz.openbmc_project.State.Chassis.Transition.Off'})
+          })
+              .then(
+                  function(response) {
+                    var json = JSON.stringify(response.data);
+                    var content = JSON.parse(json);
+                    deferred.resolve(content.status);
+                  },
+                  function(error) {
+                    console.log(error);
+                    deferred.reject(error);
+                  });
           return deferred.promise;
         },
         setLEDState: function(state, callback) {
           $http({
             method: 'PUT',
-            url: DataService.getHost() + '/xyz/openbmc_project/led/groups/enclosure_identify/attr/Asserted',
+            url: DataService.getHost() +
+                '/xyz/openbmc_project/led/groups/enclosure_identify/attr/Asserted',
             headers: {
               'Accept': 'application/json',
               'Content-Type': 'application/json'
             },
             withCredentials: true,
-            data: JSON.stringify({
-              'data': state
-            })
-          }).then(function(response) {
-            var json = JSON.stringify(response.data);
-            var content = JSON.parse(json);
-            if (callback) {
-              return callback(content.status);
-            }
-          }, function(error) {
-            if (callback) {
-              callback(error);
-            }
-            else {
-              console.log(error);
-            }
-          });
+            data: JSON.stringify({'data': state})
+          })
+              .then(
+                  function(response) {
+                    var json = JSON.stringify(response.data);
+                    var content = JSON.parse(json);
+                    if (callback) {
+                      return callback(content.status);
+                    }
+                  },
+                  function(error) {
+                    if (callback) {
+                      callback(error);
+                    } else {
+                      console.log(error);
+                    }
+                  });
         },
         bmcReboot: function(callback) {
           $http({
             method: 'PUT',
-            url: DataService.getHost() + '/xyz/openbmc_project/state/bmc0/attr/RequestedBmcTransition',
+            url: DataService.getHost() +
+                '/xyz/openbmc_project/state/bmc0/attr/RequestedBmcTransition',
             headers: {
               'Accept': 'application/json',
               'Content-Type': 'application/json'
             },
             withCredentials: true,
-            data: JSON.stringify({
-              'data': 'xyz.openbmc_project.State.BMC.Transition.Reboot'
-            })
-          }).then(function(response) {
-            var json = JSON.stringify(response.data);
-            var content = JSON.parse(json);
-            if (callback) {
-              return callback(content.status);
-            }
-          }, function(error) {
-            if (callback) {
-              callback(error);
-            }
-            else {
-              console.log(error);
-            }
-          });
+            data: JSON.stringify(
+                {'data': 'xyz.openbmc_project.State.BMC.Transition.Reboot'})
+          })
+              .then(
+                  function(response) {
+                    var json = JSON.stringify(response.data);
+                    var content = JSON.parse(json);
+                    if (callback) {
+                      return callback(content.status);
+                    }
+                  },
+                  function(error) {
+                    if (callback) {
+                      callback(error);
+                    } else {
+                      console.log(error);
+                    }
+                  });
         },
         hostPowerOn: function() {
           var deferred = $q.defer();
           $http({
             method: 'PUT',
-            url: DataService.getHost() + '/xyz/openbmc_project/state/host0/attr/RequestedHostTransition',
+            url: DataService.getHost() +
+                '/xyz/openbmc_project/state/host0/attr/RequestedHostTransition',
             headers: {
               'Accept': 'application/json',
               'Content-Type': 'application/json'
             },
             withCredentials: true,
-            data: JSON.stringify({
-              'data': 'xyz.openbmc_project.State.Host.Transition.On'
-            })
-          }).then(function(response) {
-            var json = JSON.stringify(response.data);
-            var content = JSON.parse(json);
-            deferred.resolve(content.status);
-          }, function(error) {
-            console.log(error);
-            deferred.reject(error);
-          });
+            data: JSON.stringify(
+                {'data': 'xyz.openbmc_project.State.Host.Transition.On'})
+          })
+              .then(
+                  function(response) {
+                    var json = JSON.stringify(response.data);
+                    var content = JSON.parse(json);
+                    deferred.resolve(content.status);
+                  },
+                  function(error) {
+                    console.log(error);
+                    deferred.reject(error);
+                  });
           return deferred.promise;
         },
         hostPowerOff: function() {
           var deferred = $q.defer();
           $http({
             method: 'PUT',
-            url: DataService.getHost() + '/xyz/openbmc_project/state/host0/attr/RequestedHostTransition',
+            url: DataService.getHost() +
+                '/xyz/openbmc_project/state/host0/attr/RequestedHostTransition',
             headers: {
               'Accept': 'application/json',
               'Content-Type': 'application/json'
             },
             withCredentials: true,
-            data: JSON.stringify({
-              'data': 'xyz.openbmc_project.State.Host.Transition.Off'
-            })
-          }).then(function(response) {
-            var json = JSON.stringify(response.data);
-            var content = JSON.parse(json);
-            deferred.resolve(content.status);
-          }, function(error) {
-            console.log(error);
-            deferred.reject(error);
-          });
+            data: JSON.stringify(
+                {'data': 'xyz.openbmc_project.State.Host.Transition.Off'})
+          })
+              .then(
+                  function(response) {
+                    var json = JSON.stringify(response.data);
+                    var content = JSON.parse(json);
+                    deferred.resolve(content.status);
+                  },
+                  function(error) {
+                    console.log(error);
+                    deferred.reject(error);
+                  });
           return deferred.promise;
         },
         hostReboot: function() {
           var deferred = $q.defer();
           $http({
             method: 'PUT',
-            url: DataService.getHost() + '/xyz/openbmc_project/state/host0/attr/RequestedHostTransition',
+            url: DataService.getHost() +
+                '/xyz/openbmc_project/state/host0/attr/RequestedHostTransition',
             headers: {
               'Accept': 'application/json',
               'Content-Type': 'application/json'
             },
             withCredentials: true,
-            data: JSON.stringify({
-              'data': 'xyz.openbmc_project.State.Host.Transition.Reboot'
-            })
-          }).then(function(response) {
-            var json = JSON.stringify(response.data);
-            var content = JSON.parse(json);
-            deferred.resolve(content.status);
-          }, function(error) {
-            console.log(error);
-            deferred.reject(error);
-          });
+            data: JSON.stringify(
+                {'data': 'xyz.openbmc_project.State.Host.Transition.Reboot'})
+          })
+              .then(
+                  function(response) {
+                    var json = JSON.stringify(response.data);
+                    var content = JSON.parse(json);
+                    deferred.resolve(content.status);
+                  },
+                  function(error) {
+                    console.log(error);
+                    deferred.reject(error);
+                  });
 
           return deferred.promise;
         },
@@ -467,350 +500,391 @@
               'Content-Type': 'application/json'
             },
             withCredentials: true,
-            data: JSON.stringify({
-              'data': []
-            })
-          }).then(function(response) {
-            var json = JSON.stringify(response.data);
-            var content = JSON.parse(json);
-            if (callback) {
-              return callback(content);
-            }
-          }, function(error) {
-            if (callback) {
-              callback(error);
-            }
-            else {
-              console.log(error);
-            }
-          });
+            data: JSON.stringify({'data': []})
+          })
+              .then(
+                  function(response) {
+                    var json = JSON.stringify(response.data);
+                    var content = JSON.parse(json);
+                    if (callback) {
+                      return callback(content);
+                    }
+                  },
+                  function(error) {
+                    if (callback) {
+                      callback(error);
+                    } else {
+                      console.log(error);
+                    }
+                  });
         },
         getLogs: function() {
           var deferred = $q.defer();
           $http({
             method: 'GET',
-            url: DataService.getHost() + '/xyz/openbmc_project/logging/enumerate',
+            url: DataService.getHost() +
+                '/xyz/openbmc_project/logging/enumerate',
             headers: {
               'Accept': 'application/json',
               'Content-Type': 'application/json'
             },
             withCredentials: true
-          }).then(function(response) {
-            var json = JSON.stringify(response.data);
-            var content = JSON.parse(json);
-            var dataClone = JSON.parse(JSON.stringify(content.data));
-            var data = [];
-            var severityCode = '';
-            var priority = '';
-            var health = '';
-            var relatedItems = [];
+          })
+              .then(
+                  function(response) {
+                    var json = JSON.stringify(response.data);
+                    var content = JSON.parse(json);
+                    var dataClone = JSON.parse(JSON.stringify(content.data));
+                    var data = [];
+                    var severityCode = '';
+                    var priority = '';
+                    var health = '';
+                    var relatedItems = [];
 
-            for (var key in content.data) {
-              if (content.data.hasOwnProperty(key) && content.data[key].hasOwnProperty('Id')) {
-                var severityFlags = {
-                  low: false,
-                  medium: false,
-                  high: false
-                };
-                var healthFlags = {
-                  critical: false,
-                  warning: false,
-                  good: false
-                };
-                severityCode = content.data[key].Severity.split('.').pop();
-                priority = Constants.SEVERITY_TO_PRIORITY_MAP[severityCode];
-                severityFlags[priority.toLowerCase()] = true;
-                health = Constants.SEVERITY_TO_HEALTH_MAP[severityCode];
-                healthFlags[health.toLowerCase()] = true;
-                relatedItems = [];
-                content.data[key].associations.forEach(function(item) {
-                  relatedItems.push(item[2]);
-                });
+                    for (var key in content.data) {
+                      if (content.data.hasOwnProperty(key) &&
+                          content.data[key].hasOwnProperty('Id')) {
+                        var severityFlags = {
+                          low: false,
+                          medium: false,
+                          high: false
+                        };
+                        var healthFlags = {
+                          critical: false,
+                          warning: false,
+                          good: false
+                        };
+                        severityCode =
+                            content.data[key].Severity.split('.').pop();
+                        priority =
+                            Constants.SEVERITY_TO_PRIORITY_MAP[severityCode];
+                        severityFlags[priority.toLowerCase()] = true;
+                        health = Constants.SEVERITY_TO_HEALTH_MAP[severityCode];
+                        healthFlags[health.toLowerCase()] = true;
+                        relatedItems = [];
+                        content.data[key].associations.forEach(function(item) {
+                          relatedItems.push(item[2]);
+                        });
 
-                data.push(Object.assign({
-                  path: key,
-                  copied: false,
-                  priority: priority,
-                  severity_code: severityCode,
-                  severity_flags: severityFlags,
-                  health_flags: healthFlags,
-                  additional_data: content.data[key].AdditionalData.join('\n'),
-                  type: content.data[key].Message,
-                  selected: false,
-                  search_text: ('#' + content.data[key].Id + ' ' + severityCode + ' ' + content.data[key].Severity + ' ' + content.data[key].AdditionalData.join(' ')).toLowerCase(),
-                  meta: false,
-                  confirm: false,
-                  related_items: relatedItems,
-                  data: {
-                    key: key,
-                    value: content.data[key]
-                  }
-                }, content.data[key]));
-              }
-            }
-            deferred.resolve({
-              data: data,
-              original: dataClone
-            });
-          }, function(error) {
-            console.log(error);
-            deferred.reject(error);
-          });
+                        data.push(Object.assign(
+                            {
+                              path: key,
+                              copied: false,
+                              priority: priority,
+                              severity_code: severityCode,
+                              severity_flags: severityFlags,
+                              health_flags: healthFlags,
+                              additional_data:
+                                  content.data[key].AdditionalData.join('\n'),
+                              type: content.data[key].Message,
+                              selected: false,
+                              search_text:
+                                  ('#' + content.data[key].Id + ' ' +
+                                   severityCode + ' ' +
+                                   content.data[key].Severity + ' ' +
+                                   content.data[key].AdditionalData.join(' '))
+                                      .toLowerCase(),
+                              meta: false,
+                              confirm: false,
+                              related_items: relatedItems,
+                              data: {key: key, value: content.data[key]}
+                            },
+                            content.data[key]));
+                      }
+                    }
+                    deferred.resolve({data: data, original: dataClone});
+                  },
+                  function(error) {
+                    console.log(error);
+                    deferred.reject(error);
+                  });
 
           return deferred.promise;
         },
         getAllSensorStatus: function(callback) {
           $http({
             method: 'GET',
-            url: DataService.getHost() + '/xyz/openbmc_project/sensors/enumerate',
+            url: DataService.getHost() +
+                '/xyz/openbmc_project/sensors/enumerate',
             headers: {
               'Accept': 'application/json',
               'Content-Type': 'application/json'
             },
             withCredentials: true
-          }).then(function(response) {
-            var json = JSON.stringify(response.data);
-            var content = JSON.parse(json);
-            var dataClone = JSON.parse(JSON.stringify(content.data));
-            var sensorData = [];
-            var severity = {};
-            var title = '';
-            var tempKeyParts = [];
-            var order = 0;
-            var customOrder = 0;
+          })
+              .then(
+                  function(response) {
+                    var json = JSON.stringify(response.data);
+                    var content = JSON.parse(json);
+                    var dataClone = JSON.parse(JSON.stringify(content.data));
+                    var sensorData = [];
+                    var severity = {};
+                    var title = '';
+                    var tempKeyParts = [];
+                    var order = 0;
+                    var customOrder = 0;
 
-            function getSensorStatus(reading) {
-              var severityFlags = {
-                  critical: false,
-                  warning: false,
-                  normal: false
-                },
-                severityText = '',
-                order = 0;
+                    function getSensorStatus(reading) {
+                      var severityFlags = {
+                        critical: false,
+                        warning: false,
+                        normal: false
+                      },
+                          severityText = '', order = 0;
 
-              if (reading.hasOwnProperty('CriticalLow') &&
-                reading.Value < reading.CriticalLow
-              ) {
-                severityFlags.critical = true;
-                severityText = 'critical';
-                order = 2;
-              }
-              else if (reading.hasOwnProperty('CriticalHigh') &&
-                reading.Value > reading.CriticalHigh
-              ) {
-                severityFlags.critical = true;
-                severityText = 'critical';
-                order = 2;
-              }
-              else if (reading.hasOwnProperty('CriticalLow') &&
-                reading.hasOwnProperty('WarningLow') &&
-                reading.Value >= reading.CriticalLow && reading.Value <= reading.WarningLow) {
-                severityFlags.warning = true;
-                severityText = 'warning';
-                order = 1;
-              }
-              else if (reading.hasOwnProperty('WarningHigh') &&
-                reading.hasOwnProperty('CriticalHigh') &&
-                reading.Value >= reading.WarningHigh && reading.Value <= reading.CriticalHigh) {
-                severityFlags.warning = true;
-                severityText = 'warning';
-                order = 1;
-              }
-              else {
-                severityFlags.normal = true;
-                severityText = 'normal';
-              }
-              return {
-                flags: severityFlags,
-                severityText: severityText,
-                order: order
-              };
-            }
+                      if (reading.hasOwnProperty('CriticalLow') &&
+                          reading.Value < reading.CriticalLow) {
+                        severityFlags.critical = true;
+                        severityText = 'critical';
+                        order = 2;
+                      } else if (
+                          reading.hasOwnProperty('CriticalHigh') &&
+                          reading.Value > reading.CriticalHigh) {
+                        severityFlags.critical = true;
+                        severityText = 'critical';
+                        order = 2;
+                      } else if (
+                          reading.hasOwnProperty('CriticalLow') &&
+                          reading.hasOwnProperty('WarningLow') &&
+                          reading.Value >= reading.CriticalLow &&
+                          reading.Value <= reading.WarningLow) {
+                        severityFlags.warning = true;
+                        severityText = 'warning';
+                        order = 1;
+                      } else if (
+                          reading.hasOwnProperty('WarningHigh') &&
+                          reading.hasOwnProperty('CriticalHigh') &&
+                          reading.Value >= reading.WarningHigh &&
+                          reading.Value <= reading.CriticalHigh) {
+                        severityFlags.warning = true;
+                        severityText = 'warning';
+                        order = 1;
+                      } else {
+                        severityFlags.normal = true;
+                        severityText = 'normal';
+                      }
+                      return {
+                        flags: severityFlags,
+                        severityText: severityText,
+                        order: order
+                      };
+                    }
 
-            for (var key in content.data) {
-              if (content.data.hasOwnProperty(key) && content.data[key].hasOwnProperty('Unit')) {
+                    for (var key in content.data) {
+                      if (content.data.hasOwnProperty(key) &&
+                          content.data[key].hasOwnProperty('Unit')) {
+                        severity = getSensorStatus(content.data[key]);
 
-                severity = getSensorStatus(content.data[key]);
+                        if (!content.data[key].hasOwnProperty('CriticalLow')) {
+                          content.data[key].CriticalLow = '--';
+                          content.data[key].CriticalHigh = '--';
+                        }
 
-                if (!content.data[key].hasOwnProperty('CriticalLow')) {
-                  content.data[key].CriticalLow = '--';
-                  content.data[key].CriticalHigh = '--';
-                }
+                        if (!content.data[key].hasOwnProperty('WarningLow')) {
+                          content.data[key].WarningLow = '--';
+                          content.data[key].WarningHigh = '--';
+                        }
 
-                if (!content.data[key].hasOwnProperty('WarningLow')) {
-                  content.data[key].WarningLow = '--';
-                  content.data[key].WarningHigh = '--';
-                }
+                        tempKeyParts = key.split('/');
+                        title = tempKeyParts.pop();
+                        title = tempKeyParts.pop() + '_' + title;
+                        title = title.split('_')
+                                    .map(function(item) {
+                                      return item.toLowerCase()
+                                                 .charAt(0)
+                                                 .toUpperCase() +
+                                          item.slice(1);
+                                    })
+                                    .reduce(function(prev, el) {
+                                      return prev + ' ' + el;
+                                    });
 
-                tempKeyParts = key.split('/');
-                title = tempKeyParts.pop();
-                title = tempKeyParts.pop() + '_' + title;
-                title = title.split('_').map(function(item) {
-                  return item.toLowerCase().charAt(0).toUpperCase() + item.slice(1);
-                }).reduce(function(prev, el) {
-                  return prev + ' ' + el;
-                });
+                        content.data[key].Value = getScaledValue(
+                            content.data[key].Value, content.data[key].Scale);
+                        content.data[key].CriticalLow = getScaledValue(
+                            content.data[key].CriticalLow,
+                            content.data[key].Scale);
+                        content.data[key].CriticalHigh = getScaledValue(
+                            content.data[key].CriticalHigh,
+                            content.data[key].Scale);
+                        content.data[key].WarningLow = getScaledValue(
+                            content.data[key].WarningLow,
+                            content.data[key].Scale);
+                        content.data[key].WarningHigh = getScaledValue(
+                            content.data[key].WarningHigh,
+                            content.data[key].Scale);
+                        if (Constants.SENSOR_SORT_ORDER.indexOf(
+                                content.data[key].Unit) > -1) {
+                          customOrder = Constants.SENSOR_SORT_ORDER.indexOf(
+                              content.data[key].Unit);
+                        } else {
+                          customOrder = Constants.SENSOR_SORT_ORDER_DEFAULT;
+                        }
 
-                content.data[key].Value = getScaledValue(content.data[key].Value, content.data[key].Scale);
-                content.data[key].CriticalLow = getScaledValue(content.data[key].CriticalLow, content.data[key].Scale);
-                content.data[key].CriticalHigh = getScaledValue(content.data[key].CriticalHigh, content.data[key].Scale);
-                content.data[key].WarningLow = getScaledValue(content.data[key].WarningLow, content.data[key].Scale);
-                content.data[key].WarningHigh = getScaledValue(content.data[key].WarningHigh, content.data[key].Scale);
-                if (Constants.SENSOR_SORT_ORDER.indexOf(content.data[key].Unit) > -1) {
-                  customOrder = Constants.SENSOR_SORT_ORDER.indexOf(content.data[key].Unit);
-                }
-                else {
-                  customOrder = Constants.SENSOR_SORT_ORDER_DEFAULT;
-                }
+                        sensorData.push(Object.assign(
+                            {
+                              path: key,
+                              selected: false,
+                              confirm: false,
+                              copied: false,
+                              title: title,
+                              unit:
+                                  Constants
+                                      .SENSOR_UNIT_MAP[content.data[key].Unit],
+                              severity_flags: severity.flags,
+                              status: severity.severityText,
+                              order: severity.order,
+                              custom_order: customOrder,
+                              search_text:
+                                  (title + ' ' + content.data[key].Value + ' ' +
+                                   Constants.SENSOR_UNIT_MAP[content.data[key]
+                                                                 .Unit] +
+                                   ' ' + severity.severityText + ' ' +
+                                   content.data[key].CriticalLow + ' ' +
+                                   content.data[key].CriticalHigh + ' ' +
+                                   content.data[key].WarningLow + ' ' +
+                                   content.data[key].WarningHigh + ' ')
+                                      .toLowerCase(),
+                              original_data:
+                                  {key: key, value: content.data[key]}
+                            },
+                            content.data[key]));
+                      }
+                    }
 
-                sensorData.push(Object.assign({
-                  path: key,
-                  selected: false,
-                  confirm: false,
-                  copied: false,
-                  title: title,
-                  unit: Constants.SENSOR_UNIT_MAP[content.data[key].Unit],
-                  severity_flags: severity.flags,
-                  status: severity.severityText,
-                  order: severity.order,
-                  custom_order: customOrder,
-                  search_text: (title + ' ' + content.data[key].Value + ' ' +
-                    Constants.SENSOR_UNIT_MAP[content.data[key].Unit] + ' ' +
-                    severity.severityText + ' ' +
-                    content.data[key].CriticalLow + ' ' +
-                    content.data[key].CriticalHigh + ' ' +
-                    content.data[key].WarningLow + ' ' +
-                    content.data[key].WarningHigh + ' '
-                  ).toLowerCase(),
-                  original_data: {
-                    key: key,
-                    value: content.data[key]
-                  }
-                }, content.data[key]));
-              }
-            }
-
-            callback(sensorData, dataClone);
-          }, function(error) {
-            console.log(error);
-          });
+                    callback(sensorData, dataClone);
+                  },
+                  function(error) {
+                    console.log(error);
+                  });
         },
         getActivation: function(imageId) {
           return $http({
-            method: 'GET',
-            url: DataService.getHost() + '/xyz/openbmc_project/software/' + imageId + '/attr/Activation',
-            headers: {
-              'Accept': 'application/json',
-              'Content-Type': 'application/json'
-            },
-            withCredentials: true
-          }).then(function(response) {
-            return response.data;
-          });
+                   method: 'GET',
+                   url: DataService.getHost() +
+                       '/xyz/openbmc_project/software/' + imageId +
+                       '/attr/Activation',
+                   headers: {
+                     'Accept': 'application/json',
+                     'Content-Type': 'application/json'
+                   },
+                   withCredentials: true
+                 })
+              .then(function(response) {
+                return response.data;
+              });
         },
         getFirmwares: function() {
           var deferred = $q.defer();
           $http({
             method: 'GET',
-            url: DataService.getHost() + '/xyz/openbmc_project/software/enumerate',
+            url: DataService.getHost() +
+                '/xyz/openbmc_project/software/enumerate',
             headers: {
               'Accept': 'application/json',
               'Content-Type': 'application/json'
             },
             withCredentials: true
-          }).then(function(response) {
-            var json = JSON.stringify(response.data);
-            var content = JSON.parse(json);
-            var data = [];
-            var activationStatus = '';
-            var isExtended = false;
-            var bmcActiveVersion = '';
-            var hostActiveVersion = '';
-            var imageType = '';
-            var extendedVersions = [];
-            var functionalImages = [];
+          })
+              .then(
+                  function(response) {
+                    var json = JSON.stringify(response.data);
+                    var content = JSON.parse(json);
+                    var data = [];
+                    var activationStatus = '';
+                    var isExtended = false;
+                    var bmcActiveVersion = '';
+                    var hostActiveVersion = '';
+                    var imageType = '';
+                    var extendedVersions = [];
+                    var functionalImages = [];
 
-            function getFormatedExtendedVersions(extendedVersion) {
-              var versions = [];
-              extendedVersion = extendedVersion.split(',');
+                    function getFormatedExtendedVersions(extendedVersion) {
+                      var versions = [];
+                      extendedVersion = extendedVersion.split(',');
 
-              extendedVersion.forEach(function(item) {
-                var parts = item.split('-');
-                var numberIndex = 0;
-                for (var i = 0; i < parts.length; i++) {
-                  if (/[0-9]/.test(parts[i])) {
-                    numberIndex = i;
-                    break;
-                  }
-                }
-                var titlePart = parts.splice(0, numberIndex);
-                titlePart = titlePart.join('');
-                titlePart = titlePart[0].toUpperCase() + titlePart.substr(1, titlePart.length);
-                var versionPart = parts.join('-');
-                versions.push({
-                  title: titlePart,
-                  version: versionPart
-                });
-              });
+                      extendedVersion.forEach(function(item) {
+                        var parts = item.split('-');
+                        var numberIndex = 0;
+                        for (var i = 0; i < parts.length; i++) {
+                          if (/[0-9]/.test(parts[i])) {
+                            numberIndex = i;
+                            break;
+                          }
+                        }
+                        var titlePart = parts.splice(0, numberIndex);
+                        titlePart = titlePart.join('');
+                        titlePart = titlePart[0].toUpperCase() +
+                            titlePart.substr(1, titlePart.length);
+                        var versionPart = parts.join('-');
+                        versions.push({title: titlePart, version: versionPart});
+                      });
 
-              return versions;
-            }
+                      return versions;
+                    }
 
-            // Get the list of functional images so we can compare
-            // later if an image is functional
-            if (content.data[Constants.FIRMWARE.FUNCTIONAL_OBJPATH]) {
-              functionalImages = content.data[Constants.FIRMWARE.FUNCTIONAL_OBJPATH].endpoints;
-            }
-            for (var key in content.data) {
-              if (content.data.hasOwnProperty(key) && content.data[key].hasOwnProperty('Version')) {
-                // If the image is "Functional" use that for the
-                // activation status, else use the value of "Activation"
-                // github.com/openbmc/phosphor-dbus-interfaces/blob/master/xyz/openbmc_project/Software/Activation.interface.yaml
-                activationStatus = content.data[key].Activation.split('.').pop();
-                if (functionalImages.includes(key)) {
-                  activationStatus = 'Functional';
-                }
+                    // Get the list of functional images so we can compare
+                    // later if an image is functional
+                    if (content.data[Constants.FIRMWARE.FUNCTIONAL_OBJPATH]) {
+                      functionalImages =
+                          content.data[Constants.FIRMWARE.FUNCTIONAL_OBJPATH]
+                              .endpoints;
+                    }
+                    for (var key in content.data) {
+                      if (content.data.hasOwnProperty(key) &&
+                          content.data[key].hasOwnProperty('Version')) {
+                        // If the image is "Functional" use that for the
+                        // activation status, else use the value of "Activation"
+                        // github.com/openbmc/phosphor-dbus-interfaces/blob/master/xyz/openbmc_project/Software/Activation.interface.yaml
+                        activationStatus =
+                            content.data[key].Activation.split('.').pop();
+                        if (functionalImages.includes(key)) {
+                          activationStatus = 'Functional';
+                        }
 
-                imageType = content.data[key].Purpose.split('.').pop();
-                isExtended = content.data[key].hasOwnProperty('ExtendedVersion') && content.data[key].ExtendedVersion != '';
-                if (isExtended) {
-                  extendedVersions = getFormatedExtendedVersions(content.data[key].ExtendedVersion);
-                }
-                data.push(Object.assign({
-                  path: key,
-                  activationStatus: activationStatus,
-                  imageId: key.split('/').pop(),
-                  imageType: imageType,
-                  isExtended: isExtended,
-                  extended: {
-                    show: false,
-                    versions: extendedVersions
+                        imageType = content.data[key].Purpose.split('.').pop();
+                        isExtended = content.data[key].hasOwnProperty(
+                                         'ExtendedVersion') &&
+                            content.data[key].ExtendedVersion != '';
+                        if (isExtended) {
+                          extendedVersions = getFormatedExtendedVersions(
+                              content.data[key].ExtendedVersion);
+                        }
+                        data.push(Object.assign(
+                            {
+                              path: key,
+                              activationStatus: activationStatus,
+                              imageId: key.split('/').pop(),
+                              imageType: imageType,
+                              isExtended: isExtended,
+                              extended:
+                                  {show: false, versions: extendedVersions},
+                              data: {key: key, value: content.data[key]}
+                            },
+                            content.data[key]));
+
+                        if (activationStatus == 'Functional' &&
+                            imageType == 'BMC') {
+                          bmcActiveVersion = content.data[key].Version;
+                        }
+
+                        if (activationStatus == 'Functional' &&
+                            imageType == 'Host') {
+                          hostActiveVersion = content.data[key].Version;
+                        }
+                      }
+                    }
+
+                    deferred.resolve({
+                      data: data,
+                      bmcActiveVersion: bmcActiveVersion,
+                      hostActiveVersion: hostActiveVersion
+                    });
                   },
-                  data: {
-                    key: key,
-                    value: content.data[key]
-                  }
-                }, content.data[key]));
-
-                if (activationStatus == 'Functional' && imageType == 'BMC') {
-                  bmcActiveVersion = content.data[key].Version;
-                }
-
-                if (activationStatus == 'Functional' && imageType == 'Host') {
-                  hostActiveVersion = content.data[key].Version;
-                }
-              }
-            }
-
-            deferred.resolve({
-              data: data,
-              bmcActiveVersion: bmcActiveVersion,
-              hostActiveVersion: hostActiveVersion
-            });
-          }, function(error) {
-            console.log(error);
-            deferred.reject(error);
-          });
+                  function(error) {
+                    console.log(error);
+                    deferred.reject(error);
+                  });
 
           return deferred.promise;
         },
@@ -818,23 +892,25 @@
           var deferred = $q.defer();
           $http({
             method: 'PUT',
-            url: DataService.getHost() + '/xyz/openbmc_project/software/' + imageId + '/attr/Priority',
+            url: DataService.getHost() + '/xyz/openbmc_project/software/' +
+                imageId + '/attr/Priority',
             headers: {
               'Accept': 'application/json',
               'Content-Type': 'application/json'
             },
             withCredentials: true,
-            data: JSON.stringify({
-              'data': priority
-            })
-          }).then(function(response) {
-            var json = JSON.stringify(response.data);
-            var content = JSON.parse(json);
-            deferred.resolve(content);
-          }, function(error) {
-            console.log(error);
-            deferred.reject(error);
-          });
+            data: JSON.stringify({'data': priority})
+          })
+              .then(
+                  function(response) {
+                    var json = JSON.stringify(response.data);
+                    var content = JSON.parse(json);
+                    deferred.resolve(content);
+                  },
+                  function(error) {
+                    console.log(error);
+                    deferred.reject(error);
+                  });
 
           return deferred.promise;
         },
@@ -842,23 +918,25 @@
           var deferred = $q.defer();
           $http({
             method: 'POST',
-            url: DataService.getHost() + '/xyz/openbmc_project/software/' + imageId + '/action/Delete',
+            url: DataService.getHost() + '/xyz/openbmc_project/software/' +
+                imageId + '/action/Delete',
             headers: {
               'Accept': 'application/json',
               'Content-Type': 'application/json'
             },
             withCredentials: true,
-            data: JSON.stringify({
-              'data': []
-            })
-          }).then(function(response) {
-            var json = JSON.stringify(response.data);
-            var content = JSON.parse(json);
-            deferred.resolve(content);
-          }, function(error) {
-            console.log(error);
-            deferred.reject(error);
-          });
+            data: JSON.stringify({'data': []})
+          })
+              .then(
+                  function(response) {
+                    var json = JSON.stringify(response.data);
+                    var content = JSON.parse(json);
+                    deferred.resolve(content);
+                  },
+                  function(error) {
+                    console.log(error);
+                    deferred.reject(error);
+                  });
 
           return deferred.promise;
         },
@@ -866,75 +944,81 @@
           var deferred = $q.defer();
           $http({
             method: 'PUT',
-            url: DataService.getHost() + '/xyz/openbmc_project/software/' + imageId + '/attr/RequestedActivation',
+            url: DataService.getHost() + '/xyz/openbmc_project/software/' +
+                imageId + '/attr/RequestedActivation',
             headers: {
               'Accept': 'application/json',
               'Content-Type': 'application/json'
             },
             withCredentials: true,
-            data: JSON.stringify({
-              'data': Constants.FIRMWARE.ACTIVATE_FIRMWARE
-            })
-          }).then(function(response) {
-            var json = JSON.stringify(response.data);
-            var content = JSON.parse(json);
-            deferred.resolve(content);
-          }, function(error) {
-            console.log(error);
-            deferred.reject(error);
-          });
+            data:
+                JSON.stringify({'data': Constants.FIRMWARE.ACTIVATE_FIRMWARE})
+          })
+              .then(
+                  function(response) {
+                    var json = JSON.stringify(response.data);
+                    var content = JSON.parse(json);
+                    deferred.resolve(content);
+                  },
+                  function(error) {
+                    console.log(error);
+                    deferred.reject(error);
+                  });
 
           return deferred.promise;
         },
         uploadImage: function(file) {
           return $http({
-            method: 'POST',
-            timeout: 5 * 60 * 1000,
-            url: DataService.getHost() + '/upload/image',
-            headers: {
-              'Content-Type': 'application/octet-stream'
-            },
-            withCredentials: true,
-            data: file
-          }).then(function(response) {
-            return response.data;
-          });
+                   method: 'POST',
+                   timeout: 5 * 60 * 1000,
+                   url: DataService.getHost() + '/upload/image',
+                   headers: {'Content-Type': 'application/octet-stream'},
+                   withCredentials: true,
+                   data: file
+                 })
+              .then(function(response) {
+                return response.data;
+              });
         },
         downloadImage: function(host, filename) {
           return $http({
-            method: 'POST',
-            url: DataService.getHost() + '/xyz/openbmc_project/software/action/DownloadViaTFTP',
-            headers: {
-              'Accept': 'application/json',
-              'Content-Type': 'application/json'
-            },
-            withCredentials: true,
-            data: JSON.stringify({
-              'data': [filename, host]
-            }),
-            responseType: 'arraybuffer'
-          }).then(function(response) {
-            return response.data;
-          });
+                   method: 'POST',
+                   url: DataService.getHost() +
+                       '/xyz/openbmc_project/software/action/DownloadViaTFTP',
+                   headers: {
+                     'Accept': 'application/json',
+                     'Content-Type': 'application/json'
+                   },
+                   withCredentials: true,
+                   data: JSON.stringify({'data': [filename, host]}),
+                   responseType: 'arraybuffer'
+                 })
+              .then(function(response) {
+                return response.data;
+              });
         },
         getBMCEthernetInfo: function() {
           var deferred = $q.defer();
           $http({
             method: 'GET',
-            url: DataService.getHost() + '/xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc/ethernet',
+            url: DataService.getHost() +
+                '/xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc/ethernet',
             headers: {
               'Accept': 'application/json',
               'Content-Type': 'application/json'
             },
             withCredentials: true
-          }).then(function(response) {
-            var json = JSON.stringify(response.data);
-            var content = JSON.parse(json);
-            deferred.resolve(content.data);
-          }, function(error) {
-            console.log(error);
-            deferred.reject(error);
-          });
+          })
+              .then(
+                  function(response) {
+                    var json = JSON.stringify(response.data);
+                    var content = JSON.parse(json);
+                    deferred.resolve(content.data);
+                  },
+                  function(error) {
+                    console.log(error);
+                    deferred.reject(error);
+                  });
 
           return deferred.promise;
         },
@@ -942,20 +1026,24 @@
           var deferred = $q.defer();
           $http({
             method: 'GET',
-            url: DataService.getHost() + '/xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc',
+            url: DataService.getHost() +
+                '/xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc',
             headers: {
               'Accept': 'application/json',
               'Content-Type': 'application/json'
             },
             withCredentials: true
-          }).then(function(response) {
-            var json = JSON.stringify(response.data);
-            var content = JSON.parse(json);
-            deferred.resolve(content.data);
-          }, function(error) {
-            console.log(error);
-            deferred.reject(error);
-          });
+          })
+              .then(
+                  function(response) {
+                    var json = JSON.stringify(response.data);
+                    var content = JSON.parse(json);
+                    deferred.resolve(content.data);
+                  },
+                  function(error) {
+                    console.log(error);
+                    deferred.reject(error);
+                  });
           return deferred.promise;
         },
         getServerInfo: function() {
@@ -963,34 +1051,38 @@
           // interfaces so we can get the system object(s) by the looking
           // for the system interface.
           return $http({
-            method: 'GET',
-            url: DataService.getHost() + '/xyz/openbmc_project/inventory/system',
-            headers: {
-              'Accept': 'application/json',
-              'Content-Type': 'application/json'
-            },
-            withCredentials: true
-          }).then(function(response) {
-            return response.data;
-          });
+                   method: 'GET',
+                   url: DataService.getHost() +
+                       '/xyz/openbmc_project/inventory/system',
+                   headers: {
+                     'Accept': 'application/json',
+                     'Content-Type': 'application/json'
+                   },
+                   withCredentials: true
+                 })
+              .then(function(response) {
+                return response.data;
+              });
         },
         getBMCTime: function() {
           return $http({
-            method: 'GET',
-            url: DataService.getHost() + '/xyz/openbmc_project/time/bmc',
-            headers: {
-              'Accept': 'application/json',
-              'Content-Type': 'application/json'
-            },
-            withCredentials: true
-          }).then(function(response) {
-            return response.data;
-          });
+                   method: 'GET',
+                   url: DataService.getHost() + '/xyz/openbmc_project/time/bmc',
+                   headers: {
+                     'Accept': 'application/json',
+                     'Content-Type': 'application/json'
+                   },
+                   withCredentials: true
+                 })
+              .then(function(response) {
+                return response.data;
+              });
         },
         getHardwares: function(callback) {
           $http({
             method: 'GET',
-            url: DataService.getHost() + '/xyz/openbmc_project/inventory/enumerate',
+            url: DataService.getHost() +
+                '/xyz/openbmc_project/inventory/enumerate',
             headers: {
               'Accept': 'application/json',
               'Content-Type': 'application/json'
@@ -1007,11 +1099,12 @@
             var componentIndex = -1;
             var tempParts = [];
 
-
             function isSubComponent(key) {
-
-              for (var i = 0; i < Constants.HARDWARE.parent_components.length; i++) {
-                if (key.split(Constants.HARDWARE.parent_components[i]).length == 2) return true;
+              for (var i = 0; i < Constants.HARDWARE.parent_components.length;
+                   i++) {
+                if (key.split(Constants.HARDWARE.parent_components[i]).length ==
+                    2)
+                  return true;
               }
 
               return false;
@@ -1019,8 +1112,10 @@
 
             function titlelize(title) {
               title = title.replace(/([A-Z0-9]+)/g, ' $1').replace(/^\s+/, '');
-              for (var i = 0; i < Constants.HARDWARE.uppercase_titles.length; i++) {
-                if (title.toLowerCase().indexOf((Constants.HARDWARE.uppercase_titles[i] + ' ')) > -1) {
+              for (var i = 0; i < Constants.HARDWARE.uppercase_titles.length;
+                   i++) {
+                if (title.toLowerCase().indexOf(
+                        (Constants.HARDWARE.uppercase_titles[i] + ' ')) > -1) {
                   return title.toUpperCase();
                 }
               }
@@ -1029,9 +1124,7 @@
             }
 
             function camelcaseToLabel(obj) {
-              var transformed = [],
-                label = '',
-                value = '';
+              var transformed = [], label = '', value = '';
               for (var key in obj) {
                 label = key.replace(/([A-Z0-9]+)/g, ' $1').replace(/^\s+/, '');
                 if (obj[key] !== '') {
@@ -1039,10 +1132,7 @@
                   if (value == 1 || value == 0) {
                     value = (value == 1) ? 'Yes' : 'No';
                   }
-                  transformed.push({
-                    key: label,
-                    value: value
-                  });
+                  transformed.push({key: label, value: value});
                 }
               }
 
@@ -1060,8 +1150,7 @@
 
             for (var key in content.data) {
               if (content.data.hasOwnProperty(key) &&
-                key.indexOf(Constants.HARDWARE.component_key_filter) == 0) {
-
+                  key.indexOf(Constants.HARDWARE.component_key_filter) == 0) {
                 data = camelcaseToLabel(content.data[key]);
                 searchText = getSearchText(data);
                 title = key.split('/').pop();
@@ -1069,24 +1158,21 @@
                 title = titlelize(title);
 
                 if (!isSubComponent(key)) {
-                  hardwareData.push(Object.assign({
-                    path: key,
-                    title: title,
-                    selected: false,
-                    expanded: false,
-                    search_text: title.toLowerCase() + ' ' + searchText.toLowerCase(),
-                    sub_components: [],
-                    original_data: {
-                      key: key,
-                      value: content.data[key]
-                    }
-                  }, {
-                    items: data
-                  }));
+                  hardwareData.push(Object.assign(
+                      {
+                        path: key,
+                        title: title,
+                        selected: false,
+                        expanded: false,
+                        search_text: title.toLowerCase() + ' ' +
+                            searchText.toLowerCase(),
+                        sub_components: [],
+                        original_data: {key: key, value: content.data[key]}
+                      },
+                      {items: data}));
 
                   keyIndexMap[key] = hardwareData.length - 1;
-                }
-                else {
+                } else {
                   var tempParts = key.split('/');
                   tempParts.pop();
                   tempParts = tempParts.join('/');
@@ -1094,14 +1180,16 @@
                   data = content.data[key];
                   data.title = title;
                   hardwareData[componentIndex].sub_components.push(data);
-                  hardwareData[componentIndex].search_text += ' ' + title.toLowerCase();
+                  hardwareData[componentIndex].search_text +=
+                      ' ' + title.toLowerCase();
 
-                  // Sort the subcomponents alphanumeric so they are displayed on the
-                  // inventory page in order (e.g. core 0, core 1, core 2, ... core 12, core 13)
-                  hardwareData[componentIndex].sub_components.sort(function(a, b) {
-                    return a.title.localeCompare(b.title, 'en', {
-                      numeric: true
-                    });
+                  // Sort the subcomponents alphanumeric so they are displayed
+                  // on the inventory page in order (e.g. core 0, core 1, core
+                  // 2, ... core 12, core 13)
+                  hardwareData[componentIndex].sub_components.sort(function(
+                      a, b) {
+                    return a.title.localeCompare(
+                        b.title, 'en', {numeric: true});
                   });
                 }
               }
@@ -1109,12 +1197,8 @@
 
             if (callback) {
               callback(hardwareData, content.data);
-            }
-            else {
-              return {
-                data: hardwareData,
-                original_data: content.data
-              };
+            } else {
+              return {data: hardwareData, original_data: content.data};
             }
           });
         },
@@ -1129,15 +1213,15 @@
           logs.forEach(function(item) {
             promises.push($http({
               method: 'POST',
-              url: DataService.getHost() + '/xyz/openbmc_project/logging/entry/' + item.Id + '/action/Delete',
+              url: DataService.getHost() +
+                  '/xyz/openbmc_project/logging/entry/' + item.Id +
+                  '/action/Delete',
               headers: {
                 'Accept': 'application/json',
                 'Content-Type': 'application/json'
               },
               withCredentials: true,
-              data: JSON.stringify({
-                'data': []
-              })
+              data: JSON.stringify({'data': []})
             }));
           });
 
@@ -1156,15 +1240,15 @@
           logs.forEach(function(item) {
             promises.push($http({
               method: 'PUT',
-              url: DataService.getHost() + '/xyz/openbmc_project/logging/entry/' + item.Id + '/attr/Resolved',
+              url: DataService.getHost() +
+                  '/xyz/openbmc_project/logging/entry/' + item.Id +
+                  '/attr/Resolved',
               headers: {
                 'Accept': 'application/json',
                 'Content-Type': 'application/json'
               },
               withCredentials: true,
-              data: JSON.stringify({
-                'data': '1'
-              })
+              data: JSON.stringify({'data': '1'})
             }));
           });
 
@@ -1174,65 +1258,72 @@
         },
         getPowerConsumption: function() {
           return $http({
-            method: 'GET',
-            url: DataService.getHost() + '/xyz/openbmc_project/sensors/power/total_power',
-            headers: {
-              'Accept': 'application/json',
-              'Content-Type': 'application/json'
-            },
-            withCredentials: true
-          }).then(function(response) {
-            var json = JSON.stringify(response.data);
-            var content = JSON.parse(json);
+                   method: 'GET',
+                   url: DataService.getHost() +
+                       '/xyz/openbmc_project/sensors/power/total_power',
+                   headers: {
+                     'Accept': 'application/json',
+                     'Content-Type': 'application/json'
+                   },
+                   withCredentials: true
+                 })
+              .then(
+                  function(response) {
+                    var json = JSON.stringify(response.data);
+                    var content = JSON.parse(json);
 
-            return getScaledValue(content.data.Value,
-                content.data.Scale) + ' ' +
-              Constants.POWER_CONSUMPTION_TEXT[content.data.Unit];
-          }, function(error) {
-            if ('Not Found' == error.statusText) {
-              return Constants.POWER_CONSUMPTION_TEXT.notavailable;
-            }
-            else {
-              throw error;
-            }
-          });
+                    return getScaledValue(
+                               content.data.Value, content.data.Scale) +
+                        ' ' +
+                        Constants.POWER_CONSUMPTION_TEXT[content.data.Unit];
+                  },
+                  function(error) {
+                    if ('Not Found' == error.statusText) {
+                      return Constants.POWER_CONSUMPTION_TEXT.notavailable;
+                    } else {
+                      throw error;
+                    }
+                  });
         },
         getPowerCap: function() {
           return $http({
-            method: 'GET',
-            url: DataService.getHost() + '/xyz/openbmc_project/control/host0/power_cap',
-            headers: {
-              'Accept': 'application/json',
-              'Content-Type': 'application/json'
-            },
-            withCredentials: true
-          }).then(function(response) {
-            var json = JSON.stringify(response.data);
-            var content = JSON.parse(json);
+                   method: 'GET',
+                   url: DataService.getHost() +
+                       '/xyz/openbmc_project/control/host0/power_cap',
+                   headers: {
+                     'Accept': 'application/json',
+                     'Content-Type': 'application/json'
+                   },
+                   withCredentials: true
+                 })
+              .then(function(response) {
+                var json = JSON.stringify(response.data);
+                var content = JSON.parse(json);
 
-            return (false == content.data.PowerCapEnable) ?
-              Constants.POWER_CAP_TEXT.disabled :
-              content.data.PowerCap + ' ' + Constants.POWER_CAP_TEXT.unit;
-          });
+                return (false == content.data.PowerCapEnable) ?
+                    Constants.POWER_CAP_TEXT.disabled :
+                    content.data.PowerCap + ' ' + Constants.POWER_CAP_TEXT.unit;
+              });
         },
         setHostname: function(hostname) {
           return $http({
-            method: 'PUT',
-            url: DataService.getHost() + '/xyz/openbmc_project/network/config/attr/HostName',
-            headers: {
-              'Accept': 'application/json',
-              'Content-Type': 'application/json'
-            },
-            withCredentials: true,
-            data: JSON.stringify({
-              'data': hostname
-            })
-          }).then(function(response) {
-            return response.data;
-          });
+                   method: 'PUT',
+                   url: DataService.getHost() +
+                       '/xyz/openbmc_project/network/config/attr/HostName',
+                   headers: {
+                     'Accept': 'application/json',
+                     'Content-Type': 'application/json'
+                   },
+                   withCredentials: true,
+                   data: JSON.stringify({'data': hostname})
+                 })
+              .then(function(response) {
+                return response.data;
+              });
         },
       };
       return SERVICE;
-    }]);
+    }
+  ]);
 
 })(window.angular);
diff --git a/app/common/services/apiInterceptor.js b/app/common/services/apiInterceptor.js
index b3f2ff4..03a43a3 100644
--- a/app/common/services/apiInterceptor.js
+++ b/app/common/services/apiInterceptor.js
@@ -10,9 +10,9 @@
 window.angular && (function(angular) {
   'use strict';
 
-  angular
-    .module('app.common.services')
-    .service('apiInterceptor', ['$q', '$rootScope', 'dataService', function($q, $rootScope, dataService) {
+  angular.module('app.common.services').service('apiInterceptor', [
+    '$q', '$rootScope', 'dataService',
+    function($q, $rootScope, dataService) {
       return {
         'request': function(config) {
           dataService.loading = true;
@@ -25,7 +25,7 @@
         'response': function(response) {
           dataService.loading = false;
 
-          //not interested in template requests
+          // not interested in template requests
           if (!/^https?\:/i.test(response.config.url)) {
             return response;
           }
@@ -33,13 +33,12 @@
           dataService.last_updated = new Date();
           if (!response) {
             dataService.server_unreachable = true;
-          }
-          else {
+          } else {
             dataService.server_unreachable = false;
           }
 
           if (response && response.status == 'error' &&
-            dataService.path != '/login') {
+              dataService.path != '/login') {
             $rootScope.$emit('timedout-user', {});
           }
 
@@ -52,8 +51,7 @@
               if (dataService.path != '/login') {
                 $rootScope.$emit('timedout-user', {});
               }
-            }
-            else if (rejection.status == -1) {
+            } else if (rejection.status == -1) {
               dataService.server_unreachable = true;
             }
 
@@ -62,6 +60,7 @@
           return $q.reject(rejection);
         }
       };
-    }]);
+    }
+  ]);
 
 })(window.angular);
diff --git a/app/common/services/constants.js b/app/common/services/constants.js
index d749ea8..112c90e 100644
--- a/app/common/services/constants.js
+++ b/app/common/services/constants.js
@@ -10,158 +10,142 @@
 window.angular && (function(angular) {
   'use strict';
 
-  angular
-    .module('app.common.services', [])
-    .service('Constants', function() {
-      return {
-        API_CREDENTIALS: {
-          host_storage_key: 'API_HOST_KEY',
-          default_protocol: 'https'
-        },
-        API_RESPONSE: {
-          ERROR_STATUS: 'error',
-          ERROR_MESSAGE: '401 Unauthorized',
-          SUCCESS_STATUS: 'ok',
-          SUCCESS_MESSAGE: '200 OK'
-        },
-        CHASSIS_POWER_STATE: {
-          on: 'On',
-          on_code: 'xyz.openbmc_project.State.Chassis.PowerState.On',
-          off: 'Off',
-          off_code: 'xyz.openbmc_project.State.Chassis.PowerState.Off'
-        },
-        HOST_STATE_TEXT: {
-          on: 'Running',
-          on_code: 'xyz.openbmc_project.State.Host.HostState.Running',
-          off: 'Off',
-          off_code: 'xyz.openbmc_project.State.Host.HostState.Off',
-          error: 'Quiesced',
-          error_code: 'xyz.openbmc_project.State.Host.HostState.Quiesced',
-          unreachable: 'Unreachable'
-        },
-        HOST_STATE: {
-          on: 1,
-          off: -1,
-          error: 0,
-          unreachable: -2
-        },
-        LED_STATE: {
-          on: true,
-          off: false
-        },
-        LED_STATE_TEXT: {
-          on: 'on',
-          off: 'off'
-        },
-        SEVERITY_TO_HEALTH_MAP: {
-          Emergency: 'Critical',
-          Alert: 'Critical',
-          Critical: 'Critical',
-          Error: 'Warning',
-          Warning: 'Warning',
-          Notice: 'Good',
-          Debug: 'Good',
-          Informational: 'Good'
-        },
-        SEVERITY_TO_PRIORITY_MAP: {
-          Emergency: 'High',
-          Alert: 'High',
-          Critical: 'High',
-          Error: 'High',
-          Warning: 'Medium',
-          Notice: 'Low',
-          Debug: 'Low',
-          Informational: 'Low'
-        },
-        PAGINATION: {
-          LOG_ITEMS_PER_PAGE: 25
-        },
-        HARDWARE: {
-          component_key_filter: '/xyz/openbmc_project/inventory/system',
-          parent_components: [
-            /xyz\/openbmc_project\/inventory\/system\/chassis\/motherboard\/cpu\d+\//
-          ],
-          uppercase_titles: [
-            'cpu', 'dimm'
-          ]
-        },
-        SENSOR_UNIT_MAP: {
-          'xyz.openbmc_project.Sensor.Value.Unit.RPMS': 'rpms',
-          'xyz.openbmc_project.Sensor.Value.Unit.DegreesC': 'C',
-          'xyz.openbmc_project.Sensor.Value.Unit.Volts': 'volts',
-          'xyz.openbmc_project.Sensor.Value.Unit.Meters': 'meters',
-          'xyz.openbmc_project.Sensor.Value.Unit.Watts': 'watts',
-          'xyz.openbmc_project.Sensor.Value.Unit.Amperes': 'amperes',
-          'xyz.openbmc_project.Sensor.Value.Unit.Joules': 'joules'
-        },
-        SERVER_HEALTH: {
-          critical: 'Critical',
-          warning: 'Warning',
-          good: 'Good',
-          unknown: 'Unknown'
-        },
-        SENSOR_SORT_ORDER: [
-          'xyz.openbmc_project.Sensor.Value.Unit.DegreesC',
-          'xyz.openbmc_project.Sensor.Value.Unit.RPMS',
-          'xyz.openbmc_project.Sensor.Value.Unit.Meters',
-          'xyz.openbmc_project.Sensor.Value.Unit.Volts',
-          'xyz.openbmc_project.Sensor.Value.Unit.Amperes',
-          'xyz.openbmc_project.Sensor.Value.Unit.Joules',
-          'xyz.openbmc_project.Sensor.Value.Unit.Meters'
+  angular.module('app.common.services', []).service('Constants', function() {
+    return {
+      API_CREDENTIALS:
+          {host_storage_key: 'API_HOST_KEY', default_protocol: 'https'},
+      API_RESPONSE: {
+        ERROR_STATUS: 'error',
+        ERROR_MESSAGE: '401 Unauthorized',
+        SUCCESS_STATUS: 'ok',
+        SUCCESS_MESSAGE: '200 OK'
+      },
+      CHASSIS_POWER_STATE: {
+        on: 'On',
+        on_code: 'xyz.openbmc_project.State.Chassis.PowerState.On',
+        off: 'Off',
+        off_code: 'xyz.openbmc_project.State.Chassis.PowerState.Off'
+      },
+      HOST_STATE_TEXT: {
+        on: 'Running',
+        on_code: 'xyz.openbmc_project.State.Host.HostState.Running',
+        off: 'Off',
+        off_code: 'xyz.openbmc_project.State.Host.HostState.Off',
+        error: 'Quiesced',
+        error_code: 'xyz.openbmc_project.State.Host.HostState.Quiesced',
+        unreachable: 'Unreachable'
+      },
+      HOST_STATE: {on: 1, off: -1, error: 0, unreachable: -2},
+      LED_STATE: {on: true, off: false},
+      LED_STATE_TEXT: {on: 'on', off: 'off'},
+      SEVERITY_TO_HEALTH_MAP: {
+        Emergency: 'Critical',
+        Alert: 'Critical',
+        Critical: 'Critical',
+        Error: 'Warning',
+        Warning: 'Warning',
+        Notice: 'Good',
+        Debug: 'Good',
+        Informational: 'Good'
+      },
+      SEVERITY_TO_PRIORITY_MAP: {
+        Emergency: 'High',
+        Alert: 'High',
+        Critical: 'High',
+        Error: 'High',
+        Warning: 'Medium',
+        Notice: 'Low',
+        Debug: 'Low',
+        Informational: 'Low'
+      },
+      PAGINATION: {LOG_ITEMS_PER_PAGE: 25},
+      HARDWARE: {
+        component_key_filter: '/xyz/openbmc_project/inventory/system',
+        parent_components: [
+          /xyz\/openbmc_project\/inventory\/system\/chassis\/motherboard\/cpu\d+\//
         ],
-        SENSOR_SORT_ORDER_DEFAULT: 8,
-        FIRMWARE: {
-          ACTIVATE_FIRMWARE: 'xyz.openbmc_project.Software.Activation.RequestedActivations.Active',
-          FUNCTIONAL_OBJPATH: '/xyz/openbmc_project/software/functional'
+        uppercase_titles: ['cpu', 'dimm']
+      },
+      SENSOR_UNIT_MAP: {
+        'xyz.openbmc_project.Sensor.Value.Unit.RPMS': 'rpms',
+        'xyz.openbmc_project.Sensor.Value.Unit.DegreesC': 'C',
+        'xyz.openbmc_project.Sensor.Value.Unit.Volts': 'volts',
+        'xyz.openbmc_project.Sensor.Value.Unit.Meters': 'meters',
+        'xyz.openbmc_project.Sensor.Value.Unit.Watts': 'watts',
+        'xyz.openbmc_project.Sensor.Value.Unit.Amperes': 'amperes',
+        'xyz.openbmc_project.Sensor.Value.Unit.Joules': 'joules'
+      },
+      SERVER_HEALTH: {
+        critical: 'Critical',
+        warning: 'Warning',
+        good: 'Good',
+        unknown: 'Unknown'
+      },
+      SENSOR_SORT_ORDER: [
+        'xyz.openbmc_project.Sensor.Value.Unit.DegreesC',
+        'xyz.openbmc_project.Sensor.Value.Unit.RPMS',
+        'xyz.openbmc_project.Sensor.Value.Unit.Meters',
+        'xyz.openbmc_project.Sensor.Value.Unit.Volts',
+        'xyz.openbmc_project.Sensor.Value.Unit.Amperes',
+        'xyz.openbmc_project.Sensor.Value.Unit.Joules',
+        'xyz.openbmc_project.Sensor.Value.Unit.Meters'
+      ],
+      SENSOR_SORT_ORDER_DEFAULT: 8,
+      FIRMWARE: {
+        ACTIVATE_FIRMWARE:
+            'xyz.openbmc_project.Software.Activation.RequestedActivations.Active',
+        FUNCTIONAL_OBJPATH: '/xyz/openbmc_project/software/functional'
+      },
+      POLL_INTERVALS: {
+        ACTIVATION: 5000,
+        DOWNLOAD_IMAGE: 5000,
+        POWER_OP: 5000,
+      },
+      TIMEOUT: {
+        ACTIVATION: 1000 * 60 * 10,     // 10 mins
+        DOWNLOAD_IMAGE: 1000 * 60 * 2,  // 2 mins
+        CHASSIS_OFF: 1000 * 60 * 5,     // 5 mins
+        HOST_ON: 1000 * 60 * 5,         // 5 mins
+        HOST_OFF: 1000 * 60 * 5,        // 5 mins
+      },
+      MESSAGES: {
+        POLL: {
+          CHASSIS_OFF_TIMEOUT:
+              'Time out. Chassis did not reach power off state in allotted time.',
+          HOST_ON_TIMEOUT:
+              'Time out. System did not reach Running state in allotted time.',
+          HOST_OFF_TIMEOUT:
+              'Time out. System did not reach Off state in allotted time.',
+          HOST_QUIESCED: 'System is in Error state.',
+          DOWNLOAD_IMAGE_TIMEOUT:
+              'Time out. Did not download image in allotted time.',
         },
-        POLL_INTERVALS: {
-          ACTIVATION: 5000,
-          DOWNLOAD_IMAGE: 5000,
-          POWER_OP: 5000,
+        POWER_OP: {
+          POWER_ON_FAILED: 'Power On Failed',
+          WARM_REBOOT_FAILED: 'Warm Reboot Failed',
+          COLD_REBOOT_FAILED: 'Cold Reboot Failed',
+          ORDERLY_SHUTDOWN_FAILED: 'Orderly Shutdown Failed',
+          IMMEDIATE_SHUTDOWN_FAILED: 'Immediate Shutdown Failed',
         },
-        TIMEOUT: {
-          ACTIVATION: 1000 * 60 * 10, // 10 mins
-          DOWNLOAD_IMAGE: 1000 * 60 * 2, // 2 mins
-          CHASSIS_OFF: 1000 * 60 * 5, // 5 mins
-          HOST_ON: 1000 * 60 * 5, // 5 mins
-          HOST_OFF: 1000 * 60 * 5, // 5 mins
+        SENSOR: {
+          NO_SENSOR_DATA: 'There are no sensors found.',
+          CRITICAL_NO_SENSOR_DATA: 'There are no sensors in Critical state.',
+          WARNING_NO_SENSOR_DATA: 'There are no sensors in Warning state.',
+          NORMAL_NO_SENSOR_DATA: 'There are no sensors in Normal state.'
         },
-        MESSAGES: {
-          POLL: {
-            CHASSIS_OFF_TIMEOUT: 'Time out. Chassis did not reach power off state in allotted time.',
-            HOST_ON_TIMEOUT: 'Time out. System did not reach Running state in allotted time.',
-            HOST_OFF_TIMEOUT: 'Time out. System did not reach Off state in allotted time.',
-            HOST_QUIESCED: 'System is in Error state.',
-            DOWNLOAD_IMAGE_TIMEOUT: 'Time out. Did not download image in allotted time.',
-          },
-          POWER_OP: {
-            POWER_ON_FAILED: 'Power On Failed',
-            WARM_REBOOT_FAILED: 'Warm Reboot Failed',
-            COLD_REBOOT_FAILED: 'Cold Reboot Failed',
-            ORDERLY_SHUTDOWN_FAILED: 'Orderly Shutdown Failed',
-            IMMEDIATE_SHUTDOWN_FAILED: 'Immediate Shutdown Failed',
-          },
-          SENSOR: {
-            NO_SENSOR_DATA: 'There are no sensors found.',
-            CRITICAL_NO_SENSOR_DATA: 'There are no sensors in Critical state.',
-            WARNING_NO_SENSOR_DATA: 'There are no sensors in Warning state.',
-            NORMAL_NO_SENSOR_DATA: 'There are no sensors in Normal state.'
-          },
-          ERROR_MODAL: {
-            TITLE: 'Unexpected error',
-            DESCRIPTION: 'Oops! An unexpected error occurred. Record specific details of the issue, then contact your company support services.'
-          },
-          ERROR_MESSAGE_DESC_TEMPLATE: '{{status}} - {{description}}',
+        ERROR_MODAL: {
+          TITLE: 'Unexpected error',
+          DESCRIPTION:
+              'Oops! An unexpected error occurred. Record specific details of the issue, then contact your company support services.'
         },
-        POWER_CAP_TEXT: {
-          unit: 'W',
-          disabled: 'Not Enabled'
-        },
-        POWER_CONSUMPTION_TEXT: {
-          'xyz.openbmc_project.Sensor.Value.Unit.Watts': 'W',
-          notavailable: 'Not Available'
-        },
-      };
-    });
+        ERROR_MESSAGE_DESC_TEMPLATE: '{{status}} - {{description}}',
+      },
+      POWER_CAP_TEXT: {unit: 'W', disabled: 'Not Enabled'},
+      POWER_CONSUMPTION_TEXT: {
+        'xyz.openbmc_project.Sensor.Value.Unit.Watts': 'W',
+        notavailable: 'Not Available'
+      },
+    };
+  });
 
 })(window.angular);
diff --git a/app/common/services/dataService.js b/app/common/services/dataService.js
index 79a3a0e..ffe15a2 100644
--- a/app/common/services/dataService.js
+++ b/app/common/services/dataService.js
@@ -10,9 +10,9 @@
 window.angular && (function(angular) {
   'use strict';
 
-  angular
-    .module('app.common.services')
-    .service('dataService', ['Constants', function(Constants) {
+  angular.module('app.common.services').service('dataService', [
+    'Constants',
+    function(Constants) {
       this.server_health = Constants.SERVER_HEALTH.unknown;
       this.server_state = 'Unreachable';
       this.server_status = -2;
@@ -45,20 +45,23 @@
       };
 
       this.getHost = function() {
-        if (sessionStorage.getItem(Constants.API_CREDENTIALS.host_storage_key) !== null) {
-          return sessionStorage.getItem(Constants.API_CREDENTIALS.host_storage_key);
-        }
-        else {
+        if (sessionStorage.getItem(
+                Constants.API_CREDENTIALS.host_storage_key) !== null) {
+          return sessionStorage.getItem(
+              Constants.API_CREDENTIALS.host_storage_key);
+        } else {
           return Constants.API_CREDENTIALS.default_protocol + '://' +
-            window.location.hostname +
-            (window.location.port ? ':' + window.location.port : '');
+              window.location.hostname +
+              (window.location.port ? ':' + window.location.port : '');
         }
       };
 
       this.setHost = function(hostWithPort) {
         hostWithPort = hostWithPort.replace(/^https?\:\/\//ig, '');
-        var hostURL = Constants.API_CREDENTIALS.default_protocol + '://' + hostWithPort;
-        sessionStorage.setItem(Constants.API_CREDENTIALS.host_storage_key, hostURL);
+        var hostURL =
+            Constants.API_CREDENTIALS.default_protocol + '://' + hostWithPort;
+        sessionStorage.setItem(
+            Constants.API_CREDENTIALS.host_storage_key, hostURL);
         this.host = hostURL;
         this.reloadServerId();
       };
@@ -128,16 +131,15 @@
       this.activateErrorModal = function(data) {
         if (data && data.hasOwnProperty('title')) {
           this.errorModalDetails.title = data.title;
-        }
-        else {
+        } else {
           this.errorModalDetails.title = Constants.MESSAGES.ERROR_MODAL.TITLE;
         }
 
         if (data && data.hasOwnProperty('description')) {
           this.errorModalDetails.description = data.description;
-        }
-        else {
-          this.errorModalDetails.description = Constants.MESSAGES.ERROR_MODAL.DESCRIPTION;
+        } else {
+          this.errorModalDetails.description =
+              Constants.MESSAGES.ERROR_MODAL.DESCRIPTION;
         }
         this.displayErrorModal = true;
       };
@@ -145,6 +147,7 @@
       this.deactivateErrorModal = function() {
         this.displayErrorModal = false;
       };
-    }]);
+    }
+  ]);
 
 })(window.angular);
diff --git a/app/common/services/index.js b/app/common/services/index.js
index d234069..a56dce1 100644
--- a/app/common/services/index.js
+++ b/app/common/services/index.js
@@ -8,10 +8,9 @@
 window.angular && (function(angular) {
   'use strict';
 
-  angular
-    .module('app.common.services', [
-      // Dependencies
-      // Basic resources
-    ]);
+  angular.module('app.common.services', [
+    // Dependencies
+    // Basic resources
+  ]);
 
 })(window.angular);
diff --git a/app/common/services/userModel.js b/app/common/services/userModel.js
index cd943f9..0232200 100644
--- a/app/common/services/userModel.js
+++ b/app/common/services/userModel.js
@@ -10,29 +10,26 @@
 window.angular && (function(angular) {
   'use strict';
 
-  angular
-    .module('app.common.services')
-    .service('userModel', ['APIUtils', function(APIUtils) {
+  angular.module('app.common.services').service('userModel', [
+    'APIUtils',
+    function(APIUtils) {
       return {
         login: function(username, password, callback) {
           APIUtils.login(username, password, function(response, error) {
             if (response &&
-              (response.status == APIUtils.API_RESPONSE.SUCCESS_STATUS ||
-                response.status === undefined)) {
+                (response.status == APIUtils.API_RESPONSE.SUCCESS_STATUS ||
+                 response.status === undefined)) {
               sessionStorage.setItem('LOGIN_ID', username);
               callback(true);
-            }
-            else if (response && response.data && response.data.data &&
-              response.data.data.description) {
+            } else if (
+                response && response.data && response.data.data &&
+                response.data.data.description) {
               callback(false, response.data.data.description);
-            }
-            else if (response && response.message) {
+            } else if (response && response.message) {
               callback(false, response.message);
-            }
-            else if (error) {
+            } else if (error) {
               callback(false, 'Server unreachable');
-            }
-            else {
+            } else {
               callback(false, 'Internal error');
             }
           });
@@ -46,20 +43,19 @@
         logout: function(callback) {
           APIUtils.logout(function(response, error) {
             if (response &&
-              response.status == APIUtils.API_RESPONSE.SUCCESS_STATUS) {
+                response.status == APIUtils.API_RESPONSE.SUCCESS_STATUS) {
               sessionStorage.removeItem('LOGIN_ID');
               sessionStorage.removeItem(APIUtils.HOST_SESSION_STORAGE_KEY);
               callback(true);
-            }
-            else if (response.status == APIUtils.API_RESPONSE.ERROR_STATUS) {
+            } else if (response.status == APIUtils.API_RESPONSE.ERROR_STATUS) {
               callback(false);
-            }
-            else {
+            } else {
               callback(false, error);
             }
           });
         }
       };
-    }]);
+    }
+  ]);
 
 })(window.angular);
