Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Statistics/3.3/WebApp/users/details/userDetailsCtrl.js @ 12986

Last change on this file since 12986 was 12584, checked in by dglaser, 9 years ago

#2388: Changed all files to connect to localhost / sqlexpress

HeuristicLab.Services.Hive-3.3:

  • Added Converter.cs and NewHiveService.cs, both will be integrated into existing HiveService.cs and Convert.cs when all methods are successfully implemented

HeuristicLab.Services.Hive.Web.Hive-3.3:

  • Added publish profiles

HeuristicLab.Services.WebApp.Statistics-3.3:

  • Added functionality to download TaskData as .hl file
File size: 2.1 KB
Line 
1(function () {
2    var module = appStatisticsPlugin.getAngularModule();
3    module.controller('app.statistics.userDetailsCtrl',
4        ['$scope', '$stateParams', '$interval', 'app.statistics.userService', 'app.statistics.jobService',
5        function ($scope, $stateParams, $interval, userService, jobService) {
6            $scope.interval = defaultPageUpdateInterval;
7            $scope.completedJobCurPage = 1;
8            $scope.completedJobPageSize = 20;
9
10            var getUserDetails = function () {
11                userService.getUser({ id: $stateParams.id }, function(user) {
12                    $scope.user = user;
13
14                    var length = user.TasksStates.length;
15                    var total = 0;
16                    for (var i = 0; i < length; ++i) {
17                        total += user.TasksStates[i].Count;
18                    }
19                    $scope.totalUserTasks = total;
20                });
21            };
22
23            var getAllJobs = function () {
24                jobService.getAllJobsByUserId({ id: $stateParams.id, completed: false }, function (jobs) {
25                    $scope.jobs = jobs;
26                });
27            };
28
29            var getCompletedJobs = function () {
30                jobService.getJobsByUserId({ id: $stateParams.id, page: $scope.completedJobCurPage, size: $scope.completedJobPageSize, completed: true },
31                    function (jobPage) {
32                        $scope.completedJobPage = jobPage;
33                    }
34                );
35            };
36
37            $scope.changeCompletedJobPage = function () {
38                update();
39            };
40
41            var update = function () {
42                getUserDetails();
43                getAllJobs();
44                getCompletedJobs();
45            };
46
47            $scope.updateInterval = $interval(update, $scope.interval);
48            var cancelInterval = $scope.$on('$locationChangeSuccess', function () {
49                $interval.cancel($scope.updateInterval);
50                cancelInterval();
51            });
52            update(); // init page
53        }]
54    );
55})();
Note: See TracBrowser for help on using the repository browser.