Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[32259] Revert frontend group counting

Oliver Güntherecbfbc145ff3
diff --git a/frontend/src/app/components/wp-fast-table/builders/modes/grouped/group-header-builder.ts b/frontend/src/app/components/wp-fast-table/builders/modes/grouped/group-header-builder.ts
index 082d5c0db79..517ba5056c4 100644
--- a/frontend/src/app/components/wp-fast-table/builders/modes/grouped/group-header-builder.ts
+++ b/frontend/src/app/components/wp-fast-table/builders/modes/grouped/group-header-builder.ts
@@ -52,13 +52,4 @@ export class GroupHeaderBuilder {
return row;
}
-
- public setActualCount(group:GroupObject, body:DocumentFragment|HTMLElement):void {
- const headerElement = body.querySelector(`#wp-table-rowgroup-${group.index}`);
-
- if (headerElement) {
- const count = headerElement.querySelector('.count')!;
- count.textContent = `(${group.renderedCount || group.count})`;
- }
- }
}
diff --git a/frontend/src/app/components/wp-fast-table/builders/modes/grouped/grouped-render-pass.ts b/frontend/src/app/components/wp-fast-table/builders/modes/grouped/grouped-render-pass.ts
index ea5cd058ab5..41a4c4036ac 100644
--- a/frontend/src/app/components/wp-fast-table/builders/modes/grouped/grouped-render-pass.ts
+++ b/frontend/src/app/components/wp-fast-table/builders/modes/grouped/grouped-render-pass.ts
@@ -32,7 +32,6 @@ export class GroupedRenderPass extends PlainRenderPass {
let nextGroup = this.matchingGroup(row.object);
if (nextGroup && currentGroup !== nextGroup) {
- nextGroup.renderedCount = 0;
const groupClass = groupClassNameFor(nextGroup);
let rowElement = this.headerBuilder.buildGroupRow(nextGroup, this.colspan);
this.appendNonWorkPackageRow(rowElement, groupClass);
@@ -42,11 +41,6 @@ export class GroupedRenderPass extends PlainRenderPass {
row.group = currentGroup;
this.buildSingleRow(row);
});
-
- // Update the counts to what we actually rendered
- this.groups.forEach((group) => {
- this.headerBuilder.setActualCount(group, this.tableBody);
- });
}
/**
@@ -124,6 +118,5 @@ export class GroupedRenderPass extends PlainRenderPass {
row.element = tr;
tr.classList.add(...additionalClasses);
this.appendRow(row.object, tr, additionalClasses, hidden);
- group.renderedCount += 1;
}
}
diff --git a/frontend/src/app/components/wp-table/drag-and-drop/actions/group-by-drag-action.service.ts b/frontend/src/app/components/wp-table/drag-and-drop/actions/group-by-drag-action.service.ts
index a0acaddff4b..f1f01067ba0 100644
--- a/frontend/src/app/components/wp-table/drag-and-drop/actions/group-by-drag-action.service.ts
+++ b/frontend/src/app/components/wp-table/drag-and-drop/actions/group-by-drag-action.service.ts
@@ -7,11 +7,13 @@ import {rowGroupClassName} from "core-components/wp-fast-table/builders/modes/gr
import {locatePredecessorBySelector} from "core-components/wp-fast-table/helpers/wp-table-row-helpers";
import {groupIdentifier} from "core-components/wp-fast-table/builders/modes/grouped/grouped-rows-helpers";
import {HalResourceNotificationService} from "core-app/modules/hal/services/hal-resource-notification.service";
+import {HalEventsService} from "core-app/modules/hal/services/hal-events.service";
export class GroupByDragActionService extends TableDragActionService {
private wpTableGroupBy = this.injector.get(WorkPackageViewGroupByService);
private halEditing = this.injector.get<HalResourceEditingService>(HalResourceEditingService);
+ private halEvents = this.injector.get<HalEventsService>(HalEventsService);
private halNotification = this.injector.get(HalResourceNotificationService);
public get applies() {
@@ -33,6 +35,7 @@ export class GroupByDragActionService extends TableDragActionService {
changeset.projectedResource[this.groupedAttribute!] = groupedValue;
return this.halEditing
.save(changeset)
+ .then((saved) => this.halEvents.push(saved.resource, { eventType: 'updated' }))
.catch(e => this.halNotification.handleRawError(e, workPackage));
}
diff --git a/frontend/src/app/components/wp-table/drag-and-drop/actions/table-drag-action.service.ts b/frontend/src/app/components/wp-table/drag-and-drop/actions/table-drag-action.service.ts
index bdd74454c37..10a38ca3429 100644
--- a/frontend/src/app/components/wp-table/drag-and-drop/actions/table-drag-action.service.ts
+++ b/frontend/src/app/components/wp-table/drag-and-drop/actions/table-drag-action.service.ts
@@ -1,10 +1,6 @@
import {IsolatedQuerySpace} from "core-app/modules/work_packages/query-space/isolated-query-space";
import {WorkPackageResource} from "core-app/modules/hal/resources/work-package-resource";
import {Injector} from "@angular/core";
-import {
- hierarchyGroupClass,
- hierarchyRootClass
-} from "core-components/wp-fast-table/helpers/wp-table-hierarchy-helpers";
export class TableDragActionService {
diff --git a/frontend/src/app/modules/hal/resources/wp-collection-resource.ts b/frontend/src/app/modules/hal/resources/wp-collection-resource.ts
index 8d17000ae81..cff1232cb18 100644
--- a/frontend/src/app/modules/hal/resources/wp-collection-resource.ts
+++ b/frontend/src/app/modules/hal/resources/wp-collection-resource.ts
@@ -56,8 +56,6 @@ export interface WorkPackageCollectionResource extends WorkPackageCollectionReso
export interface GroupObject {
value:any;
count:number;
- // The count currently living in the frontend
- renderedCount:number;
collapsed?:boolean;
index:number;
identifier:string;