|
|
|
@ -2,15 +2,6 @@ angular.module('openproject.workPackages.controllers') |
|
|
|
|
|
|
|
|
|
.controller('WorkPackagesController', ['$scope', 'WorkPackagesTableHelper', 'Query', 'Sortation', 'WorkPackageService', function($scope, WorkPackagesTableHelper, Query, Sortation, WorkPackageService) { |
|
|
|
|
|
|
|
|
|
$scope.$watch('groupBy', function() { |
|
|
|
|
var groupByColumnIndex = $scope.columns.map(function(column){ |
|
|
|
|
return column.name; |
|
|
|
|
}).indexOf($scope.groupBy); |
|
|
|
|
|
|
|
|
|
$scope.groupByColumn = $scope.columns[groupByColumnIndex]; |
|
|
|
|
$scope.query.group_by = $scope.groupBy; // keep the query in sync
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
function initialSetup() { |
|
|
|
|
$scope.projectIdentifier = gon.project_identifier; |
|
|
|
|
$scope.operatorsAndLabelsByFilterType = gon.operators_and_labels_by_filter_type; |
|
|
|
@ -27,7 +18,6 @@ angular.module('openproject.workPackages.controllers') |
|
|
|
|
$scope.columns = gon.columns; |
|
|
|
|
$scope.availableColumns = WorkPackagesTableHelper.getColumnDifference(gon.available_columns, $scope.columns); |
|
|
|
|
|
|
|
|
|
$scope.groupBy = $scope.query.group_by || ''; |
|
|
|
|
$scope.currentSortation = gon.sort_criteria; |
|
|
|
|
|
|
|
|
|
angular.extend($scope.query, { |
|
|
|
@ -51,7 +41,7 @@ angular.module('openproject.workPackages.controllers') |
|
|
|
|
|
|
|
|
|
$scope.setupWorkPackagesTable = function(json) { |
|
|
|
|
$scope.workPackageCountByGroup = json.work_package_count_by_group; |
|
|
|
|
$scope.rows = WorkPackagesTableHelper.getRows(json.work_packages, $scope.groupBy); |
|
|
|
|
$scope.rows = WorkPackagesTableHelper.getRows(json.work_packages, $scope.query.group_by); |
|
|
|
|
$scope.totalSums = json.sums; |
|
|
|
|
$scope.groupSums = json.group_sums; |
|
|
|
|
$scope.totalEntries = json.total_entries; |
|
|
|
|