Skip to content

Commit

Permalink
Added Owner column
Browse files Browse the repository at this point in the history
Implement get Owner from applications (support multi with comma separate)
  • Loading branch information
rbaul authored and rbaul committed Jan 23, 2024
1 parent 36d9ccf commit d059948
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
<input #filterInput pInputText type="text" (input)="dt1.filterGlobal(filterInput.value, 'contains')"
placeholder="Search keyword" />
</span>
<p-multiSelect class="to-end" [options]="tagOptions" [(ngModel)]="selectedTags" selectedItemsLabel="{0} columns selected"
[style]="{'min-width': '250px'}" placeholder="Choose Columns"></p-multiSelect>
<p-multiSelect class="to-end" [options]="tagOptions" [(ngModel)]="selectedTags"
selectedItemsLabel="{0} columns selected" [style]="{'min-width': '250px'}"
placeholder="Choose Columns"></p-multiSelect>
</div>

</ng-template>
Expand Down Expand Up @@ -57,6 +58,11 @@
Type
<p-sortIcon field="type"></p-sortIcon>
</th>
<th pSortableColumn="owner">
<p-columnFilter type="text" field="owner" display="menu"></p-columnFilter>
Owner
<p-sortIcon field="owner"></p-sortIcon>
</th>
@for (tag of selectedTags; track $index) {
<th pSortableColumn="tags.{{tag}}">
<p-columnFilter type="text" field="tags.{{tag}}" display="menu"></p-columnFilter>
Expand All @@ -79,6 +85,9 @@
<p-tag value="{{app.type | lowercase}}" severity="success"></p-tag>
}
</td>
<td>
{{ app.owner }}
</td>
@for (tag of selectedTags; track $index) {
<td>
{{app.tags[tag]}}
Expand Down Expand Up @@ -117,4 +126,4 @@ <h3>Sidebar</h3>
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
</p>
</p-sidebar>
<!-- </div> -->
<!-- </div> -->
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,34 @@ protected void setApplicationToProject(Project project, ProjectConfig projectCon
.anyMatch(application -> application.getName().equals(appName)))).collect(Collectors.toList());
project.setGroups(filteredGroups);
}
if (!CollectionUtils.isEmpty(projectConfig.getOwners())) {
if (!CollectionUtils.isEmpty(projectConfig.getOwners())) { // From Config
List<Owner> owners = getOwners(projectConfig.getOwners());
List<Owner> filteredOwners = owners.stream()
.filter(owner -> owner.getApplicationNames().stream()
.anyMatch(appName -> applicationDependencies.stream()
.anyMatch(application -> application.getName().equals(appName)))).collect(Collectors.toList());
project.setOwners(filteredOwners);
} else { // From Application
Map<String, List<String>> 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());
}
}
}
});

List<Owner> filteredOwners = owners.entrySet().stream()
.map(entry -> Owner.builder()
.name(entry.getKey()).applicationNames(entry.getValue()).build()).toList();
project.setOwners(filteredOwners);
}
project.setVersionId(versionId);
project.setVersion(version);
Expand Down

0 comments on commit d059948

Please sign in to comment.