Commit e0bd77bf by Johannes Edmeier

Wrap acitivti module.js with a scope

The 'use strict' in the activit module affected the global scope and broke the ui for some orderings of the modules. With this commit the module is wrapped into a function so the global scope isn't affected. fixes #294
parent 16fe9947
......@@ -13,80 +13,82 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
var module = angular.module('sba-applications-activiti', [ 'sba-applications' ]);
sbaModules.push(module.name);
(function (sbaModules, angular) {
'use strict';
var module = angular.module('sba-applications-activiti', ['sba-applications']);
sbaModules.push(module.name);
module.controller('activitiCtrl', [ '$scope', '$http', 'application', function($scope, $http, application) {
$scope.application = application;
$http.get('api/applications/' + application.id + '/activiti').then(function(response) {
var activiti = response.data;
$scope.summary = [];
$scope.summary.push({
key : 'Completed Task Count Today',
value : activiti.completedTaskCountToday
});
$scope.summary.push({
key : 'Process Definition Count',
value : activiti.processDefinitionCount
});
$scope.summary.push({
key : 'Cached Process Definition Count',
value : activiti.cachedProcessDefinitionCount
});
$scope.summary.push({
key : 'Completed Task Count',
value : activiti.completedTaskCount
});
$scope.summary.push({
key : 'Completed Activities',
value : activiti.completedActivities
});
$scope.summary.push({
key : 'Open Task Count',
value : activiti.openTaskCount
});
$scope.processes = [];
for (var i = 0; i < activiti.deployedProcessDefinitions.length; i++) {
var process = activiti.deployedProcessDefinitions[i];
var runningProcessInstanceCount = activiti.runningProcessInstanceCount[process];
var completedProcessInstanceCount = activiti.completedProcessInstanceCount[process];
$scope.processes.push({
name : process,
running : runningProcessInstanceCount,
completed : completedProcessInstanceCount
module.controller('activitiCtrl', ['$scope', '$http', 'application', function ($scope, $http, application) {
$scope.application = application;
$http.get('api/applications/' + application.id + '/activiti').then(function (response) {
var activiti = response.data;
$scope.summary = [];
$scope.summary.push({
key: 'Completed Task Count Today',
value: activiti.completedTaskCountToday
});
$scope.summary.push({
key: 'Process Definition Count',
value: activiti.processDefinitionCount
});
$scope.summary.push({
key: 'Cached Process Definition Count',
value: activiti.cachedProcessDefinitionCount
});
$scope.summary.push({
key: 'Completed Task Count',
value: activiti.completedTaskCount
});
}
}).catch(function(response) {
$scope.error = response.data;
});
}]);
$scope.summary.push({
key: 'Completed Activities',
value: activiti.completedActivities
});
$scope.summary.push({
key: 'Open Task Count',
value: activiti.openTaskCount
});
$scope.processes = [];
for (var i = 0; i < activiti.deployedProcessDefinitions.length; i++) {
var process = activiti.deployedProcessDefinitions[i];
var runningProcessInstanceCount = activiti.runningProcessInstanceCount[process];
var completedProcessInstanceCount = activiti.completedProcessInstanceCount[process];
$scope.processes.push({
name: process,
running: runningProcessInstanceCount,
completed: completedProcessInstanceCount
});
}
}).catch(function (response) {
$scope.error = response.data;
});
}]);
module.config([ '$stateProvider', function($stateProvider) {
$stateProvider.state('applications.activiti', {
url : '/activiti',
templateUrl : 'applications-activiti/activiti.html',
controller : 'activitiCtrl'
});
}]);
module.config(['$stateProvider', function ($stateProvider) {
$stateProvider.state('applications.activiti', {
url: '/activiti',
templateUrl: 'applications-activiti/activiti.html',
controller: 'activitiCtrl'
});
}]);
module.run([ 'ApplicationViews', '$http', function(ApplicationViews, $http) {
ApplicationViews.register({
order : 100,
title : 'Activiti',
state : 'applications.activiti',
show : function(application) {
if (!application.managementUrl || !application.statusInfo.status || application.statusInfo.status === 'OFFLINE') {
return false;
}
module.run(['ApplicationViews', '$http', function (ApplicationViews, $http) {
ApplicationViews.register({
order: 100,
title: 'Activiti',
state: 'applications.activiti',
show: function (application) {
if (!application.managementUrl || !application.statusInfo.status || application.statusInfo.status === 'OFFLINE') {
return false;
}
return $http.get('api/applications/' + application.id + '/configprops').then(
function(response) {
return $http.get('api/applications/' + application.id + '/configprops').then(
function (response) {
return response.data.processEngineEndpoint !== undefined;
}).catch(function() {
}).catch(function () {
return false;
});
}
});
}]);
}
});
}]);
})(sbaModules, angular);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment