diff --git a/.jhipster/Microservice.json b/.jhipster/Microservice.json index ac13d2b..334c236 100644 --- a/.jhipster/Microservice.json +++ b/.jhipster/Microservice.json @@ -36,6 +36,13 @@ "fieldValidateRules": [ "required" ] + }, + { + "fieldName": "ciUrl", + "fieldType": "String", + "fieldValidateRules": [ + "required" + ] } ], "relationships": [ diff --git a/microcatalog.jdl b/microcatalog.jdl index 0b861a8..acc5cf7 100644 --- a/microcatalog.jdl +++ b/microcatalog.jdl @@ -14,7 +14,8 @@ entity Microservice { description TextBlob required, imageUrl String required, swaggerUrl String required, - gitUrl String required + gitUrl String required, + ciUrl String required } entity Dependency { diff --git a/src/main/java/com/github/microcatalog/domain/Microservice.java b/src/main/java/com/github/microcatalog/domain/Microservice.java index 8a71f0b..5eb91e7 100644 --- a/src/main/java/com/github/microcatalog/domain/Microservice.java +++ b/src/main/java/com/github/microcatalog/domain/Microservice.java @@ -47,6 +47,10 @@ public class Microservice implements Serializable { @Column(name = "git_url", nullable = false) private String gitUrl; + @NotNull + @Column(name = "ci_url", nullable = false) + private String ciUrl; + @ManyToOne(optional = false) @NotNull @JsonIgnoreProperties(value = "microservices", allowSetters = true) @@ -131,6 +135,19 @@ public void setGitUrl(String gitUrl) { this.gitUrl = gitUrl; } + public String getCiUrl() { + return ciUrl; + } + + public Microservice ciUrl(String ciUrl) { + this.ciUrl = ciUrl; + return this; + } + + public void setCiUrl(String ciUrl) { + this.ciUrl = ciUrl; + } + public Team getTeam() { return team; } @@ -184,6 +201,7 @@ public String toString() { ", imageUrl='" + getImageUrl() + "'" + ", swaggerUrl='" + getSwaggerUrl() + "'" + ", gitUrl='" + getGitUrl() + "'" + + ", ciUrl='" + getCiUrl() + "'" + "}"; } } diff --git a/src/main/resources/config/liquibase/changelog/20201001051657_added_entity_Microservice.xml b/src/main/resources/config/liquibase/changelog/20201001051657_added_entity_Microservice.xml index fd75fb8..5cea077 100644 --- a/src/main/resources/config/liquibase/changelog/20201001051657_added_entity_Microservice.xml +++ b/src/main/resources/config/liquibase/changelog/20201001051657_added_entity_Microservice.xml @@ -30,6 +30,9 @@ + + + @@ -64,6 +67,7 @@ + diff --git a/src/main/resources/config/liquibase/fake-data/microservice.csv b/src/main/resources/config/liquibase/fake-data/microservice.csv index f40e7d1..ca16967 100644 --- a/src/main/resources/config/liquibase/fake-data/microservice.csv +++ b/src/main/resources/config/liquibase/fake-data/microservice.csv @@ -1,11 +1,11 @@ -id;name;description;image_url;swagger_url;git_url;team_id;status_id -1;COM silver cultivate;../fake-data/blob/hipster.txt;rich Prairie olive;Handcrafted program hard drive;lime Denmark;1;1 -2;Kenya;../fake-data/blob/hipster.txt;Yemeni Rial Cayman Islands Shoes;infrastructure;Reactive;2;2 -3;interface bifurcated Forint;../fake-data/blob/hipster.txt;teal;Bedfordshire Supervisor;pixel Regional Assimilated;3;3 -4;Home Loan Account;../fake-data/blob/hipster.txt;partnerships Wisconsin;exploit well-modulated;black online;4;4 -5;Games Rwanda Franc networks;../fake-data/blob/hipster.txt;Profound Buckinghamshire panel;Graphical User Interface Tuna;Diverse;5;1 -6;card value-added;../fake-data/blob/hipster.txt;bypass Reduced;Montana;Iceland Krona;6;2 -7;indexing;../fake-data/blob/hipster.txt;Frozen index;Intelligent Central;expedite;7;3 -8;index;../fake-data/blob/hipster.txt;Savings Account Berkshire quantify;web-readiness Investment Account;array Intelligent Rubber Table fuchsia;8;4 -9;calculating;../fake-data/blob/hipster.txt;North Dakota;throughput bluetooth Coordinator;override HTTP Incredible Granite Cheese;9;1 -10;local area network knowledge base;../fake-data/blob/hipster.txt;Fantastic Cotton Chips portals;bypass Euro Optimized;Wooden Keyboard RAM;10;2 +id;name;description;image_url;swagger_url;git_url;ci_url;team_id;status_id +1;COM silver cultivate;../fake-data/blob/hipster.txt;rich Prairie olive;Handcrafted program hard drive;lime Denmark;Kenya;1;1 +2;Yemeni Rial Cayman Islands Shoes;../fake-data/blob/hipster.txt;infrastructure;Reactive;interface bifurcated Forint;teal;2;2 +3;Bedfordshire Supervisor;../fake-data/blob/hipster.txt;pixel Regional Assimilated;Home Loan Account;partnerships Wisconsin;exploit well-modulated;3;3 +4;black online;../fake-data/blob/hipster.txt;Games Rwanda Franc networks;Profound Buckinghamshire panel;Graphical User Interface Tuna;Diverse;4;4 +5;card value-added;../fake-data/blob/hipster.txt;bypass Reduced;Montana;Iceland Krona;indexing;5;1 +6;Frozen index;../fake-data/blob/hipster.txt;Intelligent Central;expedite;index;Savings Account Berkshire quantify;6;2 +7;web-readiness Investment Account;../fake-data/blob/hipster.txt;array Intelligent Rubber Table fuchsia;calculating;North Dakota;throughput bluetooth Coordinator;7;3 +8;override HTTP Incredible Granite Cheese;../fake-data/blob/hipster.txt;local area network knowledge base;Fantastic Cotton Chips portals;bypass Euro Optimized;Wooden Keyboard RAM;8;4 +9;United Kingdom back up cross-platform;../fake-data/blob/hipster.txt;homogeneous Ameliorated;indexing;contextually-based HDD;Tuna Intelligent Steel Shoes;9;1 +10;Strategist Senior;../fake-data/blob/hipster.txt;payment circuit withdrawal;facilitate Principal;Awesome Metal Bacon AGP;Zloty online Massachusetts;10;2 diff --git a/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-card/microservice-card.component.html b/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-card/microservice-card.component.html index 88a76fd..d941251 100644 --- a/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-card/microservice-card.component.html +++ b/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-card/microservice-card.component.html @@ -21,6 +21,8 @@
{{microservice.description}}
GIT | + CI + | API
diff --git a/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-dashboard.component.html b/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-dashboard.component.html index 9e3a037..e9ca2b7 100644 --- a/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-dashboard.component.html +++ b/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-dashboard.component.html @@ -1,9 +1,10 @@
- +
-
diff --git a/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-dashboard.component.ts b/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-dashboard.component.ts index a9c1135..a075568 100644 --- a/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-dashboard.component.ts +++ b/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-dashboard.component.ts @@ -4,6 +4,7 @@ import { IMicroservice } from 'app/shared/model/microservice.model'; import { HttpResponse } from '@angular/common/http'; import { Subscription } from 'rxjs'; import { JhiEventManager } from 'ng-jhipster'; +import { IMicroserviceGroupFilter, MicroserviceGroupFilter } from 'app/shared/model/util/microservice-group-filter'; @Component({ selector: 'jhi-microservice-dashboard', @@ -11,10 +12,14 @@ import { JhiEventManager } from 'ng-jhipster'; styleUrls: ['./microservice-dashboard.component.scss'], }) export class MicroserviceDashboardComponent implements OnInit, OnDestroy { - microservices?: IMicroservice[]; + microservices: IMicroservice[]; + filter: IMicroserviceGroupFilter; eventSubscriber?: Subscription; - constructor(protected microserviceService: MicroserviceService, protected eventManager: JhiEventManager) {} + constructor(protected microserviceService: MicroserviceService, protected eventManager: JhiEventManager) { + this.microservices = []; + this.filter = new MicroserviceGroupFilter(); + } ngOnInit(): void { this.loadAll(); @@ -42,4 +47,9 @@ export class MicroserviceDashboardComponent implements OnInit, OnDestroy { this.loadAll(); } } + + onGroupFilterChanged(groupFilter: IMicroserviceGroupFilter): void { + this.filter = groupFilter; + this.loadAll(); + } } diff --git a/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-dashboard.module.ts b/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-dashboard.module.ts index b573fb0..46d80b8 100644 --- a/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-dashboard.module.ts +++ b/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-dashboard.module.ts @@ -1,12 +1,13 @@ import { NgModule } from '@angular/core'; import { MicroserviceDashboardComponent } from './microservice-dashboard.component'; -import { MicrocatalogSharedModule } from '../../../shared/shared.module'; +import { MicrocatalogSharedModule } from 'app/shared/shared.module'; import { RouterModule } from '@angular/router'; import { MicroserviceCardComponent } from './microservice-card/microservice-card.component'; import { MicroserviceSearchModule } from 'app/entities/microservice/microservice-dashboard/microservice-search/microservice-search.module'; +import { MicroserviceGroupFilterPipe } from './microservice-group-filter.pipe'; @NgModule({ - declarations: [MicroserviceDashboardComponent, MicroserviceCardComponent], + declarations: [MicroserviceDashboardComponent, MicroserviceCardComponent, MicroserviceGroupFilterPipe], imports: [MicroserviceSearchModule, MicrocatalogSharedModule, RouterModule], exports: [MicroserviceDashboardComponent], }) diff --git a/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-group-filter.pipe.ts b/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-group-filter.pipe.ts new file mode 100644 index 0000000..7f5f892 --- /dev/null +++ b/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-group-filter.pipe.ts @@ -0,0 +1,53 @@ +import { Pipe, PipeTransform } from '@angular/core'; +import { IMicroservice } from 'app/shared/model/microservice.model'; +import { IMicroserviceGroupFilter } from 'app/shared/model/util/microservice-group-filter'; + +@Pipe({ + name: 'microserviceGroupFilter', +}) +export class MicroserviceGroupFilterPipe implements PipeTransform { + transform(items: IMicroservice[], filter: IMicroserviceGroupFilter): IMicroservice[] { + if (!items || !filter) { + return items; + } + + return items.filter(i => { + let match = true; + match = match && this.contains(filter.caseSensitive, i.name, filter.name); + match = match && this.contains(filter.caseSensitive, i.description, filter.description); + match = match && this.contains(filter.caseSensitive, i.swaggerUrl, filter.swaggerUrl); + match = match && this.contains(filter.caseSensitive, i.gitUrl, filter.gitUrl); + + if (filter.status && i.status) { + match = match && i.status.id === filter.status.id; + } + if (filter.team && i.team) { + match = match && i.team.id === filter.team.id; + } + + return match; + }); + } + + contains(caseSensitive: boolean, source?: string, substr?: string): boolean { + if (!substr) { + return true; + } + + if (!source && substr) { + return false; + } + + if (source && substr) { + let sourceTerm = source; + let targetTerm = substr; + if (!caseSensitive) { + sourceTerm = source.toLowerCase(); + targetTerm = substr.toLowerCase(); + } + + return sourceTerm.includes(targetTerm); + } + return false; + } +} diff --git a/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-search/microservice-group-filter/microservice-group-filter.component.html b/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-search/microservice-group-filter/microservice-group-filter.component.html new file mode 100644 index 0000000..01cafdb --- /dev/null +++ b/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-search/microservice-group-filter/microservice-group-filter.component.html @@ -0,0 +1,64 @@ +
+ + +
diff --git a/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-search/microservice-group-filter/microservice-group-filter.component.scss b/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-search/microservice-group-filter/microservice-group-filter.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-search/microservice-group-filter/microservice-group-filter.component.ts b/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-search/microservice-group-filter/microservice-group-filter.component.ts new file mode 100644 index 0000000..181b6b5 --- /dev/null +++ b/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-search/microservice-group-filter/microservice-group-filter.component.ts @@ -0,0 +1,44 @@ +import { Component, EventEmitter, OnInit, Output } from '@angular/core'; +import { IMicroserviceGroupFilter, MicroserviceGroupFilter } from 'app/shared/model/util/microservice-group-filter'; +import { TeamService } from 'app/entities/team/team.service'; +import { StatusService } from 'app/entities/status/status.service'; +import { ITeam } from 'app/shared/model/team.model'; +import { IStatus } from 'app/shared/model/status.model'; +import { HttpResponse } from '@angular/common/http'; + +@Component({ + selector: 'jhi-microservice-group-filter', + templateUrl: './microservice-group-filter.component.html', + styleUrls: ['./microservice-group-filter.component.scss'], +}) +export class MicroserviceGroupFilterComponent implements OnInit { + groupFilter: IMicroserviceGroupFilter; + teams: ITeam[]; + statuses: IStatus[]; + + @Output() filterChanged = new EventEmitter(); + + constructor(private teamService: TeamService, private statusService: StatusService) { + this.groupFilter = new MicroserviceGroupFilter(); + this.teams = []; + this.statuses = []; + } + + ngOnInit(): void { + this.loadItems(); + } + + loadItems(): void { + this.teamService.query().subscribe((res: HttpResponse) => (this.teams = res.body || [])); + this.statusService.query().subscribe((res: HttpResponse) => (this.statuses = res.body || [])); + } + + onSearch(): void { + this.filterChanged.emit(this.groupFilter); + } + + onClearFilter(): void { + this.groupFilter = new MicroserviceGroupFilter(); + this.onSearch(); + } +} diff --git a/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-search/microservice-group-filter/microservice-group-filter.module.ts b/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-search/microservice-group-filter/microservice-group-filter.module.ts new file mode 100644 index 0000000..0a0fe0e --- /dev/null +++ b/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-search/microservice-group-filter/microservice-group-filter.module.ts @@ -0,0 +1,10 @@ +import { NgModule } from '@angular/core'; +import { MicroserviceGroupFilterComponent } from './microservice-group-filter.component'; +import { MicrocatalogSharedModule } from 'app/shared/shared.module'; + +@NgModule({ + declarations: [MicroserviceGroupFilterComponent], + imports: [MicrocatalogSharedModule], + exports: [MicroserviceGroupFilterComponent], +}) +export class MicroserviceGroupFilterModule {} diff --git a/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-search/microservice-search.component.html b/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-search/microservice-search.component.html index 9c55870..c1791ee 100644 --- a/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-search/microservice-search.component.html +++ b/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-search/microservice-search.component.html @@ -9,4 +9,5 @@ (selectItem)="onItemSelected($event.item)" (keyup.escape)="clear()" /> + diff --git a/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-search/microservice-search.component.ts b/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-search/microservice-search.component.ts index fa38c98..49da211 100644 --- a/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-search/microservice-search.component.ts +++ b/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-search/microservice-search.component.ts @@ -1,8 +1,9 @@ -import { Component, EventEmitter, OnInit, Output } from '@angular/core'; +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { Observable } from 'rxjs'; import { debounceTime, distinctUntilChanged, map, switchMap } from 'rxjs/operators'; import { MicroserviceService } from 'app/entities/microservice/microservice.service'; import { IMicroservice } from 'app/shared/model/microservice.model'; +import { IMicroserviceGroupFilter } from 'app/shared/model/util/microservice-group-filter'; @Component({ selector: 'jhi-microservice-search', @@ -12,7 +13,12 @@ import { IMicroservice } from 'app/shared/model/microservice.model'; export class MicroserviceSearchComponent implements OnInit { model: any; + /** + * Enables advanced search capabilities. Default: false + */ + @Input() advanced = false; @Output() itemSelected = new EventEmitter(); + @Output() groupFilterChanged = new EventEmitter(); constructor(protected microserviceService: MicroserviceService) {} @@ -50,4 +56,8 @@ export class MicroserviceSearchComponent implements OnInit { this.itemSelected.emit(); } } + + onFilterChanged(groupFilter: IMicroserviceGroupFilter): any { + this.groupFilterChanged.emit(groupFilter); + } } diff --git a/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-search/microservice-search.module.ts b/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-search/microservice-search.module.ts index 71b33e2..da95326 100644 --- a/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-search/microservice-search.module.ts +++ b/src/main/webapp/app/entities/microservice/microservice-dashboard/microservice-search/microservice-search.module.ts @@ -1,11 +1,11 @@ import { NgModule } from '@angular/core'; import { MicroserviceSearchComponent } from './microservice-search.component'; import { MicrocatalogSharedModule } from 'app/shared/shared.module'; -import { RouterModule } from '@angular/router'; +import { MicroserviceGroupFilterModule } from 'app/entities/microservice/microservice-dashboard/microservice-search/microservice-group-filter/microservice-group-filter.module'; @NgModule({ declarations: [MicroserviceSearchComponent], - imports: [MicrocatalogSharedModule, RouterModule], + imports: [MicrocatalogSharedModule, MicroserviceGroupFilterModule], exports: [MicroserviceSearchComponent], }) export class MicroserviceSearchModule {} diff --git a/src/main/webapp/app/entities/microservice/microservice-detail.component.html b/src/main/webapp/app/entities/microservice/microservice-detail.component.html index 9cd277c..196ded3 100644 --- a/src/main/webapp/app/entities/microservice/microservice-detail.component.html +++ b/src/main/webapp/app/entities/microservice/microservice-detail.component.html @@ -28,6 +28,10 @@

Microservice<
{{ microservice.gitUrl }}
+
Ci Url
+
+ {{ microservice.ciUrl }} +
Team
diff --git a/src/main/webapp/app/entities/microservice/microservice-update.component.html b/src/main/webapp/app/entities/microservice/microservice-update.component.html index aadbf63..1b80e6b 100644 --- a/src/main/webapp/app/entities/microservice/microservice-update.component.html +++ b/src/main/webapp/app/entities/microservice/microservice-update.component.html @@ -71,6 +71,18 @@

+ + +
+ + This field is required. + +
+

+