Discovering more about the api. think it's definitely a good idea now to create a new work packages api controller because planning elements controller isn't doing what we want.

pull/1065/head
Richard 11 years ago committed by Till Breuer
parent 2c4a159aae
commit f46d8e8219
  1. 34
      app/assets/javascripts/angular/config/work-packages-config.js
  2. 15
      app/assets/javascripts/angular/controllers/work-packages-controller.js
  3. 2
      app/assets/javascripts/angular/helpers/components/path-helper.js
  4. 1
      app/controllers/api/v2/planning_elements_controller.rb
  5. 7
      app/views/api/v2/planning_elements/index.api.rabl

@ -20,6 +20,22 @@ angular.module('openproject.workPackages.config')
])
.constant('INITIALLY_SELECT_COLUMNS', [
{
custom_field: false,
groupable: false,
meta_data: { data_type: 'integer', link: { display: true } },
name: 'id',
sortable: true,
title: '#'
},
{
custom_field: false,
groupable: false,
meta_data: { data_type: 'string' },
name: 'subject',
sortable: true,
title: 'Subject'
},
{
custom_field: false,
groupable: 'type',
@ -27,7 +43,23 @@ angular.module('openproject.workPackages.config')
name: 'type',
sortable: 'types.postition',
title: 'Type'
}
},
{
custom_field: false,
groupable: false,
meta_data: { data_type: 'date' },
name: 'start_date',
sortable: true,
title: 'Started at'
},
{
custom_field: false,
groupable: false,
meta_data: { data_type: 'date' },
name: 'due_date',
sortable: true,
title: 'Due on'
},
])
.constant('OPERATORS_AND_LABELS_BY_FILTER_TYPE', {

@ -43,13 +43,14 @@ 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.query.group_by);
$scope.totalSums = json.sums;
$scope.groupSums = json.group_sums;
$scope.totalEntries = json.total_entries;
setupPagination(json);
var meta = json.meta;
$scope.workPackageCountByGroup = meta.work_package_count_by_group;
$scope.rows = WorkPackagesTableHelper.getRows(json.planning_elements, $scope.query.group_by);
$scope.totalSums = meta.sums;
$scope.groupSums = meta.group_sums;
$scope.totalEntries = meta.total_entries;
setupPagination(meta);
};
$scope.updateResults = function() {

@ -9,7 +9,7 @@ angular.module('openproject.helpers')
return '/api/v2/projects/' + projectIdentifier;
},
workPackagesPath: function() {
return '/work_packages';
return '/planning_elements';
},
workPackagePath: function(id) {
return '/work_packages/' + id;

@ -307,6 +307,7 @@ module Api
else
[:id, :start_date] # Defaults
end
@planning_elements_meta = {
work_package_count_by_group: results.work_package_count_by_group,
sums: query.columns.map { |column| results.total_sum_of(column) },

@ -35,10 +35,11 @@ child @planning_elements => :planning_elements do
node(:start_date, :if => lambda{|pe| pe.start_date.present? && @columns.include?(:start_date)}) { |pe| pe.start_date.to_formatted_s(:db) }
node :due_date, :if => lambda{|pe| pe.due_date.present? && @columns.include?(:start_date)} {|pe| pe.due_date.to_formatted_s(:db) }
node :due_date, :if => lambda{|pe| pe.due_date.present? && @columns.include?(:due_date)} {|pe| pe.due_date.to_formatted_s(:db) }
node :created_at, if: lambda{|pe| pe.created_at.present? && @columns.include?(:start_date)} {|pe| pe.created_at.utc}
node :updated_at, if: lambda{|pe| pe.updated_at.present? && @columns.include?(:start_date)} {|pe| pe.updated_at.utc}
node :created_at, if: lambda{|pe| pe.created_at.present? && @columns.include?(:created_at)} {|pe| pe.created_at.utc}
node :updated_at, if: lambda{|pe| pe.updated_at.present? && @columns.include?(:updated_at)} {|pe| pe.updated_at.utc}
node do |element|
Hash[element.custom_values.map { |cv| ["cf_#{cv.custom_field_id}", cv.value] }]

Loading…
Cancel
Save