94169ff47ac26cfd97669d551edc3a30658a49ba
[portal/sdk.git] /
1 appDS2.controller('adminClosedLoopController', ['$scope','$http','$q','$log',function ($scope, $http,$q, $log){
2                         $scope.camunda_cockpit_url = '';                        
3                         var deferred = $q.defer();
4                         $http({
5                 method: "GET",
6                 url: "get_camunda_cockpit_link",
7             }).success( function(res) {
8                 // if the returned response is error HTML page in string format
9                 if(res.link_defined=='false'){
10                         $log.error('Retrieval of camunda cockpit link failed. Please make sure the variable "camunda_cockpit_url" is defined in the system.properties file.');
11                     deferred.reject(status);                            
12                 }
13                                 // valid cockpit url
14                 else if(res.camunda_cockpit_link!=null & res.camunda_cockpit_link!= '') {
15                                 $scope.camunda_cockpit_url = res.camunda_cockpit_link;
16                         deferred.resolve(res);
17                                 // if the defined url is empty;
18                 } else {
19                         $log.error('Please ensure the variable "camunda_cockpit_url" is properly defined in system.properties file (i.e., neither null nor empty).');
20                     deferred.reject(status);
21                 }
22                                 // API call fails
23             }).error( function(status) {
24                         $log.error('get_camunda_cockpit_link RestAPI call failed.');
25                 deferred.reject(status);
26             });
27             return deferred.promise;    
28 }]);