-
Notifications
You must be signed in to change notification settings - Fork 4
/
app.controller.table.js
67 lines (56 loc) · 2.09 KB
/
app.controller.table.js
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
(function () {
'use strict';
function main($rootScope, $scope, gitlab, auth) {
$rootScope.$on('local-storage-updated', function () {
$scope.comulative_time_spent = 0;
$scope.comulative_time_estimate = 0;
$scope.loadIssues();
});
$scope.loadIssues = function () {
var params = {};
if (localStorage.getItem('access_token')) {
params.access_token = localStorage.getItem('access_token');
} else {
return;
}
if (localStorage.getItem('project_id')) {
params.id = localStorage.getItem('project_id');
} else {
return;
}
if (localStorage.getItem('state')) {
params.state = localStorage.getItem('state');
}
if (localStorage.getItem('milestone')) {
params.milestone = localStorage.getItem('milestone');
}
if (localStorage.getItem('labels')) {
params.labels = localStorage.getItem('labels');
}
$scope.issues = gitlab.projects_issues.query(
params,
function () {
},
function () {
auth.redirectToOauth();
}
);
};
$scope.getIssuesTimeStats = function (issue_project_id, issue_iid) {
var stats = gitlab.issues_time_stats.get(
{
access_token: localStorage.getItem('access_token'),
id: issue_project_id,
issue_iid: issue_iid
},
function () {
$scope.comulative_time_estimate += stats.time_estimate;
$scope.comulative_time_spent += stats.total_time_spent;
console.log($scope.comulative_time_estimate, $scope.comulative_time_spent);
}
);
return stats;
};
}
angular.module('GitLabReportApp').controller('TableController', main);
})();