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

[#62982] frontend UI decides about displaying a leadingIcon

Tobias Dillmann6fa35010a5d3
diff --git a/frontend/src/app/features/hal/resources/wp-collection-resource.ts b/frontend/src/app/features/hal/resources/wp-collection-resource.ts
index 0e8663fc3f9..873219821db 100644
--- a/frontend/src/app/features/hal/resources/wp-collection-resource.ts
+++ b/frontend/src/app/features/hal/resources/wp-collection-resource.ts
@@ -60,7 +60,6 @@ export interface WorkPackageCollectionResource extends WorkPackageCollectionReso
*/
export interface GroupObject {
value:any;
- leadingIcon?:string;
count:number;
collapsed?:boolean;
index:number;
diff --git a/frontend/src/app/features/work-packages/components/wp-fast-table/builders/modes/grouped/group-header-builder.ts b/frontend/src/app/features/work-packages/components/wp-fast-table/builders/modes/grouped/group-header-builder.ts
index c174246341e..0d2fc954514 100644
--- a/frontend/src/app/features/work-packages/components/wp-fast-table/builders/modes/grouped/group-header-builder.ts
+++ b/frontend/src/app/features/work-packages/components/wp-fast-table/builders/modes/grouped/group-header-builder.ts
@@ -91,8 +91,18 @@ export class GroupHeaderBuilder {
return row;
}
+ /**
+ * Returns a leading icon to be rendered in front of the group, if applicable. Will use the hrefs of the group
+ * to determine whether there is a known icon for this type or not.
+ * @param group the group object to check for a leading icon.
+ * @private
+ */
private leadingIcon(group:GroupObject) {
- if (group.leadingIcon === 'projectPhaseDefinition') {
+ const isProjectPhase = group.href.some((item) =>
+ // will also match project phase definitions
+ item.href !== null && item.href.includes('api/v3/project_phase'));
+
+ if (isProjectPhase) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
return ProjectPhaseDisplayField.phaseIconByName(groupName(group), false);
}
diff --git a/lib/api/decorators/aggregation_group.rb b/lib/api/decorators/aggregation_group.rb
index cca77c26667..1e8be9995e6 100644
--- a/lib/api/decorators/aggregation_group.rb
+++ b/lib/api/decorators/aggregation_group.rb
@@ -67,11 +67,6 @@ module API
getter: ->(*) { count },
render_nil: true
- property :leading_icon,
- exec_context: :decorator,
- getter: ->(*) { leading_icon },
- render_nil: false
-
def model_required?
false
end
@@ -90,12 +85,6 @@ module API
end
end
- def leading_icon
- if represented.is_a?(Project::PhaseDefinition)
- "projectPhaseDefinition"
- end
- end
-
def convert_attribute(attribute)
::API::Utilities::PropertyNameConverter.from_ar_name(attribute)
end