-
Notifications
You must be signed in to change notification settings - Fork 4
/
app.controller.filter.js
111 lines (91 loc) · 3.12 KB
/
app.controller.filter.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
(function () {
'use strict';
function main($rootScope, $scope, $mdSidenav, gitlab, auth) {
$scope.$watch('project', function () {
$scope.labels = null;
$scope.milestone = null;
$scope.state = null;
localStorage.removeItem('labels');
localStorage.removeItem('milestone');
localStorage.removeItem('state');
if ($scope.project) {
$scope.loadProjectLabels();
$scope.loadProjectMilestones();
}
});
$rootScope.$watch('show_comulative_time_estimate', function () {
console.log($rootScope.show_comulative_time_estimate);
});
$scope.$watch('labels', function () {
if ($scope.labels) {
}
});
$scope.$watch('state', function () {
if ($scope.state) {
}
});
$scope.$watch('milestone', function () {
if ($scope.milestone) {
}
});
$scope.loadProjects = function () {
$scope.projects = gitlab.projects.query({
access_token: auth.getAccessToken(),
membership: true
});
};
$scope.loadProjectLabels = function () {
if (!$scope.project) {
return;
}
$scope.project_labels = gitlab.projects_labels.query({
access_token: auth.getAccessToken(),
id: $scope.project.id
});
};
$scope.loadProjectMilestones = function () {
if (!$scope.project) {
return;
}
$scope.project_milestones = gitlab.projects_milestones.query({
access_token: auth.getAccessToken(),
id: $scope.project.id
});
};
$scope.applyFilter = function () {
if (!angular.isObject($scope.project)) {
return;
}
localStorage.setItem('project_id', $scope.project.id);
if ($scope.state) {
localStorage.setItem('state', $scope.state);
}
if (angular.isObject($scope.milestone)) {
localStorage.setItem('milestone', $scope.milestone.title);
}
if (angular.isObject($scope.labels)) {
var l = [];
angular.forEach($scope.labels, function (item) {
l.push(item.name);
});
localStorage.setItem('labels', l.join(','));
}
$rootScope.$broadcast('local-storage-updated');
};
$rootScope.show_comulative_time_estimate = true;
$rootScope.show_comulative_time_spent = true;
$rootScope.show_show_logo_print = true;
$rootScope.table_columns = [
'srno',
'iid',
'title',
'created_at',
'author',
'assignee',
'time_estimate',
'total_time_spent'
];
$scope.loadProjects();
}
angular.module('GitLabReportApp').controller('FilterController', main);
})();