Run js-beautify and fixjsstyle on code
Found this pointer on stackoverflow:
https://stackoverflow.com/a/31660434/5508494
End goal is to get the code formatted well enough that
clang format will run correctly against it.
Change-Id: I80053e78d253d8eee49233e42d55e5807ae8fdc8
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/app/common/directives/app-header.js b/app/common/directives/app-header.js
index 93d8fa8..31f683c 100644
--- a/app/common/directives/app-header.js
+++ b/app/common/directives/app-header.js
@@ -1,94 +1,98 @@
-window.angular && (function (angular) {
- 'use strict';
+window.angular && (function(angular) {
+ 'use strict';
- angular
- .module('app.common.directives')
- .directive('appHeader', ['APIUtils', function (APIUtils) {
- return {
- 'restrict': 'E',
- 'template': require('./app-header.html'),
- 'scope': {
- 'path': '='
- },
- 'controller': ['$rootScope', '$scope','dataService', 'userModel', '$location', '$route',
- function($rootScope, $scope, dataService, userModel, $location, $route){
- $scope.dataService = dataService;
+ angular
+ .module('app.common.directives')
+ .directive('appHeader', ['APIUtils', function(APIUtils) {
+ return {
+ 'restrict': 'E',
+ 'template': require('./app-header.html'),
+ 'scope': {
+ 'path': '='
+ },
+ 'controller': ['$rootScope', '$scope', 'dataService', 'userModel', '$location', '$route',
+ function($rootScope, $scope, dataService, userModel, $location, $route) {
+ $scope.dataService = dataService;
- $scope.loadServerHealth = function(){
- APIUtils.getLogs().then(function(result){
- dataService.updateServerHealth(result.data);
- });
- }
-
- $scope.loadServerStatus = function(){
- if(!userModel.isLoggedIn()){
- return;
- }
- APIUtils.getHostState().then(function(status){
- if(status == 'xyz.openbmc_project.State.Host.HostState.Off'){
- dataService.setPowerOffState();
- }else if(status == 'xyz.openbmc_project.State.Host.HostState.Running'){
- dataService.setPowerOnState();
- }else{
- dataService.setErrorState();
- }
- }, function(error){
- dataService.activateErrorModal();
- });
- }
-
- $scope.loadNetworkInfo = function(){
- if(!userModel.isLoggedIn()){
- return;
- }
- APIUtils.getNetworkInfo().then(function(data){
- dataService.setNetworkInfo(data);
- });
- }
-
- function loadData(){
- $scope.loadServerStatus();
- $scope.loadNetworkInfo();
- $scope.loadServerHealth();
- }
-
- loadData();
-
- $scope.logout = function(){
- userModel.logout(function(status, error){
- if(status){
- $location.path('/logout');
- }else{
- console.log(error);
- }
- });
- }
-
- $scope.refresh = function(){
- //reload current page controllers and header
- loadData();
- $route.reload();
- //Add flash class to header timestamp on click of refresh
- var myEl = angular.element( document.querySelector( '.header__refresh' ) );
- myEl.addClass('flash');
- setTimeout(function () {
- myEl.removeClass("flash");
- },2000);
-
- }
-
- var loginListener = $rootScope.$on('user-logged-in', function(event, arg){
- loadData();
- });
-
- $scope.$on('$destroy', function(){
- loginListener();
- });
-
- $scope.multiRecent = function(){
- $scope.multi_server_recent = !$scope.multi_server_recent;
- };
- }]
+ $scope.loadServerHealth = function() {
+ APIUtils.getLogs().then(function(result) {
+ dataService.updateServerHealth(result.data);
+ });
};
- }]);
+
+ $scope.loadServerStatus = function() {
+ if (!userModel.isLoggedIn()) {
+ return;
+ }
+ APIUtils.getHostState().then(function(status) {
+ if (status == 'xyz.openbmc_project.State.Host.HostState.Off') {
+ dataService.setPowerOffState();
+ }
+ else if (status == 'xyz.openbmc_project.State.Host.HostState.Running') {
+ dataService.setPowerOnState();
+ }
+ else {
+ dataService.setErrorState();
+ }
+ }, function(error) {
+ dataService.activateErrorModal();
+ });
+ };
+
+ $scope.loadNetworkInfo = function() {
+ if (!userModel.isLoggedIn()) {
+ return;
+ }
+ APIUtils.getNetworkInfo().then(function(data) {
+ dataService.setNetworkInfo(data);
+ });
+ };
+
+ function loadData() {
+ $scope.loadServerStatus();
+ $scope.loadNetworkInfo();
+ $scope.loadServerHealth();
+ }
+
+ loadData();
+
+ $scope.logout = function() {
+ userModel.logout(function(status, error) {
+ if (status) {
+ $location.path('/logout');
+ }
+ else {
+ console.log(error);
+ }
+ });
+ };
+
+ $scope.refresh = function() {
+ //reload current page controllers and header
+ loadData();
+ $route.reload();
+ //Add flash class to header timestamp on click of refresh
+ var myEl = angular.element(document.querySelector('.header__refresh'));
+ myEl.addClass('flash');
+ setTimeout(function() {
+ myEl.removeClass('flash');
+ }, 2000);
+
+ };
+
+ var loginListener = $rootScope.$on('user-logged-in', function(event, arg) {
+ loadData();
+ });
+
+ $scope.$on('$destroy', function() {
+ loginListener();
+ });
+
+ $scope.multiRecent = function() {
+ $scope.multi_server_recent = !$scope.multi_server_recent;
+ };
+ }
+ ]
+ };
+ }]);
})(window.angular);