Skip to content

Commit

Permalink
Added relevant tags for project
Browse files Browse the repository at this point in the history
  • Loading branch information
rbaul authored and rbaul committed Jan 18, 2024
1 parent 474beea commit 36d9ccf
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface ProjectDto {
applications: ApplicationLiteDto[],
groups?: ApplicationGroupDto[],
owners?: OwnerDto[],
tags?: string[],
// connections?: Map<String, String[]>,
connections?: any,
dependencies?: any,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@
<ng-template pTemplate="caption">
<div class="flex">
<button pButton label="Clear" class="p-button-outlined" icon="pi pi-filter-slash" (click)="clear(dt1)"></button>
<span class="p-input-icon-left ml-auto">
<span class="p-input-icon-left">
<i class="pi pi-search"></i>
<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>
</div>

</ng-template>
Expand Down Expand Up @@ -55,7 +57,7 @@
Type
<p-sortIcon field="type"></p-sortIcon>
</th>
@for (tag of tags; track $index) {
@for (tag of selectedTags; track $index) {
<th pSortableColumn="tags.{{tag}}">
<p-columnFilter type="text" field="tags.{{tag}}" display="menu"></p-columnFilter>
{{tag}}
Expand All @@ -77,7 +79,7 @@
<p-tag value="{{app.type | lowercase}}" severity="success"></p-tag>
}
</td>
@for (tag of tags; track $index) {
@for (tag of selectedTags; track $index) {
<td>
{{app.tags[tag]}}
</td>
Expand Down Expand Up @@ -115,4 +117,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 @@ -20,3 +20,11 @@ app-project-topology {
color: $fontColor;
text-decoration: none;
}

.to-end {
margin-left: auto;
}

.flex {
display: flex;
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { ProjectTopologyComponent, TopologyType } from '../project-topology/proj

import { get } from 'lodash';
import { DropdownModule } from 'primeng/dropdown';
import { MultiSelectModule } from 'primeng/multiselect';

@Component({
selector: 'app-project-view',
Expand All @@ -35,7 +36,8 @@ import { DropdownModule } from 'primeng/dropdown';
InputTextModule,
ButtonModule,
TagModule,
DropdownModule
DropdownModule,
MultiSelectModule
],
templateUrl: './project-view.component.html',
styleUrls: ['./project-view.component.scss'],
Expand All @@ -56,11 +58,12 @@ export class ProjectViewComponent implements OnInit, OnDestroy {
};

types: AppType[] = [
{label: 'Library', value: ApplicationType.LIBRARY},
{label: 'Microservice', value: ApplicationType.MICROSERVICE}
{ label: 'Library', value: ApplicationType.LIBRARY },
{ label: 'Microservice', value: ApplicationType.MICROSERVICE }
];

tags: string[] = ['java', 'Spring Boot', 'Spring Cloud', 'gradle'];
selectedTags: string[] = ['java', 'Spring Boot', 'Spring Cloud', 'gradle'];
tagOptions: string[] = []

globalFilterFields: string[] = [];

Expand All @@ -86,6 +89,7 @@ export class ProjectViewComponent implements OnInit, OnDestroy {
if (projectId) {
this.projectApi.get(projectId).subscribe(result => {
this.data = result;
this.tagOptions = this.data.tags || [];
});
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ public class Project {
@ToString.Exclude
@ElementCollection
private List<Owner> owners;

@ToString.Exclude
@ElementCollection
private Set<String> tags;

@ToString.Exclude
@ManyToOne(fetch = FetchType.LAZY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@ protected Map<String, List<String>> createDependenciesMap(Project project) {
return appConnections;
}

protected Set<String> createProjectRelevantTags(Project project) {
Set<String> tags = new HashSet<>();

project.getApplications().forEach(application -> tags.addAll(application.getTags().keySet()));

return tags;
}

protected Application convertApplicationDependencyToApplication(ApplicationDependency applicationDependency, ApplicationType type) {
Application application = new Application();
application.setName(applicationDependency.name());
Expand Down Expand Up @@ -196,6 +204,8 @@ protected void setApplicationToProject(Project project, ProjectConfig projectCon
project.setConnections(createTopology(project, projectConfig.getApplicationPostfix(), projectConfig.getApplicationApiPostfixes()));
// Dependencies
project.setDependencies(createDependenciesMap(project));
// Relevant Tags
project.setTags(createProjectRelevantTags(project));
if (!CollectionUtils.isEmpty(projectConfig.getGroups())) {
List<ApplicationGroup> groups = getGroups(projectConfig.getGroups());
List<ApplicationGroup> filteredGroups = groups.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import java.util.List;
import java.util.Map;
import java.util.Set;

@NoArgsConstructor
@AllArgsConstructor
Expand All @@ -28,6 +29,8 @@ public class ProjectDto {
private List<ApplicationGroupDto> groups;

private List<OwnerDto> owners;

private Set<String> tags;

private ProjectVersionLiteDto projectVersion;
}

0 comments on commit 36d9ccf

Please sign in to comment.