blob: e56876d13d2bc8217ba7de0603a59c696afd81e5 (
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
|
appDS2.controller('dbcHomeCtrl', function($scope, $log, DmaapAccessService, ManifestService) {
// Loads info to show on the welcome page.
// this object holds all app data and functions
$scope.dbcapp = {};
$scope.dbcapp.selectedDmaapAccess=null;
$scope.dbcapp.isDataLoading = true;
$scope.dbcapp.isRequestFailed = false;
$scope.dbcapp.errMsg = null;
$scope.dbcapp.manifest=null;
DmaapAccessService.getSelectedDmaapAccess()
.then(function(jsonObj) {
// must match keys in java controller's method
if (jsonObj.error) {
$scope.dbcapp.isRequestFailed = true;
$scope.dbcapp.errMsg = jsonObj.error;
$scope.dbcapp.isDataLoading=false;
}
else {
$scope.dbcapp.selectedDmaapAccess=jsonObj.data;
// Next get the manifest
ManifestService.getManifest()
.then(function(jsonObj) {
// $log.debug("dbcHomeCtrl: getManifest returned " + JSON.stringify(jsonObj));
if (jsonObj.error) {
$scope.dbcapp.isRequestFailed = true;
$scope.dbcapp.errMsg = jsonObj.error;
$scope.dbcapp.isDataLoading=false;
}
else {
$scope.dbcapp.manifest=jsonObj;
$scope.dbcapp.isDataLoading=false;
}
},function(error){
$log.error("dbcHomeCtrl getManifest failed: " + error);
$scope.dbcapp.isDataLoading=false;
});
}
},function(error){
$log.error("dbcHomeCtrl: getSelectdDmaapAccess failed: " + error);
$scope.dbcapp.isDataLoading=false;
});
});
|