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/server-health/controllers/sensors-overview-controller.js b/app/server-health/controllers/sensors-overview-controller.js
index 683d071..77d2978 100644
--- a/app/server-health/controllers/sensors-overview-controller.js
+++ b/app/server-health/controllers/sensors-overview-controller.js
@@ -8,138 +8,127 @@
window.angular && (function(angular) {
'use strict';
- angular
- .module('app.overview')
- .controller('sensorsOverviewController', [
- '$scope',
- '$log',
- '$window',
- 'APIUtils',
- 'dataService',
- 'Constants',
- function($scope, $log, $window, APIUtils, dataService, Constants) {
- $scope.dataService = dataService;
+ angular.module('app.overview').controller('sensorsOverviewController', [
+ '$scope', '$log', '$window', 'APIUtils', 'dataService', 'Constants',
+ function($scope, $log, $window, APIUtils, dataService, Constants) {
+ $scope.dataService = dataService;
- $scope.dropdown_selected = false;
+ $scope.dropdown_selected = false;
- $scope.$log = $log;
+ $scope.$log = $log;
+ $scope.customSearch = '';
+ $scope.searchTerms = [];
+ $scope.messages = Constants.MESSAGES.SENSOR;
+ $scope.selectedSeverity =
+ {all: true, normal: false, warning: false, critical: false};
+ $scope.export_name = 'sensors.json';
+ $scope.loading = false;
+ $scope.jsonData = function(data) {
+ var dt = {};
+ data.data.forEach(function(item) {
+ dt[item.original_data.key] = item.original_data.value;
+ });
+ return JSON.stringify(dt);
+ };
+
+ $scope.clear = function() {
$scope.customSearch = '';
$scope.searchTerms = [];
- $scope.messages = Constants.MESSAGES.SENSOR;
- $scope.selectedSeverity = {
- all: true,
- normal: false,
- warning: false,
- critical: false
- };
- $scope.export_name = 'sensors.json';
- $scope.loading = false;
- $scope.jsonData = function(data) {
- var dt = {};
- data.data.forEach(function(item) {
- dt[item.original_data.key] = item.original_data.value;
- });
- return JSON.stringify(dt);
- };
+ };
- $scope.clear = function() {
- $scope.customSearch = '';
- $scope.searchTerms = [];
- };
-
- $scope.doSearchOnEnter = function(event) {
- var search = $scope.customSearch.replace(/^\s+/g, '').replace(/\s+$/g, '');
- if (event.keyCode === 13 &&
- search.length >= 2) {
- $scope.searchTerms = $scope.customSearch.split(' ');
+ $scope.doSearchOnEnter = function(event) {
+ var search =
+ $scope.customSearch.replace(/^\s+/g, '').replace(/\s+$/g, '');
+ if (event.keyCode === 13 && search.length >= 2) {
+ $scope.searchTerms = $scope.customSearch.split(' ');
+ } else {
+ if (search.length == 0) {
+ $scope.searchTerms = [];
}
- else {
- if (search.length == 0) {
- $scope.searchTerms = [];
- }
+ }
+ };
+
+ $scope.doSearchOnClick = function() {
+ var search =
+ $scope.customSearch.replace(/^\s+/g, '').replace(/\s+$/g, '');
+ if (search.length >= 2) {
+ $scope.searchTerms = $scope.customSearch.split(' ');
+ } else {
+ if (search.length == 0) {
+ $scope.searchTerms = [];
}
- };
+ }
+ };
- $scope.doSearchOnClick = function() {
- var search = $scope.customSearch.replace(/^\s+/g, '').replace(/\s+$/g, '');
- if (search.length >= 2) {
- $scope.searchTerms = $scope.customSearch.split(' ');
- }
- else {
- if (search.length == 0) {
- $scope.searchTerms = [];
- }
- }
- };
+ $scope.toggleSeverityAll = function() {
+ $scope.selectedSeverity.all = !$scope.selectedSeverity.all;
- $scope.toggleSeverityAll = function() {
- $scope.selectedSeverity.all = !$scope.selectedSeverity.all;
+ if ($scope.selectedSeverity.all) {
+ $scope.selectedSeverity.normal = false;
+ $scope.selectedSeverity.warning = false;
+ $scope.selectedSeverity.critical = false;
+ }
+ };
- if ($scope.selectedSeverity.all) {
- $scope.selectedSeverity.normal = false;
- $scope.selectedSeverity.warning = false;
- $scope.selectedSeverity.critical = false;
- }
- };
+ $scope.toggleSeverity = function(severity) {
+ $scope.selectedSeverity[severity] = !$scope.selectedSeverity[severity];
- $scope.toggleSeverity = function(severity) {
- $scope.selectedSeverity[severity] = !$scope.selectedSeverity[severity];
-
- if (['normal', 'warning', 'critical'].indexOf(severity) > -1) {
- if ($scope.selectedSeverity[severity] == false &&
+ if (['normal', 'warning', 'critical'].indexOf(severity) > -1) {
+ if ($scope.selectedSeverity[severity] == false &&
(!$scope.selectedSeverity.normal &&
- !$scope.selectedSeverity.warning &&
- !$scope.selectedSeverity.critical
- )) {
- $scope.selectedSeverity.all = true;
- return;
- }
- }
-
- if ($scope.selectedSeverity.normal &&
- $scope.selectedSeverity.warning &&
- $scope.selectedSeverity.critical) {
+ !$scope.selectedSeverity.warning &&
+ !$scope.selectedSeverity.critical)) {
$scope.selectedSeverity.all = true;
- $scope.selectedSeverity.normal = false;
- $scope.selectedSeverity.warning = false;
- $scope.selectedSeverity.critical = false;
+ return;
}
- else {
- $scope.selectedSeverity.all = false;
- }
- };
+ }
- $scope.filterBySeverity = function(sensor) {
- if ($scope.selectedSeverity.all) return true;
+ if ($scope.selectedSeverity.normal && $scope.selectedSeverity.warning &&
+ $scope.selectedSeverity.critical) {
+ $scope.selectedSeverity.all = true;
+ $scope.selectedSeverity.normal = false;
+ $scope.selectedSeverity.warning = false;
+ $scope.selectedSeverity.critical = false;
+ } else {
+ $scope.selectedSeverity.all = false;
+ }
+ };
- return ((sensor.severity_flags.normal && $scope.selectedSeverity.normal) ||
- (sensor.severity_flags.warning && $scope.selectedSeverity.warning) ||
- (sensor.severity_flags.critical && $scope.selectedSeverity.critical)
- );
- };
- $scope.filterBySearchTerms = function(sensor) {
+ $scope.filterBySeverity = function(sensor) {
+ if ($scope.selectedSeverity.all) return true;
- if (!$scope.searchTerms.length) return true;
+ return (
+ (sensor.severity_flags.normal && $scope.selectedSeverity.normal) ||
+ (sensor.severity_flags.warning &&
+ $scope.selectedSeverity.warning) ||
+ (sensor.severity_flags.critical &&
+ $scope.selectedSeverity.critical));
+ };
+ $scope.filterBySearchTerms = function(sensor) {
- for (var i = 0, length = $scope.searchTerms.length; i < length; i++) {
- if (sensor.search_text.indexOf($scope.searchTerms[i].toLowerCase()) == -1) return false;
- }
- return true;
- };
+ if (!$scope.searchTerms.length) return true;
- $scope.loadSensorData = function() {
- $scope.loading = true;
- APIUtils.getAllSensorStatus(function(data, originalData) {
- $scope.data = data;
- $scope.originalData = originalData;
- dataService.sensorData = data;
- $scope.export_data = JSON.stringify(originalData);
- $scope.loading = false;
- });
- };
+ for (var i = 0, length = $scope.searchTerms.length; i < length; i++) {
+ if (sensor.search_text.indexOf($scope.searchTerms[i].toLowerCase()) ==
+ -1)
+ return false;
+ }
+ return true;
+ };
- $scope.loadSensorData();
- }
- ]);
+ $scope.loadSensorData = function() {
+ $scope.loading = true;
+ APIUtils.getAllSensorStatus(function(data, originalData) {
+ $scope.data = data;
+ $scope.originalData = originalData;
+ dataService.sensorData = data;
+ $scope.export_data = JSON.stringify(originalData);
+ $scope.loading = false;
+ });
+ };
+
+ $scope.loadSensorData();
+ }
+ ]);
})(angular);