@@ -85,12 +81,10 @@
}
-
- {{ app.owner }}
- |
- @for (tag of selectedTags; track $index) {
-
- {{app.tags[tag]}}
+ @for (column of selectedColumns; track $index) {
+ |
+ {{getData(app, column)}}
+
|
}
diff --git a/microservice-visualization-webapp/src/app/project-view/project-view.component.ts b/microservice-visualization-webapp/src/app/project-view/project-view.component.ts
index 606fadf..ffe85f6 100644
--- a/microservice-visualization-webapp/src/app/project-view/project-view.component.ts
+++ b/microservice-visualization-webapp/src/app/project-view/project-view.component.ts
@@ -62,8 +62,16 @@ export class ProjectViewComponent implements OnInit, OnDestroy {
{ label: 'Microservice', value: ApplicationType.MICROSERVICE }
];
- selectedTags: string[] = ['java', 'Spring Boot', 'Spring Cloud', 'gradle'];
- tagOptions: string[] = []
+ selectedColumns: ColumnData[] = [
+ { name: 'Owner', path: 'owners' },
+ // { name: 'Description', path: 'description' },
+ { name: 'java', path: 'tags.java' },
+ { name: 'Spring Boot', path: 'tags.Spring Boot' },
+ { name: 'Spring Cloud', path: 'tags.Spring Cloud' },
+ { name: 'gradle', path: 'tags.gradle' }
+ ];
+
+ columnOptions: ColumnData[] = []
globalFilterFields: string[] = [];
@@ -89,7 +97,16 @@ export class ProjectViewComponent implements OnInit, OnDestroy {
if (projectId) {
this.projectApi.get(projectId).subscribe(result => {
this.data = result;
- this.tagOptions = this.data.tags || [];
+ this.columnOptions = this.data.tags?.map(tag => {
+ return { name: tag, path: `tags.${tag}` } as ColumnData
+ }) || [];
+
+ this.columnOptions.push(
+ { name: 'Description', path: 'description' },
+ { name: 'Owner', path: 'owners' },
+ { name: 'Version', path: 'version' },
+ { name: 'Group', path: 'group' }
+ );
});
}
});
@@ -114,6 +131,10 @@ export class ProjectViewComponent implements OnInit, OnDestroy {
});
}
+ getData(application: ApplicationLiteDto, column: ColumnData): string {
+ return get(application, column.path);
+ }
+
onRowSelect($event: any) {
console.log(`Row selected ${JSON.stringify($event)}`)
}
@@ -159,3 +180,8 @@ interface AppType {
value: ApplicationType,
label: string
}
+
+interface ColumnData {
+ name: string,
+ path: string
+}
\ No newline at end of file
diff --git a/microservice-visualization/src/main/java/com/github/rbaul/microservice_visualization/domain/model/Application.java b/microservice-visualization/src/main/java/com/github/rbaul/microservice_visualization/domain/model/Application.java
index ddaaf71..b6d891e 100644
--- a/microservice-visualization/src/main/java/com/github/rbaul/microservice_visualization/domain/model/Application.java
+++ b/microservice-visualization/src/main/java/com/github/rbaul/microservice_visualization/domain/model/Application.java
@@ -11,6 +11,7 @@
import java.util.List;
import java.util.Map;
+import java.util.Set;
@NoArgsConstructor
@AllArgsConstructor
@@ -31,9 +32,15 @@ public class Application {
private String description;
+ @Column(name = "artifact_group")
+ private String group;
+
+ private String version;
+
private String location;
-
- private String owner;
+
+ @ElementCollection
+ private Set owners;
@Enumerated(EnumType.STRING)
private ApplicationType type;
diff --git a/microservice-visualization/src/main/java/com/github/rbaul/microservice_visualization/service/loaders/ProjectLoaderService.java b/microservice-visualization/src/main/java/com/github/rbaul/microservice_visualization/service/loaders/ProjectLoaderService.java
index 92c0ef9..e35af83 100644
--- a/microservice-visualization/src/main/java/com/github/rbaul/microservice_visualization/service/loaders/ProjectLoaderService.java
+++ b/microservice-visualization/src/main/java/com/github/rbaul/microservice_visualization/service/loaders/ProjectLoaderService.java
@@ -140,8 +140,18 @@ protected Application convertApplicationDependencyToApplication(ApplicationDepen
applicationDependency.description() : String.format("%s application", applicationDependency.name());
application.setDescription(description);
application.setLocation(applicationDependency.location());
- application.setOwner(applicationDependency.owner());
+ // Owner
+ String owner = applicationDependency.owner();
+ if (StringUtils.hasText(owner)) {
+ application.setOwners(Arrays.stream(owner.split(";"))
+ .map(String::trim)
+ .filter(StringUtils::hasText)
+ .collect(Collectors.toSet()));
+ }
+
application.setLabel(applicationDependency.label());
+ application.setGroup(applicationDependency.group());
+ application.setVersion(applicationDependency.version());
application.setDependencies(applicationDependency.dependencies());
application.setManagementDependencies(applicationDependency.managementDependencies());
Map tags = new HashMap<>(applicationDependency.tags());
@@ -224,16 +234,13 @@ protected void setApplicationToProject(Project project, ProjectConfig projectCon
} else { // From Application
Map> owners = new HashMap<>();
applicationDependencies.forEach(application -> {
- if (StringUtils.hasText(application.getOwner())) {
- String[] multiOwners = application.getOwner().split(";");
- for (String owner : multiOwners) {
- String ow = owner.trim();
- if (StringUtils.hasText(ow)) {
- if (!owners.containsKey(ow)) {
- owners.put(ow, new ArrayList<>());
- }
- owners.get(ow).add(application.getName());
+ Set multiOwner = application.getOwners();
+ if (!CollectionUtils.isEmpty(multiOwner)) {
+ for (String owner : multiOwner) {
+ if (!owners.containsKey(owner)) {
+ owners.put(owner, new ArrayList<>());
}
+ owners.get(owner).add(application.getName());
}
}
});
diff --git a/microservice-visualization/src/main/java/com/github/rbaul/microservice_visualization/service/model/ApplicationDependency.java b/microservice-visualization/src/main/java/com/github/rbaul/microservice_visualization/service/model/ApplicationDependency.java
index 82c2e90..15e18d7 100644
--- a/microservice-visualization/src/main/java/com/github/rbaul/microservice_visualization/service/model/ApplicationDependency.java
+++ b/microservice-visualization/src/main/java/com/github/rbaul/microservice_visualization/service/model/ApplicationDependency.java
@@ -10,6 +10,8 @@ public record ApplicationDependency(
String name,
String label,
String description,
+ String group,
+ String version,
String location,
String owner,
Map tags,
diff --git a/microservice-visualization/src/main/java/com/github/rbaul/microservice_visualization/web/dto/ApplicationLiteDto.java b/microservice-visualization/src/main/java/com/github/rbaul/microservice_visualization/web/dto/ApplicationLiteDto.java
index 882e5d2..b0911a5 100644
--- a/microservice-visualization/src/main/java/com/github/rbaul/microservice_visualization/web/dto/ApplicationLiteDto.java
+++ b/microservice-visualization/src/main/java/com/github/rbaul/microservice_visualization/web/dto/ApplicationLiteDto.java
@@ -9,6 +9,7 @@
import lombok.experimental.SuperBuilder;
import java.util.Map;
+import java.util.Set;
@NoArgsConstructor
@AllArgsConstructor
@@ -28,9 +29,13 @@ public class ApplicationLiteDto {
private ApplicationType type;
+ private String group;
+
+ private String version;
+
private String location;
- private String owner;
+ private Set owners;
private Map tags;
}
|