Restore sums tfoot

pull/5117/head
Oliver Günther 8 years ago
parent 8bd613e9b8
commit 6330ad1e50
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 13
      frontend/app/components/wp-display/field-types/wp-display-spent-time-field.directive.html
  2. 25
      frontend/app/components/wp-display/field-types/wp-display-spent-time-field.module.ts
  3. 4
      frontend/app/components/wp-fast-table/state/wp-table-metadata.service.ts
  4. 2
      frontend/app/components/wp-fast-table/wp-fast-table.ts
  5. 6
      frontend/app/components/wp-fast-table/wp-table-metadata.ts
  6. 14
      frontend/app/components/wp-table/wp-table.directive.html

@ -1,13 +0,0 @@
<span ng-if="!$ctrl.field.isEmpty()">
<a role="link"
target="_blank"
title='{{ ::$ctrl.field.text.linkTitle }}'
ng-href="{{ $ctrl.field.timeEntriesLink }}">
{{ $ctrl.displayText }}
</a>
</span>
<span ng-if="$ctrl.field.isEmpty()" title="{{ $ctrl.displayText }}">
{{ $ctrl.displayText }}
</span>

@ -33,7 +33,7 @@ export class SpentTimeDisplayField extends DurationDisplayField {
public template: string = '/components/wp-display/field-types/wp-display-spent-time-field.directive.html';
public text: any;
public timeEntriesLink: string;
public isManualRenderer = false;
public isManualRenderer = true;
private PathHelper:any;
@ -47,13 +47,28 @@ export class SpentTimeDisplayField extends DurationDisplayField {
this.text = {
linkTitle: this.I18n.t('js.work_packages.message_view_spent_time')
};
}
public render(element: HTMLElement, displayText): void {
if (!this.value) {
return;
}
let link = document.createElement('a');
link.textContent = displayText;
link.setAttribute('title', this.text.linkTitle);
if (resource.project) {
resource.project.$load().then(project => {
this.timeEntriesLink = URI(this.PathHelper.projectTimeEntriesPath(project.identifier))
.search({ work_package_id: resource.id })
if (this.resource.project) {
this.resource.project.$load().then(project => {
let href = URI(this.PathHelper.projectTimeEntriesPath(project.identifier))
.search({ work_package_id: this.resource.id })
.toString();
link.href = href;
});
}
element.appendChild(link);
}
}

@ -22,6 +22,10 @@ export class WorkPackageTableMetadataService {
return !!_.find(this.current.groupableColumns, (column) => column.name === name);
}
public showSums():boolean {
return !!this.current.totalSums;
}
/**
* Get current selection state.
* @returns {WPTableRowSelectionState}

@ -20,7 +20,7 @@ export class WorkPackageTable {
public rows: string[] = [];
public rowIndex:{[id: string]: WorkPackageTableRow} = {};
// WP rows builder
private groupedRowsBuilder = new GroupedRowsBuilder();
private emptyRowsBuilder = new EmptyRowsBuilder();
private plainRowsBuilder = new PlainRowsBuilder();

@ -27,6 +27,9 @@ export class WorkPackageTableMetadata {
// Groupable columns
public groupableColumns:api.ex.Column[];
// Sums
public totalSums:{[attribute:string]: any};
// Export formats
public exportFormats:api.ex.ExportFormat[];
@ -38,6 +41,9 @@ export class WorkPackageTableMetadata {
this.groups = json.resource.groups;
this.groupableColumns = meta.groupable_columns;
// Sums
this.totalSums = json.resource.totalSums;
// Links
this.links = json._links;
this.bulkLinks = json._bulk_links;

@ -36,10 +36,22 @@
</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr ng-if="sumsLoaded()"
class="sum group all issue work_package">
<td ng-repeat="column in columns">
<div class="generic-table--footer-outer">
<span ng-if="$first">{{ text.sumFor }} {{ text.allWorkPackages }}</span>
<wp-display-attr
attribute="column.name"
custom-schema="resource.sumsSchema"
work-package="resource.totalSums">
</wp-display-attr>
</div>
</td>
</tr>
</tfoot>
</table>
<div class="generic-table--header-background"></div>

Loading…
Cancel
Save