aboutsummaryrefslogtreecommitdiffstats
path: root/ccsdk-app-overlay/src/main/webapp/app/ccsdk/home/executions-view-controller.js
blob: 2491e5097c25402d6921a23485f8f13abcbc1dc1 (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
appDS2.controller('executionsViewController', function($scope, $rootScope, ControllerService, $modal, ExecutionService, $log) {
	
	$scope.parent = { 'blueprint_id': 'Root', 'parent': 'parent' };
	$scope.ecdapp = {};
	$scope.ecdapp.isDataLoading = false;
	$scope.ecdapp.appLabel = "";
	$rootScope.tenantList = {
		tenant: '',
		data: {}
	};
	var debug = false;
	
	var getTenants = function() {
		ControllerService.getTenants()
			.then(function(jsonObj) {
				if (jsonObj.error) {
					$log.error("executionsViewController.getTenants failed: " + jsonObj.error);
					$scope.ecdapp.isRequestFailed = true;
					$scope.ecdapp.errMsg = jsonObj.error;
					$scope.ecdapp.tableData = [];
				} else {
					$rootScope.tenantList.data = jsonObj.items;
					$rootScope.tenantList.tenant = jsonObj.items[0].name;
				}			
			}, function(error) {
				$log.error("executionsViewController.loadTable failed: " + error);
				$scope.ecdapp.isRequestFailed = true;
				$scope.ecdapp.errMsg = error;
			});
		};

	var getAppLabel = function() {
		ControllerService.getAppLabel().then(function(jsonObj) {
			if (debug)
				$log.debug("Controller.getAppLabel succeeded: " + JSON.stringify(jsonObj));
			$scope.ecdapp.appLabel = jsonObj;
		}, function(error) {
			$log.error("Controller.getAppLabel failed: " + error);
		});
	};
	// Initialize the page
	getAppLabel();
	getTenants();

});