blob: f0820bed16b96fd3378185a999c907d1d6da4564 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
appDS2.controller('nodeServicesCtrl', function($scope, $log, message, NodeHealthService) {
'use strict';
// Controls logging in this controller
var debug = false;
if (debug)
$log.debug('nodeServicesCtrl: message is ' + JSON.stringify(message));
// this object holds all app data and functions
$scope.ecdapp = {};
$scope.ecdapp.label = 'Services on Node ' + message.node;
$scope.ecdapp.activeImg = "static/fusion/images/active.png";
$scope.ecdapp.inactiveImg = "static/fusion/images/inactive.png";
/**
* Loads the table of services for the specified node.
*/
$scope.ecdapp.loadTable = function(nodeName, dc) {
$scope.ecdapp.isDataLoading = true;
if (debug)
$log.debug('nodeServicesCtrl: loading data for ' + nodeName);
NodeHealthService.getNodeServicesHealth(nodeName, dc).then(
function(jsonObj) {
if (debug)
$log.debug('nodeServicesCtrl: response is ' + JSON.stringify(jsonObj));
if (jsonObj.error) {
$log.error("nodeServicesCtrl.loadTable failed: "
+ jsonObj.error);
$scope.ecdapp.isRequestFailed = true;
$scope.ecdapp.errMsg = jsonObj.error;
$scope.ecdapp.tableData = [];
} else {
// $log.debug("serviceHealthController.loadTable
// succeeded, size " + jsonObj.data.length);
$scope.ecdapp.isRequestFailed = false;
$scope.ecdapp.errMsg = null;
$scope.ecdapp.tableData = jsonObj;
}
$scope.ecdapp.isDataLoading = false;
},
function(error) {
$log.error("nodeServicesCtrl.loadTable failed: "
+ error);
$scope.ecdapp.isRequestFailed = true;
$scope.ecdapp.errMsg = error;
$scope.ecdapp.tableData = [];
$scope.ecdapp.isDataLoading = false;
});
};
// Show services for the requested node
if (debug)
$log.debug('nodeServicesCtrl: requesting services for node ' + message.node);
$scope.ecdapp.loadTable(message.node, message.dc);
});
|