Skip to content

Commit

Permalink
feat: add additional description on origin of function
Browse files Browse the repository at this point in the history
  • Loading branch information
StephGit committed Dec 24, 2024
1 parent 1326c7c commit 3f6ec6a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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)];
}
Expand Down
3 changes: 3 additions & 0 deletions AMW_angular/io/src/app/resources/resource-function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ export interface ResourceFunction {
miks: string[];
definedOnResource: boolean;
definedOnResourceType: boolean;
isOverwritingFunction: boolean;
overwrittenParentName?: string;
functionOriginResourceName?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ public class FunctionDTO {
Set<String> miks;
Boolean definedOnResource;
Boolean definedOnResourceType;
Boolean isOverwritingFunction;
String overwrittenParentName;
String functionOriginResourceName;



public FunctionDTO(AmwFunctionEntity entity) {
this.id = entity.getId();
Expand All @@ -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() : "";
}
}

0 comments on commit 3f6ec6a

Please sign in to comment.