Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

current development activities #33

Merged
merged 4 commits into from
Oct 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .jhipster/Microservice.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@
"fieldValidateRules": [
"required"
]
},
{
"fieldName": "ciUrl",
"fieldType": "String",
"fieldValidateRules": [
"required"
]
}
],
"relationships": [
Expand Down
3 changes: 2 additions & 1 deletion microcatalog.jdl
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/com/github/microcatalog/domain/Microservice.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -184,6 +201,7 @@ public String toString() {
", imageUrl='" + getImageUrl() + "'" +
", swaggerUrl='" + getSwaggerUrl() + "'" +
", gitUrl='" + getGitUrl() + "'" +
", ciUrl='" + getCiUrl() + "'" +
"}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
<column name="git_url" type="varchar(255)">
<constraints nullable="false" />
</column>
<column name="ci_url" type="varchar(255)">
<constraints nullable="false" />
</column>
<column name="team_id" type="bigint">
<constraints nullable="false" />
</column>
Expand Down Expand Up @@ -64,6 +67,7 @@
<column name="image_url" type="string"/>
<column name="swagger_url" type="string"/>
<column name="git_url" type="string"/>
<column name="ci_url" type="string"/>
<column name="team_id" type="numeric"/>
<column name="status_id" type="numeric"/>
<!-- jhipster-needle-liquibase-add-loadcolumn - JHipster (and/or extensions) can add load columns here -->
Expand Down
22 changes: 11 additions & 11 deletions src/main/resources/config/liquibase/fake-data/microservice.csv
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ <h6>{{microservice.description}}</h6>
<div>
<span><a href="{{microservice.gitUrl}}">GIT</a> </span>
<span class="px-1">|</span>
<span><a href="{{microservice.ciUrl}}">CI</a> </span>
<span class="px-1">|</span>
<span><a href="{{microservice.swaggerUrl}}">API</a> </span>
</div>
<span class="text-primary">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<div class="mb-4">
<jhi-microservice-search (itemSelected)="onMicroserviceSelected($event)">
<jhi-microservice-search (itemSelected)="onMicroserviceSelected($event)"
(groupFilterChanged)="onGroupFilterChanged($event)" [advanced]="true">
</jhi-microservice-search>
</div>
<div class="card-columns">
<jhi-microservice-card *ngFor="let microservice of microservices"
<jhi-microservice-card *ngFor="let microservice of (microservices | microserviceGroupFilter: filter)"
[microservice]="microservice">
</jhi-microservice-card>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,22 @@ 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',
templateUrl: './microservice-dashboard.component.html',
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();
Expand Down Expand Up @@ -42,4 +47,9 @@ export class MicroserviceDashboardComponent implements OnInit, OnDestroy {
this.loadAll();
}
}

onGroupFilterChanged(groupFilter: IMicroserviceGroupFilter): void {
this.filter = groupFilter;
this.loadAll();
}
}
Original file line number Diff line number Diff line change
@@ -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],
})
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<div class="btn-group" ngbDropdown container="body" placement="bottom-right">
<button type="button" class="btn btn-secondary dropdown-toggle" ngbDropdownToggle></button>
<div class="dropdown-menu" ngbDropdownMenu>
<div class="input-group p-3">
<div class="container">
<div class="row p-2">
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="customSwitch1"
[(ngModel)]="groupFilter.caseSensitive">
<label class="custom-control-label" for="customSwitch1"
jhiTranslate="microcatalogApp.microservice.search.group.case">
Case-sensitive search</label>
</div>
</div>
<div class="row p-2">
<input type="text" [(ngModel)]="groupFilter.name" (keyup.enter)="onSearch()" class="form-control"
placeholder="Name" aria-label="Name">
</div>
<div class="row p-2">
<input type="text" [(ngModel)]="groupFilter.description" (keyup.enter)="onSearch()"
class="form-control" placeholder="Description" aria-label="Description">
</div>
<div class="row p-2">
<input type="text" [(ngModel)]="groupFilter.swaggerUrl" (keyup.enter)="onSearch()"
class="form-control" placeholder="Swagger url" aria-label="Swagger url">
</div>
<div class="row p-2">
<input type="text" [(ngModel)]="groupFilter.gitUrl" (keyup.enter)="onSearch()" class="form-control"
placeholder="Git url" aria-label="Git url">
</div>
<div class="row p-2">
<select title="Team" [(ngModel)]="groupFilter.team" class="custom-select">
<option [ngValue]="undefined" selected
jhiTranslate="microcatalogApp.microservice.search.group.team">Select Team...
</option>
<option *ngFor="let team of teams" [ngValue]="team">
{{team.name}}
</option>
</select>
</div>
<div class="row p-2">
<select title="Status" [(ngModel)]="groupFilter.status" class="custom-select">
<option [ngValue]="undefined" selected
jhiTranslate="microcatalogApp.microservice.search.group.status">Select Status...
</option>
<option *ngFor="let status of statuses" [ngValue]="status">
{{status.name}}
</option>
</select>
</div>
<div class="row p-2">
<div class="btn-group">
<button class="btn btn-primary" (click)="onSearch()"
jhiTranslate="microcatalogApp.microservice.search.group.search">Search
</button>
<button class="btn btn-primary" (click)="onClearFilter()"
jhiTranslate="microcatalogApp.microservice.search.group.clear">Clear filters
</button>
</div>
</div>
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -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<IMicroserviceGroupFilter>();

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<ITeam[]>) => (this.teams = res.body || []));
this.statusService.query().subscribe((res: HttpResponse<IStatus[]>) => (this.statuses = res.body || []));
}

onSearch(): void {
this.filterChanged.emit(this.groupFilter);
}

onClearFilter(): void {
this.groupFilter = new MicroserviceGroupFilter();
this.onSearch();
}
}
Original file line number Diff line number Diff line change
@@ -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 {}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
(selectItem)="onItemSelected($event.item)"
(keyup.escape)="clear()"
/>
<jhi-microservice-group-filter *ngIf="advanced" class="ml-1" (filterChanged)="onFilterChanged($event)"></jhi-microservice-group-filter>
</div>
Original file line number Diff line number Diff line change
@@ -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',
Expand All @@ -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<IMicroservice>();
@Output() groupFilterChanged = new EventEmitter<IMicroserviceGroupFilter>();

constructor(protected microserviceService: MicroserviceService) {}

Expand Down Expand Up @@ -50,4 +56,8 @@ export class MicroserviceSearchComponent implements OnInit {
this.itemSelected.emit();
}
}

onFilterChanged(groupFilter: IMicroserviceGroupFilter): any {
this.groupFilterChanged.emit(groupFilter);
}
}
Loading