Format code using clang-format-5.0
Once merged, this repository will have CI enforce
the coding guidelines in the .clang-format file.
Change-Id: I96a05972665f9c67625c6850c3da25edc540be06
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 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);