Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Statistics/3.3/WebApp/jobs/jobsCtrl.js @ 12516

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

#2388:

HeuristicLab.Services.Hive.DataAccess-3.3:

  • updated daos
  • changed statistics database schema
  • updated HiveStatisticsGenerator

HeuristicLab.Services.WebApp.Statistics-3.3:

  • added jobs, client and user page
File size: 2.1 KB
Line 
1(function () {
2    var module = appStatisticsPlugin.getAngularModule();
3    module.controller('app.statistics.jobsCtrl',
4        ['$scope', '$interval', 'app.statistics.jobService', function ($scope, $interval, jobService) {
5            $scope.interval = defaultPageUpdateInterval;
6            $scope.completedJobCurPage = 1;
7            $scope.completedJobPageSize = 20;
8
9            var getAllJobs = function() {
10                jobService.getAllJobs({ completed: false }, function(jobs) {
11                    $scope.jobs = jobs;
12                    var length = $scope.jobs.length;
13                    for (var i = 0; i < length; ++i) {
14                        $scope.jobs[i].DateCreated = CSharpDateToString($scope.jobs[i].DateCreated);
15                    }
16                });
17            };
18
19            var getCompletedJobs = function() {
20                jobService.getJobs({ page: $scope.completedJobCurPage, size: $scope.completedJobPageSize, completed: true },
21                    function (jobPage) {
22                        $scope.completedJobPage = jobPage;
23                        var length = $scope.completedJobPage.Jobs.length;
24                        for (var i = 0; i < length; ++i) {
25                            $scope.completedJobPage.Jobs[i].DateCreated = CSharpDateToString($scope.completedJobPage.Jobs[i].DateCreated);
26                            $scope.completedJobPage.Jobs[i].DateCompleted = CSharpDateToString($scope.completedJobPage.Jobs[i].DateCompleted);
27                        }
28                    }
29                );
30            };
31
32            $scope.changeCompletedJobPage = function () {
33                update();
34            };
35
36            var update = function () {
37                getAllJobs();
38                getCompletedJobs();
39            };
40
41            $scope.updateInterval = $interval(update, $scope.interval);
42            var cancelInterval = $scope.$on('$locationChangeSuccess', function () {
43                $interval.cancel($scope.updateInterval);
44                cancelInterval();
45            });
46            update(); // init page
47        }]
48    );
49})();
Note: See TracBrowser for help on using the repository browser.