diff --git a/AMW_angular/io/src/app/resources/resource-edit-page/resource-edit-functions/resource-edit-functions.component.ts b/AMW_angular/io/src/app/resources/resource-edit-page/resource-edit-functions/resource-edit-functions.component.ts index 86375c8fc..0735c346e 100644 --- a/AMW_angular/io/src/app/resources/resource-edit-page/resource-edit-functions/resource-edit-functions.component.ts +++ b/AMW_angular/io/src/app/resources/resource-edit-page/resource-edit-functions/resource-edit-functions.component.ts @@ -103,11 +103,22 @@ export class ResourceEditFunctionsComponent { } mapListEntries(functions: ResourceFunction[]) { - return functions.map((element) => ({ name: element.name, description: element.miks.join(', '), id: element.id })); + return functions.map((element) => ({ + name: + element.name + + (element.definedOnResourceType + ? ` (Defined on ${element.functionOriginResourceName})` + : element.isOverwritingFunction + ? ` (Overwrite function from ${element.overwrittenParentName})` + : ''), + description: element.miks.join(', '), + id: element.id, + })); } splitFunctions(resourceFunctions: ResourceFunction[]) { const [instance, resource] = [[], []]; + resourceFunctions.sort((a, b) => (a.name < b.name ? -1 : 1)); resourceFunctions.forEach((element) => (element.definedOnResourceType ? resource : instance).push(element)); return [this.mapListEntries(instance), this.mapListEntries(resource)]; } diff --git a/AMW_angular/io/src/app/resources/resource-function.ts b/AMW_angular/io/src/app/resources/resource-function.ts index a54bb3bc1..07781a478 100644 --- a/AMW_angular/io/src/app/resources/resource-function.ts +++ b/AMW_angular/io/src/app/resources/resource-function.ts @@ -4,4 +4,7 @@ export interface ResourceFunction { miks: string[]; definedOnResource: boolean; definedOnResourceType: boolean; + isOverwritingFunction: boolean; + overwrittenParentName?: string; + functionOriginResourceName?: string; } diff --git a/AMW_rest/src/main/java/ch/mobi/itc/mobiliar/rest/dtos/FunctionDTO.java b/AMW_rest/src/main/java/ch/mobi/itc/mobiliar/rest/dtos/FunctionDTO.java index 266ed6691..452733a65 100644 --- a/AMW_rest/src/main/java/ch/mobi/itc/mobiliar/rest/dtos/FunctionDTO.java +++ b/AMW_rest/src/main/java/ch/mobi/itc/mobiliar/rest/dtos/FunctionDTO.java @@ -24,6 +24,11 @@ public class FunctionDTO { Set miks; Boolean definedOnResource; Boolean definedOnResourceType; + Boolean isOverwritingFunction; + String overwrittenParentName; + String functionOriginResourceName; + + public FunctionDTO(AmwFunctionEntity entity) { this.id = entity.getId(); @@ -32,5 +37,8 @@ public FunctionDTO(AmwFunctionEntity entity) { this.definedOnResource = entity.isDefinedOnResource(); this.definedOnResourceType = entity.isDefinedOnResourceType(); this.miks = entity.getMikNames(); + this.isOverwritingFunction = entity.isOverwritingResourceTypeFunction(); + this.overwrittenParentName = entity.getOverwrittenFunctionResourceTypeName(); + this.functionOriginResourceName = entity.getResourceType() != null ? entity.getResourceType().getName() : ""; } }